Index: /tags/ipp-20101215/ippScripts/scripts/publish_file.pl
===================================================================
--- /tags/ipp-20101215/ippScripts/scripts/publish_file.pl	(revision 30413)
+++ /tags/ipp-20101215/ippScripts/scripts/publish_file.pl	(revision 30414)
@@ -42,5 +42,5 @@
 
 # Parse the command-line arguments
-my ( $pub_id, $camera, $stage, $stage_id, $fileset, $format, $product, $workdir );
+my ( $pub_id, $camera, $stage, $stage_id, $fileset, $format, $product, $workdir, $need_magic );
 my ( $dbname, $verbose, $no_update, $no_op, $save_temps, $redirect );
 my ( $output_format );
@@ -54,4 +54,5 @@
     'fileset=s'         => \$fileset,     # Fileset name
     'workdir=s'         => \$workdir,     # Working directory
+    'need-magic'        => \$need_magic,  # do we require censored detections?
     'dbname=s'          => \$dbname,    # Database name
     'verbose'           => \$verbose,   # Print to stdout
@@ -166,4 +167,10 @@
     foreach my $comp ( @$components ) {
         my $path_base = $comp->{path_base}; # Base name for file
+        if (!$need_magic and $comp->{magicked}) {
+            # This client is authorized to receive uncensored detections
+            # Get the uri for the "backup" files
+            print "Using uncensored input from $path_base\n";
+            $path_base = $ipprc->destreaked_filename($path_base);
+        }
         next if defined $comp->{quality} and $comp->{quality} > 0;
         print "Warning: mis-matched comments\n" if defined $comment and $comment ne $comp->{comment};
@@ -181,5 +188,10 @@
             $filename = $ipprc->filename( "PSPHOT.OUT.CMF.MEF", "$path_base.pos" );
         }
-        $filename = $ipprc->file_resolve($filename);
+        &my_die("input file does not exist: $filename", $pub_id, $PS_EXIT_SYS_ERROR) if !$ipprc->file_exists($filename);
+        my $resolved = $ipprc->file_resolve($filename);
+        
+        &my_die("unable to resolve input file: $filename", $pub_id, $PS_EXIT_SYS_ERROR) if !$resolved;
+
+        $filename = $resolved;
 
         my $data = { zp => $zp,
Index: /tags/ipp-20101215/ippTasks/publish.pro
===================================================================
--- /tags/ipp-20101215/ippTasks/publish.pro	(revision 30413)
+++ /tags/ipp-20101215/ippTasks/publish.pro	(revision 30414)
@@ -79,4 +79,5 @@
     end
     add_poll_args run
+    add_poll_labels run
     command $run
   end
@@ -131,4 +132,5 @@
     book getword publishRun $pageName dbname -var DBNAME
     book getword publishRun $pageName output_format -var OUTPUT_FORMAT
+    book getword publishRun $pageName need_magic -var NEED_MAGIC
 
     stdout $LOGDIR/publish.run.log
@@ -139,4 +141,9 @@
 
     $run = publish_file.pl --pub_id $PUB_ID --camera $CAMERA --workdir $WORKDIR --product $PRODUCT --stage $STAGE --stage_id $STAGE_ID --output_format $OUTPUT_FORMAT --redirect-output
+
+    if ("$NEED_MAGIC" == "T") 
+        $run = $run --need-magic
+    end
+
     add_standard_args run
 
Index: /tags/ipp-20101215/ippTasks/survey.pro
===================================================================
--- /tags/ipp-20101215/ippTasks/survey.pro	(revision 30413)
+++ /tags/ipp-20101215/ippTasks/survey.pro	(revision 30414)
@@ -367,10 +367,12 @@
 # user functions to manipulate publish labels
 macro survey.add.publish
-  if ($0 != 3)
-    echo "USAGE: survey.add.publish (label) (client_id)"
+  if ($0 != 5)
+    echo "USAGE: survey.add.publish (tag) (label) (client_id) (comment)"
     break
   end
   book newpage SURVEY_PUBLISH $1
-  book setword SURVEY_PUBLISH $1 CLIENT_ID $2
+  book setword SURVEY_PUBLISH $1 LABEL $2
+  book setword SURVEY_PUBLISH $1 CLIENT_ID $3
+  book setword SURVEY_PUBLISH $1 COMMENT $4
   book setword SURVEY_PUBLISH $1 STATE PENDING
 end
@@ -1089,13 +1091,15 @@
     endif
 
-    book getpage SURVEY_PUBLISH 0 -var label -key STATE NEW
-    if ("$label" == "NULL")
-      # All labels have been done --- reset
-      # echo "Resetting labels"
+    # survey.publish allows multiple entries per label.
+    # The key is called tag and must be unique
+    book getpage SURVEY_PUBLISH 0 -var tag -key STATE NEW
+    if ("$tag" == "NULL")
+      # All tags have been done --- reset
+      # echo "Resetting tags"
       for i 0 $N
-        book getpage SURVEY_PUBLISH $i -var label
-	book setword SURVEY_PUBLISH $label STATE NEW
+        book getpage SURVEY_PUBLISH $i -var tag
+	book setword SURVEY_PUBLISH $tag STATE NEW
       end
-      book getpage SURVEY_PUBLISH 0 -var label -key STATE NEW
+      book getpage SURVEY_PUBLISH 0 -var tag -key STATE NEW
 
       # Select different database
@@ -1104,8 +1108,14 @@
     end
 
-    book setword SURVEY_PUBLISH $label STATE DONE
-    book getword SURVEY_PUBLISH $label CLIENT_ID -var client_id
+    book setword SURVEY_PUBLISH $tag STATE DONE
+    book getword SURVEY_PUBLISH $tag LABEL -var label
+    book getword SURVEY_PUBLISH $tag CLIENT_ID -var client_id
+    book getword SURVEY_PUBLISH $tag COMMENT -var comment
   
     $run = pubtool -definerun -label $label -client_id $client_id
+
+    if ("$comment" != "NULL") 
+        $run = $run -comment $comment
+    end
 
     if ($DB:n == 0)
@@ -1116,6 +1126,8 @@
     end
     
-    #echo $run
+    echo $run
+
     command $run
+    
   end
 
Index: /tags/ipp-20101215/ippTools/share/pubtool_pending.sql
===================================================================
--- /tags/ipp-20101215/ippTools/share/pubtool_pending.sql	(revision 30413)
+++ /tags/ipp-20101215/ippTools/share/pubtool_pending.sql	(revision 30414)
@@ -10,4 +10,5 @@
         publishClient.workdir,
 	publishClient.output_format,
+        publishClient.magicked AS need_magic,
         diffRun.diff_id AS stage_id,
         rawExp.camera,
@@ -37,4 +38,5 @@
         publishClient.workdir,
 	publishClient.output_format,
+        publishClient.magicked AS need_magic,
         camRun.cam_id AS stage_id,
         rawExp.camera,
@@ -59,4 +61,5 @@
         publishClient.workdir,
 	publishClient.output_format,
+        publishClient.magicked AS need_magic,
         diffPhotRun.diff_phot_id AS stage_id,
         rawExp.camera,
Index: /tags/ipp-20101215/ippTools/src/pubtool.c
===================================================================
--- /tags/ipp-20101215/ippTools/src/pubtool.c	(revision 30413)
+++ /tags/ipp-20101215/ippTools/src/pubtool.c	(revision 30414)
@@ -167,4 +167,5 @@
     PXOPT_COPY_STR(config->args, diffWhere, "-filter", "rawExp.filter", "LIKE");
     PXOPT_COPY_STR(config->args, diffWhere, "-obs_mode", "rawExp.obs_mode", "LIKE");
+    PXOPT_COPY_STR(config->args, diffWhere, "-comment", "rawExp.comment", "LIKE");
 
     PXOPT_COPY_S64(config->args, camWhere, "-client_id", "client_id", "==");
Index: /tags/ipp-20101215/ippTools/src/pubtoolConfig.c
===================================================================
--- /tags/ipp-20101215/ippTools/src/pubtoolConfig.c	(revision 30413)
+++ /tags/ipp-20101215/ippTools/src/pubtoolConfig.c	(revision 30414)
@@ -66,4 +66,5 @@
     psMetadataAddStr(definerunArgs, PS_LIST_TAIL, "-label", PS_META_DUPLICATE_OK, "set and search by label", NULL);
     psMetadataAddStr(definerunArgs, PS_LIST_TAIL, "-data_group", PS_META_DUPLICATE_OK, "search by data_group", NULL);
+    psMetadataAddStr(definerunArgs, PS_LIST_TAIL, "-comment", 0, "search by comment", NULL);
     psMetadataAddTime(definerunArgs, PS_LIST_TAIL, "-dateobs_begin", 0, "search for exposures by time (>=)", NULL);
     psMetadataAddTime(definerunArgs, PS_LIST_TAIL, "-dateobs_end", 0, "search for exposures by time (<=)", NULL);
