Index: trunk/www/dch/download.php
===================================================================
--- trunk/www/dch/download.php	(revision 19047)
+++ trunk/www/dch/download.php	(revision 19058)
@@ -11,14 +11,21 @@
 </head>
 <body>
-    <!--
-    <hr>
-    <p style='font-size:xx-large'> MAINTENANCE ONGOING </p>
-    <p>check again in a few hours...</p>
-    <p>
-    <hr>
-    <p>
-    <p>
-     -->
 <?php
+
+function print_popup($text)
+{
+    echo "<script type=\"text/javascript\" language=\"Javascript\">\n";
+    echo "alert(\"".$text."\")\n";
+    echo "</script>\n";
+}
+$maintenance=0;
+//$maintenance=1;
+
+if ($maintenance)
+{
+    echo "<hr>\n <p style='font-size:xx-large'> MAINTENANCE ONGOING </p>\n";
+    echo "<p>check again in a few hours...</p>\n<p>\n<hr>\n<p>\n<p>\n";
+}
+
 
 $tables=array(
@@ -28,5 +35,5 @@
 
 $times=array(
-      "time"   => "timestamp",
+      "timestamp"   => "timestamp",
       "unix"   => "unixtime",
       "mjd"   => "MJD",
@@ -220,14 +227,24 @@
 mysql_free_result($result);
 
+if (strpos($email, "@")!= false && $source<0)
+    print_popup("Please select a source.");
+
+if (strpos($email, "@")!= false && $time=="novalue")
+    print_popup("Please select a time format.");
+
+if (strpos($email, "@")!= false && $timebin=="novalue")
+    print_popup("Please select a time binning.");
+
+if (empty($email) && $time!="novalue" && $timebin!="novalue" && $source>0)
+    print_popup("Please provide an email address.");
+
+
 if (strpos($email, "@")!= false && $source>0)
 {
     echo "<h2>Sending data...</h2>\n";
-    printf("Sent email to %s containing the data of %s from %d till %d for %s binning.<br>\n", $email, $sources[$source], $start, $stop, $timebins[$timebin]);
-    //printf("Sending email to %s containing the data of %s from %d till %d for %s binning...<br>\n", $email, $sources[$source], $start, $stop, $timebins[$timebin]);
-    //echo "<input class='Width' type='button' value='Reset' onClick='self.location.href=\"download.php";
-    //if ($expert == "yes")
-    //    echo "?expert=yes";
-    //echo "\"'><br>\n";
-    //echo $start." ".$stop." ".$source." ".$timebin." ".$email." ".$table." ".$time." ".$expert." ".$dch." ".$zd." ".$th." ".$light." ".$dust."<br>\n";
+    //print_popup("Sent email to ".$email." containing the data of ".$sources[$source]." from ".$start." till ".$stop." for ".$timebins[$timebin]." binning.");
+    print_popup("Email with data sent to ".$email);
+    if ($maintenance)
+        echo $start." ".$stop." ".$source." ".$timebin." ".$email." ".$table." ".$time." ".$expert." ".$dch." ".$zd." ".$th." ".$light." ".$dust."<br>\n";
     $sent=shell_exec("/users/fact/SW.automatic.processing/DataCheck/Tools/get_data.sh ".$start." ".$stop." ".$source." ".$timebin." ".$email." ".$table." ".$time." ".$expert." ".$dch." ".$zd." ".$th." ".$light." ".$dust);
     echo $sent;
@@ -340,5 +357,5 @@
 
     //ZD
-    echo "<select name='zdcut' size='1'>\n";
+    echo "<select name='zd' size='1'>\n";
     if ($zd == "novalue")
         printf("<option value='novalue' selected>Select Zd-Cut</option>\n");
@@ -355,5 +372,5 @@
 
     //TH
-    echo "<select name='thcut' size='1'>\n";
+    echo "<select name='th' size='1'>\n";
     if ($th == "novalue")
         printf("<option value='novalue' selected>Select Threshold-Cut</option>\n");
@@ -376,5 +393,5 @@
     foreach ($lights as $key => $name)
     {
-        if ($lightt == $key)
+        if ($light == $key)
             printf("<option value='%s' selected>%s</option>\n", $key, $name);
         else
@@ -399,5 +416,5 @@
 
 
-if ($expert="yes")
+if ($expert=="yes")
 {
     echo "<ul>\n";
