Index: trunk/pstamp/web/request.php
===================================================================
--- trunk/pstamp/web/request.php	(revision 18247)
+++ trunk/pstamp/web/request.php	(revision 18552)
@@ -19,7 +19,8 @@
 // BEGIN Local configuration
 
-$COMMAND_DIR = "/export/data0/bills/psconfig/debug.linrh64/bin";
-$dsroot = "/export/data1/datastore/dsroot";
-$dbname = "simtest";
+$COMMAND_DIR = "XXX";
+$WORKDIR = "XXX";
+$dsroot = "XXX";
+$dbname = "XXX";
 
 // END Local configuration 
@@ -52,5 +53,11 @@
 
 // Initialize the request variables that we depend upon
-$rvar_project="simtest";
+$rvar_project="";
+
+$gpc1_selected="";
+$mops_selected="";
+$simtest_selected="";
+
+$require_class_id = 0;
 
 $rvar_user_tag="";
@@ -81,4 +88,15 @@
 
 import_request_variables("gp", "rvar_");
+
+if ($rvar_project == "gpc1") {
+    $gpc1_selected = "selected";
+    $require_class_id = 1;
+} else if ($rvar_project == "simtest") {
+    $simtest_selected = "selected";
+    $require_class_id = 0;
+} else {
+    $mops_selected = "selected";
+    $require_class_id = 0;
+}
 
 // figure out which select_by is set and save it's checked value 
@@ -184,4 +202,6 @@
                 }
 
+            } else {
+                $last_request_id = 0;
             }
         } catch (Exception $e) {
@@ -229,12 +249,10 @@
     $cmd = "pstamp_runcommand.sh pstamp_webrequest.pl";
 
-    // NOTE: If it is used, -list_uri must be the first argument to pstamp_webrequest.pl 
-    
     if ($list_checked) {
-        $cmd .= " -list_uri";
+        $cmd .= " --job_type list_uri";
         $making_stamps = 0;
     } else if ($get_checked) {
         $making_stamps = 0;
-        $cmd .= " -get_image";
+        $cmd .= " --job_type get_image";
     }
 
@@ -246,5 +264,5 @@
         throw new Exception('project must be specified.');
     }
-    $cmd .= " -project $rvar_project";
+    $cmd .= " --project $rvar_project";
 
     if (!$rvar_user_tag) {
@@ -308,8 +326,8 @@
 
     if (($rvar_img_type == "raw") || ($rvar_img_type == "chip")) {
-#        if (! $rvar_class_id ) {
-#            throw new Exception("must specify Class ID with Image Type $rvar_img_type.");
-#        }
-        if ((!$rvar_class_id) || ($rvar_class_id = "all")) {
+        if ($require_class_id && ! $rvar_class_id ) {
+            throw new Exception("must specify Class ID with Image Type $rvar_img_type.");
+        }
+        if ((!$rvar_class_id) || ($rvar_class_id == "all")) {
             $cmd .= " null";
         } else {
@@ -328,10 +346,10 @@
     global $COMMAND_DIR;
 
-    // echo "running $command_line\n";
+    //    echo "running $command_line\n";
 
     exec ("$COMMAND_DIR/$command_line", $output_array, $command_status);
 
     $size = sizeof($output_array);
-    // echo "output_array  contains $size lines\n";
+    //     echo "command_status: $command_status output_array  contains $size lines\n";
     if ($command_status == 0) {
         // On success we just remember the results
@@ -361,5 +379,5 @@
     $doURL = 1;
     if ($doURL) {
-        // echo "output_line: $line\n";
+//        echo "output_line: $line\n";
         $elements = explode(" ", $line);
         if (count($elements) == 3) {
@@ -428,5 +446,5 @@
         global $outFileset;
         global $dsroot;
-        $parse_error = "$dsroot/$outFileset/parse_error";
+        $parse_error = "$WORKDIR/$request_id/parse_error.txt";
         #echo "reading $parse_error\n";
         // readfile( $parse_error );
@@ -520,6 +538,7 @@
     <tr><td><b>Project:</b>&nbsp;&nbsp;&nbsp;</td>
         <td><select name="project">
-<!--            <option>gpc1 -->
-            <option>simtest
+           <option <?php echo $gpc1_selected;?> >gpc1
+           <option <?php echo $mops_selected;?> >megacam-mops
+           <option <?php echo $simtest_selected;?> >simtest
         </td>
     </tr>
@@ -562,5 +581,5 @@
 &nbsp;&nbsp;&nbsp;&nbsp;
 <b>
-<?php if ($rvar_project == "gpc1") {
+<?php if (0 && $rvar_project == "gpc1") {
         echo "Chip ID:";
       } else {
@@ -747,4 +766,5 @@
 <?php 
     $size = sizeof($output_array);
+    // echo "<pre>size of output array is $size\n</pre>";
     if ($command_status == 0) {
         if ($list_checked) {
@@ -752,10 +772,14 @@
             // later we might add links to cause a stamp to be made from a selected file
             for ($i = 0; $i < $size; $i++)  {
-                echo "<tr><td>$output_array[$i]</td></tr>";
+                // $uri = array_shift($output_array);
+                $uri = $output_array[$i];
+                echo "<tr><td>$uri</td></tr>";
             }
         } else {
             // output the list of urls
             for ($i = 0; $i < $size; $i++)  {
-                printURL($output_array[$i]);
+                // $uri = array_shift($output_array);
+                $uri = $output_array[$i];
+                printURL($uri);
             }
         }
