Changeset 766


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
Location:
trunk
Files:
3 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});
  • trunk/templates/confirm.tmpl

    r692 r766  
    2626<TMPL_IF staticip>
    2727<td>
    28 <select name="alloc_from">
    29 <TMPL_LOOP name=poollist>       <option value="<TMPL_VAR NAME=poolblock>,<TMPL_VAR NAME=poolrdepth>"><TMPL_VAR NAME=poolblock> [<TMPL_VAR NAME=poolfree>] free IP(s) in <TMPL_VAR NAME=poolcit></option>
     28<select name="parent">
     29<TMPL_LOOP name=poollist>       <option value="<TMPL_VAR NAME=poolid>"><TMPL_VAR NAME=poolblock> [<TMPL_VAR NAME=poolfree>] free IP(s) in <TMPL_VAR NAME=poolcit></option>
    3030</TMPL_LOOP></select>
    3131</td>
     
    6161</div>
    6262</TMPL_IF>
    63 
    6463</td>
    6564</tr>
     
    120119<tr>
    121120<td class="center" colspan="2">
    122 <TMPL_UNLESS poollist><input type="hidden" name="alloc_from" value="<TMPL_VAR NAME=alloc_from>"></TMPL_UNLESS>
     121<TMPL_UNLESS poollist>
     122<input type="hidden" name="alloc_from" value="<TMPL_VAR NAME=alloc_from>">
    123123<input type="hidden" name="parent" value="<TMPL_VAR NAME=parent>">
     124</TMPL_UNLESS>
    124125<input type="hidden" name="fbid" value="<TMPL_VAR NAME=fbid>">
    125126<TMPL_IF resvblock><input type="hidden" name="reserve" value="<TMPL_VAR NAME=reserve>"></TMPL_IF>
  • trunk/templates/insert.tmpl

    r633 r766  
    11<TMPL_IF err>
    22<div class="err">
    3 <p><TMPL_VAR NAME=err></p>
     3<div class="heading"><TMPL_VAR NAME=err></div>
     4<p><TMPL_VAR NAME=errmsg></p>
    45<input type="button" value="Back" onclick="history.go(-1)">
    56</div>
     
    1213</TMPL_IF>
    1314</div>
    14 <div class="center">IPs in <a href="<TMPL_VAR NAME=webpath>/cgi-bin/main.cgi?action=listpool&amp;pool=<TMPL_VAR
    15 NAME=parent>"><TMPL_VAR NAME=pool></a></div>
     15<div class="center">IPs in <a href="<TMPL_VAR NAME=webpath>/cgi-bin/main.cgi?action=listpool&amp;pool=<TMPL_VAR NAME=parentid>"><TMPL_VAR NAME=parentblock></a></div>
    1616<TMPL_ELSE>
    1717<div class="center">
Note: See TracChangeset for help on using the changeset viewer.