Changeset 566


Ignore:
Timestamp:
12/19/12 16:56:50 (11 years ago)
Author:
Kris Deugau
Message:

/trunk

Work in progress, see #5:
Replace $webvar{action} branches for showmaster and showrouted
with showsubs, calling listSubs()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/cgi-bin/main.cgi

    r553 r566  
    121121} # end add new master
    122122
    123 elsif($webvar{action} eq 'showmaster') {
    124   showMaster();
    125 }
    126 elsif($webvar{action} eq 'showrouted') {
    127   showRBlock();
    128 }
    129123elsif($webvar{action} eq 'listpool') {
    130124  showPool();
     
    223217
    224218
    225 # Display detail on master
    226 # Alrighty then!  We're showing routed blocks within a single master this time.
    227 # We should be able to steal code from showSummary(), and if I'm really smart
    228 # I'll figger a way to munge the two together.  (Once I've done that, everything
    229 # else should follow.  YMMV.)
    230 sub showMaster {
    231 
    232   $page->param(master => $webvar{block});
    233   $page->param(delmaster => ($IPDBacl{$authuser} =~ /d/));
    234 
    235   my $rlist = listMaster($ip_dbh, $webvar{block});
    236   $page->param(routedlist => $rlist);
    237 
    238   my $flist = listFree($ip_dbh, $webvar{block});
    239   $page->param(unrouted => $flist);
    240 } # showMaster
    241 
    242 
    243 # Display details of a routed block
    244 # Alrighty then!  We're showing allocations within a routed block this time.
    245 # We should be able to steal code from showSummary() and showMaster(), and if
    246 # I'm really smart I'll figger a way to munge all three together.  (Once I've
    247 # done that, everything else should follow.  YMMV.
    248 # This time, we check the database before spewing, because we may
    249 # not have anything useful to spew.
    250 sub showRBlock {
    251 
    252   $page->param(master => $webvar{block});
    253   $page->param(delrouted => $IPDBacl{$authuser} =~ /d/);
    254 
    255   my $rcity = getRoutedCity($ip_dbh, $webvar{block});
    256   $page->param(rcity => $rcity);
    257 
    258   my $blist = listRBlock($ip_dbh, $webvar{block});
    259   $page->param(blocklist => $blist);
    260 
    261   my $flist = listFree($ip_dbh, $webvar{block}, 'y');
    262   $page->param(unassigned => $flist);
    263 } # showRBlock
     219# Display blocks immediately within a given parent
     220sub showSubs {
     221  $page->param(block => $webvar{block});
     222  $page->param(mayadd => ($IPDBacl{$authuser} =~ /a/));
     223  $page->param(maydel => ($IPDBacl{$authuser} =~ /d/));
     224
     225  my $sublist = listSubs($ip_dbh, block => $webvar{block}, rdepth => $webvar{rdepth});
     226  $page->param(deldepth => $webvar{rdepth} - 1);
     227  $page->param(rdepth => $webvar{rdepth});
     228  $page->param(subdepth => $webvar{rdepth} + 1);
     229  $page->param(sublist => $sublist);
     230
     231  my $flist = listFree($ip_dbh, master => $webvar{block}, rdepth => $webvar{rdepth});
     232  $page->param(freelist => $flist);
     233} # showSubs
    264234
    265235
Note: See TracChangeset for help on using the changeset viewer.