Index: trunk/ippMonitor/Makefile.in
===================================================================
--- trunk/ippMonitor/Makefile.in	(revision 27054)
+++ trunk/ippMonitor/Makefile.in	(revision 27113)
@@ -13,5 +13,5 @@
 
 PROGRAMS = \
-$(DESTBIN)/dbadmin
+$(DESTBIN)/skyplot.dvo
 
 RAWSRC = \
@@ -39,4 +39,6 @@
 $(DESTWWW)/showimage.php \
 $(DESTWWW)/nightSummary.php \
+$(DESTWWW)/simplePlot.php \
+$(DESTWWW)/skyplot.php \
 $(DESTWWW)/getimage.php
 
Index: trunk/ippMonitor/configure.tcsh
===================================================================
--- trunk/ippMonitor/configure.tcsh	(revision 27054)
+++ trunk/ippMonitor/configure.tcsh	(revision 27113)
@@ -191,8 +191,9 @@
 cat tmp.2           | sed "s|@DBPASS@|$dbpass|"  > tmp.1
 cat tmp.1           | sed "s|@BINDIR@|$bindir|"  > tmp.2
-cat tmp.2           | sed "s|@PERLLIB@|$libdir|" > tmp.1
-cat tmp.1           | sed "s|@SITE@|$site|"      > tmp.2
-cat tmp.2           | sed "s|@DBI@|$DBI|"        > tmp.1
-cat tmp.1           | sed "s|@HOST@|$hostname|"  > raw/site.php
+cat tmp.2           | sed "s|@LIBDIR@|$libdir|"  > tmp.1
+cat tmp.1           | sed "s|@PERLLIB@|$libdir|" > tmp.2
+cat tmp.2           | sed "s|@SITE@|$site|"      > tmp.1
+cat tmp.1           | sed "s|@DBI@|$DBI|"        > tmp.2
+cat tmp.2           | sed "s|@HOST@|$hostname|"  > raw/site.php
 rm -f tmp.1 tmp.2
 
Index: trunk/ippMonitor/raw/ipp.imfiles.dat
===================================================================
--- trunk/ippMonitor/raw/ipp.imfiles.dat	(revision 27054)
+++ trunk/ippMonitor/raw/ipp.imfiles.dat	(revision 27113)
@@ -18,2 +18,3 @@
 menutop   | menutop      | link    | test page                    | phptest.php     
 menutop   | menutop      | link    | night summary                | nightSummary.php
+menutop   | menutop      | link    | simple plot                  | simplePlot.php
Index: trunk/ippMonitor/raw/simplePlot.php
===================================================================
--- trunk/ippMonitor/raw/simplePlot.php	(revision 27113)
+++ trunk/ippMonitor/raw/simplePlot.php	(revision 27113)
@@ -0,0 +1,282 @@
+<?php 
+
+include 'ipp.php';
+include 'site.php';
+
+$ID = checkID ();
+
+// require an explicit project
+if (! $ID['proj']) { projectform ($ID); }
+
+$db = dbconnect($ID['proj']);
+
+if ($ID['menu']) {
+  $myMenu = $ID['menu'];
+} else {
+  $myMenu = "ipp.imfiles.dat";
+}
+
+menu($myMenu, 'test simple plot', 'ipp.css', $ID['link'], $ID['proj']);
+
+echo "<p> test sky plot </p>";
+
+// set up the form
+echo "<form action=\"simplePlot.php\" method=\"POST\">\n";
+
+$restricted = 0;
+
+// define restrictiosn to the queries
+// ** TABLE RESTRICTIONS **
+$WHERE = "WHERE chipRun.state != 'new' AND chipRun.exp_id = rawExp.exp_id";
+$WHERE = check_restrict ('rawExp.exp_name', $WHERE, 'string', 1.0);
+$WHERE = check_restrict ('rawExp.exp_id', $WHERE, 'string', 1.0);
+$WHERE = check_restrict ('rawExp.exp_id', $WHERE, 'min', 1.0);
+$WHERE = check_restrict ('rawExp.exp_id', $WHERE, 'max', 1.0);
+$WHERE = check_restrict ('chipRun.chip_id', $WHERE, 'string', 1.0);
+$WHERE = check_restrict ('chipRun.chip_id', $WHERE, 'min', 1.0);
+$WHERE = check_restrict ('chipRun.chip_id', $WHERE, 'max', 1.0);
+$WHERE = check_restrict ('chipRun.state', $WHERE, 'string', 1.0);
+$WHERE = check_restrict ('chipRun.label', $WHERE, 'string', 1.0);
+$WHERE = check_restrict ('rawExp.telescope', $WHERE, 'string', 1.0);
+$WHERE = check_restrict ('rawExp.camera', $WHERE, 'string', 1.0);
+$WHERE = check_restrict ('rawExp.dateobs', $WHERE, 'string', 1.0);
+$WHERE = check_restrict ('rawExp.dateobs', $WHERE, 'min', 1.0);
+$WHERE = check_restrict ('rawExp.dateobs', $WHERE, 'max', 1.0);
+$WHERE = check_restrict ('rawExp.ra', $WHERE, 'min', 0.017453);
+$WHERE = check_restrict ('rawExp.ra', $WHERE, 'max', 0.017453);
+$WHERE = check_restrict ('rawExp.decl', $WHERE, 'min', 0.017453);
+$WHERE = check_restrict ('rawExp.decl', $WHERE, 'max', 0.017453);
+$WHERE = check_restrict ('rawExp.object', $WHERE, 'string', 1.0);
+$WHERE = check_restrict ('rawExp.filter', $WHERE, 'string', 1.0);
+$WHERE = check_restrict ('rawExp.exp_time', $WHERE, 'string', 1.0);
+$WHERE = check_restrict ('rawExp.exp_time', $WHERE, 'min', 1.0);
+$WHERE = check_restrict ('rawExp.exp_time', $WHERE, 'max', 1.0);
+$WHERE = check_restrict ('rawExp.airmass', $WHERE, 'string', 1.0);
+$WHERE = check_restrict ('rawExp.airmass', $WHERE, 'min', 1.0);
+$WHERE = check_restrict ('rawExp.airmass', $WHERE, 'max', 1.0);
+$WHERE = check_restrict ('rawExp.bg', $WHERE, 'string', 1.0);
+$WHERE = check_restrict ('rawExp.bg', $WHERE, 'min', 1.0);
+$WHERE = check_restrict ('rawExp.bg', $WHERE, 'max', 1.0);
+$WHERE = check_restrict ('rawExp.bg_stdev', $WHERE, 'string', 1.0);
+$WHERE = check_restrict ('rawExp.bg_stdev', $WHERE, 'min', 1.0);
+$WHERE = check_restrict ('rawExp.bg_stdev', $WHERE, 'max', 1.0);
+$WHERE = check_restrict ('rawExp.comment', $WHERE, 'string', 1.0);
+$WHERE = check_ordering ('', $WHERE);
+
+if ($restricted == 0) {
+  if ($WHERE == "") {
+    $WHERE = "$WHERE AND (0 > 1)";
+  } else {
+    $WHERE = "WHERE (0 > 1)";
+  }
+}
+
+// get the result table count
+$sql = "SELECT count(*) FROM chipRun, rawExp $WHERE";
+
+$qry = $db->query($sql);
+if (dberror($qry)) {
+  echo "<b>error reading chipRun, rawExp table count</b><br>\n";
+  echo "<br><small><b> count query : $sql </b></small><br>\n";
+  menu_end();
+}
+if (!$qry->fetchInto($row)) {
+  echo "<b>error reading chipRun, rawExp table count</b><br>\n";
+  echo "<br><small><b> count query : $sql </b></small><br>\n";
+  menu_end();
+}
+$Npoints = $row[0];
+
+echo "<b>$Npoints exposures match selection</b><br>\n";
+
+// ** HEAD CODE **
+
+// ** BUTTON RESTRICTIONS **
+$buttonLink = button_restrict_string ('rawExp.exp_name', $buttonLink);
+$buttonLink = button_restrict_string ('rawExp.exp_id', $buttonLink);
+$buttonLink = button_restrict_min ('rawExp.exp_id', $buttonLink);
+$buttonLink = button_restrict_max ('rawExp.exp_id', $buttonLink);
+$buttonLink = button_restrict_string ('chipRun.chip_id', $buttonLink);
+$buttonLink = button_restrict_min ('chipRun.chip_id', $buttonLink);
+$buttonLink = button_restrict_max ('chipRun.chip_id', $buttonLink);
+$buttonLink = button_restrict_string ('chipRun.state', $buttonLink);
+$buttonLink = button_restrict_string ('chipRun.label', $buttonLink);
+$buttonLink = button_restrict_string ('rawExp.telescope', $buttonLink);
+$buttonLink = button_restrict_string ('rawExp.camera', $buttonLink);
+$buttonLink = button_restrict_string ('rawExp.dateobs', $buttonLink);
+$buttonLink = button_restrict_min ('rawExp.dateobs', $buttonLink);
+$buttonLink = button_restrict_max ('rawExp.dateobs', $buttonLink);
+$buttonLink = button_restrict_string ('rawExp.ra', $buttonLink);
+$buttonLink = button_restrict_min ('rawExp.ra', $buttonLink);
+$buttonLink = button_restrict_max ('rawExp.ra', $buttonLink);
+$buttonLink = button_restrict_string ('rawExp.decl', $buttonLink);
+$buttonLink = button_restrict_min ('rawExp.decl', $buttonLink);
+$buttonLink = button_restrict_max ('rawExp.decl', $buttonLink);
+$buttonLink = button_restrict_string ('rawExp.object', $buttonLink);
+$buttonLink = button_restrict_string ('rawExp.filter', $buttonLink);
+$buttonLink = button_restrict_string ('rawExp.exp_time', $buttonLink);
+$buttonLink = button_restrict_min ('rawExp.exp_time', $buttonLink);
+$buttonLink = button_restrict_max ('rawExp.exp_time', $buttonLink);
+$buttonLink = button_restrict_string ('rawExp.airmass', $buttonLink);
+$buttonLink = button_restrict_min ('rawExp.airmass', $buttonLink);
+$buttonLink = button_restrict_max ('rawExp.airmass', $buttonLink);
+$buttonLink = button_restrict_string ('rawExp.bg', $buttonLink);
+$buttonLink = button_restrict_min ('rawExp.bg', $buttonLink);
+$buttonLink = button_restrict_max ('rawExp.bg', $buttonLink);
+$buttonLink = button_restrict_string ('rawExp.bg_stdev', $buttonLink);
+$buttonLink = button_restrict_min ('rawExp.bg_stdev', $buttonLink);
+$buttonLink = button_restrict_max ('rawExp.bg_stdev', $buttonLink);
+$buttonLink = button_restrict_string ('rawExp.comment', $buttonLink);
+
+// set up the table
+echo "<table class=list>\n";
+
+// ** TABLE HEADER **
+echo "<tr><td></td>\n";
+write_header_cell ("list", "Exp Name");
+write_header_cell ("list", "Exp ID");
+write_header_cell ("list", "Chip ID");
+write_header_cell ("list", "State");
+write_header_cell ("list", "Label");
+write_header_cell ("list", "Telescope");
+write_header_cell ("list", "Camera");
+write_header_cell ("list", "RA");
+write_header_cell ("list", "DEC");
+write_header_cell ("list", "Comment");
+echo "</tr>\n";
+
+// query restriction form
+// ** TABLE QUERY **
+echo "<tr><td>&ge;</td>\n";
+write_query_row ('rawExp.exp_name', 5, 'string');
+write_query_row ('rawExp.exp_id', 5, 'min');
+write_query_row ('chipRun.chip_id', 7, 'min');
+write_query_row ('chipRun.state', 7, 'string');
+write_query_row ('chipRun.label', 7, 'string');
+write_query_row ('rawExp.telescope', 10, 'string');
+write_query_row ('rawExp.camera', 10, 'string');
+write_query_row ('rawExp.ra', 8, 'min');
+write_query_row ('rawExp.decl', 8, 'min');
+write_query_row ('rawExp.comment', 65, 'string');
+echo "</tr><tr><td>&le;</td>\n";
+echo "<td> &nbsp; </td>\n";
+write_query_row ('rawExp.exp_id', 5, 'max');
+write_query_row ('chipRun.chip_id', 7, 'max');
+echo "<td> &nbsp; </td>\n";
+echo "<td> &nbsp; </td>\n";
+echo "<td> &nbsp; </td>\n";
+echo "<td> &nbsp; </td>\n";
+write_query_row ('rawExp.ra', 8, 'max');
+write_query_row ('rawExp.decl', 8, 'max');
+echo "<td> &nbsp; </td>\n";
+echo "</tr>\n";
+
+// ** TABLE HEADER **
+echo "<tr><td></td>\n";
+write_header_cell ("list", "Object");
+write_header_cell ("list", "FILTER");
+write_header_cell ("list", "exp_time    ");
+write_header_cell ("list", "airmass     ");
+write_header_cell ("list", "backgnd");
+write_header_cell ("list", "stdev    ");
+write_header_cell ("list", "Date/Time");
+echo "</tr>\n";
+
+// query restriction form
+// ** TABLE QUERY **
+echo "<tr><td>&ge;</td>\n";
+write_query_row ('rawExp.object', 8, 'string');
+write_query_row ('rawExp.filter', 10, 'string');
+write_query_row ('rawExp.exp_time', 5, 'min');
+write_query_row ('rawExp.airmass', 5, 'min');
+write_query_row ('rawExp.bg', 5, 'min');
+write_query_row ('rawExp.bg_stdev', 5, 'min');
+write_query_row ('rawExp.dateobs', 19, 'min');
+echo "</tr><tr><td>&le;</td>\n";
+echo "<td> &nbsp; </td>\n";
+echo "<td> &nbsp; </td>\n";
+write_query_row ('rawExp.exp_time', 5, 'max');
+write_query_row ('rawExp.airmass', 5, 'max');
+write_query_row ('rawExp.bg', 5, 'max');
+write_query_row ('rawExp.bg_stdev', 5, 'max');
+write_query_row ('rawExp.dateobs', 19, 'max');
+echo "</tr>\n";
+
+// close the table and form
+echo "</table>\n";
+
+echo "<input type=\"submit\" name=\"constraints\" value=\"refine search\">\n";
+$pass = $ID['pass'];
+$proj = $ID['proj'];
+$menu = $ID['menu'];
+echo "<input type=\"hidden\" name=\"pass\" value=\"$pass\">\n";
+echo "<input type=\"hidden\" name=\"proj\" value=\"$proj\">\n";
+echo "<input type=\"hidden\" name=\"menu\" value=\"$menu\">\n";
+echo "</form>\n";
+
+// if there are no results, don't make an empty figure
+if ($row[0] == 0) {
+  menu_end();
+}
+
+// we write the ra & dec to tmp file 1 and have the plotter generate tmp file 2:
+
+$datfilename = tempnam("/tmp", "dvodat.");
+$pngfilename = tempnam("/tmp", "dvopng.");
+
+$datfile = fopen($datfilename, "w");
+
+// query the database
+$sql = "SELECT rawExp.ra,rawExp.decl,rawExp.filter FROM chipRun, rawExp $WHERE";
+
+$qry = $db->query($sql);
+if (dberror($qry)) {
+  echo "<b>error reading chipRun, rawExp table</b><br>\n";
+  echo "<br><small><b> table query : $sql </b></small><br>\n";
+  menu_end();
+}
+
+// list the results
+while ($qry->fetchInto($row)) {
+  switch ($row[2]) {
+   case 'g.00000':
+    $filter = 1;
+    break;
+   case 'r.00000':
+    $filter = 2;
+    break;
+   case 'i.00000':
+    $filter = 3;
+    break;
+   case 'z.00000':
+    $filter = 4;
+    break;
+   case 'y.00000':
+    $filter = 5;
+    break;
+   case 'w.00000':
+    $filter = 6;
+    break;
+   default:
+    $filter = 0;
+    break;
+  }
+
+  $line = "$row[0] $row[1] $filter\n";
+  fwrite ($datfile, $line);
+}
+fclose($datfile);
+
+echo "<img src=\"skyplot.php?input=$datfilename&output=$pngfilename\"><br>\n";
+
+// ** TAIL CODE **
+
+echo "<small> WHERE: $WHERE<br><br></small>\n";
+echo "<small> SQL: $sql<br><br></small>\n";
+
+menu_end();
+
+unlink ($datfilename);
+unlink ($pngfilename);
+
+?>
Index: trunk/ippMonitor/raw/site.php.in
===================================================================
--- trunk/ippMonitor/raw/site.php.in	(revision 27054)
+++ trunk/ippMonitor/raw/site.php.in	(revision 27113)
@@ -8,4 +8,5 @@
 $PERLLIB = "@PERLLIB@";
 $BINDIR  = "@BINDIR@";
+$LIBDIR  = "@LIBDIR@";
 $SITE    = "@SITE@";
 
Index: trunk/ippMonitor/raw/skyplot.php
===================================================================
--- trunk/ippMonitor/raw/skyplot.php	(revision 27113)
+++ trunk/ippMonitor/raw/skyplot.php	(revision 27113)
@@ -0,0 +1,68 @@
+<?php
+
+# this program takes two arguments: 
+# an input list of RA, DEC, n(FILTER)
+# an output png filename
+# it generates a sky plot showing the locations of the given list of points
+
+$debug = 0;
+include 'site.php';
+
+### these need to be set to the correct locations!!
+$MISSING = "missing.png";
+
+### we must have been past arguments with GET:
+if ($_SERVER[REQUEST_METHOD] != 'GET') { 
+  exit ();
+}
+
+$PATH = getenv("PATH");
+putenv("PATH=$BINDIR:$PATH");
+
+$LD_LIBRARY_PATH = getenv("LD_LIBRARY_PATH");
+putenv("LD_LIBRARY_PATH=$LIBDIR:$LD_LIBRARY_PATH");
+
+if ($debug) {
+  echo "path: $PATH<br>";
+
+  $newpath = getenv("PATH");
+  echo "new path: $newpath<br>";
+
+  $newpath = getenv("LD_LIBRARY_PATH");
+  echo "new path: $newpath<br>";
+
+  echo "bindir: $BINDIR<br>";
+}
+
+if ($debug) {
+  exec ("which skyplot.dvo", $output, $status);
+  echo "which output:<br>";
+  for ($i = 0; $i < count($output); $i++) {
+    echo "output $i: $output[$i]<br>";
+  }
+  echo "status:   $status<br>";
+}
+
+$infile  = $_GET[input];
+$outfile = $_GET[output];
+
+exec ("skyplot.dvo $infile $outfile", $output, $status);
+
+if ($debug) {
+  for ($i = 0; $i < count($output); $i++) {
+    echo "output $i: $output[$i]<br>";
+  }
+  echo "status:   $status<br>";
+  exit ();
+}
+
+# use these to check the environment
+# passthru ("env");
+
+$file = fopen ($outfile, "r");
+if ($file && !$debug) {
+  header ('Content-Type: image/png');
+  fpassthru ($file);
+}
+exit ();
+?>
Index: trunk/ippMonitor/scripts/skyplot.dvo
===================================================================
--- trunk/ippMonitor/scripts/skyplot.dvo	(revision 27113)
+++ trunk/ippMonitor/scripts/skyplot.dvo	(revision 27113)
@@ -0,0 +1,63 @@
+#!/usr/bin/env dvo
+
+list filters
+ green
+ blue
+ red
+ indigo
+ black
+ gold
+end
+
+macro skyplot
+  if ($0 != 3)
+    echo "skyplot (input) (output)"
+    break
+  end
+
+  data $1
+  read r 1 d 2 f 3
+
+  resize 1000 500
+  region +ns -ew 0 0 85 ait; cgrid -ra-by-hour -c grey80
+
+  set R = r * 180/3.14
+  set D = d * 180/3.14
+
+  for i 0 $filters:n
+    subset R1 = R if (f == $i)
+    subset D1 = D if (f == $i)
+    if (R1[]) 
+      cplot R1 D1 -sz 1.0 -pt 7 -c $filters:$i
+    end
+  end
+
+  style -c red -pt 0 -sz 0.5; ecliptic
+  style -c blue -pt 0 -sz 0.5; galactic
+
+  png -name $2
+end
+
+macro galactic
+ create l 720 -360 0.1
+ set b = l * 0
+ csystem G C l b
+ cplot l b
+end
+
+macro ecliptic
+ create l 720 -360 0.1
+ set b = l * 0
+ csystem E C l b
+ cplot l b
+end
+
+if ($SCRIPT)
+  $KAPA = kapa -noX
+  if ($argv:n != 2)
+    echo "USAGE: skyplot (input) (output)"
+    exit 1
+  end
+  skyplot $argv:0 $argv:1
+  exit 0
+end
