Index: /trunk/ippMonitor/raw/czartool_labels.php
===================================================================
--- /trunk/ippMonitor/raw/czartool_labels.php	(revision 31891)
+++ /trunk/ippMonitor/raw/czartool_labels.php	(revision 31892)
@@ -46,4 +46,5 @@
 $menu = $ID['menu'];
 
+$selectedMode = $_GET[mode];
 $selectedStage = $_GET[stage];
 $selectedLabel = $_GET[label];
@@ -55,5 +56,9 @@
 $allServerCmd = $_GET[allservercmd];
 
-if ($selectedLabel == "") { $selectedLabel = "all_stdscience_labels"; }
+$headerColor = "#0080c0";
+$columnHeaderColor = "lavender";
+
+if ($selectedMode == "") { $selectedMode = "stdscience"; }
+if ($selectedLabel == "") { $selectedLabel = "all"; }
 if ($selectedStage == "") { $selectedStage = "all_stages"; }
 if ($plotType == "") { $plotType = "linear"; }
@@ -73,9 +78,9 @@
 
 $debug = 0;
-
-$stdsLabels = getLabels($czardb, "stdscience");
+$table = "<table bgcolor=\"#FFFFFF\" width=\"700\" align=\"middle\" border=\"1\" cellspacing=\"0\" cellpadding=\"4\" style=\"font-size:80%\">\n";
+
+$labels = getLabels($czardb, $selectedMode);
 $distLabels = getLabels($czardb, "distribution");
 $pubLabels = getLabels($czardb, "publishing");
-$updateLabels = getLabels($czardb, "update");
 
 if ($debug) {
@@ -86,4 +91,9 @@
 }
 
+$isUpdate = ($selectedMode == "update");
+$modeText = $isUpdate ? "Showing update processing" : "Showing standard processing";
+$modeLinkText = $isUpdate ? "standard" : "update";
+$modeLink = $isUpdate ? "stdscience" : "update";
+$link = "czartool_labels.php?pass=".$pass."&proj=".$proj."&mode=".$modeLink."&label=all&stage=" . $selectedStage . "&revertstage=" . $stage . "&plottype=$plotType";
 
 // set up the form
@@ -98,29 +108,35 @@
 
 echo "<tr>";
-echo "<td colspan=\"2\" style=\"background-color:#0080c0;\">";
+echo "<td colspan=\"3\" style=\"background-color:#0080c0;\">";
 echo "<h1 align=\"middle\">Czartool</h1>";
+echo "<h4 align=\"middle\">$modeText (change to <a href=\"$link\"><font color=\"blue\">$modeLinkText</font></a>)</h4>";
 echo "</td>";
 echo "</tr>";
 
 echo "<tr valign=\"top\">";
-echo "<td style=\"background-color:#EEEEEE;width:100px;text-align:top;\">";
+echo "<td style=width:100px;text-align:top;\">";
  # time series plot
- echo "<img src=\"czartool_getplot.php?type=t&label=$selectedLabel&stage=$selectedStage&plottype=$plotType\"><br>";
+echo "<br>";
+ echo "<img src=\"czartool_getplot.php?mode=$selectedMode&type=t&label=$selectedLabel&stage=$selectedStage&plottype=$plotType\"><br>";
  # rate time series plot
- echo "<img src=\"czartool_getplot.php?type=rt&label=$selectedLabel&stage=$selectedStage&plottype=linear\"><br>";
+echo "<br>";
+ echo "<img src=\"czartool_getplot.php?mode=$selectedMode&type=rt&label=$selectedLabel&stage=$selectedStage&plottype=linear\"><br>";
  # rate stacked histo plot
- echo "<img src=\"czartool_getplot.php?type=rh&label=$selectedLabel&stage=$selectedStage&plottype=linear\"><br>";
+ #echo "<img src=\"czartool_getplot.php?mode=$selectedMode&type=rh&label=$selectedLabel&stage=$selectedStage&plottype=linear\"><br>";
  # histogram plot
- echo "<img src=\"czartool_getplot.php?type=h&label=$selectedLabel&stage=$selectedStage&plottype=linear\"><br>";
+ #echo "<img src=\"czartool_getplot.php?mode=$selectedMode&type=h&label=$selectedLabel&stage=$selectedStage&plottype=linear\"><br>";
+ # storage plot
+echo "<br>";
+ echo "<img src=\"czartool_getplot.php?type=s\"><br>";
  # storage timeseries
- echo "<img src=\"czartool_getplot.php?type=st\"><br>";
- # storage plot
- echo "<img src=\"czartool_getplot.php?type=s\"><br>";
+ #echo "<img src=\"czartool_getplot.php?type=st\"><br>";
  # pantasks server status, if requested
+echo "<br>";
  if ($selectedServer && !$serverCmd) showServerStatus($selectedServer);
 echo "</td>";
-echo "<td style=\"background-color:#EEEEEE;height:200px;width:400px;text-align:top;\">";
-
-echo "<br><br>";
+echo "<td style=height:200px;width:10px;text-align:top;\">";
+echo "<td style=height:200px;width:400px;text-align:top;\">";
+
+#echo "<br>";
 
 // status table at top
@@ -128,5 +144,8 @@
 $plotTypeLink = ($plotType == "linear") ? "log" : "linear";
 $link = "czartool_labels.php?pass=" . $pass . "&proj=" . $proj . "&label=" . $selectedLabel . "&stage=" . $selectedStage . "&revertstage=" . $stage . "&plottype=$plotTypeLink";
-echo "<table align=\"middle\" border=\"1\" cellspacing=\"0\" cellpadding=\"4\" style=\"font-size:80%\">\n";
+echo "<br>";
+echo $table;
+#"<table width=\"$width\" align=\"middle\" border=\"1\" cellspacing=\"0\" cellpadding=\"4\" style=\"font-size:80%\">\n";
+createTableTitle("Status and links", 3);
 echo "<tr>\n";
 echo "<tr><td>Time of last update</td><td>$lastUpdateTime</td></tr>";
@@ -140,13 +159,19 @@
 echo "<tr><td>Czar log pages</td><td><a href=\"http://svn.pan-starrs.ifa.hawaii.edu/trac/ipp/wiki/PS1_IPP_CzarLogs\"><font color=\"blue\">here</font></a></td></tr>";
 echo "<tr><td>Exposure summary</td><td><a href=\"czartool_exposures.php?pass=$pass&proj=$proj\"><font color=\"blue\">here</font></a></td></tr>";
+
+$plotTypeLink = ($plotType == "linear") ? "log" : "linear";
+$link = "czartool_labels.php?pass=" . $pass . "&proj=" . $proj . "&mode=" . $selectedMode . "&label=" . $selectedLabel . "&stage=" . $selectedStage . "&revertstage=" . $stage . "&plottype=$plotTypeLink";
+echo "<tr><td>Plot type</td><td><a href=\"$link\"><font color=\"blue\">Change to $plotTypeLink</font></a></td></tr>";
+
+
 echo "</table>\n";
 
-echo "<br><br>";
+echo "<br>";
 
        createLabelsTable($pass, 
          $proj, 
          $czardb, 
-         "stdscience", 
-         $stdsLabels, 
+         $selectedMode, 
+         $labels, 
          $distLabels, 
          $pubLabels, 
@@ -158,34 +183,20 @@
          $plotType);
 
-echo "<br><br>";
-      createLabelsTable($pass, 
-         $proj, 
-         $czardb, 
-         "update", 
-         $updateLabels, 
-         $distLabels, 
-         $pubLabels, 
-         $stages, 
-         $states, 
-         "new", 
-         $selectedLabel, 
-         $selectedStage, 
-         $plotType);
-echo "<br><br>";
-      createServersTable($pass, $proj,$czardb, $servers, $selectedLabel, $selectedStage, $plotType);
-echo "<br><br>";
+if ($selectedMode == "update") {echo "<br>"; createPStampDataTable();}
+echo "<br>";
+      createServersTable($pass, $proj,$selectedMode,$czardb, $servers, $selectedLabel, $selectedStage, $plotType);
+echo "<br>";
       createSummitDataTable($gpc1db);
-echo "<br><br>";
+echo "<br>";
       createDatesTable($czardb);
-echo "<br><br>";
-      createPStampDataTable();
-echo "<br><br>";
+echo "<br>";
       # This is awful
-      echo "<table align=\"middle\" border=\"1\" cellspacing=\"0\" cellpadding=\"4\" style=\"font-size:80%\">\n";
+      echo $table;
       echo "<tr>";
-      echo "<th colspan=\"2\">Database replication status (update fix log <a href=\"http://svn.pan-starrs.ifa.hawaii.edu/trac/ipp/wiki/Replication_Issues\">here</a>)</th>";
+      createTableTitle("Database replication status (update fix log <a href=\"http://svn.pan-starrs.ifa.hawaii.edu/trac/ipp/wiki/Replication_Issues\">here</a>)", 2);
+#      echo "<th colspan=\"2\"><h2>Database replication status (update fix log <a href=\"http://svn.pan-starrs.ifa.hawaii.edu/trac/ipp/wiki/Replication_Issues\">here</a>)</h2></th>";
       echo "<tr>";
-      echo "<th>Database</th>";
-      echo "<th>Status</th>";
+      createTableColumnHeader("Database");
+      createTableColumnHeader("Status");
       showReplicationsStatus($REPL_HOST_GPC1, $REPL_USER_GPC1, $REPL_PASSWORD_GPC1, $REPL_DBNAME_GPC1);
       showReplicationsStatus($REPL_HOST_NEBULOUS, $REPL_USER_NEBULOUS, $REPL_PASSWORD_NEBULOUS, $REPL_DBNAME_NEBULOUS);
@@ -217,11 +228,14 @@
 
     // set up the table
-    echo "<table align=\"middle\" border=\"1\" cellspacing=\"0\" cellpadding=\"4\" style=\"font-size:80%\">\n";
+    global $table;
+    echo $table;
+
+    #echo "<table width=\"$width\" align=\"middle\" border=\"1\" cellspacing=\"0\" cellpadding=\"4\" style=\"font-size:80%\">\n";
     echo "<tr>";
-    echo "<th colspan=\"3\">Postage stamp requests</th>";
+    createTableTitle("Postage stamp requests", 3);
     echo "<tr>";
-    echo "<th>Label</th>";
-    echo "<th>Unfinished jobs</th>";
-    echo "<th>Priority</th>";
+    createTableColumnHeader("Label");
+    createTableColumnHeader("Unfinished jobs");
+    createTableColumnHeader("Priority");
 
     // list the results
@@ -259,11 +273,12 @@
 
     // set up the table
-    echo "<table align=\"middle\" border=\"1\" cellspacing=\"0\" cellpadding=\"4\" style=\"font-size:80%\">\n";
+    global $table;
+    echo $table;
     echo "<tr>";
-    echo "<th colspan=\"3\">Status of last night's data</th>";
+    createTableTitle("Status of last night's data", 3);
     echo "<tr>";
-    echo "<th>Exposure type</th>";
-    echo "<th>At summit</th>";
-    echo "<th>Registered at MHPCC</th>";
+    createTableColumnHeader("Exposure type");
+    createTableColumnHeader("At summit");
+    createTableColumnHeader("Registered at MHPCC");
 
     $msg = "No science images taken since $date";
@@ -281,26 +296,15 @@
         echo "<tr>";
 
-        if ($summit[0] == $mhpcc[0]) {
-
-            if ($expType[0] == "OBJECT") $msg = "All science exposures taken since $date<br>have been registered at MHPCC";
-            $error = 0;
-        }
-        else {
-            if ($expType[0] == "OBJECT") $msg = "<font color=\"red\">Warning: Not all science exposures taken since $date<br>have been registered at MHPCC</a>";
-            $error = 1;
-        }
+        if ($summit[0] == $mhpcc[0]) $error = 0;
+        else $error = 1;
 
         echo "<td>$expType[0]</td>";
         echo "<td>$summit[0]</td>";
         
-
-
-        #echo "<td bgcolor=\"$color\">$mhpcc[0]</td>";
-        createFormattedTableCell("", "", $mhpcc[0], $error);
+        createFormattedTableCell("", "", $mhpcc[0], $error, 0);
 
         echo "</tr>";
     }
 
-    echo "<td colspan=\"3\">$msg</td>";
     echo "</table>\n";
 
@@ -337,5 +341,5 @@
         $proj, 
         $db, 
-        $server, 
+        $selectedMode, 
         $labels, 
         $distLabels, 
@@ -346,60 +350,23 @@
         $selectedLabel, $selectedStage, $plotType) {
 
+    $isUpdate = ($selectedMode == "update");
+    global $headerColor;
+    global $columnHeaderColor;
+
     // setup table
-    echo "<table align=\"middle\" border=\"1\" cellspacing=\"0\" cellpadding=\"4\" style=\"font-size:80%\">\n";
+    global $table;
+    echo $table;
+    createTableTitle("Label status", 13);
+
     echo "<tr>\n";
-    echo "<th colspan=\"13\">";
-    
     $link = "czartool_labels.php?pass=".$pass
         ."&proj=".$proj
+        ."&mode=".$selectedMode
         ."&label=".$selectedLabel
         ."&stage=all_stages"
         ."&plottype=".$plotType;
-    if ($selectedStage != "all_stages") echo "<a href=\"$link\"><font color=\"blue\">";
-    else echo "<a><font color=\"black\">";
-    echo "Plot all stages</font></a> | ";
-    $link = "czartool_labels.php?pass=" . $pass . "&proj=" . $proj . "&label=all_".$server."_labels&stage=".$selectedStage."&plottype=".$plotType;
-    echo "<a ";
-    if ($selectedLabel != "all_".$server."_labels") echo "<a href=\"$link\"><font color=\"blue\">";
-    else echo "<a><font color=\"black\">";
-    echo "Plot all ".$server."_labels</a> | ";
-    $plotTypeLink = ($plotType == "linear") ? "log" : "linear";
-    $plotTypeText = ($plotType == "linear") ? "Use log plots" : "Use linear plots";
-    $link = "czartool_labels.php?pass=" . $pass . "&proj=" . $proj . "&label=" . $selectedLabel . "&stage=" . $selectedStage . "&revertstage=" . $stage . "&plottype=$plotTypeLink";
-    echo "<a href=\"$link\"><font color=\"blue\">$plotTypeText</font></a>";
-
-
-    echo "</th>";
-    echo "</tr>\n";
-
-    echo "<tr>\n";
-    //echo "<th></th>";
-    echo "<th colspan=\"2\">$server server</th>";
-    echo "<th>Reverts:</th>";
-
-    foreach ($stages as &$stage) {
-
-        if ($stage == "burntool") continue;
-        $reverting = getRevertStatus($db, $stage);
-        $link = 
-            "czartool_labels.php?pass=".$pass
-            ."&proj=".$proj
-            ."&label=".$selectedLabel
-            ."&stage=".$selectedStage
-            ."&plottype=".$plotType
-            ."&revertstage=".$stage
-            ."&revertmode=";
-
-        if(!$reverting) {$label =  "Start";$link = $link . "on";}
-        if($reverting) {$label = "Stop";$link = $link . "off";}
-        unset($reverting);
-        echo "<td><a href=\"$link\"><font color=\"blue\">$label</font></td>";
-
-    }
-
-    echo "</tr>\n";
-    echo "<tr>\n";
-    //echo "<th> </th>";
-    echo "<th colspan=\"2\">Label (in order of priority)</th>";
+    createFormattedTableCell(($selectedStage != "all_stages"), $link, "All stages", 0, "$columnHeaderColor");
+
+    #echo "<th>Label (in order of priority)</th>";
     foreach ($stages as &$stage) {
 
@@ -409,11 +376,12 @@
             "czartool_labels.php?pass=".$pass
             ."&proj=".$proj 
+            ."&mode=" .$selectedMode
             ."&label=".$selectedLabel
             ."&stage=".$stage
             ."&plottype=".$plotType;
 
-        createFormattedTableCell($showLink, $link, $stage, 0);
-    }
-
+        createFormattedTableCell($showLink, $link, $stage, 0, "$columnHeaderColor");
+#        createTableColumnHeader("Dates");
+    }
 
     // setup default link
@@ -421,4 +389,5 @@
         "czartool_labels.php?pass=".$pass
         ."&proj=".$proj
+        ."&mode=" .$selectedMode
         ."&label=".$selectedLabel
         ."&stage=".$selectedStage
@@ -426,5 +395,5 @@
 
     $searchState = "new";
-    if ($server == "update") $searchState = "update";
+    if ($selectedMode == "update") $searchState = "update";
 
     // write rows
@@ -444,8 +413,4 @@
         // show distribution/publishing status
         echo "<tr>\n";
-        $distPub = "&nbsp;";
-        if ($distributing) $distPub = "D";
-        if ($publishing) $distPub = $distPub . "P";
-        echo "<td>$distPub</td>";
 
         // create link to label summary page for each label
@@ -455,8 +420,9 @@
             "czartool_labels.php?pass=".$pass
             ."&proj=".$proj
+            ."&mode=" .$selectedMode
             ."&label=".$thisLabel
             ."&stage=".$selectedStage
             ."&plottype=".$plotType;
-        createFormattedTableCell($showLink, $link, $thisLabel, 0);
+        createFormattedTableCell($showLink, $link, $thisLabel, 0, null);
 
         $str = "";
@@ -465,52 +431,81 @@
         $link = $defaultlink;
         getStateAndFaults($db, $thisLabel, $selectedState, "burntool", $str, $anyFaults);
-        createFormattedTableCell($anyFaults, $link, $str, $anyFaults);
+        createFormattedTableCell($anyFaults, $link, $str, $anyFaults, 0);
 
         $link = "failedChipProcessedImfile.php?pass=" . $pass . "&proj=" . $proj . "&chipRun.label=" . $thisLabel . "&chipRun.state=".$searchState;
         getStateAndFaults($db, $thisLabel, $selectedState, "chip", $str, $anyFaults);
-        createFormattedTableCell($anyFaults, $link, $str, $anyFaults);
+        createFormattedTableCell($anyFaults, $link, $str, $anyFaults, 0);
 
         $link = "failedCamProcessedExp.php?pass=" . $pass . "&proj=" . $proj . "&camRun.label=" . $thisLabel . "&camRun.state=".$searchState;
         getStateAndFaults($db, $thisLabel, $selectedState, "cam", $str, $anyFaults);
-        createFormattedTableCell($anyFaults, $link, $str, $anyFaults);
+        createFormattedTableCell($anyFaults, $link, $str, $anyFaults, 0);
 
         $link =  "failedFakeProcessedImfile.php?pass=" . $pass . "&proj=" . $proj . "&fakeRun.label=" . $thisLabel . "&fakeRun.state=".$searchState;
         getStateAndFaults($db, $thisLabel, $selectedState, "fake", $str, $anyFaults);
-        createFormattedTableCell($anyFaults, $link, $str, $anyFaults);
+        createFormattedTableCell($anyFaults, $link, $str, $anyFaults, 0);
 
         $link = "failedWarpSkyfiles.php?pass=" . $pass . "&proj=" . $proj . "&warpRun.label=" . $thisLabel . "&warpRun.state=".$searchState;
         getStateAndFaults($db, $thisLabel, $selectedState, "warp", $str, $anyFaults);
-        createFormattedTableCell($anyFaults, $link, $str, $anyFaults);
+        createFormattedTableCell($anyFaults, $link, $str, $anyFaults, 0);
 
         $link = "failedStackSkyfile.php?pass=" . $pass . "&proj=" . $proj . "&stackRun.label=" . $thisLabel . "&stackRun.state=".$searchState;
         getStateAndFaults($db, $thisLabel, $selectedState, "stack", $str, $anyFaults);
-        createFormattedTableCell($anyFaults, $link, $str, $anyFaults);
+        createFormattedTableCell($anyFaults, $link, $str, $anyFaults, 0);
 
         $link = "failedDiffSkyfile.php?pass=" . $pass . "&proj=" . $proj . "&diffRun.label=" . $thisLabel . "&diffRun.state=".$searchState;
         getStateAndFaults($db, $thisLabel, $selectedState, "diff", $str, $anyFaults);
-        createFormattedTableCell($anyFaults, $link, $str, $anyFaults);
+        createFormattedTableCell($anyFaults, $link, $str, $anyFaults, 0);
 
         $link = $defaultlink;
         getStateAndFaults($db, $thisLabel, $selectedState, "magic", $str, $anyFaults);
-        createFormattedTableCell($anyFaults, $link, $str, $anyFaults);
+        createFormattedTableCell($anyFaults, $link, $str, $anyFaults, (!$isUpdate && !$distributing) ? "gray" : null);
 
         $link = $defaultlink;
         getStateAndFaults($db, $thisLabel, $selectedState, "magicDS", $str, $anyFaults);
-        createFormattedTableCell($anyFaults, $link, $str, $anyFaults);
+        createFormattedTableCell($anyFaults, $link, $str, $anyFaults, (!$isUpdate && !$distributing) ? "gray" : null);
 
         $link = $defaultlink;
         getStateAndFaults($db, $thisLabel, $selectedState, "dist", $str, $anyFaults);
-        createFormattedTableCell($anyFaults, $link, $str, $anyFaults);
+        createFormattedTableCell($anyFaults, $link, $str, $anyFaults, (!$isUpdate && !$distributing) ? "gray" : null);
 
         $link = "publishDone.php?pass=" . $pass . "&proj=" . $proj . "&publishRun.label=" . $thisLabel . "&publishRun.state=".$searchState;
         getStateAndFaults($db, $thisLabel, $selectedState, "pub", $str, $anyFaults);
-        createFormattedTableCell($anyFaults, $link, $str, $anyFaults);
+        createFormattedTableCell($anyFaults, $link, $str, $anyFaults, (!$isUpdate && !$publishing) ? "gray" : null);
 
         echo "</tr>\n";
     }
 
-    if ($selectedLabel == "all_".$server."_labels") $showLink = 0;
+    echo "<tr>\n";
+    $link = "czartool_labels.php?pass=" . $pass . "&proj=" . $proj . "&mode=" . $selectedMode . "&label=all&stage=".$selectedStage."&plottype=".$plotType;
+    createFormattedTableCell(($selectedLabel != "all"), $link, "All labels", 0, null);
+
+    createFormattedTableCell(0, null, "Reverts:", 0, "$columnHeaderColor");
+
+    foreach ($stages as &$stage) {
+
+        if ($stage == "burntool") continue;
+        $reverting = getRevertStatus($db, $stage);
+        $link = 
+            "czartool_labels.php?pass=".$pass
+            ."&proj=".$proj
+            ."&mode=" .$selectedMode
+            ."&label=".$selectedLabel
+            ."&stage=".$selectedStage
+            ."&plottype=".$plotType
+            ."&revertstage=".$stage
+            ."&revertmode=";
+
+        if(!$reverting) {$label =  "Start";$link = $link . "on";}
+        if($reverting) {$label = "Stop";$link = $link . "off";}
+        unset($reverting);
+        createFormattedTableCell(1, $link, $label, 0, "$columnHeaderColor");
+        #echo "<td><a href=\"$link\"><font color=\"blue\">$label</font></td>";
+
+    }
+
+    echo "</tr>\n";
+    if ($selectedLabel == "all") $showLink = 0;
     else  $showLink = 1;
-    $link = "czartool_labels.php?pass=" . $pass . "&proj=" . $proj . "&label=all_".$server."_labels&stage=".$selectedStage."&plottype=".$plotType;
+    $link = "czartool_labels.php?pass=".$pass."&proj=".$proj."&mode=".$selectedMode."&label=all&stage=".$selectedStage."&plottype=".$plotType;
 
     echo "</tr>\n";
@@ -521,12 +516,35 @@
 ###########################################################################
 #
+# Creates a table title
+#
+###########################################################################
+function createTableTitle($str, $colSpan) {
+
+    global $headerColor;
+    echo "<th colspan=\"$colSpan\"bgcolor=\"$headerColor\"><h2>$str</h2></th>";
+}
+
+###########################################################################
+#
+# Creates a table header cell
+#
+###########################################################################
+function createTableColumnHeader($str) {
+
+    global $columnHeaderColor;
+    echo "<th bgcolor=\"$columnHeaderColor\"><h3>$str</h3></th>";
+}
+
+###########################################################################
+#
 # Creates table cell with a red background if an error
 #
 ###########################################################################
-function createFormattedTableCell($showLink, $link, $str, $error) {
+function createFormattedTableCell($showLink, $link, $str, $error, $color) {
 
     $fontColor = $error ? "black" : "blue";
 
     if ($error) echo "<td bgcolor=\"red\">";
+    else if ($color) echo "<td bgcolor=\"$color\">";
     else  echo "<td>";
     if ($showLink) echo "<a href=\"$link\"><font color=\"$fontColor\">$str</font></td>";
@@ -640,10 +658,11 @@
 function createDatesTable($db) {
 
-    echo "<table align=\"middle\" border=\"1\" cellspacing=\"0\" cellpadding=\"4\" style=\"font-size:80%\">\n";
+    global $table;
+    echo $table;
     echo "<tr>\n";
-    echo "<th colspan=\"3\">Current dates for selected pantasks servers</th>";
+    createTableTitle("Current dates for selected pantasks servers", 3);
     echo "<tr>\n";
-    echo "<th>Server</th>";
-    echo "<th>Dates</th>";
+    createTableColumnHeader("Server");
+    createTableColumnHeader("Dates");
     echo "</tr>\n";
 
@@ -691,14 +710,15 @@
 #
 ###########################################################################
-function createServersTable($pass, $proj, $db, $servers, $selectedLabel, $selectedStage, $plotType) {
+function createServersTable($pass, $proj, $selectedMode, $db, $servers, $selectedLabel, $selectedStage, $plotType) {
 
     // set up table columns
-    echo "<table align=\"middle\" border=\"1\" cellspacing=\"0\" cellpadding=\"4\" style=\"font-size:80%\">\n";
+    global $table;
+    echo $table;
     echo "<tr>";
-    echo "<th colspan=\"3\">Pantasks server status</th>";
+    createTableTitle("Pantasks server status", 3);
     echo "<tr>";
-    echo "<th>Server</th>";
-    echo "<th>Alive?</th>";
-    echo "<th>Running?</th>";
+    createTableColumnHeader("Server");
+    createTableColumnHeader("Alive?");
+    createTableColumnHeader("Running?");
 
     //write_header_cell($class, "Server");
@@ -731,4 +751,5 @@
         $link = "czartool_labels.php?pass=".$pass
             ."&proj=".$proj
+            ."&mode=".$selectedMode
             ."&server=".$server
             ."&label=".$selectedLabel
@@ -740,7 +761,7 @@
         //write_table_cell($class, '%s', "", $alive ? "yes" : "NO");
         //echo "<td>$server</td>";
-        createFormattedTableCell(1, $link, $server, 0);
-        createFormattedTableCell(0, "", $alive ? "yes" : "NO", !$alive);
-        createFormattedTableCell(0, "", $running ? "yes" : "NO", !$running);
+        createFormattedTableCell(1, $link, $server, 0, 0);
+        createFormattedTableCell(0, "", $alive ? "yes" : "NO", !$alive, 0);
+        createFormattedTableCell(0, "", $running ? "yes" : "NO", !$running, 0);
 
         //if ($alive) {
