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


Ignore:
Timestamp:
02/18/15 17:16:21 (9 years ago)
Author:
Kris Deugau
Message:

/trunk

Add "breadcrumb" navigation trace to most pages.

File:
1 edited

Legend:

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

    r695 r697  
    7474my $header = HTML::Template->new(filename => "header.tmpl");
    7575my $footer = HTML::Template->new(filename => "footer.tmpl");
     76my $utilbar = HTML::Template->new(filename => "utilbar.tmpl", loop_context_vars => 1, global_vars => 1);
     77
     78print "Content-type: text/html\n\n";
    7679
    7780$header->param(version => $IPDB::VERSION);
    7881$header->param(addperm => $IPDBacl{$authuser} =~ /a/);
    7982$header->param(webpath => $IPDB::webpath);
    80 print "Content-type: text/html\n\n", $header->output;
     83
     84$utilbar->param(webpath => $IPDB::webpath);
     85
     86print $header->output;
    8187
    8288
     
    221227#print "Content-type: text/html\n\n", $header->output;
    222228$page->param(webpath => $IPDB::webpath);
     229print $utilbar->output;
    223230print $page->output;
    224231
     
    278285#$page->param(editme => 1) unless $pinfo->{type} ne 'mm';
    279286
     287  my $crumbs = getBreadCrumbs($ip_dbh, $pinfo->{parent_id});
     288  my @rcrumbs = reverse (@$crumbs);
     289  $utilbar->param(breadcrumb => \@rcrumbs);
     290
    280291  $page->param(self_id => $webvar{parent});
    281292  $page->param(block => $pinfo->{block});
     
    292303  my $poolinfo = getBlockData($ip_dbh, $webvar{pool});
    293304  my $cidr = new NetAddr::IP $poolinfo->{block};
     305
     306  # Tree navigation
     307  my $crumbs = getBreadCrumbs($ip_dbh, $poolinfo->{parent_id});
     308  my @rcrumbs = reverse (@$crumbs);
     309  $utilbar->param(breadcrumb => \@rcrumbs);
    294310
    295311  $page->param(block => $cidr);
     
    348364    # seems reasonable that a new allocation would share a VRF with its parent
    349365    $page->param(pvrf => $pinfo->{vrf});
     366
     367    # Tree navigation
     368    my $crumbs = getBreadCrumbs($ip_dbh, $webvar{parent});
     369    my @rcrumbs = reverse (@$crumbs);
     370    $utilbar->param(breadcrumb => \@rcrumbs);
    350371
    351372    $webvar{fbtype} = '' if !$webvar{fbtype};
     
    441462
    442463    if ($webvar{fbassign} && $webvar{fbassign} eq 'y') {
     464
     465      # Tree navigation
     466      my $crumbs = getBreadCrumbs($ip_dbh, $webvar{parent});
     467      my @rcrumbs = reverse (@$crumbs);
     468      $utilbar->param(breadcrumb => \@rcrumbs);
     469
    443470      $cidr = new NetAddr::IP $webvar{block};
    444471      $alloc_from = new NetAddr::IP $webvar{allocfrom};
     
    685712      $page->param(alloctype => $disp_alloctypes{$webvar{alloctype}});
    686713      $page->param(custid => $webvar{custid});
     714
    687715      # breadcrumbs lite!  provide at least a link to the parent of the block we just allocated.
    688716      my $binfo = getBlockData($ip_dbh, $webvar{parent});
    689717      $page->param(parentid => $webvar{parent});
    690718      $page->param(parentblock => $binfo->{block});
     719
     720      # Full breadcrumbs
     721      my $crumbs = getBreadCrumbs($ip_dbh, $webvar{parent});
     722      my @rcrumbs = reverse (@$crumbs);
     723      $utilbar->param(breadcrumb => \@rcrumbs);
     724
    691725      if ($webvar{alloctype} eq 'pr' && $webvar{billinguser}) {
    692726        $page->param(billinguser => $webvar{billinguser});
     
    829863  $page->param(id       => $webvar{id});
    830864  $page->param(basetype => $webvar{basetype});
     865
     866  # Tree navigation
     867  my $crumbs = getBreadCrumbs($ip_dbh, $blockinfo->{parent_id});
     868  my @rcrumbs = reverse (@$crumbs);
     869  $utilbar->param(breadcrumb => \@rcrumbs);
    831870
    832871  # Clean up extra whitespace on alloc type.  Mainly a legacy-data cleanup.
Note: See TracChangeset for help on using the changeset viewer.