Changeset 577


Ignore:
Timestamp:
12/21/12 17:55:49 (11 years ago)
Author:
Kris Deugau
Message:

/trunk

Work in progress, see #5:
Update templates and calling code for allocation delete to pass
and use rdepth
Start adding support for reparented netblocks; when a reparented
block is deleted, link back not only to the parent it was living
in, but the "true" parent the free space was merged with.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/cgi-bin/main.cgi

    r576 r577  
    792792  my $blockdata;
    793793
    794   if ($webvar{alloctype} eq 'rm') {
     794  if ($webvar{rdepth} == 0) {   # $webvar{alloctype} eq 'mm'
    795795
    796796    $blockdata->{block} = $webvar{block};
    797     $blockdata->{city} = getRoutedCity($ip_dbh, $webvar{block});
     797    $blockdata->{city} = "N/A";
    798798    $blockdata->{custid} = "N/A";
    799     $blockdata->{type} = $webvar{alloctype};
     799    $blockdata->{type} = 'mm';
    800800    $blockdata->{circuitid} = "N/A";
    801801    $blockdata->{description} = "N/A";
    802802    $blockdata->{notes} = "N/A";
    803803    $blockdata->{privdata} = "N/A";
    804 
    805   } elsif ($webvar{alloctype} eq 'mm') {
    806 
    807     $blockdata->{block} = $webvar{block};
    808     $blockdata->{city} = "N/A";
    809     $blockdata->{custid} = "N/A";
    810     $blockdata->{type} = $webvar{alloctype};
    811     $blockdata->{circuitid} = "N/A";
    812     $blockdata->{description} = "N/A";
    813     $blockdata->{notes} = "N/A";
    814     $blockdata->{privdata} = "N/A";
     804    $blockdata->{rdepth} = 0;
    815805
    816806  } else {
    817807
    818     $blockdata = getBlockData($ip_dbh, $webvar{block})
     808    $blockdata = getBlockData($ip_dbh, $webvar{block}, $webvar{rdepth});
    819809
    820810  } # end cases for different alloctypes
    821811
    822812  $page->param(block => $blockdata->{block});
     813  $page->param(rdepth => $blockdata->{rdepth});
    823814  $page->param(disptype => $disp_alloctypes{$blockdata->{type}});
    824   $page->param(type => $blockdata->{type});
     815#  $page->param(type => $blockdata->{type});
    825816  $page->param(city => $blockdata->{city});
    826817  $page->param(custid => $blockdata->{custid});
     
    850841
    851842  # need to retrieve block data before deleting so we can notify on that
    852   my $blockinfo = getBlockData($ip_dbh, $webvar{block});
    853 
    854   my ($code,$msg) = deleteBlock($ip_dbh, $webvar{block}, $webvar{alloctype});
     843  my $blockinfo = getBlockData($ip_dbh, $webvar{block}, $webvar{rdepth});
     844
     845  my ($code,$msg) = deleteBlock($ip_dbh, $webvar{block}, $webvar{rdepth}, $webvar{vrf});
    855846
    856847  $page->param(block => $webvar{block});
    857   if ($code eq 'OK') {
     848  $page->param(delparent => $blockinfo->{parent}) if $webvar{rdepth};
     849  $page->param(prdepth => $webvar{rdepth});
     850  if ($code =~ /^WARN/) {
     851    my ($bp,$bd) = split /,/, $msg;
     852    $page->param(bparent => $bp);
     853    $page->param(brdepth => $bd);
     854    $page->param(mergeip => $code eq 'WARNPOOL');
     855  }
     856
     857  if ($code eq 'OK' || $code =~ /^WARN/) {
    858858    syslog "notice", "$authuser deallocated '$webvar{alloctype}'-type netblock $webvar{block} ".
    859859        $blockinfo->{custid}.", ".$blockinfo->{city}.", desc='".$blockinfo->{description}."'";
  • trunk/templates/delete.tmpl

    r538 r577  
    6060<input type="button" value="Back" onclick="history.go(-1)"><input type="submit" value="Confirm">
    6161<input type="hidden" name="block" value="<TMPL_VAR NAME=block>">
    62 <input type="hidden" name="alloctype" value="<TMPL_VAR NAME=type>">
     62<input type="hidden" name="rdepth" value="<TMPL_VAR NAME=rdepth>">
    6363<input type="hidden" name="action" value="finaldelete">
    6464</fieldset>
  • trunk/templates/finaldelete.tmpl

    r517 r577  
    1 <TMPL_IF webpath></TMPL_IF>
    21<div class="center">
    32<TMPL_IF failmsg>
     
    65<TMPL_ELSE>
    76<div class="heading">Success!  <TMPL_VAR NAME=block> deallocated.</div>
     7<TMPL_IF bparent><br><div>
     8Warning: 
     9<TMPL_IF mergeip>IPs in <TMPL_VAR NAME=block> were released as available static IPs in <TMPL_VAR NAME=bparent>
     10<a href="<TMPL_VAR NAME=webpath>/cgi-bin/main.cgi?action=listpool&amp;pool=<TMPL_VAR NAME=bparent>&amp;rdepth=<TMPL_VAR NAME=brdepth>"><TMPL_VAR NAME=bparent></a>,<br>
     11not released for general netblock assignment under
     12<a href="<TMPL_VAR NAME=webpath>/cgi-bin/main.cgi?action=showsubs&amp;block=<TMPL_VAR NAME=delparent>&amp;rdepth=<TMPL_VAR NAME=prdepth>"><TMPL_VAR NAME=delparent></a>.
     13<TMPL_ELSE>
     14<TMPL_VAR NAME=block> was released as free and merged with blocks under
     15<a href="<TMPL_VAR NAME=webpath>/cgi-bin/main.cgi?action=showsubs&amp;block=<TMPL_VAR NAME=bparent>&amp;rdepth=<TMPL_VAR NAME=brdepth>"><TMPL_VAR NAME=bparent></a>,
     16not <a href="<TMPL_VAR NAME=webpath>/cgi-bin/main.cgi?action=showsubs&amp;block=<TMPL_VAR NAME=delparent>&amp;rdepth=<TMPL_VAR NAME=prdepth>"><TMPL_VAR NAME=delparent></a>.
     17</TMPL_IF>
     18</div>
     19<TMPL_ELSE>
     20<TMPL_IF delparent><div>Return to <a href="<TMPL_VAR NAME=webpath>/cgi-bin/main.cgi?action=showsubs&amp;block=<TMPL_VAR NAME=delparent>&amp;rdepth=<TMPL_VAR NAME=prdepth>"><TMPL_VAR NAME=delparent></a></div></TMPL_IF>
     21</TMPL_IF>
    822</TMPL_IF>
    923</div>
Note: See TracChangeset for help on using the changeset viewer.