Index: /trunk/cgi-bin/IPDB.pm
===================================================================
--- /trunk/cgi-bin/IPDB.pm	(revision 817)
+++ /trunk/cgi-bin/IPDB.pm	(revision 818)
@@ -129,4 +129,7 @@
 # UI layout for subblocks/containers
 our $sublistlayout = 1;
+
+# UI layout for VRF/master blocks
+our $masterswithvrfs = 2;
 
 # VLAN validation mode.  Set to 0 to allow alphanumeric vlan names instead of using the vlan number.
Index: /trunk/cgi-bin/MyIPDB.pm
===================================================================
--- /trunk/cgi-bin/MyIPDB.pm	(revision 817)
+++ /trunk/cgi-bin/MyIPDB.pm	(revision 818)
@@ -78,4 +78,10 @@
 # $IPDB::sublistlayout = 1;
 
+## UI layout for showing VRFs and master blocks
+# 1 lists VRFs on the index page, and master blocks on a subpage to formally separate them
+# 2 is a somehat "lazy" layout that brings sublists of master blocks in each VRF (as well
+#   as the "Add master" link and "Delete this VRF" button) onto the index page grouped by VRF
+#$IPDB::masterswithvrfs = 2;
+
 ## VLAN validation mode
 # Set to 0 to allow alphanumerics and _  .  - (VLAN name instead of number)
Index: /trunk/cgi-bin/main.cgi
===================================================================
--- /trunk/cgi-bin/main.cgi	(revision 817)
+++ /trunk/cgi-bin/main.cgi	(revision 818)
@@ -319,8 +319,27 @@
 sub showSummary {
   my $vrflist = listVRF($ip_dbh);
+
+  if ($IPDB::masterswithvrfs == 2) {
+    $page = HTML::Template->new(filename => "index2.tmpl", loop_context_vars => 1, global_vars => 1,
+	path => @templatepath);
+    # alternate layout;  put master blocks on the front summary page instead of "out"/"down" a
+    # layer in the browse tree
+    my $vrfinfo = HTML::Template->new(filename => "showvrf.tmpl", path => @templatepath);
+    foreach my $vrf (@$vrflist) {
+      my $masterlist = listSummary($ip_dbh, $vrf->{vrf});
+      $vrfinfo->param(vrf => $vrf->{vrf});
+      $vrfinfo->param(masterlist => $masterlist);
+      $vrfinfo->param(addmaster => ($IPDBacl{$authuser} =~ /s/) );
+      $vrfinfo->param(maydel => ($IPDBacl{$authuser} =~ /s/) );
+      $vrfinfo->param(sub => 1);
+      $vrf->{vrfinfo} = $vrfinfo->output;
+    }
+  }
+
   $page->param(vrflist => $vrflist);
 
   # Only systems/network should be allowed to add VRFs - or maybe higher?
   $page->param(addvrf => ($IPDBacl{$authuser} =~ /s/) );
+
 } # showSummary
 
@@ -338,4 +357,5 @@
   $utilbar->param(breadcrumb => \@rcrumbs);
 
+  $page->param(maydel => ($IPDBacl{$authuser} =~ /s/) );
   $page->param(addmaster => ($IPDBacl{$authuser} =~ /s/) );
 } # showVRF
Index: /trunk/ipdb.css
===================================================================
--- /trunk/ipdb.css	(revision 817)
+++ /trunk/ipdb.css	(revision 818)
@@ -180,4 +180,5 @@
 
 /* some standard width widgets */
+.w90 {	width: 90%; }
 .w70 {	width: 70%; }
 .w60 {	width: 60%; }
Index: /trunk/templates/index2.tmpl
===================================================================
--- /trunk/templates/index2.tmpl	(revision 818)
+++ /trunk/templates/index2.tmpl	(revision 818)
@@ -0,0 +1,24 @@
+<br>
+<table width="100%" cellspacing="0">
+<TMPL_IF vrflist>
+<TMPL_LOOP NAME=vrflist>
+<tr class="heading row0"><td width="20%">
+<a href="<TMPL_VAR NAME=webpath>/cgi-bin/main.cgi?action=showvrf&amp;vrf=<TMPL_VAR NAME=vrf>"><TMPL_VAR NAME=vrf></a>
+</td><td width="40%"><TMPL_VAR comment></td>
+<td>&nbsp;</td>
+</tr>
+<tr><td colspan="3">
+<TMPL_VAR NAME=vrfinfo>
+</td></tr>
+<tr><td colspan=3><br><hr class="w90"></td></tr>
+</TMPL_LOOP>
+</table>
+<TMPL_ELSE>
+<div class="heading">No VRFs defined</div>
+</TMPL_IF>
+<TMPL_IF addvrf>
+<div class="center">
+<br>
+<a href="<TMPL_VAR NAME=webpath>/cgi-bin/main.cgi?action=addvrf">Add new VRF</a>
+</div>
+</TMPL_IF>
Index: /trunk/templates/showvrf.tmpl
===================================================================
--- /trunk/templates/showvrf.tmpl	(revision 817)
+++ /trunk/templates/showvrf.tmpl	(revision 818)
@@ -1,8 +1,8 @@
-<div class="tbltitle">Master netblocks in <TMPL_VAR NAME=vrf></div>
+<TMPL_UNLESS sub><div class="tbltitle">Master netblocks in <TMPL_VAR NAME=vrf></div></TMPL_UNLESS>
 
 <br>
 <div class="center">
+<TMPL_IF masterlist>
 <table class="center altrows" width="98%" cellspacing="0">
-<TMPL_IF masterlist>
 <tr class="heading">
 <td>Master netblock</td>
@@ -21,13 +21,23 @@
 </tr>
 </TMPL_LOOP>
+</table>
 <TMPL_ELSE>
-<tr class="heading">
-<td>No netblock data</td>
-</tr>
+<hr class="w30">
+<div class="tbltitle">No netblock data
+<TMPL_IF maydel>
+<br>
+<form action="<TMPL_VAR NAME=webpath>/cgi-bin/main.cgi" method=POST>
+<fieldset><legend class="noshow">&nbsp;</legend>
+<input type=hidden name=action value="delete">
+<input type=hidden name=vrf value="<TMPL_VAR NAME=vrf>">
+<input type=submit value=" Remove this VRF ">
+</fieldset>
+</form>
 </TMPL_IF>
-</table>
+</div>
+</TMPL_IF>
 <TMPL_IF addmaster>
 <br>
-<a href="<TMPL_VAR NAME=webpath>/cgi-bin/main.cgi?action=addmaster&vrf=<TMPL_VAR NAME=vrf>">Add new master block</a>
+<a href="<TMPL_VAR NAME=webpath>/cgi-bin/main.cgi?action=addmaster&amp;vrf=<TMPL_VAR NAME=vrf>">Add new master block</a>
 </TMPL_IF>
 </div>
