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


Ignore:
Timestamp:
08/24/15 18:10:42 (9 years ago)
Author:
Kris Deugau
Message:

/trunk

Fixes for "Allocation complete" screen:

  • Refine and tune order and source of information for breadcrumbs correctness on guided allocation of a static IP
  • Remove a little stale code lingering from "rdepth"
  • Tweak template parameters and CSS/layout for error reporting
File:
1 edited

Legend:

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

    r765 r766  
    680680  }
    681681
    682   # split up some linked data for static IPs via guided allocation.  needed for breadcrumbs lite.
    683   ($webvar{alloc_from},$webvar{rdepth}) = split /,/, $webvar{alloc_from} if $webvar{alloc_from} =~ /,/;
    684 
    685682  # $code is "success" vs "failure", $msg contains OK for a
    686683  # successful netblock allocation, the IP allocated for static
     
    714711        );
    715712
     713  my $pinfo = getBlockData($ip_dbh, $webvar{parent});
     714
     715  # clean up a minor mess with guided allocation of static IPs
     716  if ($webvar{alloctype} =~ /^.i$/) {
     717    $insert_args{alloc_from} = $pinfo->{block};
     718  }
     719
    716720  my ($code,$msg) = allocateBlock($ip_dbh, %insert_args, iprev => \%iprev);
    717721
    718722  if ($code eq 'OK') {
     723    # breadcrumbs lite!  provide at least a link to the parent of the block we just allocated.
     724    $page->param(parentid => $webvar{parent});
     725    $page->param(parentblock => $pinfo->{block});
     726
    719727    if ($webvar{alloctype} =~ /^.i$/) {
    720728      $msg =~ s|/32||;
    721729      $page->param(staticip => $msg);
    722730      $page->param(custid => $webvar{custid});
    723       $page->param(parent => $webvar{parent}, pool => $webvar{alloc_from});
    724731      $page->param(billinguser => $webvar{billinguser});
    725732      mailNotify($ip_dbh, "a$webvar{alloctype}", "ADDED: $disp_alloctypes{$webvar{alloctype}} allocation",
     
    732739      $page->param(custid => $webvar{custid});
    733740
    734       # breadcrumbs lite!  provide at least a link to the parent of the block we just allocated.
    735       my $binfo = getBlockData($ip_dbh, $webvar{parent});
    736       $page->param(parentid => $webvar{parent});
    737       $page->param(parentblock => $binfo->{block});
    738 
    739741      # Full breadcrumbs
    740742      my $crumbs = getBreadCrumbs($ip_dbh, $webvar{parent});
     
    757759    syslog "err", "Allocation of '$webvar{fullcidr}' to '$webvar{custid}' as ".
    758760        "'$webvar{alloctype}' by $authuser failed: '$msg'";
    759     $page->param(err => "Allocation of $webvar{fullcidr} as '$disp_alloctypes{$webvar{alloctype}}'".
    760         " failed:<br>\n$msg\n");
     761    $page->param(err => "Allocation of $webvar{fullcidr} as '$disp_alloctypes{$webvar{alloctype}}' failed:");
     762    $page->param(errmsg => $msg);
    761763  }
    762764
     
    14291431  $page->param(block => $blockinfo->{block});
    14301432  $page->param(bdisp => $q->escapeHTML($disp_alloctypes{$blockinfo->{type}}));
    1431   $page->param(delparent_id => $blockinfo->{parent_id});# if $webvar{rdepth};
     1433  $page->param(delparent_id => $blockinfo->{parent_id});
    14321434  if ($pinfo) {
    14331435    $page->param(delparent => $pinfo->{block});
Note: See TracChangeset for help on using the changeset viewer.