Index: trunk/MagicSoft/Mars/datacenter/db/include.php
===================================================================
--- trunk/MagicSoft/Mars/datacenter/db/include.php	(revision 8123)
+++ trunk/MagicSoft/Mars/datacenter/db/include.php	(revision 8182)
@@ -24,8 +24,8 @@
         $checked = "";
 
-    printf("    <input type=\"checkbox\" name=\"%s\" value=\"On\" %s>%s\n", $name, $checked, $text);
+    printf("    <input type='checkbox' name='%s' value='On' %s>%s\n", $name, $checked, $text);
     printf("<BR>");
 
-    printf(" <select name=\"%s\">\n", $var);
+    printf(" <select name='%s'>\n", $var);
 
     $status = array
@@ -40,7 +40,7 @@
     {
         if ($stat==$i)
-            printf("<option value=\"%d\" selected>%s</option>\n", $i, $status[$i]);
+            printf("<option value='%d' selected>%s</option>\n", $i, $status[$i]);
         else
-            printf("<option value=\"%d\">%s</option>\n", $i, $status[$i]);
+            printf("<option value='%d'>%s</option>\n", $i, $status[$i]);
     }
 
@@ -78,8 +78,8 @@
         $checked = "";
 
-    printf("    <input type=\"checkbox\" name=\"%s\" value=\"On\" %s>%s\n", $name, $checked, $text);
+    printf("    <input type='checkbox' name='%s' value='On' %s>%s\n", $name, $checked, $text);
     printf("<BR>");
 
-    printf(" <select name=\"%s\">\n", $var);
+    printf(" <select name='%s'>\n", $var);
 
     $status = array
@@ -98,7 +98,7 @@
     {
         if ($stat==$i)
-            printf("<option value=\"%d\" selected>%s</option>\n", $i, $status[$i]);
+            printf("<option value='%d' selected>%s</option>\n", $i, $status[$i]);
         else
-            printf("<option value=\"%d\">%s</option>\n", $i, $status[$i]);
+            printf("<option value='%d'>%s</option>\n", $i, $status[$i]);
     }
 
@@ -144,26 +144,26 @@
         $checked = "";
 
-    printf("    <input type=\"checkbox\" name=\"%s\" value=\"On\" %s><A HREF=\"printtable.php?fTable=%s\">%s</A>\n", $name, $checked, $table, $descr);
+    printf("    <input type='checkbox' name='%s' value='On' %s><A HREF='printtable.php?fTable=%s'>%s</A>\n", $name, $checked, $table, $descr);
 
     printf("   <BR>\n");
 
-    printf("   <select name=\"%s\" size=\"1\" class=\"Width\">\n", $index);
+    printf("   <select name='%s' size='1' class='Width'>\n", $index);
 
     if (empty($_GET[$index]) || $_GET[$index]==0)
-        printf("    <option value=\"0\" selected>--- ALL ---</option>\n");
-    else
-        printf("    <option value=\"0\">--- ALL ---</option>\n");
+        printf("    <option value='0' selected>--- ALL ---</option>\n");
+    else
+        printf("    <option value='0'>--- ALL ---</option>\n");
 
     if (!empty($_GET[$index]) && $_GET[$index]==-1)
-        printf("    <option value=\"-1\" selected>--- GROUP BY ---</option>\n");
-    else
-        printf("    <option value=\"-1\">--- GROUP BY ---</option>\n");
+        printf("    <option value='-1' selected>--- GROUP BY ---</option>\n");
+    else
+        printf("    <option value='-1'>--- GROUP BY ---</option>\n");
 
     while ($row = mysql_fetch_row($result))
     {
         if (!empty($_GET[$index]) && $_GET[$index]==$row[0])
-            printf("    <option value=\"%s\" selected>%s</option>\n", $row[0], $row[1]);
+            printf("    <option value='%s' selected>%s</option>\n", $row[0], $row[1]);
         else
-            printf("    <option value=\"%s\">%s</option>\n", $row[0], $row[1]);
+            printf("    <option value='%s'>%s</option>\n", $row[0], $row[1]);
     }
     printf("   </select>\n");
@@ -258,5 +258,28 @@
         $checked = "";
 
-    printf("    <td><input type=\"checkbox\" name=\"%s\" value=\"On\" %s>%s</td>\n", $value, $checked, $text);
+    printf("    <td><input type='checkbox' name='%s' value='On' %s>%s</td>\n", $value, $checked, $text);
+}
+
+function Checkbox2($val, $set, $text)
+{
+    $value=$val.$set;
+    switch ($set)
+    {
+    case  "ON":
+        if (!isset($_POST["submit"]) && ereg(" ".$val." ", $_GET["Set"]))
+            $_POST[$value]="On";
+        break;
+    case "Off":
+        if (!isset($_POST["submit"]) && ereg(" ".$val." ", $_GET["Set2"]))
+            $_POST[$value]="On";
+        break;
+    }
+
+    if ($_POST[$value]=="On")
+        $checked = "checked";
+    else
+        $checked = "";
+
+    printf("    <td><input type='checkbox' name='%s' value='On' %s>%s</td>\n", $value, $checked, $text);
 }
 
@@ -400,5 +423,5 @@
 }
 
-function PrintMagicTable($result0, $alias, $rightalign, $limitsmean, $limitsmin, $limitsmax, $_GET)
+function PrintMagicTable($result0, $alias, $rightalign, $limitsmean, $limitsmin, $limitsmax, $form, $_GET)
 {
     $col   = FALSE;
@@ -418,7 +441,9 @@
 
     printf("\n<center>\n");
+    if ($form)
+        printf("<form method='POST'>");
     if (empty($_GET["fPrintTable"]))
         printf("<p>%s<P>\n", $menu);
-    printf("<table BORDER=\"0\">\n");
+    printf("<table BORDER='0'>\n");
     while ($row0 = mysql_fetch_assoc($result0))
     {
@@ -427,4 +452,6 @@
             printf(" <tr BGCOLOR='#C0C0C0'>\n");
             $first = FALSE;
+            if ($form)
+                printf("<td>ON</td><td>Off</td>");
             foreach ($row0 as $key => $element)
             {
@@ -455,10 +482,17 @@
         $col = !$col;
 
+        if ($form)
+        {
+//            printf("<td>%s</td>",$row0["Sequ"]."ON");
+//            printf("<td>%s</td>",$row0["Sequ"]."Off");
+            CheckBox2($row0["Sequ"], "ON","");
+            CheckBox2($row0["Sequ"], "Off","");
+        }
         foreach ($row0 as $key => $element)
         {
             if (empty($rightalign[$key]))
-                printf("  <td align=\"left\">");
+                printf("  <td align='left'>");
             else
-                printf("  <td align=\"right\">");
+                printf("  <td align='right'>");
 
             //determine color of text in cell
@@ -551,7 +585,11 @@
         printf("%s\n", $menu);
     printf("<P>\n");
-    printf("</center>\n");
-    printf("</td>\n");
-    printf("</tr>\n");
+
+    if (!$form)
+    {
+        printf("</center>\n");
+        printf("</td>\n");
+        printf("</tr>\n");
+    }
 }
 
