Changeset 627 for trunk/cgi-bin


Ignore:
Timestamp:
10/08/14 17:17:38 (10 years ago)
Author:
Kris Deugau
Message:

/trunk

Commit 3/mumble for work done intermittently over the past ~year.
See #5, comment 25:

  • Update suballocation list/summary; IPDB::listSubs(), main.cgi:showSubs(), and page template
Location:
trunk/cgi-bin
Files:
2 edited

Legend:

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

    r625 r627  
    460460  # Just In Case
    461461  $args{vrf} = '' if !$args{vrf};
    462   $args{rdepth} = 1 if !$args{rdepth};
    463462
    464463  # Snag the allocations for this block
    465   my $sth = $dbh->prepare("SELECT cidr,city,type,custid,swip,description".
    466         " FROM allocations WHERE parent = ? AND rdepth = ? ORDER BY cidr");
    467   $sth->execute($args{block},$args{rdepth});
     464  my $sth = $dbh->prepare("SELECT cidr,city,type,custid,swip,description,id,master_id".
     465        " FROM allocations WHERE parent_id = ? ORDER BY cidr");
     466  $sth->execute($args{parent});
    468467
    469468  # hack hack hack
     
    472471
    473472  my @blocklist;
    474   while (my ($cidr,$city,$type,$custid,$swip,$desc) = $sth->fetchrow_array()) {
     473  while (my ($cidr,$city,$type,$custid,$swip,$desc,$id) = $sth->fetchrow_array()) {
    475474    $custsth->execute($custid);
    476475    my ($ncust) = $custsth->fetchrow_array();
     
    484483        desc => $desc,
    485484        hassubs => ($type eq 'rm' || $type =~ /.c/ ? 1 : 0),
     485        id => $id,
    486486        );
    487487#    $row{subblock} = ($type =~ /^.r$/);         # hmf.  wonder why these won't work in the hash declaration...
  • trunk/cgi-bin/main.cgi

    r624 r627  
    244244# Display blocks immediately within a given parent
    245245sub showSubs {
    246   $page->param(block => $webvar{block});
     246  my $pinfo = getBlockData($ip_dbh, $webvar{parent});
     247
     248  $page->param(del_id => $webvar{parent});
     249  $page->param(block => $pinfo->{block});
    247250  $page->param(mayadd => ($IPDBacl{$authuser} =~ /a/));
    248251  $page->param(maydel => ($IPDBacl{$authuser} =~ /d/));
    249252
    250   my $sublist = listSubs($ip_dbh, block => $webvar{block}, rdepth => $webvar{rdepth});
    251   $page->param(deldepth => $webvar{rdepth} - 1);
    252   $page->param(rdepth => $webvar{rdepth});
    253   $page->param(subdepth => $webvar{rdepth} + 1);
     253  my $sublist = listSubs($ip_dbh, parent => $webvar{parent});
    254254  $page->param(sublist => $sublist);
    255255
    256   my $flist = listFree($ip_dbh, master => $webvar{block}, rdepth => $webvar{rdepth});
     256  my $flist = listFree($ip_dbh, parent => $webvar{parent});
    257257  $page->param(freelist => $flist);
    258258} # showSubs
Note: See TracChangeset for help on using the changeset viewer.