Index: trunk/MagicSoft/Mars/datacenter/db/ganymed.php
===================================================================
--- trunk/MagicSoft/Mars/datacenter/db/ganymed.php	(revision 7571)
+++ trunk/MagicSoft/Mars/datacenter/db/ganymed.php	(revision 7578)
@@ -20,8 +20,22 @@
         $query0 .= " LEFT JOIN Ganymed ON DataSets.fDataSetNumber=Ganymed.fDataSetNumber ";
 
-        $query0 .= " WHERE DataSets.fDataSetNumber between " . $_GET["fRunMin"] . " and " . $_GET["fRunMax"] ;
+        if (!empty($_GET["fRunMin"]) && !empty($_GET["fRunMax"]))
+            $query0 .= " WHERE DataSets.fDataSetNumber between " . $_GET["fRunMin"] . " and " . $_GET["fRunMax"] ;
         if (!empty($_GET["fDataSetNo"]))
-            $query0 .= " AND DataSets.fDataSetNumber='" . $_GET["fDataSetNo"] . "'";
-        $query0 .= " AND fSourceName REGEXP \"^" . $_GET["fSourceN"] . "\" ";
+        {
+            if (strpos($query0, " WHERE ")==FALSE)
+                $query0 .= " WHERE ";
+            else
+                $query0 .= " AND ";
+            $query0 .= " DataSets.fDataSetNumber='" . $_GET["fDataSetNo"] . "'";
+        }
+        if (!empty($_GET["fSourceN"]))
+        {
+            if (strpos($query0, " WHERE ")==FALSE)
+                $query0 .= " WHERE ";
+            else
+                $query0 .= " AND ";
+            $query0 .= " fSourceName REGEXP \"^" . $_GET["fSourceN"] . "\" ";
+        }
         $query0 .= " ORDER BY DataSets.fDataSetNumber ";
 
@@ -117,36 +131,6 @@
         return "there is an error -> tell Dani";
     }
-/*
-    function GetSequences($datasetfile)
-//    function QueryRuns($type, $sequ, $db_id, $db)
-    {
-        printf(" <td align='left'>");
-        printf(" to be done");
-        printf(" </td>\n");
-        printf(" <td> to be done ");
-        printf(" </td>\n");
-     }
-
-    function QueryMissingFiles($sequ, $db_id, $db)
-    {
-        $query2  = "SELECT fSequenceFirst FROM SequencesSequenceProcessStatus ";
-        $query2 .= " WHERE fSequenceFirst=" . $sequ . " AND IsNull(fStar)";
-
-        mysql_select_db($db);
-        $files = mysql_query($query2, $db_id);
-        $numfiles = mysql_num_rows($files);
-        printf(" <td align='left'>");
-        for ($i=0 ; $i<$numfiles ; $i++)
-        {
-            $file=mysql_result($files, $i, 0);
-            if ($i!=0)
-                printf(", ");
-            printf(" %s ", $file);
-        }
-        printf(" </td>\n");
-     }
-*/
-
-    function PrintDataSetInfo($result0)
+
+    function PrintDataSetInfo($result0, $ganymedtabs)
     {
         $numres = mysql_num_rows($result0);
@@ -234,10 +218,5 @@
                     $sequences=split(" ", trim($sequon));
                     foreach($sequences as $key => $sequ)
-                    {
-                        $sequno=sprintf("%08d",$sequ);
-                        $sequno2=substr($sequno,0,4);
-                        printf("<a href=\"http://www.astro.uni-wuerzburg.de/datacenter/star/%s/%s/\">%s</a> ",
-                               $sequno2, $sequno, $sequ);
-                    }
+                        printf("<a href=\"sequence.php?fSequenceNo=%s&fAll=On\">%s</a> ", $sequ, $sequ);
                     printf("</td></tr>");
 
@@ -247,13 +226,15 @@
                         $sequences=split(" ", trim($sequoff));
                         foreach($sequences as $key => $sequ)
-                        {
-                            $sequno=sprintf("%08d",$sequ);
-                            $sequno2=substr($sequno,0,4);
-                            printf("<a href=\"http://www.astro.uni-wuerzburg.de/datacenter/star/%s/%s/\">%s</a> ",
-                                   $sequno2, $sequno, $sequ);
-                        }
+                            printf("<a href=\"sequence.php?fSequenceNo=%s&fAll=On\">%s</a> ", $sequ, $sequ);
+                        printf("</td></tr>");
                     }
                 }
             }
+            printf("<tr><td colspan=\"6\">\n Plots: ");
+            foreach($ganymedtabs as $key => $element)
+                if (!$key==0)
+                    printf("<a href=\"http://www.astro.uni-wuerzburg.de/datacenter/ganymed/%s/%s/ganymed%s-tab%s.png\">%s</a> ", $num2, $num, $num, $key, $element);
+
+            printf("</td></tr>");
 
             if ($_GET["fAll"]=="On" && !is_null($ganymed))
@@ -276,5 +257,5 @@
     }
 
-    function PrintPage($html, $host, $user, $pw, $db)
+    function PrintPage($html, $host, $user, $pw, $db, $ganymedtabs)
     {
         $db_id = mysql_connect($host, $user, $pw);
@@ -293,5 +274,5 @@
         {
             if ($html=="1" || $html=="2")
-                PrintDataSetInfo($result0);
+                PrintDataSetInfo($result0, $ganymedtabs);
             else
                 PrintText($result0);
@@ -307,4 +288,5 @@
     include ("include.php");
     include ("db.php");
+    include ("tabs.php");
 
     ini_set("display_errors", "On");
@@ -316,5 +298,5 @@
         header("Content-Disposition: attachment; filename=query-result.txt");
 
-        PrintPage("0", $host, $user, $pw, $db);
+        PrintPage("0", $host, $user, $pw, $db, $ganymedtabs);
     }
     else
@@ -333,7 +315,7 @@
         {
             if (empty($_GET["fPrintTable"]))
-                PrintPage("1", $host, $user, $pw, $db);
-            else
-                PrintPage("2", $host, $user, $pw, $db);
+                PrintPage("1", $host, $user, $pw, $db, $ganymedtabs);
+            else
+                PrintPage("2", $host, $user, $pw, $db, $ganymedtabs);
         }
 
