Changeset 818 for trunk


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
Files:
5 edited
1 copied

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
  • trunk/ipdb.css

    r782 r818  
    180180
    181181/* some standard width widgets */
     182.w90 {  width: 90%; }
    182183.w70 {  width: 70%; }
    183184.w60 {  width: 60%; }
  • trunk/templates/index2.tmpl

    r815 r818  
    11<br>
     2<table width="100%" cellspacing="0">
     3<TMPL_IF vrflist>
     4<TMPL_LOOP NAME=vrflist>
     5<tr class="heading row0"><td width="20%">
     6<a href="<TMPL_VAR NAME=webpath>/cgi-bin/main.cgi?action=showvrf&amp;vrf=<TMPL_VAR NAME=vrf>"><TMPL_VAR NAME=vrf></a>
     7</td><td width="40%"><TMPL_VAR comment></td>
     8<td>&nbsp;</td>
     9</tr>
     10<tr><td colspan="3">
     11<TMPL_VAR NAME=vrfinfo>
     12</td></tr>
     13<tr><td colspan=3><br><hr class="w90"></td></tr>
     14</TMPL_LOOP>
     15</table>
     16<TMPL_ELSE>
     17<div class="heading">No VRFs defined</div>
     18</TMPL_IF>
     19<TMPL_IF addvrf>
    220<div class="center">
    3 <table class="center altrows" width="98%" cellspacing="0">
    4 <TMPL_IF vrflist>
    5 <tr class="heading">
    6 <td>VRF</td>
    7 <td>Comment</td>
    8 </tr>
    9 <TMPL_LOOP NAME=vrflist>
    10 <tr>
    11 <td><a href="<TMPL_VAR NAME=webpath>/cgi-bin/main.cgi?action=showvrf&amp;vrf=<TMPL_VAR NAME=vrf>"><TMPL_VAR NAME=vrf></a></td>
    12 <td><TMPL_VAR comment></td>
    13 </tr>
    14 </TMPL_LOOP>
    15 <TMPL_ELSE>
    16 <tr class="heading">
    17 <td>No VRFs defined</td>
    18 </tr>
    19 </TMPL_IF>
    20 </table>
    21 <TMPL_IF addvrf>
    2221<br>
    2322<a href="<TMPL_VAR NAME=webpath>/cgi-bin/main.cgi?action=addvrf">Add new VRF</a>
     23</div>
    2424</TMPL_IF>
    25 </div>
  • trunk/templates/showvrf.tmpl

    r815 r818  
    1 <div class="tbltitle">Master netblocks in <TMPL_VAR NAME=vrf></div>
     1<TMPL_UNLESS sub><div class="tbltitle">Master netblocks in <TMPL_VAR NAME=vrf></div></TMPL_UNLESS>
    22
    33<br>
    44<div class="center">
     5<TMPL_IF masterlist>
    56<table class="center altrows" width="98%" cellspacing="0">
    6 <TMPL_IF masterlist>
    77<tr class="heading">
    88<td>Master netblock</td>
     
    2121</tr>
    2222</TMPL_LOOP>
     23</table>
    2324<TMPL_ELSE>
    24 <tr class="heading">
    25 <td>No netblock data</td>
    26 </tr>
     25<hr class="w30">
     26<div class="tbltitle">No netblock data
     27<TMPL_IF maydel>
     28<br>
     29<form action="<TMPL_VAR NAME=webpath>/cgi-bin/main.cgi" method=POST>
     30<fieldset><legend class="noshow">&nbsp;</legend>
     31<input type=hidden name=action value="delete">
     32<input type=hidden name=vrf value="<TMPL_VAR NAME=vrf>">
     33<input type=submit value=" Remove this VRF ">
     34</fieldset>
     35</form>
    2736</TMPL_IF>
    28 </table>
     37</div>
     38</TMPL_IF>
    2939<TMPL_IF addmaster>
    3040<br>
    31 <a href="<TMPL_VAR NAME=webpath>/cgi-bin/main.cgi?action=addmaster&vrf=<TMPL_VAR NAME=vrf>">Add new master block</a>
     41<a href="<TMPL_VAR NAME=webpath>/cgi-bin/main.cgi?action=addmaster&amp;vrf=<TMPL_VAR NAME=vrf>">Add new master block</a>
    3242</TMPL_IF>
    3343</div>
Note: See TracChangeset for help on using the changeset viewer.