Changeset 465 for branches/htmlform/cgi-bin/main.cgi
- Timestamp:
- 08/06/10 16:30:33 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/htmlform/cgi-bin/main.cgi
r463 r465 308 308 sub showMaster { 309 309 310 print qq(<center><div class="heading">Summarizing routed blocks for ). 311 qq($webvar{block}:</div></center><br>\n); 310 $page->param(master => $webvar{block}); 312 311 313 312 my %allocated; 314 313 my %free; 315 my % routed;314 my %cities; 316 315 my %bigfree; 317 316 … … 331 330 $bigfree{"$cidr"} = 128; 332 331 # Retain the routing destination 333 $ routed{"$cidr"} = $data[1];332 $cities{"$cidr"} = $data[1]; 334 333 } 335 334 336 335 # Check if there were actually any blocks routed from this master 337 336 if ($i > 0) { 338 startTable('Routed block','Routed to','Allocated blocks',339 'Free blocks','Largest free block');340 337 341 338 # Count the allocations … … 365 362 } 366 363 367 # Print the data.368 my $ count=0;364 my @routed; 365 my $rowclass = 0; 369 366 foreach my $master (@localmasters) { 370 my @row = ("<a href=\"/ip/cgi-bin/main.cgi?action=showrouted&block=$master\">$master</a>", 371 $routed{"$master"}, $allocated{"$master"}, 372 $free{"$master"}, 373 ( ($bigfree{"$master"} eq 128) ? ("<NONE>") : ("/".$bigfree{"$master"}) ) 374 ); 375 printRow(\@row, 'color1' ) if($count%2==0); 376 printRow(\@row, 'color2' ) if($count%2!=0); 377 $count++; 378 } 379 } else { 380 # If a master block has no routed blocks, then by definition it has no 381 # allocations, and can be deleted. 382 print qq(<hr width="60%"><center><div class="heading">No allocations in ). 383 qq($master.</div>\n). 384 ($IPDBacl{$authuser} =~ /d/ ? 385 qq(<form action="/ip/cgi-bin/main.cgi" method=POST>\n). 386 qq(<input type=hidden name=action value="delete">\n). 387 qq(<input type=hidden name=block value="$master">\n). 388 qq(<input type=hidden name=alloctype value="mm">\n). 389 qq(<input type=submit value=" Remove this master ">\n). 390 qq(</form></center>\n) : 391 ''); 367 my %row = ( 368 rowclass => $rowclass % 2, 369 block => "$master", 370 city => $cities{"$master"}, 371 nsubs => $allocated{"$master"}, 372 nfree => $free{"$master"}, 373 lfree => ( ($bigfree{"$master"} eq 128) ? ("<NONE>") : ("/".$bigfree{"$master"}) ) 374 ); 375 push @routed, \%row; 376 $rowclass++; 377 } 378 $page->param(routedlist => \@routed); 392 379 393 380 } # end check for existence of routed blocks in master 394 381 395 print qq(</table>\n<hr width="60%">\n). 396 qq(<center><div class="heading">Unrouted blocks in $master:</div></center><br>\n); 397 398 startTable('Netblock','Range'); 382 $page->param(delmaster => ($IPDBacl{$authuser} =~ /d/)); 399 383 400 384 # Snag the free blocks. … … 403 387 "routed='n' order by cidr"); 404 388 $sth->execute(); 389 my @unrouted; 390 my $rowclass = 0; 405 391 while (my @data = $sth->fetchrow_array()) { 406 392 my $cidr = new NetAddr::IP $data[0]; 407 my @row = ("$cidr", $cidr->range); 408 printRow(\@row, 'color1' ) if($count%2==0); 409 printRow(\@row, 'color2' ) if($count%2!=0); 410 $count++; 411 } 412 413 print "</table>\n"; 393 my %row = ( 394 rowclass => $rowclass % 2, 395 fblock => "$cidr", 396 frange => $cidr->range 397 ); 398 push @unrouted, \%row; 399 $rowclass++; 400 } 401 $page->param(unrouted => \@unrouted); 402 414 403 } # showMaster 415 404
Note:
See TracChangeset
for help on using the changeset viewer.