Changeset 529 for trunk/cgi-bin/IPDB.pm
- Timestamp:
- 10/25/12 15:43:55 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/cgi-bin/IPDB.pm
r528 r529 28 28 &addMaster 29 29 &listSummary &listMaster &listRBlock &listFree &listPool 30 &getRoutedCity 30 &getTypeList 31 &getParent &getRoutedCity 31 32 &allocateBlock &deleteBlock &getBlockData 32 33 &getNodeList … … 41 42 &addMaster 42 43 &listSummary &listMaster &listRBlock &listFree &listPool 43 &getRoutedCity 44 &getTypeList 45 &getParent &getRoutedCity 44 46 &allocateBlock &deleteBlock &getBlockData 45 47 &getNodeList … … 467 469 return \@poolips; 468 470 } # end listPool() 471 472 473 ## IPDB::getTypeList() 474 # Get an alloctype/description pair list suitable for dropdowns 475 # Takes a flag to determine which general groups of types are returned 476 # Returns an reference to an array of hashrefs 477 sub getTypeList { 478 my $dbh = shift; 479 my $tgroup = shift || 'a'; # technically optional, like this, but should 480 # really be specified in the call for clarity 481 my $tlist; 482 if ($tgroup eq 'p') { 483 # grouping 'p' - primary allocation types. These include static IP pools (_d and _p), 484 # dynamic-allocation ranges (_e), containers (_c), and the "miscellaneous" cn, in, and en types. 485 $tlist = $dbh->selectall_arrayref("SELECT type,listname FROM alloctypes WHERE listorder < 500 ". 486 "AND type NOT LIKE '_i' AND type NOT LIKE '_r' ORDER BY listorder", { Slice => {} }); 487 } elsif ($tgroup eq 'c') { 488 # grouping 'c' - contained types. These include all static IPs and all _r types. 489 $tlist = $dbh->selectall_arrayref("SELECT type,listname FROM alloctypes WHERE listorder <= 500 ". 490 " AND (type LIKE '_i' OR type LIKE '_r') ORDER BY listorder", { Slice => {} }); 491 } else { 492 # grouping 'a' - all standard allocation types. This includes everything 493 # but mm (present only as a formality). Make this the default. 494 $tlist = $dbh->selectall_arrayref("SELECT type,listname FROM alloctypes WHERE listorder <= 500 ". 495 " ORDER BY listorder", { Slice => {} }); 496 } 497 return $tlist; 498 } 499 500 501 ## IPDB::getParent() 502 # Get a block's parent's details 503 # Takes a database handle and CIDR block 504 # Returns a hashref to the parent routed or container block, if any 505 sub getParent { 506 my $dbh = shift; 507 my $block = shift; 508 509 my $pinfo = $dbh->selectrow_hashref("SELECT cidr,custid,type,city,description FROM allocations". 510 " WHERE cidr >>= ?", undef, ($block) ); 511 return $pinfo; 512 } # end getParent() 469 513 470 514
Note:
See TracChangeset
for help on using the changeset viewer.