Index: trunk/MagicSoft/Mars/datacenter/db/showplots-ds.php
===================================================================
--- trunk/MagicSoft/Mars/datacenter/db/showplots-ds.php	(revision 8593)
+++ trunk/MagicSoft/Mars/datacenter/db/showplots-ds.php	(revision 8598)
@@ -4,4 +4,5 @@
 
 include("plotinclude.php");
+//print header
 printf("<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n");
 printf("<html>\n<head>\n");
@@ -12,4 +13,5 @@
 printf("<body>\n");
 
+//init
 $ds=0;
 if (!empty($_GET["ds"]))
@@ -33,9 +35,24 @@
 $numseq=0;
 
+//check if dataset file is existing
 if (!empty($ds))
 {
     $num=sprintf("%08d",$ds);
     $num2=substr($num,0,5);
-    $datasetfile="http://datacenter.astro.uni-wuerzburg.de/datasets/" . $num2 . "/dataset" . $num . ".txt";
+    $datasetfile="../datasets/" . $num2 . "/dataset" . $num . ".txt";
+    if (!file_exists($datasetfile))
+    {
+        printf("Sorry, there's no file for dataset %s available.", $ds);
+        //set dataset and sequence numbers to 0 for next checks
+        $ds=0;
+        $seq=0;
+    }
+}
+
+//in case of a valid dataset
+if (!empty($ds))
+{
+    //get sequences from dataset file
+    // alternative: query it from db
     $dataset=file_get_contents($datasetfile);
     $onpos=strpos($dataset, "SequencesOn:");
@@ -53,4 +70,6 @@
     if ($seq!=0 && !in_array($seq, $sequences))
         $seq=0;
+
+    //get next, current and previous sequence
     foreach($sequences as $key => $sequ)
     {
@@ -72,14 +91,19 @@
     }
     $numseq=count($sequences);
+
+    //in case a dataset consists of less than 3 sequences
     if ($numseq==2)
         $nextseq=$prevseq;
 }
 
+//get link for plot
 $type=gettypename($type2);
 $plot=getplotname($seq, $tabnum, $type, $type2);
 
+//print form for choosing dataset and plots
 printf("<form action='showplots-ds.php' method='GET'>\n");
 printf("<table width='100%%' border='0'>\n");
-printf("<tr><td align='center'>\n");
+printf("<tr><td valign='top'>\n");
+printf("<a href='http://db.astro.uni-wuerzburg.de'>home</a>\n</td><td align='center'>");
 if (!empty($prevseq))
     printf("%d &nbsp;", $prevseq);
@@ -87,5 +111,5 @@
     printf("<input type='submit' value='<< Prev Plot' name='prev'>\n");
 printf("<input type='text' name='ds' size='5' maxlength='5' value='%s'>\n", $ds);
-printf("<input type='text' name='type2' size='6' maxlength='6' value='%s'>\n", $type2);
+PrintType2PullDown($type2);
 printf("<input type='text' name='tabnum' size='2' maxlenght='2' value='%s'>\n", $tabnum);
 printf("<input type='hidden' name='prevseq' size='2' maxlenght='2' value='%s'>\n", $prevseq);
@@ -104,5 +128,7 @@
     print(" ] \n");
 }
-printf("</td>\n</tr>\n<tr>\n<td align='center'>\n");
+printf("</td><td align='right'>\n");
+printf("<input class='Width' type='button' value='Reset' onClick='self.location.href=\"showplots-ds.php\"'>\n");
+printf("</td>\n</tr>\n<tr>\n<td align='center' colspan='3'>\n");
 if (!empty($seq))
 {
@@ -114,5 +140,5 @@
 }
 else
-    printf("You have to insert a dataset number in the first field.");
+    printf("You have to insert a dataset number into the first field.");
 printf("</td>\n</tr>\n</table>\n");
 printf("</form>\n");
Index: trunk/MagicSoft/Mars/datacenter/db/showplots.php
===================================================================
--- trunk/MagicSoft/Mars/datacenter/db/showplots.php	(revision 8593)
+++ trunk/MagicSoft/Mars/datacenter/db/showplots.php	(revision 8598)
@@ -11,4 +11,5 @@
 printf("<body>\n");
 
+//init
 $seq=0;
 if (!empty($_GET["seq"]))
@@ -25,10 +26,9 @@
 if (!empty($seq))
 {
+    //decision whether next or previous plot has been chosen
     if (!empty($_GET["next"]))
         $tabnum=$tabnum+1;
     if (!empty($_GET["prev"]))
         $tabnum=$tabnum-1;
-    $type=gettypename($type2);
-    $plot=getplotname($seq, $tabnum, $type, $type2);
 
     //be careful: this has to be adapted in case tabs are removed or new tabs are added
@@ -41,4 +41,6 @@
     $startabs=18;
 
+    //in case the tab does not exist, because it's one the far
+    //go to next type
     if (($type2=="calib" && $tabnum==($calibtabs+1))
         || ($type2=="signal" && $tabnum==($signaltabs+1))
@@ -58,7 +60,7 @@
             break;
         }
-        $type=gettypename($type2);
-        $plot=getplotname($seq, $tabnum, $type, $type2);
     }
+    //in case the tab does not exist, because it's 0
+    //go to previous type
     if ($tabnum==0)
     {
@@ -78,7 +80,9 @@
             break;
         }
-        $type=gettypename($type2);
-        $plot=getplotname($seq, $tabnum, $type, $type2);
     }
+    //get link for plot
+    $type=gettypename($type2);
+    $plot=getplotname($seq, $tabnum, $type, $type2);
+
     $next=$tabnum+1;
     $prev=$tabnum-1;
@@ -86,7 +90,8 @@
 printf("<form action='showplots.php' method='GET'>\n");
 printf("<table width='100%%' border='0'>\n");
-printf("<tr><td align='center'>\n");
+printf("<tr><td valign='top'>\n");
+printf("<a href='http://db.astro.uni-wuerzburg.de'>home</a>\n</td><td align='center'>");
 printf("<input type='text' name='seq' size='10' maxlength='10' value='%s'>\n", $seq);
-printf("<input type='text' name='type2' size='10' maxlength='10' value='%s'>\n", $type2);
+PrintType2PullDown($type2);
 printf("<input type='text' name='tabnum' size='2' maxlenght='2' value='%s'>\n", $tabnum);
 printf("<input type='submit' value='Show Plot'><br>\n");
@@ -97,9 +102,9 @@
     printf("<input type='submit' value='Next Plot %d >>' name='next'>\n", $next);
 }
-printf("</td>\n</tr>\n<tr>\n<td align='center'>\n");
+printf("</td>\n</tr>\n<tr>\n<td align='center' colspan='2'>\n");
 if (!empty($seq))
     printf("<img src='%s'>", $plot);
 else
-    printf("You have to select a sequence.");
+    printf("You have to insert a sequence number into the first field.");
 printf("</td>\n</tr>\n</table>\n");
 printf("</form>\n");
