Index: trunk/ippMonitor/Makefile
===================================================================
--- trunk/ippMonitor/Makefile	(revision 13566)
+++ trunk/ippMonitor/Makefile	(revision 13595)
@@ -32,4 +32,5 @@
 
 DEFSRC = \
+$(DESTBIN)/keptDetrendFrames.php \
 $(DESTBIN)/masterDetrendFrames.php \
 $(DESTBIN)/masterDetrendImfiles.php \
Index: trunk/ippMonitor/def/detInputExp.d
===================================================================
--- trunk/ippMonitor/def/detInputExp.d	(revision 13566)
+++ trunk/ippMonitor/def/detInputExp.d	(revision 13595)
@@ -14,4 +14,8 @@
 ARGS  ARG2  detProcessedImfile.iteration=$detInputExp.iteration
 
+HEAD PHP if ($_GET['detInputExp_det_id']) { 
+HEAD PHP   echo "<a href=detResidExp.php?" . $ID['link'] . "> resid </a>";
+HEAD PHP   echo "<a href=detProcessedExp.php?" . $ID['link'] . "> proc </a>"; }
+
 #     field                  width 	name        show         link to                 extras
 FIELD detInputExp.det_id,    7,    	det_id
Index: trunk/ippMonitor/def/detProcessedExp.d
===================================================================
--- trunk/ippMonitor/def/detProcessedExp.d	(revision 13566)
+++ trunk/ippMonitor/def/detProcessedExp.d	(revision 13595)
@@ -16,4 +16,6 @@
 ARGS  ARG1 basename=$detProcessedExp.path_base
 
+OP    OP1  $detProcessedExp.bg / $detProcessedExp.bg_stdev
+
 #     field                    size    	name       show          link to                 extras
 FIELD detProcessedExp.det_id,     7,   	Det ID,    value
@@ -24,5 +26,10 @@
 FIELD detProcessedExp.bg_mean_stdev, 8,	[stdev],   value
 FIELD detProcessedExp.bg_stdev,   8,   	stdev,     value
-FIELD detProcessedExp.recipe,    15,   	Recipe,    value
+FIELD *,                          8,    S/N,       op=OP1
+FIELD rawExp.dateobs,             8,   	obs date,  value
+FIELD rawExp.filter,              8,   	filter,    value
+FIELD rawExp.exp_time,            8,   	exptime,   value
+FIELD rawExp.ccd_temp,            8,   	ccd temp,  value
+FIELD rawExp.airmass,             8,   	airmass,   value
 FIELD detProcessedExp.path_base, 20,   	path_base, none
 
Index: trunk/ippMonitor/def/detResidExp.d
===================================================================
--- trunk/ippMonitor/def/detResidExp.d	(revision 13566)
+++ trunk/ippMonitor/def/detResidExp.d	(revision 13595)
@@ -20,15 +20,23 @@
 ARGS  ARG2 basename=$detResidExp.path_base
 
+OP    OP1  $detResidExp.bg / $detResidExp.bg_stdev
+
 #     field                   size    name       show         link to              linkargs
 FIELD detResidExp.det_id,        7,   Det ID,    value
+FIELD rawExp.camera,            10,   camera,    value
 FIELD detResidExp.exp_tag, 	15,   Exposure,  value,       rawImfile.php,       ARG1
+FIELD detResidExp.iteration,     5,   iter,      value
+FIELD *,    	                 8,   image,     image=JPEG2, detResidImfile.php,  ARG2
 FIELD detResidExp.bg,            8,   backgnd,   value
 FIELD detResidExp.bg_mean_stdev, 8,   [stdev]
 FIELD detResidExp.bg_stdev,      8,   stdev,     value
-FIELD detResidExp.iteration,     5,   iter,      value
-FIELD *,    	                 8,   image,     image=JPEG2, detResidImfile.php,  ARG2
+FIELD *,                         8,   S/N,       op=OP1
+FIELD rawExp.dateobs,            8,   obs date,  value
+FIELD rawExp.filter,             8,   filter,    value
+FIELD rawExp.exp_time,           8,   exptime,   value
+FIELD rawExp.ccd_temp,           8,   ccd temp,  value
+FIELD rawExp.airmass,            8,   airmass,   value
 FIELD detResidExp.accept,        4,   keep,      value
-FIELD detResidExp.path_base,    20,   path_base,  none
-FIELD rawExp.camera,            20,   camera,     none
+FIELD detResidExp.path_base,    20,   path_base, none
 
 TD_CLASS list_off $detResidExp.accept == 0
Index: trunk/ippMonitor/def/detResidImfile.d
===================================================================
--- trunk/ippMonitor/def/detResidImfile.d	(revision 13566)
+++ trunk/ippMonitor/def/detResidImfile.d	(revision 13595)
@@ -14,5 +14,5 @@
 # FIELD uri,        20,   uri
 # FIELD recipe,     20,   recipe
-# FIELD path_base,  20,   path_base
+FIELD path_base,  20,   path_base
 
 TAIL PHP insert_image ('PPIMAGE.JPEG1');
Index: trunk/ippMonitor/def/detRun.d
===================================================================
--- trunk/ippMonitor/def/detRun.d	(revision 13566)
+++ trunk/ippMonitor/def/detRun.d	(revision 13595)
@@ -4,11 +4,22 @@
 MENU  ipp.detrend.dat
 
-ARGS  ARG1 det_id=$det_id
+ARGS  ARG1 detRunSummary.det_id=$det_id
 
-#     field       width name         show    link to              extras
-FIELD det_id,        7,   det ID,      value,  detRunSummary.php,   ARG1
-FIELD iteration,     5,   iteration
-FIELD det_type,      8,   det_type
+ARGS  ARG2 detInputExp.det_id=$det_id
+ARGS  ARG2 detInputExp.iteration=$iteration
+
+ARGS  ARG3 detProcessedExp.det_id=$det_id
+
+ARGS  ARG4 detResidExp.det_id=$det_id
+ARGS  ARG4 detResidExp.iteration=$iteration
+
+#     field       width name            show         link to                extras
+FIELD det_id,        5,   det ID,       value,       detRunSummary.php,     ARG1
+FIELD iteration,     3,   iter
+FIELD det_type,      5,   type
 FIELD state,         5,   state
+FIELD *,             5,   choose,       value=input, detInputExp.php,       ARG2
+FIELD *,             5,   choose,       value=proc,  detProcessedExp.php,   ARG3
+FIELD *,             5,   choose,       value=resid, detResidExp.php,       ARG4
 FIELD mode,          5,   mode
 FIELD filter,       10,   filter     
Index: trunk/ippMonitor/def/detRunSummary.d
===================================================================
--- trunk/ippMonitor/def/detRunSummary.d	(revision 13566)
+++ trunk/ippMonitor/def/detRunSummary.d	(revision 13595)
@@ -4,14 +4,19 @@
 MENU  ipp.detrend.dat
 
-ARGS  ARG1  det_id=$det_id
-ARGS  ARG1  iteration=$iteration
+ARGS  ARG1  detInputExp.det_id=$detRunSummary.det_id
+ARGS  ARG1  detInputExp.iteration=$detRunSummary.iteration
 
-#     field      name             show         link to           extras
-FIELD det_id,    7,    det_id    
-FIELD iteration, 5,    iter
-FIELD accept,    4,    keep
-FIELD *,         20,   choose,    value=input, detInputExp.php,  ARG1
-FIELD *,         20,   choose,    value=resid, detResidExp.php,  ARG1
-FIELD bg,        20,   bg
-FIELD bg_stdev,  20,   bg_stdev
-# FIELD bg_mean_stdev, 20,   bg_mean_stdev
+ARGS  ARG2  detResidExp.det_id=$detRunSummary.det_id
+ARGS  ARG2  detResidExp.iteration=$detRunSummary.iteration
+
+#     field                     name  show      link to           extras
+FIELD detRunSummary.det_id,     7,    det_id    
+FIELD detRunSummary.iteration,  5,    iter
+FIELD detRunSummary.accept,     4,    keep
+FIELD *,                       20,    choose,    value=input, detInputExp.php,  ARG1
+FIELD *,                       20,    choose,    value=proc,  detProcessedExp.php,      ARG3
+FIELD *,                       20,    choose,    value=resid, detResidExp.php,  ARG2
+FIELD detRunSummary.bg,        20,    bg
+FIELD detRunSummary.bg_stdev,  20,    bg_stdev
+
+TD_CLASS list_off $detRunSummary.accept == 0
Index: trunk/ippMonitor/def/masterDetrendFrames.d
===================================================================
--- trunk/ippMonitor/def/masterDetrendFrames.d	(revision 13566)
+++ trunk/ippMonitor/def/masterDetrendFrames.d	(revision 13595)
@@ -23,7 +23,8 @@
 
 #     field                    width name          show         link to                   extras
-FIELD detRunSummary.det_id,    7,    det_id,       value,       detRunSummary.php,        ARG1
-FIELD detRunSummary.iteration, 5,    iter
+FIELD detRunSummary.det_id,    5,    det ID,       value,       detRunSummary.php,        ARG1
+FIELD detRunSummary.iteration, 3,    iter
 FIELD detRun.det_type,         5,    type
+FIELD detRun.state,            5,    state
 FIELD *,                       20,   choose,       value=input, detInputExp.php,          ARG2
 FIELD *,                       20,   choose,       value=proc,  detProcessedExp.php,      ARG3
Index: trunk/ippMonitor/generate
===================================================================
--- trunk/ippMonitor/generate	(revision 13566)
+++ trunk/ippMonitor/generate	(revision 13595)
@@ -73,7 +73,12 @@
 	}
 
-	# the ARGS commands defines arguments to FIELDS commands
+	# the ARGS commands define arguments to FIELDS commands
 	if ($key eq "ARGS") {
 	    push @linkargs, $value;
+	}
+
+	# the OP commands define field operations
+	if ($key eq "OP") {
+	    push @opwords, $value;
 	}
 
@@ -123,4 +128,8 @@
     }
 
+    foreach $opword (@opwords) {
+	&parse_opwords ($opword);
+    }
+
     if (0) {
 	print STDERR "show: $show[0]\n";
@@ -219,7 +228,12 @@
     # add column sorting elements here
     for ($i = 0; $i < @field; $i++) {
+	($label, $value, $string) = &parse_label ($show[$i]);
 	if ($show[$i] eq "none")  { next; }
 	# printf FILE "echo \"<th class=\\\"list\\\"> $name[$i] </th>\\n\";\n";
-	printf FILE "write_table_header (\"list\", \"$name[$i]\", \"$field[$i]\", \$buttonLink, \$ID, '$myFile');\n";
+	if ($label eq "op") {
+	    printf FILE "write_table_header (\"list\", \"$name[$i]\", \"$opf{$value}\", \$buttonLink, \$ID, '$myFile');\n";
+	} else {
+	    printf FILE "write_table_header (\"list\", \"$name[$i]\", \"$field[$i]\", \$buttonLink, \$ID, '$myFile');\n";
+	}
     }
 }
@@ -292,4 +306,18 @@
 	}
 
+	if ($label eq "op") {
+	    # create the basic link variable
+	    if ($link[$i]) {
+		printf FILE "  \$link = \"$link[$i]\" . \"?menu=$MENU&\" . \$ID['link'];\n";
+		# add extra GET data to target
+		if ($extras[$i]) { &parse_extras ($linkarg{$extras[$i]}); } 
+		$myLink = "\$link";
+	    } else {
+		$myLink = "\"\"";
+	    }
+	    printf FILE "  write_table_cell (\$class, $myLink, $ops{$value});\n";
+	    next;
+	}
+
 	if (($label eq "image") && !$link[$i]) {
 	    # print the actual table cell line with the image...
@@ -485,4 +513,27 @@
 }
 
+sub parse_opwords {
+    my ($value) = $_[0];
+
+    @words = split (" ", $value);
+    $name = shift (@words);
+
+    $opline = "";
+    foreach $word (@words) {
+	$fword = &parse_fieldname ($word);
+	push @outwords, $fword;
+	if ($word =~ m|^\$|) {
+	    $word = substr ($word, 1);
+	}
+	push @outfields, $word;
+    }
+    $outline = join (" ", @outwords);
+    $ops{$name} = $outline;
+    $outline = join (" ", @outfields);
+    $opf{$name} = $outline;
+
+    return 1;
+}
+
 sub init_key {
     my ($key)   = $_[0];
Index: trunk/ippMonitor/raw/ipp.detrend.dat
===================================================================
--- trunk/ippMonitor/raw/ipp.detrend.dat	(revision 13566)
+++ trunk/ippMonitor/raw/ipp.detrend.dat	(revision 13595)
@@ -27,4 +27,5 @@
 
 menutop   | menutop      | plain   | &nbsp;                       | 
+menulink  | menuselect 	 | link    | Detrend Kept                 | keptDetrendFrames.php
 menulink  | menuselect 	 | link    | Detrend Frames               | masterDetrendFrames.php
 menulink  | menuselect 	 | link    | Detrend Runs                 | detRun.php             
Index: trunk/ippMonitor/raw/ipp.php
===================================================================
--- trunk/ippMonitor/raw/ipp.php	(revision 13566)
+++ trunk/ippMonitor/raw/ipp.php	(revision 13595)
@@ -9,7 +9,11 @@
 }
 
-function loginform () { 
+function loginform ($username) { 
   echo '<form action="Login.php" method="POST">', "\n";
-  echo 'Username: <input type="text" name="username"><br>', "\n";
+  if ($username) {
+    echo "Username: <input type=\"text\" name=\"username\" value=\"$username\"><br>\n";
+  } else {
+    echo "Username: <input type=\"text\" name=\"username\"><br>\n";
+  }
   echo 'Password: <input type="text" name="password"><br>', "\n";
   echo '<input type="submit" name="login" value="login">', "\n";
@@ -19,12 +23,15 @@
 function projectform ($ID) {
     menu ('ipp.menu.dat', 'Select Project', 'ipp.css', $ID['link'], $ID['proj']);
+    if ($_GET['new'] && $_GET['proj']) {
+      echo "<p> Project is now <b>" . $_GET['proj'] . "</b></p>\n";
+    }
     echo "<p> Please select the project of interest </p>\n";
-    echo "<form action=\"SelectProject.php\" method=\"POST\">\n";
-    echo "Project: <input type=\"text\" name=\"proj\"><br>\n";
-    echo "<input type=\"submit\" name=\"project\">\n";
+    // echo "<form action=\"SelectProject.php\" method=\"POST\">\n";
+    // echo "Project: <input type=\"text\" name=\"proj\"><br>\n";
+    // echo "<input type=\"submit\" name=\"project\">\n";
 
     $pass = $ID['pass'];
-    echo "<input type=\"hidden\" name=\"pass\" value=\"$pass\">\n";
-    echo "</form>\n";
+    // echo "<input type=\"hidden\" name=\"pass\" value=\"$pass\">\n";
+    // echo "</form>\n";
 
     $db = dbconnect('ippadmin');
@@ -42,5 +49,9 @@
     echo "<tr class=select><th class=select> projects </th></tr>\n";
     while ($qry->fetchInto($row)) {
-      echo "<tr class=select><td class=select> $row[0] </td></tr>\n";
+      // add a link here to set the database
+      $tmp_proj = $row[0];
+      $tmp_link = "pass=$pass";
+      echo "<tr class=select><td class=select><a href=\"SelectProject.php?$tmp_link&proj=$tmp_proj&new=1\"> $row[0] </a></td></tr>\n";
+      // echo "<tr class=select><td class=select> $row[0] </td></tr>\n";
     }
     echo "</table>\n";
@@ -77,4 +88,11 @@
   $password = $_POST[password];
 
+  // if password is not specified, keep username and ask again
+  if ($password == "") {
+    menu ('ipp.menu.dat', 'Login', 'ipp.css', '', '');
+    loginform ($username);
+    menu_end ();
+  }
+
   $db = dbconnect('ippadmin');
 
@@ -84,7 +102,8 @@
   $qry = $db->query($sql);
   if (DB::iserror($db)) {
+    menu ('ipp.menu.dat', 'Login', 'ipp.css', '', '');
     echo "<b>error reading users table</b><br>\n";
     echo "Login Failed, please try again<br>\n";
-    loginform ();
+    loginform ("");
     menu_end();
   }
@@ -94,5 +113,5 @@
     menu ('ipp.menu.dat', 'Login', 'ipp.css', '', '');
     echo "Login Failed, please try again<br>\n";
-    loginform ();
+    loginform ("");
     menu_end ();
     exit ();
@@ -179,5 +198,5 @@
     menu('ipp.menu.dat', 'Login', 'ipp.css', '', '');
     logintext ();    
-    loginform ();
+    loginform ("");
     menu_end ();
   }
@@ -185,6 +204,7 @@
   $db = dbconnect ('ippadmin');
 
-  // make this a DB lookup
   $pass = $ID['pass'];
+
+  // search for password
   $sql = "SELECT username FROM cookies WHERE cookie = '$pass'";
   $qry = $db->query($sql);
@@ -192,14 +212,13 @@
     echo "<b>error reading users table</b><br>\n";
     echo "Login Failed, please try again<br>\n";
-    loginform ();
+    loginform ("");
     menu_end();
   }
   
-  # $success = (($username == "eugene") && ($password == "test"));
   $success = $qry->fetchInto($row);
   if (! $success) {
     menu('ipp.menu.dat', 'Login', 'ipp.css', '', '');
     echo "unknown user, please login again<br>\n";
-    loginform ();
+    loginform ("");
     menu_end ();
   }
