Changeset 595 for branches/stable/cgi-bin/main.cgi
- Timestamp:
- 05/15/13 17:26:55 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/stable/cgi-bin/main.cgi
r594 r595 238 238 my $flist = listFree($ip_dbh, $webvar{block}); 239 239 $page->param(unrouted => $flist); 240 $page->param(mayadd => ($IPDBacl{$authuser} =~ /a/)); 240 241 } # showMaster 241 242 … … 312 313 $page->param(rowa => 'row'.($webvar{block} eq '' ? 1 : 0)); 313 314 $page->param(rowb => 'row'.($webvar{block} eq '' ? 0 : 1)); 314 $page->param( block => $webvar{block});# fb-assign flag, if block is set, we're in fb-assign315 $page->param(iscontained => ($webvar{fbtype} && $webvar{fbtype} ne 'y')); 316 317 # New special case- block to assign is specified 318 if ($webvar{block} ne '') {315 $page->param(allocfrom => $webvar{block}); # fb-assign flag, if block is set, we're in fb-assign 316 317 if ($webvar{fbtype}) { 318 319 # Common case, according to reported usage. Block to assign is specified. 319 320 my $block = new NetAddr::IP $webvar{block}; 320 321 321 # Handle contained freeblock allocation. 322 # This is a little dangerous, as it's *theoretically* possible to 323 # get fbtype='n' (aka a non-routed freeblock). However, should 324 # someone manage to get there, they get what they deserve. 325 if ($webvar{fbtype} ne 'y') { 326 # Snag the type of the container block from the database. 327 ## hmm. need a flag for parent class/type, sort of? 328 my $pblock = subParent($ip_dbh, $webvar{block}); 329 my $ptype = $pblock->{type}; 330 $ptype =~ s/c$/r/; 331 $page->param(fbdisptype => $list_alloctypes{$ptype}); 332 $page->param(type => $ptype); 322 $webvar{fbtype} = '' if !$webvar{fbtype}; 323 if ($webvar{fbtype} eq 'i') { 324 my $ipinfo = getBlockData($ip_dbh, $webvar{block}, 'i'); 325 my $pinfo = getBlockData($ip_dbh, $webvar{parent}); 326 $page->param( 327 fbip => 1, 328 block => $ipinfo->{block}, 329 fbdisptype => $list_alloctypes{$ipinfo->{type}}, 330 type => $ipinfo->{type}, 331 allocfrom => $pinfo->{block}, 332 ); 333 } elsif ($webvar{fbtype} eq 'n') { 334 $page->param( 335 fbrouted => 1, 336 fbdisptype => $list_alloctypes{'rm'}, 337 type => 'rm', 338 block => $block, 339 ); 333 340 } else { 334 341 # get "primary" alloctypes, since these are all that can correctly be assigned if we're in this branch 335 my $tlist = getTypeList($ip_dbh, ' p');342 my $tlist = getTypeList($ip_dbh, 'n'); 336 343 $tlist->[0]->{sel} = 1; 337 $page->param(typelist => $tlist); 338 } 344 $page->param(typelist => $tlist, block => $block); 345 } 346 339 347 } else { 348 349 # Uncommon case, according to reported usage. Block to assign needs to be found based on criteria. 340 350 my $mlist = getMasterList($ip_dbh, 'c'); 341 351 $page->param(masterlist => $mlist); 342 352 343 353 my @pops; 344 foreach my $pop (@ poplist) {354 foreach my $pop (@citylist) { 345 355 my %row = (pop => $pop); 346 356 push (@pops, \%row); … … 353 363 $page->param(typelist => $tlist); 354 364 } 355 356 365 my @cities; 357 366 foreach my $city (@citylist) { … … 400 409 401 410 if ($webvar{fbassign} && $webvar{fbassign} eq 'y') { 411 $cidr = new NetAddr::IP $webvar{block}; 402 412 $alloc_from = new NetAddr::IP $webvar{allocfrom}; 403 ## possibly messy behaviour: force the _from and block to be the network addr?404 $alloc_from = qq($alloc_from<input type=hidden name=alloc_from value="$alloc_from">);405 $cidr = new NetAddr::IP $webvar{block};406 413 $webvar{maskbits} = $cidr->masklen; 407 414 } else { # done with direct freeblocks assignment … … 440 447 441 448 # this chunk now specific to "guided" allocation; freeblock-select can now slice-n-dice on its own. 442 $alloc_from = qq($cidr<input type=hidden name=alloc_from value="$cidr">);449 $alloc_from = "$cidr"; 443 450 # If the block to be allocated is smaller than the one we found, 444 451 # figure out the "real" block to be allocated. … … 452 459 } 453 460 } # check for freeblocks assignment or IPDB-controlled assignment 454 455 $alloc_from = "$cidr";456 461 457 462 } # if ($webvar{alloctype} =~ /^.i$/)
Note:
See TracChangeset
for help on using the changeset viewer.