Changeset 577 for trunk/cgi-bin/main.cgi


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.

File:
1 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}."'";
Note: See TracChangeset for help on using the changeset viewer.