Changeset 528 for trunk/cgi-bin/main.cgi
- Timestamp:
- 10/24/12 16:34:36 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/cgi-bin/main.cgi
r527 r528 129 129 } 130 130 elsif($webvar{action} eq 'listpool') { 131 listPool();131 showPool(); 132 132 } 133 133 … … 267 267 268 268 # List the IPs used in a pool 269 sub listPool {269 sub showPool { 270 270 271 271 my $cidr = new NetAddr::IP $webvar{pool}; … … 280 280 281 281 # Snag pool info for heading 282 $sth = $ip_dbh->prepare("select type,city from allocations where cidr=?"); 283 $sth->execute($webvar{pool}); 284 my ($pooltype, $poolcity) = $sth->fetchrow_array; 285 286 $page->param(disptype => $disp_alloctypes{$pooltype}); 287 $page->param(city => $poolcity); 282 my $poolinfo = getBlockData($ip_dbh, $webvar{pool}); 283 284 $page->param(disptype => $disp_alloctypes{$poolinfo->{type}}); 285 $page->param(city => $poolinfo->{city}); 288 286 289 287 # Only display net/gw/bcast if it's a "real" netblock and not a PPP(oE) lunacy 290 $page->param(realblock => $pool type=~ /^.d$/);288 $page->param(realblock => $poolinfo->{type} =~ /^.d$/); 291 289 292 290 # probably have to add an "edit IP allocation" link here somewhere. 293 291 294 $sth = $ip_dbh->prepare("select ip,custid,available,description,type". 295 " from poolips where pool='$webvar{pool}' order by ip"); 296 $sth->execute; 297 my @poolips; 298 my $rowclass = 0; 299 while (my ($ip,$custid,$available,$desc,$type) = $sth->fetchrow_array) { 300 my %row = ( 301 rowclass => $rowclass++ % 2, 302 ip => $ip, 303 custid => $custid, 304 available => $available, 305 desc => $desc, 306 maydel => $IPDBacl{$authuser} =~ /d/, 307 delme => $available eq 'n' 308 ); 309 push @poolips, \%row; 310 } 311 $page->param(poolips => \@poolips); 312 313 } # end listPool 292 my $plist = listPool($ip_dbh, $webvar{pool}); 293 # technically slightly more efficient to check the ACL in an if () once outside the foreach 294 foreach (@{$plist}) { 295 $$_{maydel} = $IPDBacl{$authuser} =~ /d/; 296 } 297 $page->param(poolips => $plist); 298 } # end showPool 314 299 315 300 … … 1038 1023 1039 1024 # need to retrieve block data before deleting so we can notify on that 1040 my ($cidr,$custid,$type,$city,$description)= getBlockData($ip_dbh, $webvar{block});1025 my $blockinfo = getBlockData($ip_dbh, $webvar{block}); 1041 1026 1042 1027 my ($code,$msg) = deleteBlock($ip_dbh, $webvar{block}, $webvar{alloctype}); … … 1044 1029 $page->param(block => $webvar{block}); 1045 1030 if ($code eq 'OK') { 1046 syslog "notice", "$authuser deallocated '$webvar{alloctype}'-type netblock $webvar{block} ".1047 " $custid, $city, desc='$description'";1031 syslog "notice", "$authuser deallocated '$webvar{alloctype}'-type netblock $webvar{block} ". 1032 $blockinfo->{custid}.", ".$blockinfo->{city}.", desc='".$blockinfo->{description}."'"; 1048 1033 mailNotify($ip_dbh, 'da', "REMOVED: $disp_alloctypes{$webvar{alloctype}} $webvar{block}", 1049 1034 "$disp_alloctypes{$webvar{alloctype}} $webvar{block} deallocated by $authuser\n". 1050 "CustID: $custid\nCity: $city\nDescription: $description\n"); 1035 "CustID: ".$blockinfo->{custid}."\nCity: ".$blockinfo->{city}. 1036 "\nDescription: ".$blockinfo->{description}."\n"); 1051 1037 } else { 1052 1038 $page->param(failmsg => $msg);
Note:
See TracChangeset
for help on using the changeset viewer.