Changeset 536 for trunk/cgi-bin/IPDB.pm


Ignore:
Timestamp:
10/31/12 17:56:03 (12 years ago)
Author:
Kris Deugau
Message:

/trunk

Clean up and move SQL for post-update backlink to IPDB.pm. See #34.
Also rename getParent() to subParent() to fit in with ipParent() and
blockParent().

Fix a couple "Use of uninitialized..." log-noise bugs. See #31.

Move some HTML-entity-escaping into the template, and shuffle lines
munging the notes and restricted data on post-update value display
so we can properly munge in <br> for \n. Doesn't seem to be a way
to plug that into HTML::Template. :( See #3.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/cgi-bin/IPDB.pm

    r535 r536  
    2929        &listSummary &listMaster &listRBlock &listFree &listPool
    3030        &getTypeList &getPoolSelect &findAllocateFrom
    31         &getParent &getRoutedCity
     31        &ipParent &subParent &blockParent &getRoutedCity
    3232        &allocateBlock &updateBlock &deleteBlock &getBlockData
    3333        &getNodeList &getNodeName &getNodeInfo
     
    4343                &listSummary &listMaster &listRBlock &listFree &listPool
    4444                &getTypeList &getPoolSelect &findAllocateFrom
    45                 &getParent &getRoutedCity
     45                &ipParent &subParent &blockParent &getRoutedCity
    4646                &allocateBlock &updateBlock &deleteBlock &getBlockData
    4747                &getNodeList &getNodeName &getNodeInfo
     
    576576
    577577
    578 ## IPDB::getParent()
    579 # Get a block's parent's details
    580 # Takes a database handle and CIDR block
    581 # Returns a hashref to the parent routed or container block, if any
    582 sub getParent {
     578## IPDB::ipParent()
     579# Get an IP's parent pool's details
     580# Takes a database handle and IP
     581# Returns a hashref to the parent pool block, if any
     582sub ipParent {
    583583  my $dbh = shift;
    584584  my $block = shift;
     
    587587        " WHERE cidr >>= ?", undef, ($block) );
    588588  return $pinfo;
    589 } # end getParent()
     589} # end ipParent()
     590
     591
     592## IPDB::subParent()
     593# Get a block's parent's details
     594# Takes a database handle and CIDR block
     595# Returns a hashref to the parent container block, if any
     596sub subParent {
     597  my $dbh = shift;
     598  my $block = shift;
     599
     600  my $pinfo = $dbh->selectrow_hashref("SELECT cidr,custid,type,city,description FROM allocations".
     601        " WHERE cidr >>= ?", undef, ($block) );
     602  return $pinfo;
     603} # end subParent()
     604
     605
     606## IPDB::blockParent()
     607# Get a block's parent's details
     608# Takes a database handle and CIDR block
     609# Returns a hashref to the parent container block, if any
     610sub blockParent {
     611  my $dbh = shift;
     612  my $block = shift;
     613
     614  my $pinfo = $dbh->selectrow_hashref("SELECT cidr,city FROM routed".
     615        " WHERE cidr >>= ?", undef, ($block) );
     616  return $pinfo;
     617} # end blockParent()
    590618
    591619
Note: See TracChangeset for help on using the changeset viewer.