Index: branches/eam_branches/ipp-20120601/dvodist/scripts/mkdist.20120509.sh
===================================================================
--- branches/eam_branches/ipp-20120601/dvodist/scripts/mkdist.20120509.sh	(revision 34047)
+++ branches/eam_branches/ipp-20120601/dvodist/scripts/mkdist.20120509.sh	(revision 34047)
@@ -0,0 +1,37 @@
+#!/bin/csh -f
+
+# create the links needed to expose a specific catalog to the distribution server
+
+# general locations
+set wwwroot = /data/ippc17.0/dvodist/www-root
+set catroot = /data/ipp064.0/eugene/3pi.20111229/catdir.20120509
+
+set catdir = 3pi.20120509
+set cattgt = $wwwroot/$catdir
+
+set nlist = (n0000 n0730 n1500 n2230 n3000 n3730 n4500 n5230 n6000 n6730 n7500 n8230)
+set slist = (s0000 s0730 s1500 s2230 s3000 s3730 s4500 s5230 s6000 s6730 s7500 s8230)
+
+# top-level files
+mkdir -p $cattgt
+foreach file (HostTable.dat Images.dat Photcodes.dat SkyTable.fits flatcorr.fits)
+  ln -s $catroot/$file $cattgt
+end
+
+# make DEC directories
+foreach dir ($nlist $slist)
+  mkdir $cattgt/$dir
+end
+
+# link all files from all hostdirs into all DEC dirs
+foreach hostdir (`grep -v \# $cattgt/HostTable.dat | awk '{print $3}'`)
+  echo $hostdir
+  foreach dir ($nlist $slist)
+    ln -s $hostdir/$dir/*.cpt $cattgt/$dir
+    ln -s $hostdir/$dir/*.cpm $cattgt/$dir
+    ln -s $hostdir/$dir/*.cps $cattgt/$dir
+    ln -s $hostdir/$dir/*.cpn $cattgt/$dir
+  end
+end
+   
+
Index: branches/eam_branches/ipp-20120601/dvodist/scripts/mkdist.20120525.sh
===================================================================
--- branches/eam_branches/ipp-20120601/dvodist/scripts/mkdist.20120525.sh	(revision 34047)
+++ branches/eam_branches/ipp-20120601/dvodist/scripts/mkdist.20120525.sh	(revision 34047)
@@ -0,0 +1,35 @@
+#!/bin/csh -f
+
+# create the links needed to expose a specific catalog to the distribution server
+
+# general locations
+set wwwroot = /data/ippc17.0/www/dvodist/www-root
+set catroot = /data/ipp064.0/eugene/3pi.20111229/catdir.20120525
+
+set catdir = 3pi.20120525
+set cattgt = $wwwroot/$catdir
+
+set nlist = (n0000 n0730 n1500 n2230 n3000 n3730 n4500 n5230 n6000 n6730 n7500 n8230)
+set slist = (s0000 s0730 s1500 s2230 s3000 s3730 s4500 s5230 s6000 s6730 s7500 s8230)
+
+# top-level files
+mkdir -p $cattgt
+foreach file (HostTable.dat Images.dat Photcodes.dat SkyTable.fits flatcorr.fits)
+  ln -s $catroot/$file $cattgt
+end
+
+# make DEC directories
+foreach dir ($nlist $slist)
+  mkdir $cattgt/$dir
+end
+
+# link all files from all hostdirs into all DEC dirs
+foreach hostdir (`grep -v \# $cattgt/HostTable.dat | awk '{print $3}'`)
+  echo $hostdir
+  foreach dir ($nlist $slist)
+    ln -s $hostdir/$dir/*.cpt $cattgt/$dir
+    ln -s $hostdir/$dir/*.cpm $cattgt/$dir
+    ln -s $hostdir/$dir/*.cps $cattgt/$dir
+    ln -s $hostdir/$dir/*.cpn $cattgt/$dir
+  end
+end
Index: branches/eam_branches/ipp-20120601/dvodist/scripts/mkdist.testcat.sh
===================================================================
--- branches/eam_branches/ipp-20120601/dvodist/scripts/mkdist.testcat.sh	(revision 34047)
+++ branches/eam_branches/ipp-20120601/dvodist/scripts/mkdist.testcat.sh	(revision 34047)
@@ -0,0 +1,46 @@
+#!/bin/csh -f
+
+# create the links needed to expose a specific catalog to the distribution server
+
+# general locations
+set wwwroot = /data/ippc17.0/dvodist/www-root
+set catroot = /data/ipp064.0/eugene/refcat.20120202/catdir.syn.test.v1
+
+set catdir = catdir.syn.test
+set cattgt = $wwwroot/$catdir
+
+set nlist = (n0000 n0730 n1500 n2230 n3000 n3730 n4500 n5230 n6000 n6730 n7500 n8230)
+set slist = (s0000 s0730 s1500 s2230 s3000 s3730 s4500 s5230 s6000 s6730 s7500 s8230)
+
+# top-level files
+mkdir -p $cattgt
+foreach file (HostTable.dat Images.dat Photcodes.dat SkyTable.fits flatcorr.fits)
+  ln -s $catroot/$file $cattgt
+end
+
+# make DEC directories
+foreach dir ($nlist $slist)
+  mkdir $cattgt/$dir
+end
+
+# link all files from all hostdirs into all DEC dirs
+if (-e $cattgt/HostTable.dat) then
+  foreach hostdir (`grep -v \# $cattgt/HostTable.dat | awk '{print $3}'`)
+    echo $hostdir
+    foreach dir ($nlist $slist)
+      ln -s $hostdir/$dir/*.cpt $cattgt/$dir
+      ln -s $hostdir/$dir/*.cpm $cattgt/$dir
+      ln -s $hostdir/$dir/*.cps $cattgt/$dir
+      ln -s $hostdir/$dir/*.cpn $cattgt/$dir
+    end
+  end
+else
+  set hostdir = $catroot
+  echo $hostdir
+  foreach dir ($nlist $slist)
+    ln -s $hostdir/$dir/*.cpt $cattgt/$dir
+    ln -s $hostdir/$dir/*.cpm $cattgt/$dir
+    ln -s $hostdir/$dir/*.cps $cattgt/$dir
+    ln -s $hostdir/$dir/*.cpn $cattgt/$dir
+  end
+endif
Index: branches/eam_branches/ipp-20120601/dvodist/scripts/mkindex.sh
===================================================================
--- branches/eam_branches/ipp-20120601/dvodist/scripts/mkindex.sh	(revision 34047)
+++ branches/eam_branches/ipp-20120601/dvodist/scripts/mkindex.sh	(revision 34047)
@@ -0,0 +1,36 @@
+#!/bin/csh -f 
+
+if ($#argv != 1) then
+  echo "USAGE: mkindex.sh (dir)"
+  exit 2
+endif
+
+set topdir = $argv[1]
+
+# this is weak: depends on root location
+ln -s /data/ippc17.0/www/dvodist/www-root/index.php $topdir/
+
+set file = `basename $topdir`
+echo "$file : plain : title  : Title" > $topdir/index.txt
+echo "..             : dir   : dir2  : parent directory" >> $topdir/index.txt
+
+set N = 1
+foreach entry ($topdir/*)
+  set file = `basename $entry`
+  if ("$file" == "index.php") continue
+  if ("$file" == "index.txt") continue
+
+  if (-d $entry) then
+    echo "$file : dir : dir$N : directory" >> $topdir/index.txt
+  endif
+
+  if (-f $entry) then
+    echo "$file : file : file$N : database file" >> $topdir/index.txt
+  endif
+
+  if ($N == 1) then
+    set N = 2
+  else
+    set N = 1
+  endif
+end
Index: branches/eam_branches/ipp-20120601/dvodist/www-root/docs.txt
===================================================================
--- branches/eam_branches/ipp-20120601/dvodist/www-root/docs.txt	(revision 34047)
+++ branches/eam_branches/ipp-20120601/dvodist/www-root/docs.txt	(revision 34047)
@@ -0,0 +1,123 @@
+<h2>DVO Documentation</h2>
+
+<h3>Release Notes on 3pi.20120525</h3>
+
+This database contains PS1 3pi observations through 2012/01/21.  The
+ubercal zero points have been applied to all exposures included in
+that analysis.  The remaining exposures have been tied to the ubercal
+system via relative photometry.  The ubercal measurements are given
+10x their poisson weight to ensure they drive the photometric
+solution.
+
+The database has been merged with the PS1 Synthetic photometry
+database (based on 2MASS and USNO-B).  For objects brighter than the
+saturation limit, the Synthetic photometry has been used for the mean
+magnitudes (these can be identified by having bit 0x04 raised in the
+mean filter flags).  Objects which used ubercal photometry have the
+bit 0x08 raised in the mean filter flags.  
+
+This database has also been merged with the 2MASS, WISE, and
+SuperCOSMOS databases.  The following photcodes are used for those
+external photometric sources:
+
+<table class="page">
+<tr><th> Source </th><th> Photcode </th></tr>
+<tr><td> 2MASS_J </td><td> 2011 </td></tr>   
+<tr><td> 2MASS_H </td><td> 2012 </td></tr>   
+<tr><td> 2MASS_K </td><td> 2013 </td></tr>   
+<tr><td> WISE_W1 </td><td> 2014 </td></tr>   
+<tr><td> WISE_W2 </td><td> 2015 </td></tr>   
+<tr><td> WISE_W3 </td><td> 2016 </td></tr>   
+<tr><td> WISE_W4 </td><td> 2017 </td></tr>   
+<tr><td> SYNTH.g </td><td> 3001 </td></tr>   
+<tr><td> SYNTH.r </td><td> 3002 </td></tr>   
+<tr><td> SYNTH.i </td><td> 3003 </td></tr>   
+<tr><td> SYNTH.z </td><td> 3004 </td></tr>   
+<tr><td> SYNTH.y </td><td> 3005 </td></tr>
+<tr><td> SCOS.103a.E       </td><td>      1150  </td></tr>
+<tr><td> SCOS.4414.OG590   </td><td>      1151  </td></tr>
+<tr><td> SCOS.4415.OG590   </td><td>      1152  </td></tr>
+<tr><td> SCOS.IIIaF.OG590  </td><td>      1153  </td></tr>
+<tr><td> SCOS.IIIaF.RG610  </td><td>      1154  </td></tr>
+<tr><td> SCOS.IIIaF.RG630  </td><td>      1155  </td></tr>
+<tr><td> SCOS.IIIaJ.GG385  </td><td>      1156  </td></tr>
+<tr><td> SCOS.IIIaJ.GG395  </td><td>      1157  </td></tr>
+<tr><td> SCOS.IVN.RG715    </td><td>      1158  </td></tr>
+<tr><td> SCOS.IVN.RG9      </td><td>      1159  </td></tr>
+</table>
+
+<img width=1000px src="relphot.20120528/sigma.i.ubercal.20120528.v0.png"><br>
+Map of the mean per-star residual (inst mag brighter than -10) for
+i-band (ubercal data only).
+<br>
+
+<img width=1000px src="relphot.20120528/sigma.g.ubercal.20120528.v0.png"><br>
+Map of the mean per-star residual (inst mag brighter than -10) for
+g-band (ubercal data only).
+<br>
+
+<h3>Comparison with 2MASS</h3>
+
+The plots below compare the PS1 grizy photometry with 2MASS photometry
+by examining the location of the color-color locus for early (&lt; K0)
+main sequence stars.
+
+For each pixel (0.5 degree on a side), I select all objects with PS1 r
+&lt; 20 and detected JHK magnitudes, keeping only those with S/N in
+the mean &gt; 50 and standard deviations less than 0.05 magnitudes.  I
+then fit the stellar locus in g-r,r-i for the g-r range 0.2 to 1.0,
+and keep only objects that fall within 0.05 of that (linear) stellar
+locus fit.<br>
+
+I then fit the stellar locus with a line in each of the color-color diagrams
+g-i,i-J; g-i,i-H; g-i,i-K.  I measure the mean i-J color expected from
+the fit for stars with g-i = 0.5.  The figures below show the maps of
+the i-J, i-H, and i-K offsets as well as the J-H and H-K offsets at
+g-i = 0.5.  The center of these maps is RA,DEC = 0,0, (east is left,
+north is up).  The pixels are 0.5 degrees on a side.<br> 
+
+These maps show three main features.  The Galactic Plane is quite
+clear, and not surprising: this test is particularly sensitive to
+reddening. <br>
+
+Several large scale patches are also visible (eg, the black patch near
+RA ~ 150 deg).  Disappointingly, these correspond to areas without
+good ubercal ties -- in other words, these are regions in which the
+data were obtained in non-photometric conditions.  This shows the
+limitation of using relative photometry to tie across individual
+exposures.  If the exposures have an extinction gradient, the
+correction far from the photometrically tied region can drift from the
+correct value.  The largest region at RA ~ 150 matches a section with
+poor i-band photometry and has a depth of roughly 0.1 magnitudes in
+i-J.  Assuming this is completely due to i-band errors, this
+corresponds to about 0.06 magnitudes of drift to the center of this
+region. <br>
+
+The third pattern is at a lower level of intensity: N-S strips with
+roughly E-W bands.  They are most noticable in K and H-K.  These
+appear to correspond well to the 2MASS scanning pattern, and have an
+amplitude corresponding to about 0.02 - 0.04 magnitudes of offset in
+K.  <br>
+
+<img width=1000px src="relphot.20120528/dJ.allsky.20120528.v3.png"><br>
+Map of the i-J color at g-i = 0.5. 
+<br>
+
+<img width=1000px src="relphot.20120528/dH.allsky.20120528.v3.png"><br>
+Map of the i-H color at g-i = 0.5. 
+<br>
+
+<img width=1000px src="relphot.20120528/dK.allsky.20120528.v3.png"><br>
+Map of the i-K color at g-i = 0.5. 
+<br>
+
+Combinations of the above maps can highlight any problems in 2MASS
+which are driven by the color rather than the mean magnitudes.
+
+<img width=1000px src="relphot.20120528/dJH.allsky.20120528.v3.png"><br>
+Map of the J-H color at g-i = 0.5. 
+<br>
+
+<img width=1000px src="relphot.20120528/dHK.allsky.20120528.v3.png"><br>
+Map of the H-K color at g-i = 0.5. 
+<br>
Index: branches/eam_branches/ipp-20120601/dvodist/www-root/help.txt
===================================================================
--- branches/eam_branches/ipp-20120601/dvodist/www-root/help.txt	(revision 34047)
+++ branches/eam_branches/ipp-20120601/dvodist/www-root/help.txt	(revision 34047)
@@ -0,0 +1,13 @@
+<h2>DVO Distribution Help</h2>
+
+<p> These web pages contain the PS1 DVO databases, making it easy to
+download entire databases with the 'wget' command.  It is necessary to
+include an authorized user and the password.</p>
+
+
+Use a wget command on the directory of interest, eg:
+
+<tt> wget --user=ps1sc --password=(PASS) -r -np -nH http://dvodist.ipp.ifa.hawaii.edu/3pi.20120509 </tt>
+
+Ask your DRAVG representative if you need the password.
+
Index: branches/eam_branches/ipp-20120601/dvodist/www-root/index.php
===================================================================
--- branches/eam_branches/ipp-20120601/dvodist/www-root/index.php	(revision 34047)
+++ branches/eam_branches/ipp-20120601/dvodist/www-root/index.php	(revision 34047)
@@ -0,0 +1,61 @@
+<?php 
+
+$utils = "/data/ippc17.0/www/dvodist/www-util";
+
+include "$utils/ipp.php";
+
+// if we come in directly, the top-level directory should be /dvodist
+// if we come in from the ippops1 proxy, we need to set the root to /
+$ifaProxy = "128.171.227.208";
+
+// is the request coming from our proxY?
+$fromProxy = $_SERVER['HTTP_X_FORWARDED_FOR'] && ($_SERVER['REMOTE_ADDR'] == $ifaProxy);
+if ($fromProxy) {
+  $rootdir = "";
+ } else {
+  $rootdir = "/dvodist";
+ }
+
+menu("$utils/ipp.menu.dat", 'DVO Distribution Server', $rootdir, "$rootdir/ipp.css", '', '');
+
+$script = basename($_SERVER[SCRIPT_NAME]);
+
+if ($script == "index.php") {
+  dirlist ("index.txt");
+ }
+
+if ($script == "docs.php") {
+  verbatim ("docs.txt");
+ }
+
+if ($script == "help.php") {
+  verbatim ("help.txt");
+ }
+
+menu_end();
+?>
+
+// generic proxy detection
+// if ( $_SERVER['HTTP_X_FORWARDED_FOR']
+//      || $_SERVER['HTTP_X_FORWARDED']
+//      || $_SERVER['HTTP_FORWARDED_FOR']
+//      || $_SERVER['HTTP_CLIENT_IP']
+//      || $_SERVER['HTTP_VIA']
+//      || in_array($_SERVER['REMOTE_PORT'], array(8080,80,6588,8000,3128,553,554))
+//      || @fsockopen($_SERVER['REMOTE_ADDR'], 80, $errno, $errstr, 30))
+//   {
+//     exit('Proxy detected');
+//   }
+
+// list server info:
+// $varlist = array ('SCRIPT_NAME', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_FORWARDED_FOR', 'HTTP_CLIENT_IP', 'HTTP_VIA', 'REMOTE_ADDR');
+// 
+// foreach ($varlist as $name) {
+//   echo "$name : $_SERVER[$name]<br>\n";
+// }
+// 
+// echo "get list<br>\n";
+// foreach ($_GET as $key => $value) {
+//   echo "$key : $value<br>\n";
+// }
+
Index: branches/eam_branches/ipp-20120601/dvodist/www-root/index.txt
===================================================================
--- branches/eam_branches/ipp-20120601/dvodist/www-root/index.txt	(revision 34047)
+++ branches/eam_branches/ipp-20120601/dvodist/www-root/index.txt	(revision 34047)
@@ -0,0 +1,5 @@
+DVO Database  	       : plain : title : Comment
+3pi.20120525 	       : dir   : dir1  : DVO Database Released 2012.05.25, ubercal + relphot + relastro (pm + par)
+# allsky.tables.20120513 : dir   : dir2  : Summary Tables for allsky (FITS & CSV formats)
+allsky.tables.20120602 : dir   : dir2  : Summary Tables for allsky (FITS & CSV formats)
+catdir.syn.test        : dir   : dir1  : Test DVO Database
Index: branches/eam_branches/ipp-20120601/dvodist/www-root/ipp.css
===================================================================
--- branches/eam_branches/ipp-20120601/dvodist/www-root/ipp.css	(revision 34047)
+++ branches/eam_branches/ipp-20120601/dvodist/www-root/ipp.css	(revision 34047)
@@ -0,0 +1,421 @@
+
+/* internal link line: c0d0d0 : d8d0f0
+   external link line: 303070 
+   border:             0080c0
+ */
+
+body  { 
+    background-color: #a0d0e0; 
+    padding: 5px; 
+    margin: 5px
+}
+
+h1 {
+    margin-top: 0.05em;
+    margin-bottom: 0.05em;
+}
+
+h2 {
+    margin-top: 0.05em;
+    margin-bottom: 0.05em;
+}
+
+h3 {
+    margin-top: 0.05em;
+    margin-bottom: 0.05em;
+}
+
+h4 {
+    margin-top: 0.05em;
+    margin-bottom: 0.05em;
+}
+
+div.debug {
+    height: 15%;
+    background-color: #ffffaa;
+    overflow: auto;
+}
+
+a:link, a:visited, a:active { 
+    text-decoration: underline; 
+    font-weight: bold; 
+    color: #ff0000
+}
+
+a.button      { 
+    text-decoration: none; 
+    font-weight: bold;   
+    color: #000000; 
+    background: #0080c0
+}
+a.menutop     { 
+    text-decoration: none; 
+    font-weight: bold;   
+    color: #ffffff
+}
+a.menutops    { 
+    text-decoration: none; 
+    font-weight: bold;   
+    color: #80f0ff
+}
+a.menuext     { 
+    text-decoration: none; 
+    font-weight: bold;   
+    color: #ffffff
+}
+a.menulink    { 
+    text-decoration: none; 
+    font-weight: normal; 
+    color: #000000
+}
+a.menuselect  { 
+    text-decoration: none; 
+    font-weight: normal; 
+    color: #0000ff
+}
+a.piclink     { 
+    text-decoration: none; 
+    font-weight: normal; 
+    color: #0080c0
+}
+
+table.dirlist { text-align: left; 
+             font-size: small; 
+	     font-weight: normal; 
+	     background: #303030; 
+	     border: 1px solid #000000; 
+	     padding: 1px; 
+}
+
+a.dir1     { 
+    text-decoration: none; 
+    font-weight: bold;   
+    color: #800080
+}
+a.dir2     { 
+    text-decoration: none; 
+    font-weight: bold;   
+    color: #800080
+}
+a.file1     { 
+    text-decoration: none; 
+    font-weight: bold;   
+    color: #800080
+}
+a.file2     { 
+    text-decoration: none; 
+    font-weight: bold;   
+    color: #800080
+}
+tr.dir1    { 
+    text-align: left; 
+    background: #d0d0d0; 
+    font-size: small; 
+    color: #000000; 
+    padding: 1px; 
+}
+tr.dir2    { 
+    text-align: left; 
+    background: #d0d0ff; 
+    font-size: small; 
+    color: #000000; 
+    padding: 1px; 
+}
+tr.file1    { 
+    text-align: left; 
+    background: #d0d0d0; 
+    font-size: small; 
+    color: #000000; 
+    padding: 2px; 
+}
+tr.file2    { 
+    text-align: left; 
+    background: #d0d0ff; 
+    font-size: small; 
+    color: #000000; 
+    padding: 2px; 
+}
+tr.break    { 
+    text-align: left; 
+    background: #0080c0; 
+    font-size: small; 
+    color: #ffffff; 
+    padding-top: 4px; 
+}
+tr.title    { 
+    text-align: left; 
+    background: #d0d0ff; 
+    font-size: medium; 
+    color: #000000; 
+    padding: 2px; 
+    padding-top: 4px; 
+    padding-bottom: 4px; 
+}
+
+td.menutop    { 
+    text-align: left; 
+    background: #0080c0; 
+    font-size: small; 
+    color: #ffffff; 
+    padding: 2px; 
+}
+td.menutops   { 
+    text-align: left; 
+    background: #0080c0; 
+    font-size: small; 
+    color: #000000; 
+    padding: 2px; 
+}
+td.menuext    { 
+    text-align: left; 
+    background: #303070; 
+    font-size: small; 
+    color: #ffffff; 
+    padding: 2px; 
+}
+td.menulink   { 
+    text-align: left; 
+    background: #d0d0ff; 
+    font-size: small; 
+    color: #000000; 
+    padding: 2px; 
+    font-weight: normal; 
+    text-indent: 0px; 
+}
+td.menuselect { 
+    text-align: left; 
+    background: #d0d0ff; 
+    font-size: small; 
+    color: #ff0000; 
+    padding: 2px; 
+    font-weight: normal; 
+    text-indent: 0px; 
+}
+td.menuline   { 
+    text-align: left; 
+    background: #d0d0ff; 
+    font-size: small; 
+    color: #000000; 
+    padding: 2px; 
+    font-weight: normal; 
+    text-indent: 0px; 
+}
+
+td.picture    { 
+    text-align: left; 
+    background: #00ffff; 
+    font-size: small; 
+    color: #ff0000; 
+    padding: 0px; 
+    text-indent: 2px; 
+    font-weight: normal; 
+}
+td.piclink    { 
+    text-align: left; 
+    background: #0080c0; 
+    font-size: small; 
+    color: #ff0000; 
+    padding: 0px; 
+    text-indent: 0px; 
+    font-weight: normal; 
+}
+
+table.page { 
+    border: 0px solid #0080c0; 
+    background: #a0d0e0; 
+    padding: 0px
+}
+
+td.title { 
+    background-color: #ff0000; 
+    padding: 5px; 
+    font-size: x-large; 
+    text-align: left; 
+    vertical-align: top
+}
+
+td.body  { 
+           text-align: left; 
+           font-size: small;  
+           font-weight: normal;  
+           vertical-align: top;
+	   background: #d0d0ff; 
+	   background-color: #d0d0ff; 
+	   border: 3px solid #0080c0; 
+	   padding: 5px; 
+}
+
+table.menu { 
+    text-align: left; 
+    font-size: small; 
+    font-weight: normal; 
+    background: #ff0000; 
+    border: 3px solid #0080c0; 
+    padding: 0px; 
+}
+
+table.select { 
+    text-align: left; 
+    font-size: small; 
+    font-weight: normal; 
+    background: #0080c0; 
+    border: 1px solid #0080c0; 
+    padding: 0px; 
+}
+
+td.select  { 
+    text-align: left; 
+    font-size: small;  
+    font-weight: bold;  
+    vertical-align: top;
+    color: #ffffff; 
+    background: #0080c0; 
+    background-color: #0080c0; 
+    border: 2px solid #0080c0; 
+    padding: 2px; 
+}
+
+th.select  { 
+           text-align: left; 
+           font-size: small;  
+           font-weight: bold;  
+           vertical-align: top;
+	   color: #000000; 
+	   background: #d0d0ff; 
+	   background-color: #d0d0ff; 
+	   border: 0px solid #0080c0; 
+	   padding: 2px; 
+}
+
+table.list { text-align: left; 
+             font-size: small; 
+	     font-weight: normal; 
+	     background: #d0d0ff; 
+	     border: 2px solid #ffffff; 
+	     padding: 0px; 
+}
+
+td.list  { 
+           text-align: left; 
+           font-size: small;  
+           font-weight: normal;  
+           vertical-align: top;
+	   background: #d0d0ff; 
+	   background-color: #d0d0ff; 
+	   border: 2px solid #000000; 
+	   padding: 2px; 
+}
+
+td.list_off  { 
+           text-align: left; 
+           font-size: small;  
+           font-weight: normal;  
+           vertical-align: top;
+	   background: #a0a0a0; 
+	   background-color: #a0a0a0;
+	   border: 2px solid #000000; 
+	   padding: 2px; 
+}
+
+td.list_drop  { 
+           text-align: left; 
+           font-size: small;  
+           font-weight: normal;  
+           vertical-align: top;
+	   background: #a0a0a0; 
+	   background-color: #a0a0a0;
+	   border: 2px solid #000000; 
+	   padding: 2px; 
+}
+
+td.list_run  { 
+           text-align: left; 
+           font-size: small;  
+           font-weight: normal;  
+           vertical-align: top;
+	   background: #ffa0a0; 
+	   background-color: #ffa0a0;
+	   border: 2px solid #000000; 
+	   padding: 2px; 
+}
+
+td.det_off  { 
+           text-align: left; 
+           font-size: small;  
+           font-weight: normal;  
+           vertical-align: top;
+	   background: #a0a0a0; 
+	   background-color: #a0a0a0;
+	   border: 2px solid #000000; 
+	   padding: 2px; 
+}
+
+td.det_drop  { 
+           text-align: left; 
+           font-size: small;  
+           font-weight: normal;  
+           vertical-align: top;
+	   background: #a0a0a0; 
+	   background-color: #ffa0a0;
+	   border: 2px solid #000000; 
+	   padding: 2px; 
+}
+
+td.det_add  { 
+           text-align: left; 
+           font-size: small;  
+           font-weight: normal;  
+           vertical-align: top;
+	   background: #ffa0a0; 
+	   background-color: #a0a0ff;
+	   border: 2px solid #000000; 
+	   padding: 2px; 
+}
+
+th.list  { 
+           text-align: left; 
+           font-size: small;  
+           font-weight: bold;  
+           vertical-align: top;
+	   background: #d0d0ff; 
+	   background-color: #d0d0ff; 
+	   border: 2px solid #000000; 
+	   padding: 2px; 
+}
+
+td.ul3x2    { 
+    text-align: right; 
+    vertical-align: bottom;
+    padding: 0px; 
+    text-indent: 0px; 
+}
+td.uc3x2    { 
+    text-align: center; 
+    vertical-align: bottom;
+    padding: 0px; 
+    text-indent: 0px; 
+}
+td.ur3x2    { 
+    text-align: left; 
+    vertical-align: bottom;
+    padding: 0px; 
+    text-indent: 0px; 
+}
+td.ll3x2    { 
+    text-align: right; 
+    vertical-align: top;
+    padding: 0px; 
+    text-indent: 0px; 
+}
+td.lc3x2    { 
+    text-align: center; 
+    vertical-align: top;
+    padding: 0px; 
+    text-indent: 0px; 
+}
+td.lr3x2    { 
+    text-align: left; 
+    vertical-align: top;
+    padding: 0px; 
+    text-indent: 0px; 
+}
Index: branches/eam_branches/ipp-20120601/dvodist/www-util/blank.html
===================================================================
--- branches/eam_branches/ipp-20120601/dvodist/www-util/blank.html	(revision 34047)
+++ branches/eam_branches/ipp-20120601/dvodist/www-util/blank.html	(revision 34047)
@@ -0,0 +1,10 @@
+<html>
+<head>
+  <title> Load and Setup </title>
+</head>
+
+<link rel="STYLESHEET" HREF="ipp.css">
+<body>
+
+test index<br>
+</body></html>
Index: branches/eam_branches/ipp-20120601/dvodist/www-util/ipp.menu.dat
===================================================================
--- branches/eam_branches/ipp-20120601/dvodist/www-util/ipp.menu.dat	(revision 34047)
+++ branches/eam_branches/ipp-20120601/dvodist/www-util/ipp.menu.dat	(revision 34047)
@@ -0,0 +1,20 @@
+# style   | select-style | type    | menu line                    | link page       
+
+piclink   | piclink      | piclink | /PScolorlogo2.jpg            | http://panstarrs.ifa.hawaii.edu
+menuext   | menuext      | link    | Pan-STARRS public            | http://panstarrs.ifa.hawaii.edu
+menuext   | menuext      | link    | Pan-STARRS project           | http://panstarrs.ifa.hawaii.edu/project
+menuext   | menuext      | link    | Pan-STARRS IPP Wiki          | http://svn.pan-starrs.ifa.hawaii.edu/trac/ipp/wiki
+menuext   | menuext      | link    | PS1SC Wiki                   | http://ps1sc.ifa.hawaii.edu/PS1wiki/index.php/Main_Page
+
+menutop   | menutop      | plain   | &nbsp;                       | 
+menutop   | menuselect   | link    | DVO Releases                 | /index.php
+menutop   | menuselect   | link    | Documentation                | /docs.php
+menutop   | menuselect   | link    | Help                         | /help.php
+
+
+# we have four valid menu types: picture, piclink, link, plain
+# picture   | picture    | picture | PScolorlogo2.jpg             | none
+# piclink   | piclink    | piclink | PScolorlogo2.jpg             | http://panstarrs.ifa.hawaii.edu
+# menulink  | menuselect | link    | other page                   | notest.php     
+# menutop   | menutop    | plain   | foo bar                      | none            
+
Index: branches/eam_branches/ipp-20120601/dvodist/www-util/ipp.php
===================================================================
--- branches/eam_branches/ipp-20120601/dvodist/www-util/ipp.php	(revision 34047)
+++ branches/eam_branches/ipp-20120601/dvodist/www-util/ipp.php	(revision 34047)
@@ -0,0 +1,198 @@
+<?php
+
+global $realroot;
+$realroot = "/dvodist";
+
+function head ($title) {
+  echo "<head>\n";
+  echo "  <title> $title </title>\n";
+  /* JavaScript code */
+  echo "  <script type=\"text/javascript\">\n";
+  echo "  function changeCell(cellId, newContent){\n";
+  echo "    document.getElementById(cellId).innerHTML=newContent;\n";
+  echo "  }\n";
+  echo "  </script>\n";
+  echo "</head>\n\n";
+}
+
+function menu ($source, $title, $root, $sheet, $append, $project) {
+
+  echo "<html>\n";
+  head($title);
+  echo "<link rel=\"STYLESHEET\" HREF=\"$sheet\">\n";
+  echo "<body>\n";
+
+  if (! $project) { $project = "none"; }
+
+  // echo "<p style=\"font-size:50%\">host: $WWWHOST, db: $DBHOST</p>\n";
+  echo "<table class=page cellspacing=10px><tr><td valign=top>\n";
+  echo "<table class=menu cellspacing=0px>\n";
+
+  menulines ($source, $root, $append, $project);
+
+  echo '</table></td><td class="body" valign=top>', "\n\n";
+}
+
+function menulines ($source, $root, $append, $project) {
+
+  $file = fopen ($source, "r");
+
+  // loop over the lines in the file and generate lines in the menu
+  while ($line = fgetcsv ($file, 1024, "|")) {
+    if (ereg ('^[:blank:]*#', $line[0])) continue;
+    if (count($line) < 2) continue;
+
+    if (count($line) == 2) {
+      $value = trim($line[0]);
+      if ($value == "input") {
+        $value = trim($line[1]);
+        menulines ($value, $root, $append, $project);
+      }
+      continue;
+    }
+    if (count($line) != 5) continue;
+
+    $type = trim($line[2]);
+    $name = trim($line[3]);
+    $base = trim($line[4]);
+
+    if (preg_match ('|\$PROJECT|', $name)) {
+      $name = preg_replace ('|\$PROJECT|', $project, $name);
+    }
+
+    // append additional elements if needed
+    if ($append) {
+      $link = "$base" . "?" . $append;
+    } else {
+      $link = "$base";
+    }
+	
+    // prepend the rootdir if needed (reference to /)
+    if ($link[0] == '/') {
+      $link = $root . $link;
+    } 
+
+    global $realroot;
+
+    // hi-lite the current page (use select-style, not style)
+    $thisname = $_SERVER[SCRIPT_NAME]; 
+    $page = $realroot . $base;
+    if ($page == $thisname) {
+      $style = trim($line[1]);
+    } else { 
+      $style = trim($line[0]);
+    }       
+
+    switch ($type) { 
+    case 'plain':
+      echo "<tr><td class=\"$style\"> $name </td></tr>\n";  
+      break;
+    case 'picture':
+      // prepend the rootdir if needed (reference to /)
+      if ($name[0] == '/') {
+	$name = $root . $name;
+      } 
+      echo "<tr><td class=\"$style\"> <img src=\"$name\"> </td></tr>\n";     
+      break;
+    case 'piclink':
+      // prepend the rootdir if needed (reference to /)
+      if ($name[0] == '/') {
+	$name = $root . $name;
+      } 
+      echo "<tr><td class=\"$style\"> <a class=\"$style\" href=\"$link\"> <img class=\"$style\" src=\"$name\"> </a></td></tr>\n";     
+      break;
+    default:
+      echo "<tr><td class=\"$style\"> <a class=\"$style\" href=\"$link\"> $name </a></td></tr>\n";     
+      break;
+    } 
+  }
+  fclose ($file);
+}
+
+function menu_end () { 
+  echo "</td></tr></table>\n";
+  echo "</body></html>\n\n";
+  exit ();
+}
+
+function dirlist ($source) {
+  $file = fopen ($source, "r");
+  echo "<table class=\"dirlist\">\n";
+
+  // loop over the lines in the file and generate lines in the menu
+  while ($line = fgetcsv ($file, 1024, ":")) {
+    if (ereg ('^[:blank:]*#', $line[0])) continue;
+    if (count($line) < 2) continue;
+
+    // allows nested entries..
+    // if (count($line) == 2) {
+    //   $value = trim($line[0]);
+    //   if ($value == "input") {
+    //     $value = trim($line[1]);
+    //     menulines ($value, $root, $append, $project);
+    //   }
+    //   continue;
+    // }
+
+    if (count($line) != 4) continue;
+
+    $name  = trim($line[0]);
+    $type  = trim($line[1]);
+    $style = trim($line[2]);
+    $info  = trim($line[3]);
+
+    switch ($type) { 
+    case 'plain':
+      echo "<tr class=\"$style\"><td>$name</td><td>$info</td></tr>\n";  
+      break;
+    case 'dir':
+      echo "<tr class=\"$style\"><td><a class=\"$style\" href=\"$name\">$name</a></td><td>$info</td></tr>\n";
+      break;
+    default:
+      echo "<tr class=\"$style\"><td><a class=\"$style\" href=\"$name\">$name</a></td><td>$info</td></tr>\n";
+      break;
+    } 
+  }
+  fclose ($file);
+  echo "</table>\n";
+}
+
+function verbatim ($source) {
+  $file = fopen ($source, "r");
+
+  $addbreak = 0;
+
+  // loop over the lines in the file and generate lines in the menu
+  while ($line = fgets ($file, 1024)) {
+    if (strlen($line) < 2) {
+      if (!$addbreak) {
+	echo "<br>\n";
+      }
+      $addbreak = 1;
+      continue;
+    }
+    $Nc = strlen($line);
+    echo "$line\n";
+    $addbreak = 0;
+  } 
+  fclose ($file);
+}
+
+//////////////////////////////////////////////////////////////////////////
+// Return the value associated to the key (GET or POST method)
+// If convertKeyToHtmlkey is true, the key is converted to a 
+// so-called HTML, i.e. the key where '.' are replaced by '_'
+// (e.g. the conversion of 'f.o.o.b_a_r' is 'f_o_o_b_a_r'.
+//
+function get_value_from_key ($key, $convertKeyToHtmlkey) {
+  if ($convertKeyToHtmlkey) {
+    $htmlkey = preg_replace ('|\.|', '_', $key);
+  } else {
+    $htmlkey = $key;
+  }
+  if ($_SERVER[REQUEST_METHOD] == 'GET') { 
+    return $_GET[$htmlkey]; 
+  } else {
+    return $_POST[$htmlkey]; 
+  }
+}
Index: branches/eam_branches/ipp-20120601/dvodist/www-util/phptest.php
===================================================================
--- branches/eam_branches/ipp-20120601/dvodist/www-util/phptest.php	(revision 34047)
+++ branches/eam_branches/ipp-20120601/dvodist/www-util/phptest.php	(revision 34047)
@@ -0,0 +1,25 @@
+<?php 
+
+include 'ipp.php';
+
+menu('ipp.menu.dat', 'test.page', 'ipp.css', '', '');
+
+$varlist = array ('SERVER_NAME', 'GATEWAY_INTERFACE', 'SERVER_PROTOCOL',
+'SERVER_PORT', 'REQUEST_METHOD', 'PATH_INFO', 'PATH_TRANSLATED', 'SCRIPT_NAME',
+'QUERY_STRING', 'REMOTE_HOST', 'REMOTE_ADDR', 'AUTH_TYPE', 'REMOTE_USER',
+'REMOTE_IDENT', 'CONTENT_TYPE', 'CONTENT_LENGTH');
+
+foreach ($varlist as $name) {
+  echo "$name : $_SERVER[$name]<br>\n";
+}
+
+echo "get list<br>\n";
+foreach ($_GET as $key => $value) {
+  echo "$key : $value<br>\n";
+}
+
+$value = system ("ls /etc", $status);
+echo "status: $status\n";
+
+menu_end();
+?>
Index: branches/eam_branches/ipp-20120601/ippData/htdocs/docs.txt
===================================================================
--- branches/eam_branches/ipp-20120601/ippData/htdocs/docs.txt	(revision 34047)
+++ branches/eam_branches/ipp-20120601/ippData/htdocs/docs.txt	(revision 34047)
@@ -0,0 +1,123 @@
+<h2>DVO Documentation</h2>
+
+<h3>Release Notes on 3pi.20120525</h3>
+
+This database contains PS1 3pi observations through 2012/01/21.  The
+ubercal zero points have been applied to all exposures included in
+that analysis.  The remaining exposures have been tied to the ubercal
+system via relative photometry.  The ubercal measurements are given
+10x their poisson weight to ensure they drive the photometric
+solution.
+
+The database has been merged with the PS1 Synthetic photometry
+database (based on 2MASS and USNO-B).  For objects brighter than the
+saturation limit, the Synthetic photometry has been used for the mean
+magnitudes (these can be identified by having bit 0x04 raised in the
+mean filter flags).  Objects which used ubercal photometry have the
+bit 0x08 raised in the mean filter flags.  
+
+This database has also been merged with the 2MASS, WISE, and
+SuperCOSMOS databases.  The following photcodes are used for those
+external photometric sources:
+
+<table class="page">
+<tr><th> Source </th><th> Photcode </th></tr>
+<tr><td> 2MASS_J </td><td> 2011 </td></tr>   
+<tr><td> 2MASS_H </td><td> 2012 </td></tr>   
+<tr><td> 2MASS_K </td><td> 2013 </td></tr>   
+<tr><td> WISE_W1 </td><td> 2014 </td></tr>   
+<tr><td> WISE_W2 </td><td> 2015 </td></tr>   
+<tr><td> WISE_W3 </td><td> 2016 </td></tr>   
+<tr><td> WISE_W4 </td><td> 2017 </td></tr>   
+<tr><td> SYNTH.g </td><td> 3001 </td></tr>   
+<tr><td> SYNTH.r </td><td> 3002 </td></tr>   
+<tr><td> SYNTH.i </td><td> 3003 </td></tr>   
+<tr><td> SYNTH.z </td><td> 3004 </td></tr>   
+<tr><td> SYNTH.y </td><td> 3005 </td></tr>
+<tr><td> SCOS.103a.E       </td><td>      1150  </td></tr>
+<tr><td> SCOS.4414.OG590   </td><td>      1151  </td></tr>
+<tr><td> SCOS.4415.OG590   </td><td>      1152  </td></tr>
+<tr><td> SCOS.IIIaF.OG590  </td><td>      1153  </td></tr>
+<tr><td> SCOS.IIIaF.RG610  </td><td>      1154  </td></tr>
+<tr><td> SCOS.IIIaF.RG630  </td><td>      1155  </td></tr>
+<tr><td> SCOS.IIIaJ.GG385  </td><td>      1156  </td></tr>
+<tr><td> SCOS.IIIaJ.GG395  </td><td>      1157  </td></tr>
+<tr><td> SCOS.IVN.RG715    </td><td>      1158  </td></tr>
+<tr><td> SCOS.IVN.RG9      </td><td>      1159  </td></tr>
+</table>
+
+<img width=1000px src="relphot.20120528/sigma.i.ubercal.20120528.v0.png"><br>
+Map of the mean per-star residual (inst mag brighter than -10) for
+i-band (ubercal data only).
+<br>
+
+<img width=1000px src="relphot.20120528/sigma.g.ubercal.20120528.v0.png"><br>
+Map of the mean per-star residual (inst mag brighter than -10) for
+g-band (ubercal data only).
+<br>
+
+<h3>Comparison with 2MASS</h3>
+
+The plots below compare the PS1 grizy photometry with 2MASS photometry
+by examining the location of the color-color locus for early (&lt; K0)
+main sequence stars.
+
+For each pixel (0.5 degree on a side), I select all objects with PS1 r
+&lt; 20 and detected JHK magnitudes, keeping only those with S/N in
+the mean &gt; 50 and standard deviations less than 0.05 magnitudes.  I
+then fit the stellar locus in g-r,r-i for the g-r range 0.2 to 1.0,
+and keep only objects that fall within 0.05 of that (linear) stellar
+locus fit.<br>
+
+I then fit the stellar locus with a line in each of the color-color diagrams
+g-i,i-J; g-i,i-H; g-i,i-K.  I measure the mean i-J color expected from
+the fit for stars with g-i = 0.5.  The figures below show the maps of
+the i-J, i-H, and i-K offsets as well as the J-H and H-K offsets at
+g-i = 0.5.  The center of these maps is RA,DEC = 0,0, (east is left,
+north is up).  The pixels are 0.5 degrees on a side.<br> 
+
+These maps show three main features.  The Galactic Plane is quite
+clear, and not surprising: this test is particularly sensitive to
+reddening. <br>
+
+Several large scale patches are also visible (eg, the black patch near
+RA ~ 150 deg).  Disappointingly, these correspond to areas without
+good ubercal ties -- in other words, these are regions in which the
+data were obtained in non-photometric conditions.  This shows the
+limitation of using relative photometry to tie across individual
+exposures.  If the exposures have an extinction gradient, the
+correction far from the photometrically tied region can drift from the
+correct value.  The largest region at RA ~ 150 matches a section with
+poor i-band photometry and has a depth of roughly 0.1 magnitudes in
+i-J.  Assuming this is completely due to i-band errors, this
+corresponds to about 0.06 magnitudes of drift to the center of this
+region. <br>
+
+The third pattern is at a lower level of intensity: N-S strips with
+roughly E-W bands.  They are most noticable in K and H-K.  These
+appear to correspond well to the 2MASS scanning pattern, and have an
+amplitude corresponding to about 0.02 - 0.04 magnitudes of offset in
+K.  <br>
+
+<img width=1000px src="relphot.20120528/dJ.allsky.20120528.v3.png"><br>
+Map of the i-J color at g-i = 0.5. 
+<br>
+
+<img width=1000px src="relphot.20120528/dH.allsky.20120528.v3.png"><br>
+Map of the i-H color at g-i = 0.5. 
+<br>
+
+<img width=1000px src="relphot.20120528/dK.allsky.20120528.v3.png"><br>
+Map of the i-K color at g-i = 0.5. 
+<br>
+
+Combinations of the above maps can highlight any problems in 2MASS
+which are driven by the color rather than the mean magnitudes.
+
+<img width=1000px src="relphot.20120528/dJH.allsky.20120528.v3.png"><br>
+Map of the J-H color at g-i = 0.5. 
+<br>
+
+<img width=1000px src="relphot.20120528/dHK.allsky.20120528.v3.png"><br>
+Map of the H-K color at g-i = 0.5. 
+<br>
Index: branches/eam_branches/ipp-20120601/ippData/htdocs/help.txt
===================================================================
--- branches/eam_branches/ipp-20120601/ippData/htdocs/help.txt	(revision 34047)
+++ branches/eam_branches/ipp-20120601/ippData/htdocs/help.txt	(revision 34047)
@@ -0,0 +1,13 @@
+<h2>DVO Distribution Help</h2>
+
+<p> These web pages contain the PS1 DVO databases, making it easy to
+download entire databases with the 'wget' command.  It is necessary to
+include an authorized user and the password.</p>
+
+
+Use a wget command on the directory of interest, eg:
+
+<tt> wget --user=ps1sc --password=(PASS) -r -np -nH http://dvodist.ipp.ifa.hawaii.edu/3pi.20120509 </tt>
+
+Ask your DRAVG representative if you need the password.
+
Index: branches/eam_branches/ipp-20120601/ippData/htdocs/index.info.txt
===================================================================
--- branches/eam_branches/ipp-20120601/ippData/htdocs/index.info.txt	(revision 34047)
+++ branches/eam_branches/ipp-20120601/ippData/htdocs/index.info.txt	(revision 34047)
@@ -0,0 +1,5 @@
+<h2>Pan-STARRS 1 Data Distribution Server</h2>
+
+<p> These web pages contain the PS1 data for public release</p>
+
+<br><br>
Index: branches/eam_branches/ipp-20120601/ippData/htdocs/index.php
===================================================================
--- branches/eam_branches/ipp-20120601/ippData/htdocs/index.php	(revision 34047)
+++ branches/eam_branches/ipp-20120601/ippData/htdocs/index.php	(revision 34047)
@@ -0,0 +1,59 @@
+<?php 
+
+$utils = "/export/ipp002.0/www/localhost/utils";
+
+include "$utils/ipp.php";
+
+// if we come in directly, the top-level directory should be /dvodist
+// if we come in from the ippops1 proxy, we need to set the root to /
+$ifaProxy = "128.171.227.208";
+
+// is the request coming from our proxY?
+// $fromProxy = $_SERVER['HTTP_X_FORWARDED_FOR'] && ($_SERVER['REMOTE_ADDR'] == $ifaProxy);
+// if ($fromProxy) ... 
+$rootdir = "";
+
+menu("$utils/ipp.menu.dat", 'DVO Distribution Server', $rootdir, "$rootdir/ipp.css", '', '');
+
+$script = basename($_SERVER[SCRIPT_NAME]);
+
+if ($script == "index.php") {
+  verbatim ("index.info.txt");
+  dirlist ("index.txt");
+ }
+
+if ($script == "docs.php") {
+  verbatim ("docs.txt");
+ }
+
+if ($script == "help.php") {
+  verbatim ("help.txt");
+ }
+
+menu_end();
+?>
+
+// generic proxy detection
+// if ( $_SERVER['HTTP_X_FORWARDED_FOR']
+//      || $_SERVER['HTTP_X_FORWARDED']
+//      || $_SERVER['HTTP_FORWARDED_FOR']
+//      || $_SERVER['HTTP_CLIENT_IP']
+//      || $_SERVER['HTTP_VIA']
+//      || in_array($_SERVER['REMOTE_PORT'], array(8080,80,6588,8000,3128,553,554))
+//      || @fsockopen($_SERVER['REMOTE_ADDR'], 80, $errno, $errstr, 30))
+//   {
+//     exit('Proxy detected');
+//   }
+
+// list server info:
+// $varlist = array ('SCRIPT_NAME', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_FORWARDED_FOR', 'HTTP_CLIENT_IP', 'HTTP_VIA', 'REMOTE_ADDR');
+// 
+// foreach ($varlist as $name) {
+//   echo "$name : $_SERVER[$name]<br>\n";
+// }
+// 
+// echo "get list<br>\n";
+// foreach ($_GET as $key => $value) {
+//   echo "$key : $value<br>\n";
+// }
+
Index: branches/eam_branches/ipp-20120601/ippData/htdocs/index.txt
===================================================================
--- branches/eam_branches/ipp-20120601/ippData/htdocs/index.txt	(revision 34047)
+++ branches/eam_branches/ipp-20120601/ippData/htdocs/index.txt	(revision 34047)
@@ -0,0 +1,4 @@
+# Name                   : link                       : type  : style : info
+Data Product  	         : none                       : plain : title : Comment
+PS1 Photometry Ladder v0 : photladder.20120604.subset : dir   : dir1  : Photometry Ladder released 2012.06.07 (EAM UPDATE)
+Synthetic Photometry DVO : catdir.syn.test            : dir   : dir1  : Demonstration DVO Database
Index: branches/eam_branches/ipp-20120601/ippData/htdocs/ipp.css
===================================================================
--- branches/eam_branches/ipp-20120601/ippData/htdocs/ipp.css	(revision 34047)
+++ branches/eam_branches/ipp-20120601/ippData/htdocs/ipp.css	(revision 34047)
@@ -0,0 +1,421 @@
+
+/* internal link line: c0d0d0 : d8d0f0
+   external link line: 303070 
+   border:             0080c0
+ */
+
+body  { 
+    background-color: #a0d0e0; 
+    padding: 5px; 
+    margin: 5px
+}
+
+h1 {
+    margin-top: 0.05em;
+    margin-bottom: 0.05em;
+}
+
+h2 {
+    margin-top: 0.05em;
+    margin-bottom: 0.05em;
+}
+
+h3 {
+    margin-top: 0.05em;
+    margin-bottom: 0.05em;
+}
+
+h4 {
+    margin-top: 0.05em;
+    margin-bottom: 0.05em;
+}
+
+div.debug {
+    height: 15%;
+    background-color: #ffffaa;
+    overflow: auto;
+}
+
+a:link, a:visited, a:active { 
+    text-decoration: underline; 
+    font-weight: bold; 
+    color: #ff0000
+}
+
+a.button      { 
+    text-decoration: none; 
+    font-weight: bold;   
+    color: #000000; 
+    background: #0080c0
+}
+a.menutop     { 
+    text-decoration: none; 
+    font-weight: bold;   
+    color: #ffffff
+}
+a.menutops    { 
+    text-decoration: none; 
+    font-weight: bold;   
+    color: #80f0ff
+}
+a.menuext     { 
+    text-decoration: none; 
+    font-weight: bold;   
+    color: #ffffff
+}
+a.menulink    { 
+    text-decoration: none; 
+    font-weight: normal; 
+    color: #000000
+}
+a.menuselect  { 
+    text-decoration: none; 
+    font-weight: normal; 
+    color: #0000ff
+}
+a.piclink     { 
+    text-decoration: none; 
+    font-weight: normal; 
+    color: #0080c0
+}
+
+table.dirlist { text-align: left; 
+             font-size: small; 
+	     font-weight: normal; 
+	     background: #303030; 
+	     border: 1px solid #000000; 
+	     padding: 1px; 
+}
+
+a.dir1     { 
+    text-decoration: none; 
+    font-weight: bold;   
+    color: #800080
+}
+a.dir2     { 
+    text-decoration: none; 
+    font-weight: bold;   
+    color: #800080
+}
+a.file1     { 
+    text-decoration: none; 
+    font-weight: bold;   
+    color: #800080
+}
+a.file2     { 
+    text-decoration: none; 
+    font-weight: bold;   
+    color: #800080
+}
+tr.dir1    { 
+    text-align: left; 
+    background: #d0d0d0; 
+    font-size: small; 
+    color: #000000; 
+    padding: 1px; 
+}
+tr.dir2    { 
+    text-align: left; 
+    background: #d0d0ff; 
+    font-size: small; 
+    color: #000000; 
+    padding: 1px; 
+}
+tr.file1    { 
+    text-align: left; 
+    background: #d0d0d0; 
+    font-size: small; 
+    color: #000000; 
+    padding: 2px; 
+}
+tr.file2    { 
+    text-align: left; 
+    background: #d0d0ff; 
+    font-size: small; 
+    color: #000000; 
+    padding: 2px; 
+}
+tr.break    { 
+    text-align: left; 
+    background: #0080c0; 
+    font-size: small; 
+    color: #ffffff; 
+    padding-top: 4px; 
+}
+tr.title    { 
+    text-align: left; 
+    background: #d0d0ff; 
+    font-size: medium; 
+    color: #000000; 
+    padding: 2px; 
+    padding-top: 4px; 
+    padding-bottom: 4px; 
+}
+
+td.menutop    { 
+    text-align: left; 
+    background: #0080c0; 
+    font-size: small; 
+    color: #ffffff; 
+    padding: 2px; 
+}
+td.menutops   { 
+    text-align: left; 
+    background: #0080c0; 
+    font-size: small; 
+    color: #000000; 
+    padding: 2px; 
+}
+td.menuext    { 
+    text-align: left; 
+    background: #303070; 
+    font-size: small; 
+    color: #ffffff; 
+    padding: 2px; 
+}
+td.menulink   { 
+    text-align: left; 
+    background: #d0d0ff; 
+    font-size: small; 
+    color: #000000; 
+    padding: 2px; 
+    font-weight: normal; 
+    text-indent: 0px; 
+}
+td.menuselect { 
+    text-align: left; 
+    background: #d0d0ff; 
+    font-size: small; 
+    color: #ff0000; 
+    padding: 2px; 
+    font-weight: normal; 
+    text-indent: 0px; 
+}
+td.menuline   { 
+    text-align: left; 
+    background: #d0d0ff; 
+    font-size: small; 
+    color: #000000; 
+    padding: 2px; 
+    font-weight: normal; 
+    text-indent: 0px; 
+}
+
+td.picture    { 
+    text-align: left; 
+    background: #00ffff; 
+    font-size: small; 
+    color: #ff0000; 
+    padding: 0px; 
+    text-indent: 2px; 
+    font-weight: normal; 
+}
+td.piclink    { 
+    text-align: left; 
+    background: #0080c0; 
+    font-size: small; 
+    color: #ff0000; 
+    padding: 0px; 
+    text-indent: 0px; 
+    font-weight: normal; 
+}
+
+table.page { 
+    border: 0px solid #0080c0; 
+    background: #a0d0e0; 
+    padding: 0px
+}
+
+td.title { 
+    background-color: #ff0000; 
+    padding: 5px; 
+    font-size: x-large; 
+    text-align: left; 
+    vertical-align: top
+}
+
+td.body  { 
+           text-align: left; 
+           font-size: small;  
+           font-weight: normal;  
+           vertical-align: top;
+	   background: #d0d0ff; 
+	   background-color: #d0d0ff; 
+	   border: 3px solid #0080c0; 
+	   padding: 5px; 
+}
+
+table.menu { 
+    text-align: left; 
+    font-size: small; 
+    font-weight: normal; 
+    background: #ff0000; 
+    border: 3px solid #0080c0; 
+    padding: 0px; 
+}
+
+table.select { 
+    text-align: left; 
+    font-size: small; 
+    font-weight: normal; 
+    background: #0080c0; 
+    border: 1px solid #0080c0; 
+    padding: 0px; 
+}
+
+td.select  { 
+    text-align: left; 
+    font-size: small;  
+    font-weight: bold;  
+    vertical-align: top;
+    color: #ffffff; 
+    background: #0080c0; 
+    background-color: #0080c0; 
+    border: 2px solid #0080c0; 
+    padding: 2px; 
+}
+
+th.select  { 
+           text-align: left; 
+           font-size: small;  
+           font-weight: bold;  
+           vertical-align: top;
+	   color: #000000; 
+	   background: #d0d0ff; 
+	   background-color: #d0d0ff; 
+	   border: 0px solid #0080c0; 
+	   padding: 2px; 
+}
+
+table.list { text-align: left; 
+             font-size: small; 
+	     font-weight: normal; 
+	     background: #d0d0ff; 
+	     border: 2px solid #ffffff; 
+	     padding: 0px; 
+}
+
+td.list  { 
+           text-align: left; 
+           font-size: small;  
+           font-weight: normal;  
+           vertical-align: top;
+	   background: #d0d0ff; 
+	   background-color: #d0d0ff; 
+	   border: 2px solid #000000; 
+	   padding: 2px; 
+}
+
+td.list_off  { 
+           text-align: left; 
+           font-size: small;  
+           font-weight: normal;  
+           vertical-align: top;
+	   background: #a0a0a0; 
+	   background-color: #a0a0a0;
+	   border: 2px solid #000000; 
+	   padding: 2px; 
+}
+
+td.list_drop  { 
+           text-align: left; 
+           font-size: small;  
+           font-weight: normal;  
+           vertical-align: top;
+	   background: #a0a0a0; 
+	   background-color: #a0a0a0;
+	   border: 2px solid #000000; 
+	   padding: 2px; 
+}
+
+td.list_run  { 
+           text-align: left; 
+           font-size: small;  
+           font-weight: normal;  
+           vertical-align: top;
+	   background: #ffa0a0; 
+	   background-color: #ffa0a0;
+	   border: 2px solid #000000; 
+	   padding: 2px; 
+}
+
+td.det_off  { 
+           text-align: left; 
+           font-size: small;  
+           font-weight: normal;  
+           vertical-align: top;
+	   background: #a0a0a0; 
+	   background-color: #a0a0a0;
+	   border: 2px solid #000000; 
+	   padding: 2px; 
+}
+
+td.det_drop  { 
+           text-align: left; 
+           font-size: small;  
+           font-weight: normal;  
+           vertical-align: top;
+	   background: #a0a0a0; 
+	   background-color: #ffa0a0;
+	   border: 2px solid #000000; 
+	   padding: 2px; 
+}
+
+td.det_add  { 
+           text-align: left; 
+           font-size: small;  
+           font-weight: normal;  
+           vertical-align: top;
+	   background: #ffa0a0; 
+	   background-color: #a0a0ff;
+	   border: 2px solid #000000; 
+	   padding: 2px; 
+}
+
+th.list  { 
+           text-align: left; 
+           font-size: small;  
+           font-weight: bold;  
+           vertical-align: top;
+	   background: #d0d0ff; 
+	   background-color: #d0d0ff; 
+	   border: 2px solid #000000; 
+	   padding: 2px; 
+}
+
+td.ul3x2    { 
+    text-align: right; 
+    vertical-align: bottom;
+    padding: 0px; 
+    text-indent: 0px; 
+}
+td.uc3x2    { 
+    text-align: center; 
+    vertical-align: bottom;
+    padding: 0px; 
+    text-indent: 0px; 
+}
+td.ur3x2    { 
+    text-align: left; 
+    vertical-align: bottom;
+    padding: 0px; 
+    text-indent: 0px; 
+}
+td.ll3x2    { 
+    text-align: right; 
+    vertical-align: top;
+    padding: 0px; 
+    text-indent: 0px; 
+}
+td.lc3x2    { 
+    text-align: center; 
+    vertical-align: top;
+    padding: 0px; 
+    text-indent: 0px; 
+}
+td.lr3x2    { 
+    text-align: left; 
+    vertical-align: top;
+    padding: 0px; 
+    text-indent: 0px; 
+}
Index: branches/eam_branches/ipp-20120601/ippData/scripts/mkindex.sh
===================================================================
--- branches/eam_branches/ipp-20120601/ippData/scripts/mkindex.sh	(revision 34047)
+++ branches/eam_branches/ipp-20120601/ippData/scripts/mkindex.sh	(revision 34047)
@@ -0,0 +1,37 @@
+#!/bin/csh -f 
+
+if ($#argv != 1) then
+  echo "USAGE: mkindex.sh (dir)"
+  exit 2
+endif
+
+set topdir = $argv[1]
+
+# this is weak: depends on root location
+ln -s /export/ipp002.0/www/localhost/htdocs/ippData/index.php $topdir/
+
+set file = `basename $topdir`
+echo "$file : $file : plain : title  : Title" > $topdir/index.txt
+echo "..    : ..    : dir   : dir2   : parent directory" >> $topdir/index.txt
+
+set N = 1
+foreach entry ($topdir/*)
+  set file = `basename $entry`
+  if ("$file" == "index.php") continue
+  if ("$file" == "index.txt") continue
+
+  if (-d $entry) then
+    echo "$file : $file : dir : dir$N : directory" >> $topdir/index.txt
+    /export/ipp002.0/www/localhost/scripts/mkindex.sh $entry
+  endif
+
+  if (-f $entry) then
+    echo "$file : $file : file : file$N : database file" >> $topdir/index.txt
+  endif
+
+  if ($N == 1) then
+    set N = 2
+  else
+    set N = 1
+  endif
+end
Index: branches/eam_branches/ipp-20120601/ippData/utils/blank.html
===================================================================
--- branches/eam_branches/ipp-20120601/ippData/utils/blank.html	(revision 34047)
+++ branches/eam_branches/ipp-20120601/ippData/utils/blank.html	(revision 34047)
@@ -0,0 +1,10 @@
+<html>
+<head>
+  <title> Load and Setup </title>
+</head>
+
+<link rel="STYLESHEET" HREF="ipp.css">
+<body>
+
+test index<br>
+</body></html>
Index: branches/eam_branches/ipp-20120601/ippData/utils/ipp.menu.dat
===================================================================
--- branches/eam_branches/ipp-20120601/ippData/utils/ipp.menu.dat	(revision 34047)
+++ branches/eam_branches/ipp-20120601/ippData/utils/ipp.menu.dat	(revision 34047)
@@ -0,0 +1,20 @@
+# style   | select-style | type    | menu line                    | link page       
+
+piclink   | piclink      | piclink | /PScolorlogo2.jpg            | http://panstarrs.ifa.hawaii.edu
+menuext   | menuext      | link    | Pan-STARRS public            | http://panstarrs.ifa.hawaii.edu
+menuext   | menuext      | link    | Pan-STARRS project           | http://panstarrs.ifa.hawaii.edu/project
+menuext   | menuext      | link    | Pan-STARRS IPP Wiki          | http://svn.pan-starrs.ifa.hawaii.edu/trac/ipp/wiki
+menuext   | menuext      | link    | PS1SC Wiki                   | http://ps1sc.ifa.hawaii.edu/PS1wiki/index.php/Main_Page
+
+menutop   | menutop      | plain   | &nbsp;                       | 
+menutop   | menuselect   | link    | Pan-STARRS Data              | /index.php
+menutop   | menuselect   | link    | Documentation                | /docs.php
+menutop   | menuselect   | link    | Help                         | /help.php
+
+
+# we have four valid menu types: picture, piclink, link, plain
+# picture   | picture    | picture | PScolorlogo2.jpg             | none
+# piclink   | piclink    | piclink | PScolorlogo2.jpg             | http://panstarrs.ifa.hawaii.edu
+# menulink  | menuselect | link    | other page                   | notest.php     
+# menutop   | menutop    | plain   | foo bar                      | none            
+
Index: branches/eam_branches/ipp-20120601/ippData/utils/ipp.php
===================================================================
--- branches/eam_branches/ipp-20120601/ippData/utils/ipp.php	(revision 34047)
+++ branches/eam_branches/ipp-20120601/ippData/utils/ipp.php	(revision 34047)
@@ -0,0 +1,206 @@
+<?php
+
+global $realroot;
+$realroot = "/dvodist";
+
+function head ($title) {
+  echo "<head>\n";
+  echo "  <title> $title </title>\n";
+  /* JavaScript code */
+  echo "  <script type=\"text/javascript\">\n";
+  echo "  function changeCell(cellId, newContent){\n";
+  echo "    document.getElementById(cellId).innerHTML=newContent;\n";
+  echo "  }\n";
+  echo "  </script>\n";
+  echo "</head>\n\n";
+}
+
+function menu ($source, $title, $root, $sheet, $append, $project) {
+
+  echo "<html>\n";
+  head($title);
+  echo "<link rel=\"STYLESHEET\" HREF=\"$sheet\">\n";
+  echo "<body>\n";
+
+  if (! $project) { $project = "none"; }
+
+  // echo "<p style=\"font-size:50%\">host: $WWWHOST, db: $DBHOST</p>\n";
+  echo "<table class=page cellspacing=10px><tr><td valign=top>\n";
+  echo "<table class=menu cellspacing=0px>\n";
+
+  menulines ($source, $root, $append, $project);
+
+  echo '</table></td><td class="body" valign=top>', "\n\n";
+}
+
+function menulines ($source, $root, $append, $project) {
+
+  $file = fopen ($source, "r");
+
+  // loop over the lines in the file and generate lines in the menu
+  while ($line = fgetcsv ($file, 1024, "|")) {
+    if (ereg ('^[:blank:]*#', $line[0])) continue;
+    if (count($line) < 2) continue;
+
+    if (count($line) == 2) {
+      $value = trim($line[0]);
+      if ($value == "input") {
+        $value = trim($line[1]);
+        menulines ($value, $root, $append, $project);
+      }
+      continue;
+    }
+    if (count($line) != 5) continue;
+
+    $type = trim($line[2]);
+    $name = trim($line[3]);
+    $base = trim($line[4]);
+
+    if (preg_match ('|\$PROJECT|', $name)) {
+      $name = preg_replace ('|\$PROJECT|', $project, $name);
+    }
+
+    // append additional elements if needed
+    if ($append) {
+      $link = "$base" . "?" . $append;
+    } else {
+      $link = "$base";
+    }
+	
+    // prepend the rootdir if needed (reference to /)
+    if ($link[0] == '/') {
+      $link = $root . $link;
+    } 
+
+    global $realroot;
+
+    // hi-lite the current page (use select-style, not style)
+    $thisname = $_SERVER[SCRIPT_NAME]; 
+    $page = $realroot . $base;
+    if ($page == $thisname) {
+      $style = trim($line[1]);
+    } else { 
+      $style = trim($line[0]);
+    }       
+
+    switch ($type) { 
+    case 'plain':
+      echo "<tr><td class=\"$style\"> $name </td></tr>\n";  
+      break;
+    case 'picture':
+      // prepend the rootdir if needed (reference to /)
+      if ($name[0] == '/') {
+	$name = $root . $name;
+      } 
+      echo "<tr><td class=\"$style\"> <img src=\"$name\"> </td></tr>\n";     
+      break;
+    case 'piclink':
+      // prepend the rootdir if needed (reference to /)
+      if ($name[0] == '/') {
+	$name = $root . $name;
+      } 
+      echo "<tr><td class=\"$style\"> <a class=\"$style\" href=\"$link\"> <img class=\"$style\" src=\"$name\"> </a></td></tr>\n";     
+      break;
+    default:
+      echo "<tr><td class=\"$style\"> <a class=\"$style\" href=\"$link\"> $name </a></td></tr>\n";     
+      break;
+    } 
+  }
+  fclose ($file);
+}
+
+function menu_end () { 
+  echo "</td></tr></table>\n";
+  echo "</body></html>\n\n";
+  exit ();
+}
+
+function dirlist ($source) {
+  if (!file_exists($source)) return;
+
+  $file = fopen ($source, "r");
+  if (!$file) return;
+
+  echo "<table class=\"dirlist\">\n";
+
+  // loop over the lines in the file and generate lines in the menu
+  while ($line = fgetcsv ($file, 1024, ":")) {
+    if (ereg ('^[:blank:]*#', $line[0])) continue;
+    if (count($line) < 2) continue;
+
+    // allows nested entries..
+    // if (count($line) == 2) {
+    //   $value = trim($line[0]);
+    //   if ($value == "input") {
+    //     $value = trim($line[1]);
+    //     menulines ($value, $root, $append, $project);
+    //   }
+    //   continue;
+    // }
+
+    if (count($line) != 5) continue;
+
+    $name  = trim($line[0]);
+    $link  = trim($line[1]);
+    $type  = trim($line[2]);
+    $style = trim($line[3]);
+    $info  = trim($line[4]);
+
+    switch ($type) { 
+    case 'plain':
+      echo "<tr class=\"$style\"><td>$name</td><td>$info</td></tr>\n";  
+      break;
+    case 'dir':
+      echo "<tr class=\"$style\"><td><a class=\"$style\" href=\"$link\">$name</a></td><td>$info</td></tr>\n";
+      break;
+    default:
+      echo "<tr class=\"$style\"><td><a class=\"$style\" href=\"$link\">$name</a></td><td>$info</td></tr>\n";
+      break;
+    } 
+  }
+  fclose ($file);
+  echo "</table>\n";
+}
+
+function verbatim ($source) {
+  if (!file_exists($source)) return;
+
+  $file = fopen ($source, "r");
+  if (!$file) return;
+
+  $addbreak = 0;
+
+  // loop over the lines in the file and generate lines in the menu
+  while ($line = fgets ($file, 1024)) {
+    if (strlen($line) < 2) {
+      if (!$addbreak) {
+	echo "<br>\n";
+      }
+      $addbreak = 1;
+      continue;
+    }
+    $Nc = strlen($line);
+    echo "$line\n";
+    $addbreak = 0;
+  } 
+  fclose ($file);
+}
+
+//////////////////////////////////////////////////////////////////////////
+// Return the value associated to the key (GET or POST method)
+// If convertKeyToHtmlkey is true, the key is converted to a 
+// so-called HTML, i.e. the key where '.' are replaced by '_'
+// (e.g. the conversion of 'f.o.o.b_a_r' is 'f_o_o_b_a_r'.
+//
+function get_value_from_key ($key, $convertKeyToHtmlkey) {
+  if ($convertKeyToHtmlkey) {
+    $htmlkey = preg_replace ('|\.|', '_', $key);
+  } else {
+    $htmlkey = $key;
+  }
+  if ($_SERVER[REQUEST_METHOD] == 'GET') { 
+    return $_GET[$htmlkey]; 
+  } else {
+    return $_POST[$htmlkey]; 
+  }
+}
Index: branches/eam_branches/ipp-20120601/ippData/utils/phptest.php
===================================================================
--- branches/eam_branches/ipp-20120601/ippData/utils/phptest.php	(revision 34047)
+++ branches/eam_branches/ipp-20120601/ippData/utils/phptest.php	(revision 34047)
@@ -0,0 +1,28 @@
+<?php 
+
+$utils = "/export/ipp002.0/www/localhost/utils";
+
+include "$utils/ipp.php";
+
+menu("$utils/ipp.menu.dat", 'test.page', $rootdir, "$rootdir/ipp.css", '', '');
+
+
+$varlist = array ('SERVER_NAME', 'GATEWAY_INTERFACE', 'SERVER_PROTOCOL',
+'SERVER_PORT', 'REQUEST_METHOD', 'PATH_INFO', 'PATH_TRANSLATED', 'SCRIPT_NAME',
+'QUERY_STRING', 'REMOTE_HOST', 'REMOTE_ADDR', 'AUTH_TYPE', 'REMOTE_USER',
+'REMOTE_IDENT', 'CONTENT_TYPE', 'CONTENT_LENGTH');
+
+foreach ($varlist as $name) {
+  echo "$name : $_SERVER[$name]<br>\n";
+}
+
+echo "get list<br>\n";
+foreach ($_GET as $key => $value) {
+  echo "$key : $value<br>\n";
+}
+
+$value = system ("ls /etc", $status);
+echo "status: $status\n";
+
+menu_end();
+?>
Index: branches/eam_branches/ipp-20120601/ippMonitor/INSTALL
===================================================================
--- branches/eam_branches/ipp-20120601/ippMonitor/INSTALL	(revision 34045)
+++ branches/eam_branches/ipp-20120601/ippMonitor/INSTALL	(revision 34047)
@@ -15,4 +15,11 @@
 # note that we have a special version for ippmonitor without $PSCONFIG/$PSCONFDIR values:
 ipp@ippdb03 / ippdb03 example:
- psconfigure --dbhost ippdb01 --dbuser ipp --dbpass ipp --htdocs /var/www/localhost/htdocs --site ~/ippconfig/ippmonitor.config
+# psconfigure --dbhost ippdb01 --dbuser ipp --dbpass ipp --htdocs /var/www/localhost/htdocs --site ~/ippconfig/ippmonitor.config
 
+#ipp@ippdb03 / ippdb01 example:
+ psconfigure --dbhost ippdb03 --dbuser ipp --dbpass ipp --htdocs /var/www/localhost/htdocs --site ~/ippconfig/ippmonitor.config
+
+#
+# Regular installation on ippMonitor.ifa.hawaii.edu
+# Note: we use a 'science databases (replication) slave' and the ippMonitor read-only account to connect to that database
+psconfigure --dbhost scidbs1 --dbuser ippMonitor --dbpass ippMonitor --htdocs /var/www/localhost/htdocs --site ~/ippconfig/ippmonitor.config
Index: branches/eam_branches/ipp-20120601/ippMonitor/czartool/czartool/czarconfig.xml
===================================================================
--- branches/eam_branches/ipp-20120601/ippMonitor/czartool/czartool/czarconfig.xml	(revision 34045)
+++ branches/eam_branches/ipp-20120601/ippMonitor/czartool/czartool/czarconfig.xml	(revision 34047)
@@ -21,5 +21,5 @@
   <gpc1database>
     <name>gpc1</name>
-    <host>ippdb01</host>
+    <host>scidbs1</host>
     <user>ippMonitor</user>
     <password>ippMonitor</password>
@@ -29,5 +29,5 @@
   <czardatabase>
     <name>czardb</name>
-    <host>ippdb01</host>
+    <host>scidbm</host>
     <user>ipp</user>
     <password>ipp</password>
@@ -46,2 +46,3 @@
 
 </czarconfig>
+
Index: branches/eam_branches/ipp-20120601/ippMonitor/def/autocode.php
===================================================================
--- branches/eam_branches/ipp-20120601/ippMonitor/def/autocode.php	(revision 34045)
+++ branches/eam_branches/ipp-20120601/ippMonitor/def/autocode.php	(revision 34047)
@@ -28,7 +28,9 @@
 // ** TABLE RESTRICTIONS **
 
+// Note: the restriction is now moved AFTER the count query
+// unless the RESTRICT_COUNT keyword is used
 if ($restricted == 0) {
-  if ("$UNRESTRICTED" != "none") {
-    $WHERE = "$WHERE $UNRESTRICTED";
+  if ("$RESTRICT_COUNT" != "none") {
+    $WHERE = "$WHERE $RESTRICT_COUNT";
   }
 }
@@ -56,4 +58,12 @@
   menu_end();
 }
+
+// Restrict the query if it is necessary
+if ($restricted == 0) {
+  if ( ("$UNRESTRICTED" != "none") && ("$RESTRICT_COUNT" == "none") ) {
+    $WHERE = "$WHERE $UNRESTRICTED";
+  }
+}
+
 // set up the row counter variables
 if ($ID['from']) {
Index: branches/eam_branches/ipp-20120601/ippMonitor/def/camProcessedExp_Images.d
===================================================================
--- branches/eam_branches/ipp-20120601/ippMonitor/def/camProcessedExp_Images.d	(revision 34045)
+++ branches/eam_branches/ipp-20120601/ippMonitor/def/camProcessedExp_Images.d	(revision 34047)
@@ -3,4 +3,6 @@
 FILE  camProcessedExp_Images.php
 MENU  ipp.science.dat
+
+UNRESTRICTED AND 0>1
 
 # the following WHERE clauses are added to all queries joined by AND
@@ -10,5 +12,4 @@
 WHERE camProcessedExp.cam_id  = camRun.cam_id
 WHERE camProcessedExp.fault = 0
-
 # define image names to be used below
 # IMAGE VAR basename filerule camera class_id
Index: branches/eam_branches/ipp-20120601/ippMonitor/def/diffSummary_Images.d
===================================================================
--- branches/eam_branches/ipp-20120601/ippMonitor/def/diffSummary_Images.d	(revision 34045)
+++ branches/eam_branches/ipp-20120601/ippMonitor/def/diffSummary_Images.d	(revision 34047)
@@ -3,4 +3,6 @@
 FILE  diffSummary_Images.php
 MENU  ipp.stack.dat
+
+UNRESTRICTED AND 0>1
 
 WHERE diffRun.diff_id             = diffSkyfile.diff_id
Index: branches/eam_branches/ipp-20120601/ippMonitor/def/newImfile.d
===================================================================
--- branches/eam_branches/ipp-20120601/ippMonitor/def/newImfile.d	(revision 34045)
+++ branches/eam_branches/ipp-20120601/ippMonitor/def/newImfile.d	(revision 34047)
@@ -4,4 +4,6 @@
 MENU  ipp.load.dat
 
+UNRESTRICTED WHERE 0>1
+
 #        field       size  format  name           show   link to         extras
 FIELD    exp_id,	5, %d,     exposure ID
Index: branches/eam_branches/ipp-20120601/ippMonitor/def/pzDoneImfile.d
===================================================================
--- branches/eam_branches/ipp-20120601/ippMonitor/def/pzDoneImfile.d	(revision 34045)
+++ branches/eam_branches/ipp-20120601/ippMonitor/def/pzDoneImfile.d	(revision 34047)
@@ -3,4 +3,6 @@
 FILE  pzDoneImfile.php
 MENU  ipp.load.dat
+
+UNRESTRICTED AND 0>1
 
 WHERE pzDownloadImfile.fault     = 0
Index: branches/eam_branches/ipp-20120601/ippMonitor/def/pzPendingImfile.d
===================================================================
--- branches/eam_branches/ipp-20120601/ippMonitor/def/pzPendingImfile.d	(revision 34045)
+++ branches/eam_branches/ipp-20120601/ippMonitor/def/pzPendingImfile.d	(revision 34047)
@@ -3,4 +3,6 @@
 FILE  pzPendingImfile.php
 MENU  ipp.load.dat
+
+UNRESTRICTED AND 0>1
 
 WHERE summitImfile.exp_name  = pzDownloadExp.exp_name 
Index: branches/eam_branches/ipp-20120601/ippMonitor/def/rawBurntoolState.d
===================================================================
--- branches/eam_branches/ipp-20120601/ippMonitor/def/rawBurntoolState.d	(revision 34045)
+++ branches/eam_branches/ipp-20120601/ippMonitor/def/rawBurntoolState.d	(revision 34047)
@@ -5,4 +5,5 @@
 
 # if no query restrictions are supplied, we want to limit the query or it is extremely long running:
+RESTRICT_COUNT WHERE 0>1
 UNRESTRICTED WHERE exp_id = 0
 
Index: branches/eam_branches/ipp-20120601/ippMonitor/def/rawImfile.d
===================================================================
--- branches/eam_branches/ipp-20120601/ippMonitor/def/rawImfile.d	(revision 34045)
+++ branches/eam_branches/ipp-20120601/ippMonitor/def/rawImfile.d	(revision 34047)
@@ -5,4 +5,6 @@
 
 # HEAD PHP insert_backref ("rawExp.php", "exp_id", $ID['link']);
+
+UNRESTRICTED WHERE 0>1
 
 OP   OP1  $ra * 57.295783
Index: branches/eam_branches/ipp-20120601/ippMonitor/def/summitImfile.d
===================================================================
--- branches/eam_branches/ipp-20120601/ippMonitor/def/summitImfile.d	(revision 34045)
+++ branches/eam_branches/ipp-20120601/ippMonitor/def/summitImfile.d	(revision 34047)
@@ -3,4 +3,6 @@
 FILE  summitImfile.php
 MENU  ipp.load.dat
+
+UNRESTRICTED WHERE 0>1
 
 #        field     size  format  name             show   link to         extras
Index: branches/eam_branches/ipp-20120601/ippMonitor/raw/czartool_labels.php
===================================================================
--- branches/eam_branches/ipp-20120601/ippMonitor/raw/czartool_labels.php	(revision 34045)
+++ branches/eam_branches/ipp-20120601/ippMonitor/raw/czartool_labels.php	(revision 34047)
@@ -171,5 +171,7 @@
 echo "<tr><td>Who's using the cluster?</td><td><a href=\"http://ippmonitor.ipp.ifa.hawaii.edu/ippMonitor/clusterMonitor/top.html\"><font color=\"blue\">here</font></a></td></tr>";
 echo "<tr><td>IPP metrics</td><td><a href=\"http://ipp0022.ifa.hawaii.edu/ps1sc/ippMetrics\"><font color=\"blue\">here</font></a></td></tr>";
-echo "<tr><td>Czar log pages</td><td><a href=\"http://svn.pan-starrs.ifa.hawaii.edu/trac/ipp/wiki/PS1_IPP_CzarLogs\"><font color=\"blue\">here</font></a></td></tr>";
+echo "<tr><td>Czar log pages</td><td><a href=\"http://svn.pan-starrs.ifa.hawaii.edu/trac/ipp/wiki/PS1_IPP_CzarLogs\"><font color=\"blue\">All</font></a>&nbsp;&nbsp;&nbsp;";
+echo "<a href=\"http://svn.pan-starrs.ifa.hawaii.edu/trac/ipp/wiki/PS1_IPP_CzarLog_".(date("Ymd")-date("w")+"1")."\">This week</a>";
+echo "</td></tr>";
 echo "<tr><td>Exposure summary</td><td><a href=\"czartool_exposures.php?pass=$pass&proj=$proj\"><font color=\"blue\">here</font></a></td></tr>";
 
@@ -215,4 +217,5 @@
       showReplicationsStatus($REPL_HOST_PSTAMP, $REPL_USER_PSTAMP, $REPL_PASSWORD_PSTAMP, $REPL_DBNAME_PSTAMP);
       showReplicationsStatus($REPL_HOST_IPPADMIN, $REPL_USER_IPPADMIN, $REPL_PASSWORD_IPPADMIN, $REPL_DBNAME_IPPADMIN);
+      showReplicationsStatus($REPL_HOST_ISP, $REPL_USER_ISP, $REPL_PASSWORD_ISP, $REPL_DBNAME_ISP);
       echo "</table>";
 
Index: branches/eam_branches/ipp-20120601/ippMonitor/raw/site.php.in
===================================================================
--- branches/eam_branches/ipp-20120601/ippMonitor/raw/site.php.in	(revision 34045)
+++ branches/eam_branches/ipp-20120601/ippMonitor/raw/site.php.in	(revision 34047)
@@ -25,10 +25,10 @@
 $REPL_USER_IPPADMIN = "ippMonitor";
 $REPL_PASSWORD_IPPADMIN = "ippMonitor";
-$REPL_DBNAME_IPPADMIN = "ipp001 (gpc1, isp, ippadmin, czardb)";
+$REPL_DBNAME_IPPADMIN = "ipp001 (gpc1, isp, ippadmin, czardb, ipptopsps, megacam, ssp, uip)" ;
 
 $REPL_HOST_NEBULOUS = "ippdb02.IfA.Hawaii.Edu";
 $REPL_USER_NEBULOUS = "ippMonitor";
 $REPL_PASSWORD_NEBULOUS = "ippMonitor";
-$REPL_DBNAME_NEBULOUS = "ippdb02 (Nebulous)";
+$REPL_DBNAME_NEBULOUS = "ippdb02 (nebulous)";
 
 $REPL_HOST_PSTAMP = "ippc19.IfA.Hawaii.Edu";
@@ -40,5 +40,12 @@
 $REPL_USER_GPC1 = "ippMonitor";
 $REPL_PASSWORD_GPC1 = "ippMonitor";
-$REPL_DBNAME_GPC1 = "ippdb03 (gpc1, isp, ippadmin, czardb)";
+$REPL_DBNAME_GPC1 = "ippdb03 (czardb, gpc1, ippadmin, ipptopsps, megacam, skycells, ssp, uip)";
+
+$REPL_HOST_ISP = "ippc17.IfA.Hawaii.Edu";
+$REPL_USER_ISP = "ippMonitor";
+$REPL_PASSWORD_ISP = "ippMonitor";
+$REPL_DBNAME_ISP = "ippc17 (isp)";
+
+
 
 ?>
Index: branches/eam_branches/ipp-20120601/ippMonitor/scripts/generate
===================================================================
--- branches/eam_branches/ipp-20120601/ippMonitor/scripts/generate	(revision 34045)
+++ branches/eam_branches/ipp-20120601/ippMonitor/scripts/generate	(revision 34047)
@@ -29,4 +29,5 @@
     &init_key ("MODE");
     &init_key ("UNRESTRICTED");
+    &init_key ("RESTRICT_COUNT");
     &init_key ("TABLE");
     &init_key ("TITLE");
@@ -46,10 +47,10 @@
         if ($key eq "TABLE") { ($value) = $value =~ m|^\s*(.+)\s*$|; }
         if ($key eq "TYPE")  { ($value) = $value =~ m|^\s*(.+)\s*$|; }
-	if ($key eq "TOPLOT") { ($value) = $value =~ m|^\s*(.+)\s*$|; }
-	if ($key eq "PLOTTER") { ($value) = $value =~ m|^\s*(.+)\s*$|; }
-	if ($key eq "PLOTTITLE") { 
-	    ($value) = $value =~ m|^\s*(.+)\s*$|;
-	    $value =~ s/\s/_/g;
-	}
+        if ($key eq "TOPLOT") { ($value) = $value =~ m|^\s*(.+)\s*$|; }
+        if ($key eq "PLOTTER") { ($value) = $value =~ m|^\s*(.+)\s*$|; }
+        if ($key eq "PLOTTITLE") {
+            ($value) = $value =~ m|^\s*(.+)\s*$|;
+            $value =~ s/\s/_/g;
+        }
 
         &set_keypair ($key, $value);
@@ -61,16 +62,16 @@
             if ($field =~ m|\S+\s+as\s+\S+|) {
                 ($fieldreal) = $field =~ m|\S+\s+as\s+(\S+)|;
-		#print STDERR "Case 1\n";
+                #print STDERR "Case 1\n";
             } elsif ($field =~ m|\S+\s+AS\s+\S+|) {
-		#print STDERR "field=$field\n";
-		$fieldreal = $field;
-		$fieldreal =~ s/\s+AS.*$//;
+                #print STDERR "field=$field\n";
+                $fieldreal = $field;
+                $fieldreal =~ s/\s+AS.*$//;
                 #($fieldreal) = $field =~ m|\S+\s+as\s+(\S+)|;
-		#print STDERR "Case 2\n";
+                #print STDERR "Case 2\n";
             } else {
                 $fieldreal = $field;
-		#print STDERR "Case 3\n";
+                #print STDERR "Case 3\n";
             }
-	    #print STDERR "field=[$field]\tfieldreal=[$fieldreal]\n";
+            #print STDERR "field=[$field]\tfieldreal=[$fieldreal]\n";
 
             if ($VERBOSE) { printf "%-20s %-20s %-20s %-20s %-20s %-20s\n", $field, $name, $format, $show, $link, $extras; }
@@ -141,4 +142,5 @@
     &check_key ("MODE", "basic");
     &check_key ("UNRESTRICTED", "none");
+    &check_key ("RESTRICT_COUNT", "none");
     &check_key ("TABLE", "");
     &check_key ("TITLE", "");
@@ -324,5 +326,4 @@
 # generate a WHERE test for each field (field != *)
 sub write_table_restrict {
-
     if ($WHERE) {
         print FILE "\$WHERE = \"WHERE $WHERE\";\n";
@@ -348,5 +349,5 @@
 }
 
-# Generate GROUP BY statement if any 
+# Generate GROUP BY statement if any
 sub write_group_by {
     print FILE "\$WHERE = check_ordering ('$GROUPS', \$WHERE);\n";
@@ -536,7 +537,7 @@
     @extfields = split (/,/, $extras);
     for ($i = 0; $i < @extfields; $i++) {
-	# print STDERR $extfields[$i],"\n";
+        # print STDERR $extfields[$i],"\n";
         ($label, $value, $outline) = &parse_label ($extfields[$i]);
-	# print STDERR "[",$label,"]","[",$value,"]","[",$outline,"\n";
+        # print STDERR "[",$label,"]","[",$value,"]","[",$outline,"\n";
         print FILE "  \$link = \$link . \"&$outline\";\n";
     }
@@ -553,5 +554,5 @@
     # print STDERR "#############################\n";
     # foreach my $key ( keys %linkarg ) {
-    # 	print STDERR "key: $key, value: $linkarg{$key}\n";
+    #   print STDERR "key: $key, value: $linkarg{$key}\n";
     # }
 
@@ -560,8 +561,8 @@
 
     if ($linkarg{$word}) {
-	# print STDERR "Case 1\n";
+        # print STDERR "Case 1\n";
         $linkarg{$word} = "$linkarg{$word},$value";
     } else {
-	# print STDERR "Case 2\n";
+        # print STDERR "Case 2\n";
         $linkarg{$word} = $value;
     }
@@ -585,11 +586,11 @@
     # print STDERR "### parse_label ###\n";
     # for ($i = 0; $i < @field; $i++) {
-    # 	print STDERR "field[$i]=$field[$i]\n";
+    #   print STDERR "field[$i]=$field[$i]\n";
     # }
     # for ($i = 0; $i < @fieldreal; $i++) {
-    # 	print STDERR "fieldreal[$i]=$fieldreal[$i]\n";
+    #   print STDERR "fieldreal[$i]=$fieldreal[$i]\n";
     # }
     # for ($i = 0; $i < @count; $i++) {
-    # 	print STDERR "count[$i]=$count[$i]\n";
+    #   print STDERR "count[$i]=$count[$i]\n";
     # }
 
@@ -598,5 +599,5 @@
     if ($string =~ m|\S+=\S+|) {
         ($label, $value) = $string =~ m|(\S+)=(\S+)|;
-	# print STDERR "value=$value\n";
+        # print STDERR "value=$value\n";
         if ($value =~ m|^\$|) {
           MATCH_LABEL:
@@ -669,7 +670,7 @@
     $name   = &parse_fieldname ($name);
     if (exists $ops{$name}) {
-	#if OPx was defined, replace it by its value
-	$name = $ops{$name};
-	$name =~ s/\s+//g;
+        #if OPx was defined, replace it by its value
+        $name = $ops{$name};
+        $name =~ s/\s+//g;
     }
     $camera = &parse_fieldname ($camera);
Index: branches/eam_branches/ipp-20120601/ippMonitor/supervision/check_if_mysql_slave_is_running_fine.py
===================================================================
--- branches/eam_branches/ipp-20120601/ippMonitor/supervision/check_if_mysql_slave_is_running_fine.py	(revision 34047)
+++ branches/eam_branches/ipp-20120601/ippMonitor/supervision/check_if_mysql_slave_is_running_fine.py	(revision 34047)
@@ -0,0 +1,78 @@
+#!/usr/bin/env python
+
+# This script is supposed to be run on a host which is running a mysql
+# replication slave. It should be started from the crontab every
+# hour(?).
+#
+# This script makes sure that the mysql replication slave is fine on
+# the localhost. If there is any problem, that is, if the replication
+# is broken because of an error or if the lag between the master and
+# the server is too important (see the MAX_LAG_SECONDS parameter),
+# then an e-mail is sent to the ps-ipp-ops mailing list (actually the
+# RECIPIENT parameter).
+#
+
+import MySQLdb
+import smtplib
+from email.mime.text import MIMEText
+import socket
+
+def send_email(recipient, subject, body):
+    message = MIMEText(body)
+    message['Subject'] = subject
+    _from = 'ipp@ifa.hawaii.edu'
+    message['From'] = _from
+    _to = [recipient]
+    message['To'] = recipient
+    SMTP_CONNECTION = smtplib.SMTP('hale.ifa.hawaii.edu')
+    SMTP_CONNECTION.sendmail(_from, _to, message.as_string())
+    SMTP_CONNECTION.quit()
+
+if __name__ == '__main__':
+    # Configuration parameters
+    MAX_LAG_SECONDS = 10000
+    RECIPIENT = 'ps-ipp-ops@ifa.hawaii.edu'
+
+    # Don't change anything after this
+    db = MySQLdb.connect('localhost', 'root')
+    cursor = db.cursor()
+    cursor.execute('SHOW SLAVE STATUS')
+    ( Slave_IO_State, Master_Host, Master_User, Master_Port,
+      Connect_Retry, Master_Log_File, Read_Master_Log_Pos, Relay_Log_File,
+      Relay_Log_Pos, Relay_Master_Log_File, Slave_IO_Running, Slave_SQL_Running,
+      Replicate_Do_DB, Replicate_Ignore_DB, Replicate_Do_Table, Replicate_Ignore_Table,
+      Replicate_Wild_Do_Table, Replicate_Wild_Ignore_Table, 
+      Last_Errno, Last_Error, Skip_Counter, Exec_Master_Log_Pos,
+      Relay_Log_Space, Until_Condition, Until_Log_File, Until_Log_Pos,
+      Master_SSL_Allowed, Master_SSL_CA_File, Master_SSL_CA_Path, Master_SSL_Cert,
+      Master_SSL_Cipher, Master_SSL_Key, Seconds_Behind_Master) = cursor.fetchall()[0]
+    nodename = socket.gethostbyaddr(socket.gethostname())[0].split('.')[0]
+    if Seconds_Behind_Master is None:
+        if Last_Error != '':
+            send_email(RECIPIENT, 
+                       'MySQL replication problem on %s' % (nodename),
+                       """Last_error value when executing SHOW SLAVE STATUS on that host is:
+%s
+""" % (Last_Error) )
+        else:
+            send_email(RECIPIENT, 
+                       'MySQL replication problem on %s' % (nodename),
+                       """Slave_IO_State value when executing SHOW SLAVE STATUS on that host is:
+%s
+""" % (Slave_IO_State) )
+            print 'Replication problem: %s (is master down?)' % Slave_IO_State
+    elif Seconds_Behind_Master > MAX_LAG_SECONDS:
+        nodename = socket.gethostbyaddr(socket.gethostname())[0].split('.')[0]
+        send_email(RECIPIENT, 
+                   'MySQL replication is late on %s' % (nodename),
+                   """The Seconds_Behind_Master value when executing the 'SHOW SLAVE STATUS' mysql statement on that host is:
+   %s
+
+For info, the threshold is %s seconds.
+
+Check if there is a blocking statement executing on the slave
+""" % (Seconds_Behind_Master, MAX_LAG_SECONDS) )
+    else:
+        pass
+    cursor.close()
+    db.close()
Index: branches/eam_branches/ipp-20120601/ippScripts/scripts/addstar_run.pl
===================================================================
--- branches/eam_branches/ipp-20120601/ippScripts/scripts/addstar_run.pl	(revision 34045)
+++ branches/eam_branches/ipp-20120601/ippScripts/scripts/addstar_run.pl	(revision 34047)
@@ -38,6 +38,6 @@
 }
 my $minidvodb_path;
-my $stage_extra1 ;
-my ( $add_id, $camera, $stage, $stage_id, $multi_num, $outroot, $stageroot, $dbname, $reduction, $dvodb, $minidvodb, $minidvodb_name, $minidvodb_group, $image_only, $verbose, $no_update,
+
+my ( $add_id, $camera, $stage, $stage_id, $stage_extra1, $outroot, $stageroot, $dbname, $reduction, $dvodb, $minidvodb, $minidvodb_name, $minidvodb_group, $image_only, $verbose, $no_update,
      $no_op, $redirect, $save_temps);
 GetOptions(
@@ -46,5 +46,5 @@
     'stage|s=s'        => \$stage, # Camera
     'stage_id|w=s'   => \$stage_id,
-    'multi_num|w=s'    => \$multi_num, # the number for a staticskymulti (for finding cmf)
+    'stage_extra1|w=s'    => \$stage_extra1, # the number for a staticskymulti (for finding cmf), or stack_id
     'dbname|d=s'        => \$dbname, # Database name
     'outroot|w=s'       => \$outroot, # output file base name
@@ -162,17 +162,47 @@
     }
 }
-if (($stage =~/staticsky/) || ($stage =~/stack/)) {
+if (($stage =~/stack/)) {
     $fpaObjects =~ s/smf$/cmf/;
     $fpaObjectsAlt =~ s/smf$/cmf/;
-}
+
+}
+my $fpaObjects1;
+my $fpaObjects2;
 my $checkalt = 0;
 if ($stage =~/staticsky/) {
-    $fpaObjects =~ s/smf$/cmf/; #this should do nothing because it was already modded above
-    &my_die( "can't find the filter_num for staticsky_multi, giving up.", $add_id, $PS_EXIT_SYS_ERROR) unless (defined $multi_num);
-    my $nice_num = sprintf ("%03d", $multi_num);
-    $fpaObjects =~ s/cmf$/$nice_num.cmf/;  #this make it look for .001.cmf, etc
-    if ($multi_num == 0) {
-	$checkalt =1 ; #if it's staticsky and multi_num = 0 there's an alternate file to try if this one doesn't work
-    }
+    $checkalt = 1;
+    my $sources   = $ipprc->filename("PSPHOT.OUT.CMF.MEF", $stageroot); #this is mostly rigtht except the .cmf needs either
+    # .000.cmf or .stk.xxxxx.cmf
+    print "$sources\n\n\n";
+    &my_die( "can't find the filter_num for staticsky_multi, giving up.", $add_id, $PS_EXIT_SYS_ERROR) unless (defined $stage_extra1);
+
+    
+    $fpaObjects1 = $sources;
+    $fpaObjects2 = $sources;
+    $fpaObjects = $sources;
+
+    my $nice_num = sprintf ("%03d", $stage_extra1);
+
+    $fpaObjects1 =~ s/cmf$/stk.$stage_extra1.cmf/;
+    $fpaObjects2 =~ s/cmf$/$nice_num.cmf/;  #this make it look for .001.cmf, etc
+ # we have 3 of them to try
+    my $realFile = $ipprc->file_resolve($fpaObjects);
+    my $realFile1 = $ipprc->file_resolve($fpaObjects1);
+    my $realFile2 = $ipprc->file_resolve($fpaObjects2);
+    if (!defined($realFile1)) {
+	if (!defined($realFile2)) {
+	    print "using $fpaObjects\n";
+	    
+	} else {
+	    print "using $fpaObjects2\n";
+	    $fpaObjects = $fpaObjects2;
+	}
+	
+    } else {
+	print "using $fpaObjects1\n";
+	$fpaObjects = $fpaObjects1;
+    }
+     
+
 }
 
@@ -230,17 +260,8 @@
 	    my $camdir = $ipprc->dvo_cameradir(); # Camera directory for addstar
 	   
-	    my $realFile = $ipprc->file_resolve($fpaObjects);
-	    if (!defined($realFile)) {
-		print "can't find $fpaObjects\n";
-		if ($checkalt)  {
-		    $realFile = $ipprc->file_resolve($fpaObjectsAlt) or &my_die("Unable to resolve $fpaObjectsAlt", $add_id, $PS_EXIT_SYS_ERROR);
-		    $fpaObjects = $fpaObjectsAlt; # want to make sure the correct value is used.
-		} else {
-		    # try the 'good one' again and fail i
-		    #$realFile = $ipprc->file_resolve($fpaObjects) or 
-		    &my_die("Unable to resolve $fpaObjects", $add_id, $PS_EXIT_SYS_ERROR);
-		}
-		
-	    }
+	    my $realFile = $ipprc->file_resolve($fpaObjects) or  &my_die("Unable to resolve $fpaObjects", $add_id, $PS_EXIT_SYS_ERROR);
+	    
+	    
+	   
 
 	    # require a defined output dvo database to run addstar (ie, refuse to use the .ptolemyrc default)
Index: branches/eam_branches/ipp-20120601/ippScripts/scripts/automate_stacks.pl
===================================================================
--- branches/eam_branches/ipp-20120601/ippScripts/scripts/automate_stacks.pl	(revision 34045)
+++ branches/eam_branches/ipp-20120601/ippScripts/scripts/automate_stacks.pl	(revision 34047)
@@ -1588,8 +1588,13 @@
 
 sub init_gpc_db {
+    ## change to use the site.config setting now, however may want to use replicated scidbs instead
+    my $ipprc =  PS::IPP::Config->new(); # IPP Configuration
+    my $siteConfig = $ipprc->{_siteConfig};
     use constant DB_SOCKET => '/var/run/mysqld/mysqld.sock';
-    my $dbserver = 'ippdb01';
+    # my $dbserver = 'ippdb01';
     my $dbuser = 'ippuser';
     my $dbpass = 'ippuser';
+    my $dbserver = metadataLookupStr($siteConfig, 'DBSERVER');
+    die "database configuration set up" unless defined($dbserver);
     $db = DBI->connect("DBI:mysql:database=${dbname};host=${dbserver};" .
                        "mysql_socket=" . DB_SOCKET(),
Index: branches/eam_branches/ipp-20120601/ippScripts/scripts/bundle_detrends.pl
===================================================================
--- branches/eam_branches/ipp-20120601/ippScripts/scripts/bundle_detrends.pl	(revision 34045)
+++ branches/eam_branches/ipp-20120601/ippScripts/scripts/bundle_detrends.pl	(revision 34047)
@@ -128,8 +128,12 @@
 
 sub init_gpc_db {
+    ## change to use the site.config setting now, however may want to use replicated scidbs instead
+    my $siteConfig = $ipprc->{_siteConfig};
     use constant DB_SOCKET => '/var/run/mysqld/mysqld.sock';
-    my $dbserver = 'ippdb01';
+    # my $dbserver = 'ippdb01';
     my $dbuser = 'ippuser';
     my $dbpass = 'ippuser';
+    my $dbserver = metadataLookupStr($siteConfig, 'DBSERVER');
+    die "database configuration set up" unless defined($dbserver);
     $db = DBI->connect("DBI:mysql:database=${dbname};host=${dbserver};" .
                        "mysql_socket=" . DB_SOCKET(),
Index: branches/eam_branches/ipp-20120601/ippScripts/scripts/make_burntool_pcontrol.pl
===================================================================
--- branches/eam_branches/ipp-20120601/ippScripts/scripts/make_burntool_pcontrol.pl	(revision 34045)
+++ branches/eam_branches/ipp-20120601/ippScripts/scripts/make_burntool_pcontrol.pl	(revision 34047)
@@ -29,8 +29,13 @@
 
 # Load database
+## change to use the site.config setting now
 $dbname = 'gpc1';
-$dbserver = 'ippdb01';
+#$dbserver = 'ippdb01';
 $dbuser = 'ipp';
 $dbpass = 'ipp';
+my $ipprc =  PS::IPP::Config->new(); # IPP Configuration
+my $siteConfig = $ipprc->{_siteConfig};
+my $dbserver = metadataLookupStr($siteConfig, 'DBSERVER');
+die "database configuration not set up" unless defined($dbserver);
 $db = DBI->connect("DBI:mysql:database=${dbname};host=${dbserver};" .
                    "mysql_socket=" . DB_SOCKET(),
Index: branches/eam_branches/ipp-20120601/ippScripts/scripts/nightly_science.pl
===================================================================
--- branches/eam_branches/ipp-20120601/ippScripts/scripts/nightly_science.pl	(revision 34045)
+++ branches/eam_branches/ipp-20120601/ippScripts/scripts/nightly_science.pl	(revision 34047)
@@ -32,4 +32,8 @@
     exit($PS_EXIT_CONFIG_ERROR);
 }
+
+## for DB connection, want to use siteConfig DB settings
+my $ipprc =  PS::IPP::Config->new(); # IPP Configuration
+my $siteConfig = $ipprc->{_siteConfig};
 
 my $db;
@@ -2052,8 +2056,15 @@
 
 sub init_gpc_db {
+    ## change to use the siteConfig setting, while readonly probably do not want to use a readonly replicated DB incase it gets behind
+    my $dbserver = metadataLookupStr($siteConfig, 'DBSERVER');
+    my $dbuser = metadataLookupStr($ipprc->{_siteConfig}, "RO_DBUSER");
+    my $dbpass = metadataLookupStr($ipprc->{_siteConfig}, "RO_DBPASSWORD");
+    die "database configuration not set up" unless defined($dbserver);
+    die "database configuration not set up" unless defined($dbuser);
+    die "database configuration not set up" unless defined($dbpass);
+    #my $dbserver = 'ippdb01';
+    #my $dbuser = 'ippuser';
+    #my $dbpass = 'ippuser';
     use constant DB_SOCKET => '/var/run/mysqld/mysqld.sock';
-    my $dbserver = 'ippdb01';
-    my $dbuser = 'ippuser';
-    my $dbpass = 'ippuser';
     $db = DBI->connect("DBI:mysql:database=${dbname};host=${dbserver};" .
                        "mysql_socket=" . DB_SOCKET(),
Index: branches/eam_branches/ipp-20120601/ippScripts/scripts/staticsky.pl
===================================================================
--- branches/eam_branches/ipp-20120601/ippScripts/scripts/staticsky.pl	(revision 34045)
+++ branches/eam_branches/ipp-20120601/ippScripts/scripts/staticsky.pl	(revision 34047)
@@ -81,5 +81,5 @@
     -msg => "Required options: --sky_id --outroot --camera",
     -exitval => 3,
-          ) unless 
+          ) unless
     defined $sky_id and
     defined $outroot and
@@ -120,5 +120,5 @@
 
 
-# generate the input 
+# generate the input
 print $listFile "INPUT   MULTI\n";
 my $nInputs = @$files;
@@ -194,5 +194,5 @@
         # Perform stack photometry analysis
         {
-            my $command = "$psphotStack $outroot.stk";
+            my $command = "$psphotStack $outroot";
             $command .= " -input $listName";
             $command .= " -threads $threads" if defined $threads;
@@ -235,8 +235,9 @@
                     # we have one set of output files per input file set
                     for (my $i = 0; $i < @$files; $i++) {
-                        my $outputName     = $ipprc->filename("PSPHOT.STACK.OUTPUT.IMAGE", $outroot, $i);
-                        my $outputMask     = $ipprc->filename("PSPHOT.STACK.OUTPUT.MASK", $outroot, $i);
-                        my $outputVariance = $ipprc->filename("PSPHOT.STACK.OUTPUT.VARIANCE", $outroot, $i);
-                        my $outputSources  = $ipprc->filename("PSPHOT.STACK.OUTPUT", $outroot, $i);
+                        my $stack_id = @$files[$i]->{stack_id};
+                        my $outputName     = $ipprc->filename("PSPHOT.STACK.OUTPUT.IMAGE", $outroot, $stack_id);
+                        my $outputMask     = $ipprc->filename("PSPHOT.STACK.OUTPUT.MASK", $outroot, $stack_id);
+                        my $outputVariance = $ipprc->filename("PSPHOT.STACK.OUTPUT.VARIANCE", $outroot, $stack_id);
+                        my $outputSources  = $ipprc->filename("PSPHOT.STACK.OUTPUT", $outroot, $stack_id);
 
                         # XXX these are optional and not generated by default
@@ -256,6 +257,6 @@
 
                     # XXX check the recipe -- should we expect these to exist?
-                    # &my_die("Couldn't find expected output file: $chisqName", 	  $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($chisqName);
-                    # &my_die("Couldn't find expected output file: $chisqMask", 	  $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($chisqMask);
+                    # &my_die("Couldn't find expected output file: $chisqName",           $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($chisqName);
+                    # &my_die("Couldn't find expected output file: $chisqMask",           $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($chisqMask);
                     # &my_die("Couldn't find expected output file: $chisqVariance", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($chisqVariance);
                 }
@@ -346,5 +347,5 @@
                 }
 
-                &my_die("Couldn't find expected output file: $configuration", $sky_id, $PS_EXIT_SYS_ERROR) 
+                &my_die("Couldn't find expected output file: $configuration", $sky_id, $PS_EXIT_SYS_ERROR)
                     unless $ipprc->file_exists($configuration);
             } else {
@@ -359,9 +360,9 @@
     {
         my $command = "$staticskytool -sky_id $sky_id";
-	$command .= " -addresult -path_base $outroot";
-	$command .= " -num_inputs $nInputs";
-	# $command .= " $cmdflags";
-	$command .= (" -dtime_script " . ((DateTime->now->mjd - $mjd_start) * 86400));
-	$command .= " -hostname $host" if defined $host;
+        $command .= " -addresult -path_base $outroot";
+        $command .= " -num_inputs $nInputs";
+        # $command .= " $cmdflags";
+        $command .= (" -dtime_script " . ((DateTime->now->mjd - $mjd_start) * 86400));
+        $command .= " -hostname $host" if defined $host;
         $command .= " -dbname $dbname" if defined $dbname;
 
@@ -371,6 +372,6 @@
             $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
             my $err_message = "Unable to perform staticskytool -addresult";
-	    warn($err_message);
-	    exit $error_code;
+            warn($err_message);
+            exit $error_code;
         }
     }
@@ -389,9 +390,9 @@
     if (defined $sky_id and not $no_update) {
         my $command = "$staticskytool -sky_id $sky_id -fault $exit_code";
-	$command .= " -addresult";
-	$command .= (" -dtime_script " . ((DateTime->now->mjd - $mjd_start) * 86400));
-	$command .= " -hostname $host" if defined $host;
-	$command .= " -path_base $outroot" if defined $outroot;
-	$command .= " -dbname $dbname" if defined $dbname;
+        $command .= " -addresult";
+        $command .= (" -dtime_script " . ((DateTime->now->mjd - $mjd_start) * 86400));
+        $command .= " -hostname $host" if defined $host;
+        $command .= " -path_base $outroot" if defined $outroot;
+        $command .= " -dbname $dbname" if defined $dbname;
         run(command => $command, verbose => $verbose);
     }
Index: branches/eam_branches/ipp-20120601/ippTools/share/addtool_find_sky_id_multi.sql
===================================================================
--- branches/eam_branches/ipp-20120601/ippTools/share/addtool_find_sky_id_multi.sql	(revision 34045)
+++ branches/eam_branches/ipp-20120601/ippTools/share/addtool_find_sky_id_multi.sql	(revision 34047)
@@ -2,5 +2,5 @@
      distinct(sky_id) as stage_id,
      staticskyRun.*,
-    staticskyResult.num_inputs
+    staticskyResult.num_inputs, stack_id
 FROM 
      staticskyRun
Index: branches/eam_branches/ipp-20120601/ippTools/share/addtool_find_sky_id_multi_dvo.sql
===================================================================
--- branches/eam_branches/ipp-20120601/ippTools/share/addtool_find_sky_id_multi_dvo.sql	(revision 34045)
+++ branches/eam_branches/ipp-20120601/ippTools/share/addtool_find_sky_id_multi_dvo.sql	(revision 34047)
@@ -1,3 +1,3 @@
-SELECT distinct(sky_id) as stage_id, staticskyRun.*, staticskyResult.num_inputs FROM staticskyResult
+SELECT distinct(sky_id) as stage_id, staticskyRun.*, staticskyResult.num_inputs, stack_id FROM staticskyResult
 JOIN staticskyRun USING(sky_id)
 join staticskyInput using(sky_id)
Index: branches/eam_branches/ipp-20120601/ippTools/src/addtool.c
===================================================================
--- branches/eam_branches/ipp-20120601/ippTools/src/addtool.c	(revision 34045)
+++ branches/eam_branches/ipp-20120601/ippTools/src/addtool.c	(revision 34047)
@@ -292,5 +292,5 @@
       // }
     if (strcmp(stage,"staticsky") == 0) {
-      psStringAppend(&query, " GROUP BY sky_id");  //some reason it needs this
+      psStringAppend(&query, " GROUP BY sky_id, stack_id");  //some reason it needs this
       }
 
@@ -525,7 +525,9 @@
 	psS64 stage_id =0; 
 	bool status = false;
-	psS32 num_inputs = psMetadataLookupS32(&status, md, "num_inputs");
+	//psS32 num_inputs = psMetadataLookupS32(&status, md, "num_inputs");
+	psS32 stack_id = psMetadataLookupS32(&status, md, "stack_id");
+
 	if (!status) {
-	  psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item num_inputs");
+	  psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item stack_id");
 	  return false;
 	}
@@ -540,9 +542,9 @@
 
         // queue the exp
-	for (int filter_id = 0; filter_id < num_inputs; filter_id++) {  
-        if (!pxaddQueueByCamID(config,
+      	//for (int filter_id = 0; filter_id < num_inputs; filter_id++) {  
+	  if (!pxaddQueueByCamID(config,
 			       stage,
-                               stage_id,
-			       filter_id,
+			       stage_id,
+			       stack_id,
                                workdir     ? workdir   : row->workdir,
                                reduction   ? reduction : row->reduction,
@@ -555,7 +557,7 @@
                                minidvodb_group,
                                minidvodb_name
-        )) {
+				 )) {
             if (!psDBRollback(config->dbh)) {
-                psError(PS_ERR_UNKNOWN, false, "database error sfg");
+	      psError(PS_ERR_UNKNOWN, false, "database error sfg");
             }
             psError(PS_ERR_UNKNOWN, false,
@@ -564,6 +566,6 @@
             psFree(output);
             return false;
-        }
-	}
+	  }
+	  //}
         psFree(row);
     }
Index: branches/eam_branches/ipp-20120601/ippconfig/recipes/filerules-mef.mdc
===================================================================
--- branches/eam_branches/ipp-20120601/ippconfig/recipes/filerules-mef.mdc	(revision 34045)
+++ branches/eam_branches/ipp-20120601/ippconfig/recipes/filerules-mef.mdc	(revision 34047)
@@ -239,5 +239,5 @@
 PSPHOT.CHISQ.MASK       OUTPUT {OUTPUT}.{CHIP.NAME}.chisq.mk.fits MASK     NONE       FPA        TRUE      SIMPLE
 PSPHOT.CHISQ.VARIANCE   OUTPUT {OUTPUT}.{CHIP.NAME}.chisq.wt.fits VARIANCE NONE       FPA        TRUE      SIMPLE
-PSPHOT.STACK.OUTPUT     OUTPUT {OUTPUT}.{CHIP.NAME}.{FILE.ID}.cmf CMF      NONE       FPA        TRUE      NONE
+PSPHOT.STACK.OUTPUT     OUTPUT {OUTPUT}.{CHIP.NAME}.sky.{FILE.ID}.cmf CMF      NONE       FPA        TRUE      NONE
                                                      
 SOURCE.PLOT.MOMENTS     OUTPUT {OUTPUT}.mnt.png                  KAPA      NONE       FPA        TRUE      NONE
Index: branches/eam_branches/ipp-20120601/ippconfig/recipes/filerules-simple.mdc
===================================================================
--- branches/eam_branches/ipp-20120601/ippconfig/recipes/filerules-simple.mdc	(revision 34045)
+++ branches/eam_branches/ipp-20120601/ippconfig/recipes/filerules-simple.mdc	(revision 34047)
@@ -216,8 +216,8 @@
 PSPHOT.CHISQ.MASK            OUTPUT {OUTPUT}.chisq.mk.fits        MASK            NONE       FPA        TRUE      NONE
 PSPHOT.CHISQ.VARIANCE        OUTPUT {OUTPUT}.chisq.wt.fits        VARIANCE        NONE       FPA        TRUE      NONE
-PSPHOT.STACK.OUTPUT.IMAGE    OUTPUT {OUTPUT}.{FILE.ID}.im.fits    IMAGE           NONE       FPA        TRUE      NONE
-PSPHOT.STACK.OUTPUT.MASK     OUTPUT {OUTPUT}.{FILE.ID}.mk.fits    MASK            NONE       FPA        TRUE      NONE
-PSPHOT.STACK.OUTPUT.VARIANCE OUTPUT {OUTPUT}.{FILE.ID}.wt.fits    VARIANCE        NONE       FPA        TRUE      NONE
-PSPHOT.STACK.OUTPUT          OUTPUT {OUTPUT}.{FILE.ID}.cmf        CMF             NONE       FPA        TRUE      NONE
+PSPHOT.STACK.OUTPUT.IMAGE    OUTPUT {OUTPUT}.stk.{FILE.ID}.im.fits    IMAGE           NONE       FPA        TRUE      NONE
+PSPHOT.STACK.OUTPUT.MASK     OUTPUT {OUTPUT}.stk.{FILE.ID}.mk.fits    MASK            NONE       FPA        TRUE      NONE
+PSPHOT.STACK.OUTPUT.VARIANCE OUTPUT {OUTPUT}.stk.{FILE.ID}.wt.fits    VARIANCE        NONE       FPA        TRUE      NONE
+PSPHOT.STACK.OUTPUT          OUTPUT {OUTPUT}.stk.{FILE.ID}.cmf        CMF             NONE       FPA        TRUE      NONE
                                                      
 SOURCE.PLOT.MOMENTS          OUTPUT {OUTPUT}.mnt.png              KAPA            NONE       FPA        TRUE      NONE
Index: branches/eam_branches/ipp-20120601/ippconfig/recipes/filerules-split.mdc
===================================================================
--- branches/eam_branches/ipp-20120601/ippconfig/recipes/filerules-split.mdc	(revision 34045)
+++ branches/eam_branches/ipp-20120601/ippconfig/recipes/filerules-split.mdc	(revision 34047)
@@ -235,8 +235,8 @@
 PSPHOT.CHISQ.MASK            OUTPUT {OUTPUT}.chisq.mk.fits            MASK            NONE       FPA        TRUE      NONE
 PSPHOT.CHISQ.VARIANCE        OUTPUT {OUTPUT}.chisq.wt.fits            VARIANCE        NONE       FPA        TRUE      NONE
-PSPHOT.STACK.OUTPUT.IMAGE    OUTPUT {OUTPUT}.{FILE.ID}.im.fits        IMAGE           NONE       FPA        TRUE      NONE
-PSPHOT.STACK.OUTPUT.MASK     OUTPUT {OUTPUT}.{FILE.ID}.mk.fits        MASK            NONE       FPA        TRUE      NONE
-PSPHOT.STACK.OUTPUT.VARIANCE OUTPUT {OUTPUT}.{FILE.ID}.wt.fits        VARIANCE        NONE       FPA        TRUE      NONE
-PSPHOT.STACK.OUTPUT          OUTPUT {OUTPUT}.{FILE.ID}.cmf            CMF             NONE       FPA        TRUE      NONE
+PSPHOT.STACK.OUTPUT.IMAGE    OUTPUT {OUTPUT}.stk.{FILE.ID}.im.fits        IMAGE           NONE       FPA        TRUE      NONE
+PSPHOT.STACK.OUTPUT.MASK     OUTPUT {OUTPUT}.stk.{FILE.ID}.mk.fits        MASK            NONE       FPA        TRUE      NONE
+PSPHOT.STACK.OUTPUT.VARIANCE OUTPUT {OUTPUT}.stk.{FILE.ID}.wt.fits        VARIANCE        NONE       FPA        TRUE      NONE
+PSPHOT.STACK.OUTPUT          OUTPUT {OUTPUT}.stk.{FILE.ID}.cmf            CMF             NONE       FPA        TRUE      NONE
 PSPHOT.STACK.CONFIG          OUTPUT {OUTPUT}.psphotStack.mdc          TEXT            NONE       FPA        TRUE      NONE
                                                      
