Index: trunk/MagicSoft/Mars/datacenter/db/include.php
===================================================================
--- trunk/MagicSoft/Mars/datacenter/db/include.php	(revision 7484)
+++ trunk/MagicSoft/Mars/datacenter/db/include.php	(revision 7527)
@@ -104,5 +104,5 @@
 }
 
-function StatusQuery($name)
+function StatusQuery($name, $needs)
 {
     $var  = $name . "Status";
@@ -112,7 +112,11 @@
     case 0: $txt .= ""; break;
     case 1: $txt .= "NOT (IsNull(" . $name . ") OR " . $name . "='1970-01-01 00:00:00') AND "; break;
-    case 2: $txt .= "IsNull(" . $name . ") AND "; break;
+    case 2: $txt .= "IsNull(" . $name . ") AND IsNull(fStartTime) AND IsNull(fFailedTime) AND NOT IsNull(" . $needs[$name] . ") AND "; break;
     case 3: $txt .= $name ."='1970-01-01 00:00:00' AND "; break;
-    case 4: $txt .= ""; break;
+    case 4: $txt .= " (IsNull(" . $name . ") AND IsNull(fFailedTime) AND NOT IsNull(fStartTime) AND date_sub(Now(),interval 12 hour) < fStartTime AND NOT IsNull(" . $needs[$name] . ")) AND "; break;
+    case 5: $txt .= " (IsNull(" . $name . ") AND NOT IsNull(fFailedTime) AND NOT IsNull(fStartTime) AND NOT IsNull(" . $needs[$name] . ")) AND "; break;
+    case 6: $txt .= " (IsNull(" . $name . ") AND IsNull(fFailedTime) AND NOT IsNull(fStartTime) AND date_sub(Now(),interval 12 hour) > fStartTime AND NOT IsNull(" . $needs[$name] . ")) AND "; break;
+//    case 6: $txt .= "crashed"; break;
+    case 7: $txt .= ""; break;
     }
     return $txt;
@@ -138,9 +142,12 @@
           2 => "not done",
           3 => "not to be done",
-          4 => "group by"
+          4 => "running",
+          5 => "failed",
+          6 => "crashed",
+          7 => "group by",
         );
 
     $stat=$_GET[$var];
-    for ($i=0; $i<5; $i++)
+    for ($i=0; $i<8; $i++)
     {
         if ($stat==$i)
@@ -399,5 +406,5 @@
     foreach ($_GET as $key => $element)
         if ($key==$column)
-            if ($element==4)
+            if ($element==7)
                 return -1;
     return 0;
