Changeset 818 for trunk/cgi-bin


Ignore:
Timestamp:
03/10/16 18:02:41 (9 years ago)
Author:
Kris Deugau
Message:

/trunk

Introduce a more "relaxed" layout for listing VRFs and master netblocks -
interleave the lists of master blocks for each VRF with the VRF heading,
instead of formally separating them onto different pages.

Refine and adapt showvrfs.tmpl to show the master blocks instead of
reinventing another wheel.

See #54.

Location:
trunk/cgi-bin
Files:
3 edited

Legend:

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

    r817 r818  
    129129# UI layout for subblocks/containers
    130130our $sublistlayout = 1;
     131
     132# UI layout for VRF/master blocks
     133our $masterswithvrfs = 2;
    131134
    132135# VLAN validation mode.  Set to 0 to allow alphanumeric vlan names instead of using the vlan number.
  • trunk/cgi-bin/MyIPDB.pm

    r780 r818  
    7878# $IPDB::sublistlayout = 1;
    7979
     80## UI layout for showing VRFs and master blocks
     81# 1 lists VRFs on the index page, and master blocks on a subpage to formally separate them
     82# 2 is a somehat "lazy" layout that brings sublists of master blocks in each VRF (as well
     83#   as the "Add master" link and "Delete this VRF" button) onto the index page grouped by VRF
     84#$IPDB::masterswithvrfs = 2;
     85
    8086## VLAN validation mode
    8187# Set to 0 to allow alphanumerics and _  .  - (VLAN name instead of number)
  • trunk/cgi-bin/main.cgi

    r816 r818  
    319319sub showSummary {
    320320  my $vrflist = listVRF($ip_dbh);
     321
     322  if ($IPDB::masterswithvrfs == 2) {
     323    $page = HTML::Template->new(filename => "index2.tmpl", loop_context_vars => 1, global_vars => 1,
     324        path => @templatepath);
     325    # alternate layout;  put master blocks on the front summary page instead of "out"/"down" a
     326    # layer in the browse tree
     327    my $vrfinfo = HTML::Template->new(filename => "showvrf.tmpl", path => @templatepath);
     328    foreach my $vrf (@$vrflist) {
     329      my $masterlist = listSummary($ip_dbh, $vrf->{vrf});
     330      $vrfinfo->param(vrf => $vrf->{vrf});
     331      $vrfinfo->param(masterlist => $masterlist);
     332      $vrfinfo->param(addmaster => ($IPDBacl{$authuser} =~ /s/) );
     333      $vrfinfo->param(maydel => ($IPDBacl{$authuser} =~ /s/) );
     334      $vrfinfo->param(sub => 1);
     335      $vrf->{vrfinfo} = $vrfinfo->output;
     336    }
     337  }
     338
    321339  $page->param(vrflist => $vrflist);
    322340
    323341  # Only systems/network should be allowed to add VRFs - or maybe higher?
    324342  $page->param(addvrf => ($IPDBacl{$authuser} =~ /s/) );
     343
    325344} # showSummary
    326345
     
    338357  $utilbar->param(breadcrumb => \@rcrumbs);
    339358
     359  $page->param(maydel => ($IPDBacl{$authuser} =~ /s/) );
    340360  $page->param(addmaster => ($IPDBacl{$authuser} =~ /s/) );
    341361} # showVRF
Note: See TracChangeset for help on using the changeset viewer.