Index: /trunk/MagicSoft/Mars/Changelog
===================================================================
--- /trunk/MagicSoft/Mars/Changelog	(revision 8465)
+++ /trunk/MagicSoft/Mars/Changelog	(revision 8466)
@@ -24,4 +24,12 @@
      - moved temporary directory for pstoimg to /tmp
 
+   * datacenter/db/plotdb.php, datacenter/db/plotinclude.php, 
+     datacenter/db/menu.js  :
+     - implemented possibility to plot datasets by inserting dataset 
+       number as Set1
+
+   * datacenter/db/plot.php:
+     - implemented variables for colours
+
 
 
Index: /trunk/MagicSoft/Mars/datacenter/db/menu.js
===================================================================
--- /trunk/MagicSoft/Mars/datacenter/db/menu.js	(revision 8465)
+++ /trunk/MagicSoft/Mars/datacenter/db/menu.js	(revision 8466)
@@ -150,2 +150,14 @@
 }
 
+function showset2()
+{
+    var el = document.getElementById("set2");
+    el.style.display="inline";
+}
+
+function hideset2()
+{
+    var el = document.getElementById("set2");
+    el.style.display="none";
+}
+
Index: /trunk/MagicSoft/Mars/datacenter/db/plot.php
===================================================================
--- /trunk/MagicSoft/Mars/datacenter/db/plot.php	(revision 8465)
+++ /trunk/MagicSoft/Mars/datacenter/db/plot.php	(revision 8466)
@@ -55,12 +55,17 @@
 $labelfont="arialdb.ttf";
 $labelsize=10;
+//colours
+$colour=0x000000;
+$setcolour=0x0080ff;
+$set2colour=0xff0000;
+
 if ($_GET["plot"]=="val")
 {
     $column2=$_GET[$primary."Col2"];
-    $c->addScatterLayer($val2, $val1, $column, CircleSymbol, $small, 0x000000, 0x000000);
+    $c->addScatterLayer($val2, $val1, $column, CircleSymbol, $small, $colour, $colour);
     if (!empty($_GET["Set"]))
-        $c->addScatterLayer($Setval2, $Setval1, $column, CircleSymbol, $large, 0x0080ff, 0x0080ff);
+        $c->addScatterLayer($Setval2, $Setval1, $column, CircleSymbol, $large, $setcolour, $setcolour);
     if (!empty($_GET["Set2"]))
-        $c->addScatterLayer($Set2val2, $Set2val1, $column, CircleSymbol, $large, 0xff0000, 0xff0000);
+        $c->addScatterLayer($Set2val2, $Set2val1, $column, CircleSymbol, $large, $set2colour, $set2colour);
     $c->yAxis->setTitle($column, $axisfont, $axissize);
     $c->xAxis->setTitle($column2, $axisfont, $axissize);
@@ -69,9 +74,9 @@
 else
 {
-    $c->addScatterLayer($prim, $val1, $column, CircleSymbol, $small, 0x000000, 0x000000);
+    $c->addScatterLayer($prim, $val1, $column, CircleSymbol, $small, $colour, $colour);
     if (!empty($_GET["Set"]))
-        $c->addScatterLayer($Setprim, $Setval1, $column, CircleSymbol, $large, 0x0080ff, 0x0080ff);
+        $c->addScatterLayer($Setprim, $Setval1, $column, CircleSymbol, $large, $setcolour, $setcolour);
     if (!empty($_GET["Set2"]))
-        $c->addScatterLayer($Set2prim, $Set2val1, $column, CircleSymbol, $large, 0xff0000, 0xff0000);
+        $c->addScatterLayer($Set2prim, $Set2val1, $column, CircleSymbol, $large, $set2colour, $set2colour);
     $c->yAxis->setTitle($column, $axisfont, $axissize);
     $c->xAxis->setTitle($primary, $axisfont, $axissize);
Index: /trunk/MagicSoft/Mars/datacenter/db/plotdb.php
===================================================================
--- /trunk/MagicSoft/Mars/datacenter/db/plotdb.php	(revision 8465)
+++ /trunk/MagicSoft/Mars/datacenter/db/plotdb.php	(revision 8466)
@@ -1,4 +1,32 @@
 <?php
 {
+    function GetSequencesFromDataSet($onoff)
+    {
+        include("db.php");
+        $db_id = mysql_pconnect($host, $user, $pw);
+        if ($db_id==FALSE)
+        {
+            printf("mysql_connect returned the following error: %s\n", mysql_error());
+            die("");
+        }
+        mysql_select_db($db);
+        $query="SELECT fSequenceFirst FROM DataSetSequenceMapping WHERE fDataSetNumber IN (";
+        $query .= str_replace(" ", ",", trim($_GET["Set"])) . ") AND fOnOff=" . $onoff;
+//        printf("Q: %s<br>", $query);
+        $result=mysql_query($query, $db_id);
+
+        $sequences="";
+        while ($row = mysql_fetch_row($result))
+            $sequences.= $row[0] . " ";
+
+        mysql_free_result($result);
+        mysql_close($db_id);
+
+        $text="";
+        if (!empty($sequences))
+            $text.= str_replace(" ", "+", trim($sequences));
+        return $text;
+    }
+  
     function PrintDiv($host, $user, $pw, $db, $column, $tables, $num)
     {
@@ -81,4 +109,6 @@
     if (empty($_GET["Set2"]))
         $_GET["Set2"]="";
+    if (empty($_GET["set"]))
+        $_GET["set"]="";
 
     printf("<center>\n<table cellpadding='0'>\n");
@@ -139,9 +169,16 @@
 
     printf("</table>\n");
-
-    printf("<br>Set1: <input name='Set' type='text' size='20' maxlength='100' value='%s'>\n", $_GET["Set"]);
-    printf("<br>Set2: <input name='Set2' type='text' size='20' maxlength='100' value='%s'>\n", $_GET["Set2"]);
-
-    printf("<br><br><input class='Width' type='submit' value='Query Plot'><br>\n");
+    printf("<br>\n");
+
+    printf("&nbsp;<input type='radio' name='set' value='sequences' onclick='showset2()' %s> sequences &nbsp;\n", $_GET["set"]=="sequences" ? "checked" : "");
+    printf("&nbsp;<input type='radio' name='set' value='datasets' onclick='hideset2()' %s> datasets <br>\n", $_GET["set"]=="datasets" ? "checked" : "");
+
+    printf("<div id='set1' style='display:inline'>Set1: <input name='Set' type='text' size='20' maxlength='100' value='%s'>\n</div>\n<br>\n", $_GET["Set"]);
+    if (empty($_GET["set"]) || $_GET["set"]=="sequences")
+        printf("<div id='set2' style='display:inline'>Set2: <input name='Set2' type='text' size='20' maxlength='100' value='%s'>\n</div>\n<br>\n", $_GET["Set2"]);
+    else
+        printf("<div id='set2' style='display:none'>Set2: <input name='Set2' type='text' size='20' maxlength='100' value='%s'>\n</div>\n<br>\n", $_GET["Set2"]);
+
+    printf("<br><input class='Width' type='submit' value='Query Plot'><br>\n");
     printf("<input class='Width' type='button' value='Reset' onClick='self.location.href=\"plotdb.php\"'><br>\n");
 
@@ -154,5 +191,15 @@
         $img="plot.php?par=hallo";
         foreach($_GET as $var => $val)
+        {
+            if ($var=="Set2" && $_GET["set"]=="datasets")
+                continue;
+            if ($var=="Set" && $_GET["set"]=="datasets" && !empty($val))
+            {
+                $img.= "&amp;Set=" . GetSequencesFromDataSet("1");
+                $img.= "&amp;Set2=" . GetSequencesFromDataSet("2");
+                continue;
+            }
             $img.="&amp;".$var ."=".$val;
+        }
 //        printf("link: %s<br>", $img);
         printf("<img src='%s' alt='plot'>", $img);
@@ -161,16 +208,31 @@
     printf("<tr><td colspan='2'>\n");
     printf("some remarks:\n<ul>");
-    printf("<li>For Runs plotting the whole range (i.e. without giving a range or when giving a too large range) ");
+    printf("<li>For Runs plotting the whole range (i.e. without giving a range or when giving a too large range) \n");
     printf("doesn't work with ChartDirector.</li>\n");
-    printf("<li>In Set1 and Set2 Sets can be given (e.g. on sequences in Set1 and off sequences in Set2) - they ");
-    printf("are displayed in colour (Set: blue, Set2: red). Please give the numbers with space as separator (e.g. 40004 40022).</<li>\n");
-    printf("<li>0 is not accepted in the ranges fields, please write .0 or 00</li>");
-    printf("<li>Be aware, that plotting timestamps, e.g. fRunStart, doesn't work. </li>");
-    printf("</ul></td></tr>\n");
+    printf("<li>In Set1 and Set2 Sets can be given: <br>\n ");
+    printf("If 'sequences' is selected e.g. on sequences in Set1 (displayed in blue) and off sequences in Set2 \n");
+    printf("(diplayed in red). <br>\n ");
+    printf("If 'datasets' is selected you can enter a dataset number as Set1. The on data is displayed in blue, \n");
+    printf("the off data in red. <br>\n");
+    printf("&nbsp;&nbsp;&nbsp;Please give the numbers with space as separator (e.g. 40004 40022).<br>\n</<li>\n");
+    printf("<li>0 is not accepted in the ranges fields, please write .0 or 00</li>\n");
+    printf("<li>Be aware, that plotting timestamps, e.g. fRunStart, and strings, e.g. fComment doesn't work. </li>\n");
+    printf("</ul>\n</td>\n</tr>\n");
 
     /*
-    printf("<tr><td>\n");
+    printf("<tr><td colspan='2'>\n");
     $query=GetQuery($tables, $joins, "");
-    printf("Q: %s</td></tr>", $query);
+    printf("Q: %s<br>", $query);
+    if (!empty($_GET["Set"]))
+    {
+        $query=GetQuery($tables, $joins, "Set");
+        printf("Q: %s<br>", $query);
+    }
+    if (!empty($_GET["Set2"]))
+    {
+        $query=GetQuery($tables, $joins, "Set2");
+        printf("Q: %s<br>", $query);
+    }
+    printf("</td></tr>");
     */
 
