Index: branches/czw_branch/20100519/ippMonitor/Makefile.in
===================================================================
--- branches/czw_branch/20100519/ippMonitor/Makefile.in	(revision 28044)
+++ branches/czw_branch/20100519/ippMonitor/Makefile.in	(revision 28304)
@@ -14,7 +14,7 @@
 PROGRAMS = \
 $(DESTBIN)/skyplot.dvo \
-$(DESTBIN)/getLabels.pl \
-$(DESTBIN)/checkServer.pl \
-$(DESTBIN)/getServerStatus.pl
+$(DESTBIN)/czartool_getLabels.pl \
+$(DESTBIN)/czartool_checkServer.pl \
+$(DESTBIN)/czartool_getServerStatus.pl
 
 RAWSRC = \
@@ -47,5 +47,7 @@
 $(DESTWWW)/skyplot.php \
 $(DESTWWW)/getimage.php \
-$(DESTWWW)/czartool.php \
+$(DESTWWW)/ipp.czartool.dat \
+$(DESTWWW)/czartool_labels.php \
+$(DESTWWW)/czartool_servers.php \
 
 
@@ -140,4 +142,9 @@
 $(DESTWWW)/stackProcessedSkyfile_Images.php \
 $(DESTWWW)/stackFailedSkyfile.php \
+$(DESTWWW)/staticskyRun.php \
+$(DESTWWW)/staticskySummary.php \
+$(DESTWWW)/staticskyInputSkyfile.php \
+$(DESTWWW)/staticskyProcessedSkyfile.php \
+$(DESTWWW)/staticskyFailedSkyfile.php \
 $(DESTWWW)/magicRun.php \
 $(DESTWWW)/magicSummary.php \
Index: branches/czw_branch/20100519/ippMonitor/def/staticskyFailedSkyfile.d
===================================================================
--- branches/czw_branch/20100519/ippMonitor/def/staticskyFailedSkyfile.d	(revision 28304)
+++ branches/czw_branch/20100519/ippMonitor/def/staticskyFailedSkyfile.d	(revision 28304)
@@ -0,0 +1,26 @@
+TABLE staticskyInput, staticskyRun, stackRun, staticskyResult
+TITLE Static Sky Processed 
+FILE  staticskyFailedSkyfile.php
+MENU  ipp.stack.dat
+
+WHERE staticskyRun.sky_id = staticskyInput.sky_id
+WHERE staticskyInput.stack_id = stackRun.stack_id
+WHERE staticskyInput.sky_id = staticskyResult.sky_id
+WHERE staticskyResult.fault != 0
+
+#        field                          size  format  name           show     link to         extras
+FIELD staticskyRun.sky_id,          5, %s,     Sky ID
+FIELD staticskyRun.label,    	    7, %s,     Label
+FIELD staticskyRun.state,    	    7, %s,     State
+FIELD stackRun.stack_id,            5, %s,     Stack ID
+FIELD stackRun.skycell_id,          5, %s,     Skycell ID
+FIELD stackRun.tess_id,             5, %s,     Tess ID
+FIELD stackRun.filter,              5, %s,     Filter 
+FIELD stackRun.label,               5, %s,     Stack Label
+FIELD staticskyRun.data_group, 	    7, %s,     data grp
+FIELD staticskyRun.dist_group, 	    7, %s,     dist grp
+FIELD staticskyResult.dtime_phot,   7, %.2f,   t(phot)
+FIELD staticskyResult.dtime_script, 7, %.2f,   t(script)
+FIELD staticskyResult.sources,      7, %d,     n(sources)
+FIELD staticskyResult.fault,        7, %d,     fault
+FIELD staticskyResult.quality,      7, %d,     quality
Index: branches/czw_branch/20100519/ippMonitor/def/staticskyInputSkyfile.d
===================================================================
--- branches/czw_branch/20100519/ippMonitor/def/staticskyInputSkyfile.d	(revision 28304)
+++ branches/czw_branch/20100519/ippMonitor/def/staticskyInputSkyfile.d	(revision 28304)
@@ -0,0 +1,19 @@
+TABLE staticskyInput, staticskyRun, stackRun
+TITLE Static Sky Input Exposures
+FILE  staticskyInputSkyfile.php
+MENU  ipp.stack.dat
+
+WHERE staticskyRun.sky_id = staticskyInput.sky_id
+WHERE staticskyInput.stack_id = stackRun.stack_id
+
+#        field                          size  format  name           show     link to         extras
+FIELD staticskyRun.sky_id,          5, %s,     Sky ID
+FIELD staticskyRun.label,    	    7, %s,     Label
+FIELD staticskyRun.state,    	    7, %s,     State
+FIELD stackRun.stack_id,            5, %s,     Stack ID
+FIELD stackRun.skycell_id,          5, %s,     Skycell ID
+FIELD stackRun.tess_id,             5, %s,     Tess ID
+FIELD stackRun.filter,              5, %s,     Filter 
+FIELD stackRun.label,               5, %s,     Stack Label
+FIELD staticskyRun.data_group, 	    7, %s,     data grp
+FIELD staticskyRun.dist_group, 	    7, %s,     dist grp
Index: branches/czw_branch/20100519/ippMonitor/def/staticskyProcessedSkyfile.d
===================================================================
--- branches/czw_branch/20100519/ippMonitor/def/staticskyProcessedSkyfile.d	(revision 28304)
+++ branches/czw_branch/20100519/ippMonitor/def/staticskyProcessedSkyfile.d	(revision 28304)
@@ -0,0 +1,25 @@
+TABLE staticskyInput, staticskyRun, stackRun, staticskyResult
+TITLE Static Sky Processed 
+FILE  staticskyProcessedSkyfile.php
+MENU  ipp.stack.dat
+
+WHERE staticskyRun.sky_id = staticskyInput.sky_id
+WHERE staticskyInput.stack_id = stackRun.stack_id
+WHERE staticskyInput.sky_id = staticskyResult.sky_id
+
+#        field                          size  format  name           show     link to         extras
+FIELD staticskyRun.sky_id,          5, %s,     Sky ID
+FIELD staticskyRun.label,    	    7, %s,     Label
+FIELD staticskyRun.state,    	    7, %s,     State
+FIELD stackRun.stack_id,            5, %s,     Stack ID
+FIELD stackRun.skycell_id,          5, %s,     Skycell ID
+FIELD stackRun.tess_id,             5, %s,     Tess ID
+FIELD stackRun.filter,              5, %s,     Filter 
+FIELD stackRun.label,               5, %s,     Stack Label
+FIELD staticskyRun.data_group, 	    7, %s,     data grp
+FIELD staticskyRun.dist_group, 	    7, %s,     dist grp
+FIELD staticskyResult.dtime_phot,   7, %.2f,   t(phot)
+FIELD staticskyResult.dtime_script, 7, %.2f,   t(script)
+FIELD staticskyResult.sources,      7, %d,     n(sources)
+FIELD staticskyResult.fault,        7, %d,     fault
+FIELD staticskyResult.quality,      7, %d,     quality
Index: branches/czw_branch/20100519/ippMonitor/def/staticskyRun.d
===================================================================
--- branches/czw_branch/20100519/ippMonitor/def/staticskyRun.d	(revision 28304)
+++ branches/czw_branch/20100519/ippMonitor/def/staticskyRun.d	(revision 28304)
@@ -0,0 +1,15 @@
+TABLE staticskyRun
+TITLE staticskyRun
+FILE  staticskyRun.php
+MENU  ipp.stack.dat
+
+#        field          size  format  name           show     link to         extras
+FIELD    sky_id,	 5,   %s,     Sky ID
+# FIELD    skycell_id,	 5,   %s,     Skycell ID
+FIELD    label,	 	 5,   %s,     Label
+FIELD    data_group, 	 5,   %s,     Data grp
+FIELD    dist_group,	 5,   %s,     Dist grp
+FIELD    state,		 5,   %s,     State
+
+#FIELD    registered,	 5,   %s,     time registered
+#FIELD    workdir,	10,   %s,     workdir
Index: branches/czw_branch/20100519/ippMonitor/def/staticskySummary.d
===================================================================
--- branches/czw_branch/20100519/ippMonitor/def/staticskySummary.d	(revision 28304)
+++ branches/czw_branch/20100519/ippMonitor/def/staticskySummary.d	(revision 28304)
@@ -0,0 +1,16 @@
+TABLE staticskyRun
+TITLE Static Sky Summary
+FILE  staticskySummary.php
+MENU  ipp.stack.dat
+
+#     field           size  format  name         show    link to         extras
+FIELD label,    	 15, %s,    label
+FIELD data_group,        10, %s,    data_group
+FIELD workdir,    	 7, %s,     workdir
+FIELD state,    	 7, %s,     state
+FIELD count(state) as n, 7, %d,     count
+
+MODE  summary
+GROUP state
+GROUP label
+GROUP workdir
Index: branches/czw_branch/20100519/ippMonitor/raw/czartool.php
===================================================================
--- branches/czw_branch/20100519/ippMonitor/raw/czartool.php	(revision 28044)
+++ 	(revision )
@@ -1,315 +1,0 @@
-<?php
-include 'ipp.php';
-include 'site.php';
-
-$ID = checkID ();
-
-// require an explicit project
-if (! $ID['proj']) { projectform ($ID); }
-
-$db = dbconnect($ID['proj']);
-
-if ($ID['menu']) {$myMenu = $ID['menu'];} 
-else {$myMenu = "ipp.imfiles.dat";}
-
-menu($myMenu, 'Czartool', 'ipp.css', $ID['link'], $ID['proj']);
-
-$pass = $ID['pass'];
-$proj = $ID['proj'];
-$menu = $ID['menu'];
-
-$userSelection = $_GET[label];
-
-if ($userSelection == "") {$userSelection = $_POST['state'];}
-if ($userSelection == "") {$userSelection = "new";}
-
-$debug = 0;
-
-$PATH = getenv("PATH");
-putenv("PATH=$BINDIR:$PATH");
-
-$LD_LIBRARY_PATH = getenv("LD_LIBRARY_PATH");
-putenv("LD_LIBRARY_PATH=$LIBDIR:$LD_LIBRARY_PATH");
-
-exec("getLabels.pl -s stdscience", $stdsLabels, $status);
-exec("getLabels.pl -s distribution", $distLabels, $status);
-
-if ($debug) {
-    echo "prog returned $status, and output:<br>";
-    for ($i = 0; $i < count($distLabels); $i++) { 
-        echo "$distLabels[$i]<br>";
-    }           
-}
-
-$states=array("full","new","drop","wait");
-$stages=array("chip","cam","fake","warp","stack","diff","magic","destreak","dist");
-$servers=array("addstar", "cleanup", "detrend", "distribution", "pstamp", "publishing", "registration", "replication", "stdscience", "summitcopy");
-$separator = "-----";
-// set up the form
-echo "<form action=\"czartool.php\" method=\"POST\">\n";
-echo "<select name=state >\n";
-echo "<option value=\"none\">Select one...</option>\n";
-echo "<option value=\"none\">$separator</option>\n";
-foreach ($states as &$state) {echo "<option value=\"$state\">'$state' for all labels</option>\n";}
-echo "<option value=\"none\">$separator</option>\n";
-echo "<option value=\"servers\">Check all pantasks servers</option>\n";
-foreach ($servers as &$server) {echo "<option value=\"$server\">Status for '$server' server</option>\n";}
-echo "<option value=\"none\">$separator</option>\n";
-foreach ($stdsLabels as &$label) {echo "<option value=\"$label\">$label</option>\n";}
-
-echo "</select>\n";
-echo "<input type=submit value=Go>\n";
-
-echo "<input type=\"hidden\" name=\"pass\" value=\"$pass\">\n";
-echo "<input type=\"hidden\" name=\"proj\" value=\"$proj\">\n";
-echo "<input type=\"hidden\" name=\"menu\" value=\"$menu\">\n";
-echo "</form>\n";
-
-
-$stateChosen = 0;
-foreach ($states as &$state) {
-
-    if ($userSelection == $state) {
-        showAllLabels($pass, $proj, $db, $stdsLabels, $distLabels, $stages, $states, $state); 
-        $stateChosen=1;
-        break;
-    }
-}
-
-$serverChosen = 0;
-foreach ($servers as &$server) {
-
-    if ($userSelection == $server) {
-        showServerStatus($server); 
-        $serverChosen=1;
-        break;
-    }
-}
-if (!$stateChosen && !$serverChosen) {
-
-    if ($userSelection == "servers") {showAllServerStatus($servers); }// TODO
-    elseif ($userSelection == $separator) {}
-    else { showOneLabel($pass, $proj, $db, $userSelection, $stages, $states);}
-
-}
-menu_end();
-
-###########################################################################
-#
-# Shows the status of the provided pantasks server 
-#
-###########################################################################
-function showServerStatus($server) {
-
-    echo "<p> Status for $server server </p>";
-
-    $results=array();
-    exec("getServerStatus.pl -s $server", $results, $status);
-
-    foreach ($results as &$line) {
-        echo "<pre>\n";
-        echo "$line\n";
-        echo "</pre>\n";
-
-    }
-
-}
-
-###########################################################################
-#
-# Checks the status of all the pantasks servers 
-#
-###########################################################################
-function showAllServerStatus($servers) {
-
-    echo "<p> Status for all pantasks servers </p>";
-
-    // set up table columns
-    $class = "list";
-    echo "<table class=list>\n";
-    echo "<tr><td></td>\n";
-    write_header_cell($class, "Server");
-    write_header_cell($class, "Alive?");
-    write_header_cell($class, "Scheduler running?");
-    echo "</tr>\n";
-
-    foreach ($servers as &$server) {
-
-        $results=array();
-        exec("checkServer.pl -s $server", $results, $status);
-
-        echo "<tr><td></td>\n";
-        write_table_cell($class, '%s', "", $server);
-        write_table_cell($class, '%s', "", $results[0]);
-        write_table_cell($class, '%s', "", $results[1]);
-        echo "</tr>\n";
-    }
-
-    echo "</table>\n";
-}
-
-
-###########################################################################
-#
-# Checks one label and prints results in a table
-#
-###########################################################################
-function showOneLabel($pass, $proj, $db, $label, $stages, $states) {
-
-    echo "<p> Current status for label '$label' (any faults are shown in parentheses) </p>";
-
-    // set up table columns
-    $class = "list";
-    echo "<table class=list>\n";
-    echo "<tr><td></td>\n";
-    write_header_cell($class, "state");
-    foreach ($stages as &$stage) {write_header_cell($class, $stage);}
-    echo "</tr>\n";
-
-    // write rows
-    foreach ($states as &$state) {
-
-        $link = "czartool.php?pass=" . $pass . "&proj=" . $proj . "&label=" . $state;
-
-        echo "<tr><td></td>\n";
-        write_table_cell($class, '%s', $link, $state);
-        write_table_cell($class, '%s', "", getStateAndFaults($db, $label,"chipRun", $state, "chip"));
-        write_table_cell($class, '%s', "", getStateAndFaults($db, $label,"camRun", $state, "cam"));
-        write_table_cell($class, '%s', "", getStateAndFaults($db, $label,"fakeRun", $state, "fake"));
-        write_table_cell($class, '%s', "", getStateAndFaults($db, $label,"warpRun", $state, "warp"));
-        write_table_cell($class, '%s', "", getStateAndFaults($db, $label,"stackRun", $state, "stack"));
-        write_table_cell($class, '%s', "", getStateAndFaults($db, $label,"diffRun", $state, "diff"));
-        write_table_cell($class, '%s', "", getStateAndFaults($db, $label,"magicRun", $state, "magic"));
-        write_table_cell($class, '%s', "", getStateAndFaults($db, $label,"magicDSRun", $state, "magicDS"));
-        write_table_cell($class, '%s', "", getStateAndFaults($db, $label,"distRun", $state, "dist"));
-        echo "</tr>\n";
-    }
-
-    echo "</table>\n";
-}
-
-###########################################################################
-#
-# Creates table for all labels showing all stages for given 'state'
-#
-###########################################################################
-function showAllLabels($pass, $proj, $db, $stdsLabels, $distLabels, $stages, $states, $selectedState) {
-
-    echo "<p> Current stdscience labels for '$selectedState' (any faults are shown in parentheses)</p>";
-
-    // set up table columns
-    $class = "list";
-    echo "<table class=list>\n";
-    echo "<tr><td></td>\n";
-    write_header_cell($class, "label");
-    write_header_cell($class, "distributing?");
-    //    echo "<td class=\"$class\"><a href=\"$link\"> $myValue </a></td>\n";
-    //    echo "<th class=\"$class\"><a href=\"czartool.php\">label</th>\n";
-
-    foreach ($stages as &$stage) {write_header_cell($class, $stage);}
-    //foreach ($stages as &$stage) {
-
-    //  $link = "czartool.php?pass=" . $pass . "&proj=" . $proj . "&label=" . $stage;
-    // echo "<th class=\"$class\"><a href=\"$link\">$stage</th>\n";
-    // }
-
-    echo "</tr>\n";
-
-    // write rows
-    foreach ($stdsLabels as &$stdsLabel) {
-
-        $distributing = false;
-        foreach ($distLabels as &$distLabel) {
-
-            if ($stdsLabel == $distLabel) { $distributing = true; break;}
-        }
-
-
-        // create link to label summary page for each label
-        $link = "czartool.php?pass=" . $pass . "&proj=" . $proj . "&label=" . $stdsLabel;
-
-        echo "<tr><td></td>\n";
-        write_table_cell($class, '%s', $link, $stdsLabel);
-        write_table_cell($class, '%s', "", $distributing ? "yes" : "NO");
-        write_table_cell($class, '%s', "", getStateAndFaults($db, $stdsLabel,"chipRun", $selectedState, "chip"));
-        write_table_cell($class, '%s', "", getStateAndFaults($db, $stdsLabel,"camRun", $selectedState, "cam"));
-        write_table_cell($class, '%s', "", getStateAndFaults($db, $stdsLabel,"fakeRun", $selectedState, "fake"));
-        write_table_cell($class, '%s', "", getStateAndFaults($db, $stdsLabel,"warpRun", $selectedState, "warp"));
-        write_table_cell($class, '%s', "", getStateAndFaults($db, $stdsLabel,"stackRun", $selectedState, "stack"));
-        write_table_cell($class, '%s', "", getStateAndFaults($db, $stdsLabel,"diffRun", $selectedState, "diff"));
-        write_table_cell($class, '%s', "", getStateAndFaults($db, $stdsLabel,"magicRun", $selectedState, "magic"));
-        write_table_cell($class, '%s', "", getStateAndFaults($db, $stdsLabel,"magicDSRun", $selectedState, "magicDS"));
-        write_table_cell($class, '%s', "", getStateAndFaults($db, $stdsLabel,"distRun", $selectedState, "dist"));
-        echo "</tr>\n";
-    }
-
-    echo "</table>\n";
-}
-
-###########################################################################
-#
-# Returns state and fault-count (if new) as a string
-#
-###########################################################################
-function getStateAndFaults($db, $label, $table, $state, $stage) {
-
-    $new = checkLabel($db, $label, $table, $state, $stage);
-
-    if ($state != "new") {return $new;}
-
-    $faults = countFaults($db, $label,$table,$stage);
-
-    if ($faults < 1) {return $new;}
-
-    return $new."(".$faults.")";
-}
-
-###########################################################################
-#
-# Returns count of exposures with this state for this label
-#
-###########################################################################
-function checkLabel($db, $label, $table, $state, $stage) {
-
-    $sql = "SELECT COUNT(state) FROM $table WHERE label LIKE '$label' AND state = '$state'";
-    if ($debug) {echo "$sql<br>";}
-
-    $qry = $db->query($sql);
-    if (dberror($qry)) {echo "<b>error with $sql </b><br>\n";}
-    if (!$qry->fetchInto($row)) {echo "<b>error with $sql </b><br>\n";}
-    return $row[0];
-}
-
-###########################################################################
-#
-# Returns count of faults for this stage and label
-#
-###########################################################################
-function countFaults($db, $label, $table, $stage) {
-
-    $joinTable = 0;
-    $id = $stage."_id";
-
-    if ($stage == "chip") {$joinTable="chipProcessedImfile";}
-    elseif ($stage == "cam") {$joinTable="camProcessedExp";}
-    elseif ($stage == "fake") {$joinTable="fakeProcessedImfile";}
-    elseif ($stage == "warp") {$joinTable="warpSkyfile";}
-    elseif ($stage == "stack") {$joinTable="stackSumSkyfile";}
-    elseif ($stage == "diff") {$joinTable="diffSkyfile";}
-    elseif ($stage == "magic") {$joinTable="magicNodeResult";}
-    elseif ($stage == "magicDS") {$id = "magic_ds_id"; $joinTable="magicDSFile";}
-    elseif ($stage == "dist") {$joinTable="distComponent";}
-    else {return -1;}
-
-    $faultCol =  $joinTable.".fault";
-
-    $sql = "SELECT COUNT(DISTINCT $id) FROM $table JOIN $joinTable USING ($id) WHERE label LIKE '$label' AND $faultCol != 0 AND $table.state = 'new'";
-    if ($debug) {echo "$sql<br>";}
-
-    $qry = $db->query($sql);
-    if (dberror($qry)) {echo "<b>error with $sql </b><br>\n";}
-    if (!$qry->fetchInto($row)) {echo "<b>error with $sql </b><br>\n";}
-    return $row[0];
-}
-?>
-
Index: branches/czw_branch/20100519/ippMonitor/raw/czartool_labels.php
===================================================================
--- branches/czw_branch/20100519/ippMonitor/raw/czartool_labels.php	(revision 28304)
+++ branches/czw_branch/20100519/ippMonitor/raw/czartool_labels.php	(revision 28304)
@@ -0,0 +1,307 @@
+<?php
+include 'ipp.php';
+include 'site.php';
+
+$ID = checkID ();
+
+// require an explicit project
+if (! $ID['proj']) { projectform ($ID); }
+
+$db = dbconnect($ID['proj']);
+
+if ($ID['menu']) {$myMenu = $ID['menu'];}
+else {$myMenu = "ipp.czartool.dat";}
+
+menu($myMenu, 'Czartool', 'ipp.css', $ID['link'], $ID['proj']);
+
+$pass = $ID['pass'];
+$proj = $ID['proj'];
+$menu = $ID['menu'];
+
+$userSelection = $_GET[selection];
+
+if ($userSelection == "") {$userSelection = $_POST['state'];}
+if ($userSelection == "") {$userSelection = "new";}
+
+$debug = 0;
+
+$PATH = getenv("PATH");
+putenv("PATH=$BINDIR:$PATH");
+
+$LD_LIBRARY_PATH = getenv("LD_LIBRARY_PATH");
+putenv("LD_LIBRARY_PATH=$LIBDIR:$LD_LIBRARY_PATH");
+
+exec("czartool_getLabels.pl -s stdscience", $stdsLabels, $status);
+exec("czartool_getLabels.pl -s distribution", $distLabels, $status);
+
+if ($debug) {
+    echo "prog returned $status, and output:<br>";
+    for ($i = 0; $i < count($distLabels); $i++) {
+        echo "$distLabels[$i]<br>";
+    }
+}
+
+$states=array("full","new","drop","wait");
+$stages=array("chip","cam","fake","warp","stack","diff","magic","destreak","dist");
+
+// set up the form
+echo "<form action=\"czartool_labels.php\" method=\"POST\">\n";
+
+echo "<input type=\"hidden\" name=\"pass\" value=\"$pass\">\n";
+echo "<input type=\"hidden\" name=\"proj\" value=\"$proj\">\n";
+echo "<input type=\"hidden\" name=\"menu\" value=\"$menu\">\n";
+echo "</form>\n";
+$stateChosen = 0;
+foreach ($states as &$state) {
+
+    if ($userSelection == $state) {
+        showAllLabels($pass, $proj, $db, $stdsLabels, $distLabels, $stages, $states, $state);
+        $stateChosen=1;
+        break;
+    }
+}
+
+if (!$stateChosen) showOneLabel($pass, $proj, $db, $userSelection, $stages, $states);
+
+menu_end();
+
+
+###########################################################################
+#
+# Checks one label and prints results in a table
+#
+###########################################################################
+function showOneLabel($pass, $proj, $db, $label, $stages, $states) {
+
+    echo "<p> Current status for label '$label' (any faults are shown in parentheses) </p>";
+
+    // set up table columns
+    $class = "list";
+    echo "<table class=$class>\n";
+    echo "<tr><td></td>\n";
+    write_header_cell($class, "state");
+    foreach ($stages as &$stage) {write_header_cell($class, $stage);}
+    echo "</tr>\n";
+
+    // write rows
+    foreach ($states as &$state) {
+
+        $link = "czartool_labels.php?pass=" . $pass . "&proj=" . $proj . "&selection=" . $state;
+        $defaultlink = "czartool_labels.php?pass=" . $pass . "&proj=" . $proj;
+
+        echo "<tr><td></td>\n";
+        write_table_cell($class, '%s', $link, $state);
+
+        $str = "";
+        $anyFaults = false; 
+        $link = "chipProcessedImfile_failure.php?menu=ipp.science.dat&pass=" . $pass . "&proj=" . $proj . "&label=" . $stdsLabel;
+        getStateAndFaults($db, $label,"chipRun", $state, "chip", $str, $anyFaults);
+        write_table_cell($class, '%s', $anyFaults ? $link : "", $str);
+
+        $link = "camProcessedExp_failure.php?pass=" . $pass . "&proj=" . $proj . "&label=" . $stdsLabel;
+        getStateAndFaults($db, $label,"camRun", $state, "cam", $str, $anyFaults);
+        write_table_cell($class, '%s',  $anyFaults ? $link : "", $str);
+
+        $link = $defaultlink;
+        getStateAndFaults($db, $label,"fakeRun", $state, "fake", $str, $anyFaults);
+        write_table_cell($class, '%s',  $anyFaults ? $link : "", $str);
+
+        $link = "warpFailedSkyfiles.php?pass=" . $pass . "&proj=" . $proj;
+        getStateAndFaults($db, $label,"warpRun", $state, "warp", $str, $anyFaults);
+        write_table_cell($class, '%s',  $anyFaults ? $link : "",  $str);
+        
+        $link = "stackFailedSkyfile.php?pass=" . $pass . "&proj=" . $proj;
+        getStateAndFaults($db, $label,"stackRun", $state, "stack", $str, $anyFaults);
+        write_table_cell($class, '%s',  $anyFaults ? $link : "", $str);
+
+        $link = "diffFailedSkyfile.php?pass=" . $pass . "&proj=" . $proj;
+        getStateAndFaults($db, $label,"diffRun", $state, "diff", $str, $anyFaults);
+        write_table_cell($class, '%s',  $anyFaults ? $link : "",  $str);
+
+        $link = $defaultlink;
+        getStateAndFaults($db, $label,"magicRun", $state, "magic", $str, $anyFaults);
+        write_table_cell($class, '%s',  $anyFaults ? $link : "", $str);
+
+        $link = $defaultlink;
+        getStateAndFaults($db, $label,"magicDSRun", $state, "magicDS", $str, $anyFaults);
+        write_table_cell($class, '%s',  $anyFaults ? $link : "", $str);
+       
+        $link = $defaultlink;
+        getStateAndFaults($db, $label,"distRun", $state, "dist", $str, $anyFaults);
+        write_table_cell($class, '%s',  $anyFaults ? $link : "", $str);
+
+        echo "</tr>\n";
+    }
+
+    echo "</table>\n";
+
+    echo "<p> - Click on a state to see all labels for that state <br>";
+    echo "- Click on a fault to find logfile </p>";
+}
+
+###########################################################################
+#
+# Creates table for all labels showing all stages for given 'state'
+#
+###########################################################################
+function showAllLabels($pass, $proj, $db, $stdsLabels, $distLabels, $stages, $states, $selectedState) {
+
+    echo "<p> Current stdscience labels for '$selectedState' (any faults are shown in parentheses)</p>";
+
+    // set up table columns
+    $class = "list";
+    //echo "<table class=$class BORDER=\"0\" CELLSPACING=\"0\" CELLPADDING=\"5\">\n";
+    echo "<table class=$class >\n";
+    echo "<tr><td></td>\n";
+    write_header_cell($class, "label");
+    write_header_cell($class, "distributing?");
+    //    echo "<td class=\"$class\"><a href=\"$link\"> $myValue </a></td>\n";
+    //    echo "<th class=\"$class\"><a href=\"czartool.php\">label</th>\n";
+
+    foreach ($stages as &$stage) {write_header_cell($class, $stage);}
+    //foreach ($stages as &$stage) {
+
+    //  $link = "czartool.php?pass=" . $pass . "&proj=" . $proj . "&label=" . $stage;
+    // echo "<th class=\"$class\"><a href=\"$link\">$stage</th>\n";
+    // }
+
+    echo "</tr>\n";
+
+    // write rows
+    foreach ($stdsLabels as &$stdsLabel) {
+
+        $distributing = false;
+        foreach ($distLabels as &$distLabel) {
+
+            if ($stdsLabel == $distLabel) { $distributing = true; break;}
+        }
+
+
+        // create link to label summary page for each label
+        $link = "czartool_labels.php?pass=" . $pass . "&proj=" . $proj . "&selection=" . $stdsLabel;
+        $defaultlink = "czartool_labels.php?pass=" . $pass . "&proj=" . $proj;
+
+        echo "<tr><td></td>\n";
+        write_table_cell($class, '%s', $link, $stdsLabel);
+        write_table_cell($class, '%s', "", $distributing ? "yes" : "NO");
+
+        $str = "";
+        $anyFaults = false; 
+
+        $link = "chipProcessedImfile_failure.php?menu=ipp.science.dat&pass=" . $pass . "&proj=" . $proj . "&label=" . $stdsLabel;
+        getStateAndFaults($db, $stdsLabel,"chipRun", $selectedState, "chip", $str, $anyFaults);
+        write_table_cell($class, '%s', $anyFaults ? $link : "", $str);
+
+        $link = "camProcessedExp_failure.php?pass=" . $pass . "&proj=" . $proj . "&label=" . $stdsLabel;
+        getStateAndFaults($db, $stdsLabel,"camRun", $selectedState, "cam", $str, $anyFaults);
+        write_table_cell($class, '%s',  $anyFaults ? $link : "", $str);
+
+        $link = $defaultlink;
+        getStateAndFaults($db, $stdsLabel,"fakeRun", $selectedState, "fake", $str, $anyFaults);
+        write_table_cell($class, '%s',  $anyFaults ? $link : "", $str);
+
+        $link = "warpFailedSkyfiles.php?pass=" . $pass . "&proj=" . $proj;
+        getStateAndFaults($db, $stdsLabel,"warpRun", $selectedState, "warp", $str, $anyFaults);
+        write_table_cell($class, '%s',  $anyFaults ? $link : "",  $str);
+        
+        $link = "stackFailedSkyfile.php?pass=" . $pass . "&proj=" . $proj;
+        getStateAndFaults($db, $stdsLabel,"stackRun", $selectedState, "stack", $str, $anyFaults);
+        write_table_cell($class, '%s',  $anyFaults ? $link : "", $str);
+
+        $link = "diffFailedSkyfile.php?pass=" . $pass . "&proj=" . $proj;
+        getStateAndFaults($db, $stdsLabel,"diffRun", $selectedState, "diff", $str, $anyFaults);
+        write_table_cell($class, '%s',  $anyFaults ? $link : "",  $str);
+
+        $link = $defaultlink;
+        getStateAndFaults($db, $stdsLabel,"magicRun", $selectedState, "magic", $str, $anyFaults);
+        write_table_cell($class, '%s',  $anyFaults ? $link : "", $str);
+
+        $link = $defaultlink;
+        getStateAndFaults($db, $stdsLabel,"magicDSRun", $selectedState, "magicDS", $str, $anyFaults);
+        write_table_cell($class, '%s',  $anyFaults ? $link : "", $str);
+       
+        $link = $defaultlink;
+        getStateAndFaults($db, $stdsLabel,"distRun", $selectedState, "dist", $str, $anyFaults);
+        write_table_cell($class, '%s',  $anyFaults ? $link : "", $str);
+
+        echo "</tr>\n";
+    }
+
+    echo "</table>\n";
+
+    echo "<p> - Click on a label to see all states for that label (full, new, drop etc)<br>";
+    echo "- Click on a fault to find logfile </p>";
+}
+
+###########################################################################
+#
+# Returns state and fault-count (if new) as a string
+#
+###########################################################################
+function getStateAndFaults($db, $label, $table, $state, $stage, &$str, &$anyFaults) {
+
+    $anyFaults = false;
+
+    $str = checkLabel($db, $label, $table, $state, $stage);
+
+    if ($state == "new") {
+
+        $faults = countFaults($db, $label,$table,$stage);
+
+        if ($faults > 0) {
+
+            $str = $str."(".$faults.")";
+            $anyFaults = true;
+        }
+    }
+}
+
+###########################################################################
+#
+# Returns count of exposures with this state for this label
+#
+###########################################################################
+function checkLabel($db, $label, $table, $state, $stage) {
+
+    $sql = "SELECT COUNT(state) FROM $table WHERE label LIKE '$label' AND state = '$state'";
+    if ($debug) {echo "$sql<br>";}
+
+    $qry = $db->query($sql);
+    if (dberror($qry)) {echo "<b>error with $sql </b><br>\n";}
+    if (!$qry->fetchInto($row)) {echo "<b>error with $sql </b><br>\n";}
+    return $row[0];
+}
+
+###########################################################################
+#
+# Returns count of faults for this stage and label
+#
+###########################################################################
+function countFaults($db, $label, $table, $stage) {
+
+    $joinTable = 0;
+    $id = $stage."_id";
+
+    if ($stage == "chip") {$joinTable="chipProcessedImfile";}
+    elseif ($stage == "cam") {$joinTable="camProcessedExp";}
+    elseif ($stage == "fake") {$joinTable="fakeProcessedImfile";}
+    elseif ($stage == "warp") {$joinTable="warpSkyfile";}
+    elseif ($stage == "stack") {$joinTable="stackSumSkyfile";}
+    elseif ($stage == "diff") {$joinTable="diffSkyfile";}
+    elseif ($stage == "magic") {$joinTable="magicNodeResult";}
+    elseif ($stage == "magicDS") {$id = "magic_ds_id"; $joinTable="magicDSFile";}
+    elseif ($stage == "dist") {$joinTable="distComponent";}
+    else {return -1;}
+
+    $faultCol =  $joinTable.".fault";
+
+    $sql = "SELECT COUNT(DISTINCT $id) FROM $table JOIN $joinTable USING ($id) WHERE label LIKE '$label' AND $faultCol != 0 AND $table.state = 'new'";
+    if ($debug) {echo "$sql<br>";}
+
+    $qry = $db->query($sql);
+    if (dberror($qry)) {echo "<b>error with $sql </b><br>\n";}
+    if (!$qry->fetchInto($row)) {echo "<b>error with $sql </b><br>\n";}
+    return $row[0];
+}
+?>
+
Index: branches/czw_branch/20100519/ippMonitor/raw/czartool_servers.php
===================================================================
--- branches/czw_branch/20100519/ippMonitor/raw/czartool_servers.php	(revision 28304)
+++ branches/czw_branch/20100519/ippMonitor/raw/czartool_servers.php	(revision 28304)
@@ -0,0 +1,125 @@
+<?php
+include 'ipp.php';
+include 'site.php';
+
+$ID = checkID ();
+
+// require an explicit project
+if (! $ID['proj']) { projectform ($ID); }
+
+$db = dbconnect($ID['proj']);
+
+if ($ID['menu']) {$myMenu = $ID['menu'];}
+else {$myMenu = "ipp.czartool.dat";}
+
+menu($myMenu, 'Czartool', 'ipp.css', $ID['link'], $ID['proj']);
+
+$pass = $ID['pass'];
+$proj = $ID['proj'];
+$menu = $ID['menu'];
+
+$userSelection = $_GET[server];
+
+if ($userSelection == "") {$userSelection = $_POST['state'];}
+if ($userSelection == "") {$userSelection = "new";}
+
+$debug = 0;
+
+$PATH = getenv("PATH");
+putenv("PATH=$BINDIR:$PATH");
+
+$LD_LIBRARY_PATH = getenv("LD_LIBRARY_PATH");
+putenv("LD_LIBRARY_PATH=$LIBDIR:$LD_LIBRARY_PATH");
+
+$servers=array(
+        "addstar", 
+        "cleanup", 
+        "detrend", 
+        "distribution", 
+        "pstamp", 
+        "update", 
+        "publishing", 
+        "registration", 
+        "replication", 
+        "stdscience", 
+        "summitcopy");
+
+// set up the form
+echo "<form action=\"czartool_servers.php\" method=\"POST\">\n";
+echo "<input type=\"hidden\" name=\"pass\" value=\"$pass\">\n";
+echo "<input type=\"hidden\" name=\"proj\" value=\"$proj\">\n";
+echo "<input type=\"hidden\" name=\"menu\" value=\"$menu\">\n";
+echo "</form>\n";
+
+
+$serverChosen = 0;
+foreach ($servers as &$server) {
+
+    if ($userSelection == $server) {
+        showServerStatus($server);
+        $serverChosen=1;
+        break;
+    }
+}
+if (!$serverChosen) showAllServerStatus($pass, $proj,$servers);
+
+menu_end();
+
+###########################################################################
+#
+# Shows the status of the provided pantasks server 
+#
+###########################################################################
+function showServerStatus($server) {
+
+    echo "<p> Status for $server server </p>";
+
+    $results=array();
+    exec("czartool_getServerStatus.pl -s $server", $results, $status);
+
+    foreach ($results as &$line) {
+        echo "<pre>\n";
+        echo "$line\n";
+        echo "</pre>\n";
+
+    }
+
+}
+
+###########################################################################
+#
+# Checks the status of all the pantasks servers 
+#
+###########################################################################
+function showAllServerStatus($pass, $proj, $servers) {
+
+    echo "<p> Status for all pantasks servers </p>";
+
+    // set up table columns
+    $class = "list";
+    echo "<table class=$class>\n";
+    echo "<tr><td></td>\n";
+    write_header_cell($class, "Server");
+    write_header_cell($class, "Alive?");
+    write_header_cell($class, "Scheduler running?");
+    echo "</tr>\n";
+
+    foreach ($servers as &$server) {
+
+        $link = "czartool_servers.php?pass=" . $pass . "&proj=" . $proj . "&server=" . $server;
+
+        $results=array();
+        exec("czartool_checkServer.pl -s $server", $results, $status);
+
+        echo "<tr><td></td>\n";
+        write_table_cell($class, '%s', $link, $server);
+        write_table_cell($class, '%s', "", $results[0]);
+        write_table_cell($class, '%s', "", $results[1]);
+        echo "</tr>\n";
+    }
+
+    echo "</table>\n";
+    echo "<p> Click on a server to see its current status </p>";
+
+}
+
Index: branches/czw_branch/20100519/ippMonitor/raw/ipp.czartool.dat
===================================================================
--- branches/czw_branch/20100519/ippMonitor/raw/ipp.czartool.dat	(revision 28304)
+++ branches/czw_branch/20100519/ippMonitor/raw/ipp.czartool.dat	(revision 28304)
@@ -0,0 +1,5 @@
+input     | ipp.imfiles.dat 
+
+menutop   | menutop      | plain   | &nbsp;                       | 
+menulink  | menuselect 	 | link    | Check labels             	  | czartool_labels.php  
+menulink  | menuselect 	 | link    | Check servers             	  | czartool_servers.php                         
Index: branches/czw_branch/20100519/ippMonitor/raw/ipp.imfiles.dat
===================================================================
--- branches/czw_branch/20100519/ippMonitor/raw/ipp.imfiles.dat	(revision 28044)
+++ branches/czw_branch/20100519/ippMonitor/raw/ipp.imfiles.dat	(revision 28304)
@@ -21,4 +21,4 @@
 menutop   | menutop      | link    | simple plot - chip           | simplePlot.php
 menutop   | menutop      | link    | simple plot - cam            | simplePlotcam.php
-menutop   | menutop      | link    | czartool                     | czartool.php
+menutop   | menutop      | link    | czartool                     | czartool_labels.php
 
Index: branches/czw_branch/20100519/ippMonitor/raw/ipp.stack.dat
===================================================================
--- branches/czw_branch/20100519/ippMonitor/raw/ipp.stack.dat	(revision 28044)
+++ branches/czw_branch/20100519/ippMonitor/raw/ipp.stack.dat	(revision 28304)
@@ -27,2 +27,9 @@
 menulink  | menuselect   | link    | Magic Failed Nodes           | magicFailedNodes.php
 menulink  | menuselect   | link    | Magic Failed Masks           | magicFailedMasks.php
+
+menutop   | menutop      | plain   | &nbsp;                       | 
+menulink  | menuselect   | link    | Static Sky Summary           | staticskySummary.php
+menulink  | menuselect   | link    | Static Sky Run               | staticskyRun.php
+menulink  | menuselect   | link    | Static Sky Input Skyfile     | staticskyInputSkyfile.php
+menulink  | menuselect   | link    | Static Sky Processed Skyfile | staticskyProcessedSkyfile.php
+menulink  | menuselect   | link    | Static Sky Failed Skyfile    | staticskyFailedSkyfile.php
Index: branches/czw_branch/20100519/ippMonitor/scripts/checkServer.pl
===================================================================
--- branches/czw_branch/20100519/ippMonitor/scripts/checkServer.pl	(revision 28044)
+++ 	(revision )
@@ -1,25 +1,0 @@
-#!/usr/bin/perl -w
-
-use warnings;
-use strict;
-use Getopt::Long;
-
-my $server = undef;
-GetOptions ("server|s=s" => \$server);
-
-my @cmdOut = `echo "status ;quit" | pantasks_client -c ~ipp/$server/ptolemy.rc 2>&1`;
-my $line;
-my $foundStatus = 0;
-my $isRunning = 0;
-foreach $line (@cmdOut) {
-
-    chomp($line);
-    if ($line =~ m/Scheduler is stopped/) {$isRunning = 0; $foundStatus=1;last;}
-    if ($line =~ m/Scheduler is running/) {$isRunning = 1; $foundStatus=1;last;}
-    if ($line =~ m/Task Staus/) {last;}
-
-}
-
-($foundStatus) ? print "yes\n" : print "no\n";
-($isRunning) ? print "yes\n" : print "no\n";
-
Index: branches/czw_branch/20100519/ippMonitor/scripts/czartool_checkServer.pl
===================================================================
--- branches/czw_branch/20100519/ippMonitor/scripts/czartool_checkServer.pl	(revision 28304)
+++ branches/czw_branch/20100519/ippMonitor/scripts/czartool_checkServer.pl	(revision 28304)
@@ -0,0 +1,25 @@
+#!/usr/bin/perl -w
+
+use warnings;
+use strict;
+use Getopt::Long;
+
+my $server = undef;
+GetOptions ("server|s=s" => \$server);
+
+my @cmdOut = `echo "status ;quit" | pantasks_client -c ~ipp/$server/ptolemy.rc 2>&1`;
+my $line;
+my $foundStatus = 0;
+my $isRunning = 0;
+foreach $line (@cmdOut) {
+
+    chomp($line);
+    if ($line =~ m/Scheduler is stopped/) {$isRunning = 0; $foundStatus=1;last;}
+    if ($line =~ m/Scheduler is running/) {$isRunning = 1; $foundStatus=1;last;}
+    if ($line =~ m/Task Staus/) {last;}
+
+}
+
+($foundStatus) ? print "yes\n" : print "no\n";
+($isRunning) ? print "yes\n" : print "no\n";
+
Index: branches/czw_branch/20100519/ippMonitor/scripts/czartool_getLabels.pl
===================================================================
--- branches/czw_branch/20100519/ippMonitor/scripts/czartool_getLabels.pl	(revision 28304)
+++ branches/czw_branch/20100519/ippMonitor/scripts/czartool_getLabels.pl	(revision 28304)
@@ -0,0 +1,25 @@
+#!/usr/bin/perl -w
+
+use warnings;
+use strict;
+use Getopt::Long;
+
+my $server = undef;
+GetOptions ("server|s=s" => \$server);
+
+my @cmdOut = `echo "show.labels;quit" | pantasks_client -c ~ipp/$server/ptolemy.rc 2>&1`;
+my $line;
+my $passedHeader=0;
+foreach $line (@cmdOut) {
+
+    chomp($line);
+    if ($line =~ m/pantasks:\s+(.*)/) {
+  
+        # HACK to get around 'dummy' label in stdscience
+        if ($1 !~ m/.*dummy.*/) {print "$1\n"};
+        $passedHeader=1; 
+        next;
+    }
+
+    if ($passedHeader){print "$line\n";}
+}
Index: branches/czw_branch/20100519/ippMonitor/scripts/czartool_getServerStatus.pl
===================================================================
--- branches/czw_branch/20100519/ippMonitor/scripts/czartool_getServerStatus.pl	(revision 28304)
+++ branches/czw_branch/20100519/ippMonitor/scripts/czartool_getServerStatus.pl	(revision 28304)
@@ -0,0 +1,18 @@
+#!/usr/bin/perl -w
+
+use warnings;
+use strict;
+use Getopt::Long;
+
+my $server = undef;
+GetOptions ("server|s=s" => \$server);
+
+my @cmdOut = `echo "status;quit" | pantasks_client -c ~ipp/$server/ptolemy.rc 2>&1`;
+my $line;
+my $passedHeader=0;
+foreach $line (@cmdOut) {
+
+    chomp($line);
+    if ($line =~ m/.*Task Status.*/) {$passedHeader=1;next;}
+    if ($passedHeader){print "$line<br>";}
+}
Index: branches/czw_branch/20100519/ippMonitor/scripts/getLabels.pl
===================================================================
--- branches/czw_branch/20100519/ippMonitor/scripts/getLabels.pl	(revision 28044)
+++ 	(revision )
@@ -1,25 +1,0 @@
-#!/usr/bin/perl -w
-
-use warnings;
-use strict;
-use Getopt::Long;
-
-my $server = undef;
-GetOptions ("server|s=s" => \$server);
-
-my @cmdOut = `echo "show.labels;quit" | pantasks_client -c ~ipp/$server/ptolemy.rc 2>&1`;
-my $line;
-my $passedHeader=0;
-foreach $line (@cmdOut) {
-
-    chomp($line);
-    if ($line =~ m/pantasks:\s+(.*)/) {
-  
-        # HACK to get around 'dummy' label in stdscience
-        if ($1 !~ m/.*dummy.*/) {print "$1\n"};
-        $passedHeader=1; 
-        next;
-    }
-
-    if ($passedHeader){print "$line\n";}
-}
Index: branches/czw_branch/20100519/ippMonitor/scripts/getServerStatus.pl
===================================================================
--- branches/czw_branch/20100519/ippMonitor/scripts/getServerStatus.pl	(revision 28044)
+++ 	(revision )
@@ -1,18 +1,0 @@
-#!/usr/bin/perl -w
-
-use warnings;
-use strict;
-use Getopt::Long;
-
-my $server = undef;
-GetOptions ("server|s=s" => \$server);
-
-my @cmdOut = `echo "status;quit" | pantasks_client -c ~ipp/$server/ptolemy.rc 2>&1`;
-my $line;
-my $passedHeader=0;
-foreach $line (@cmdOut) {
-
-    chomp($line);
-    if ($line =~ m/.*Task Status.*/) {$passedHeader=1;next;}
-    if ($passedHeader){print "$line<br>";}
-}
