Changeset 633 for trunk/cgi-bin/main.cgi


Ignore:
Timestamp:
10/08/14 18:01:55 (10 years ago)
Author:
Kris Deugau
Message:

/trunk

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

  • Netblock assignment
    • Update several supporting data-grabber subs in IPDB.pm
    • Update assignment sub
    • Update data-entry, confirmation, and acceptance/error page templates and related main.cgi sections
File:
1 edited

Legend:

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

    r631 r633  
    300300
    301301  # hack pthbttt eww
     302  $webvar{parent} = 0 if !$webvar{parent};
    302303  $webvar{block} = '' if !$webvar{block};
    303304
     
    307308  $page->param(allocfrom => $webvar{block});    # fb-assign flag, if block is set, we're in fb-assign
    308309
    309   if ($webvar{block} ne '') {
     310  if ($webvar{fbid} || $webvar{fbtype}) {
    310311
    311312    # Common case, according to reported usage.  Block to assign is specified.
    312313    my $block = new NetAddr::IP $webvar{block};
    313     $page->param(rdepth => $webvar{rdepth});
    314 
    315     my $rdns = getBlockRDNS($ip_dbh, $webvar{block}, $webvar{rdepth}, vrf => $webvar{vrf}, user => $authuser);
     314
     315    my $rdns = getBlockRDNS($ip_dbh, id => $webvar{parent}, type => $webvar{fbtype}, user => $authuser);
    316316    $page->param(rdns => $rdns) if $rdns;
     317    $page->param(parent => $webvar{parent});
     318    $page->param(fbid => $webvar{fbid});
    317319
    318320    $webvar{fbtype} = '' if !$webvar{fbtype};
    319321    if ($webvar{fbtype} eq 'i') {
    320       my $ipinfo = getBlockData($ip_dbh, $block);
     322      my $ipinfo = getBlockData($ip_dbh, $webvar{block}, 'i');
     323      my $pinfo = getBlockData($ip_dbh, $webvar{parent});
    321324      $page->param(
    322325        fbip => 1,
    323         block => $block,
     326        block => $ipinfo->{block},
    324327        fbdisptype => $list_alloctypes{$ipinfo->{type}},
    325328        type => $ipinfo->{type},
    326         allocfrom => $ipinfo->{pool},
     329        allocfrom => $pinfo->{block},
    327330        );
    328331    } else {
     
    340343
    341344    my @pops;
    342     foreach my $pop (@poplist) {
     345    foreach my $pop (@citylist) {
    343346      my %row = (pop => $pop);
    344347      push (@pops, \%row);
     
    378381  my $cidr;
    379382  my $alloc_from;
     383  my $fbid = $webvar{fbid};
     384  my $p_id = $webvar{parent};
    380385
    381386  # Going to manually validate some items.
     
    428433
    429434## fixme:  add rdepth?
    430       ($cidr,$webvar{rdepth}) = findAllocateFrom($ip_dbh, $webvar{maskbits}, $webvar{alloctype}, $webvar{city},
    431         $webvar{pop}, (master => $webvar{allocfrom}, allowpriv => $webvar{allowpriv}) );
     435      ($fbid,$cidr,$p_id) = findAllocateFrom($ip_dbh, $webvar{maskbits}, $webvar{alloctype},
     436        $webvar{city}, $webvar{pop}, (master => $webvar{allocfrom}, allowpriv => $webvar{allowpriv}) );
    432437      if (!$cidr) {
    433438        $page->param(err => $failmsg);
     
    464469  $page->param(typefull => $q->escapeHTML($disp_alloctypes{$webvar{alloctype}}));
    465470  $page->param(alloc_from => $alloc_from);
    466   $page->param(rdepth => $webvar{rdepth});
     471  $page->param(parent => $p_id);
     472  $page->param(fbid => $fbid);
    467473  $page->param(cidr => $cidr);
    468474  $page->param(rdns => $webvar{rdns});
     
    514520  # IP, or the error message if an error occurred.
    515521
    516   my ($code,$msg) = allocateBlock($ip_dbh, cidr => $webvar{fullcidr}, alloc_from => $webvar{alloc_from},
    517         rdepth => $webvar{rdepth}, custid => $webvar{custid}, type => $webvar{alloctype}, city => $webvar{city},
     522  my ($code,$msg) = allocateBlock($ip_dbh, cidr => $webvar{fullcidr}, fbid => $webvar{fbid},
     523        parent => $webvar{parent}, custid => $webvar{custid}, type => $webvar{alloctype}, city => $webvar{city},
    518524        desc => $webvar{desc}, notes => $webvar{notes}, circid => $webvar{circid},
    519525        privdata => $webvar{privdata}, nodeid => $webvar{node}, rdns => $webvar{rdns}, user => $authuser);
     
    524530      $page->param(staticip => $msg);
    525531      $page->param(custid => $webvar{custid});
    526       $page->param(parent => $webvar{alloc_from}, rdepth => $webvar{rdepth}-1);
     532      $page->param(parent => $webvar{parent}, pool => $webvar{alloc_from});
    527533      $page->param(billinguser => $webvar{billinguser});
    528534      mailNotify($ip_dbh, "a$webvar{alloctype}", "ADDED: $disp_alloctypes{$webvar{alloctype}} allocation",
     
    535541      $page->param(custid => $webvar{custid});
    536542      # breadcrumbs lite!  provide at least a link to the parent of the block we just allocated.
    537       my $binfo = getBlockData($ip_dbh, $webvar{fullcidr}, $webvar{rdepth});
    538       $page->param(parent => $binfo->{parent}, rdepth => $binfo->{rdepth});
     543      my $binfo = getBlockData($ip_dbh, $webvar{parent});
     544      $page->param(parentid => $webvar{parent});
     545      $page->param(parentblock => $binfo->{block});
    539546      if ($webvar{alloctype} eq 'pr' && $webvar{billinguser}) {
    540547        $page->param(billinguser => $webvar{billinguser});
Note: See TracChangeset for help on using the changeset viewer.