message when there are no slivers in a slice
smbaker [Wed, 19 Dec 2012 00:27:56 +0000 (16:27 -0800)]
apps/gacksadmin/user_nodelist.php

index 410f9fa..829ebc8 100644 (file)
@@ -75,40 +75,45 @@ if ($account_name != NULL) {
 
         print "<br><br>";
 
-        $headers=array();
-        $headers["Site Name"] = "string";
-        $headers["Sliver Count"] = "int";
-
-        $table = new PlekitTable("sites", $headers, 0, array("pagesize_area"=>False, "notes_area"=>False, "search_area"=>False));
-        $table->start();
-        foreach ($site_names as $site_id=>$site_name) {
-            $table->row_start();
-            $table->cell($site_name);
-            $table->cell($site_count[$site_id]);
-            $table->row_end();
-        }
-        $table->end();
+        if (count($slice_nodes)==0) {
+            print "This slice currently has no slivers associated with it.<br><br> ";
+            print "Please use the [Add Slivers] link above to add some slivers.";
+        } else {
+            $headers=array();
+            $headers["Site Name"] = "string";
+            $headers["Sliver Count"] = "int";
+
+            $table = new PlekitTable("sites", $headers, 0, array("pagesize_area"=>False, "notes_area"=>False, "search_area"=>False));
+            $table->start();
+            foreach ($site_names as $site_id=>$site_name) {
+                $table->row_start();
+                $table->cell($site_name);
+                $table->cell($site_count[$site_id]);
+                $table->row_end();
+            }
+            $table->end();
 
-        print "<br><center>";
-        print href(l_gacks_nodelist_download($account_name), "Export Node List as CSV");
-        print "</center>";
+            print "<br><center>";
+            print href(l_gacks_nodelist_download($account_name), "Export Node List as CSV");
+            print "</center>";
 
-        $headers=array();
-        $headers["Hostname"] = "string";
-        $headers["Site"] = "string";
+            $headers=array();
+            $headers["Hostname"] = "string";
+            $headers["Site"] = "string";
 
-        $table = new PlekitTable("slivers", $headers, 0);
-        $table->start();
-        foreach ($slice_nodes as $node) {
-            $table->row_start();
-            $table->cell($node["hostname"]);
+            $table = new PlekitTable("slivers", $headers, 0);
+            $table->start();
+            foreach ($slice_nodes as $node) {
+                $table->row_start();
+                $table->cell($node["hostname"]);
 
-            $site_name = $site_names[$node["site_id"]];
-            $table->cell($site_name);
+                $site_name = $site_names[$node["site_id"]];
+                $table->cell($site_name);
 
-            $table->row_end();
+                $table->row_end();
+            }
+            $table->end();
         }
-        $table->end();
     }
 }