#!/usr/bin/perl -w use lib '/usr/local/perl/lib/site_perl/5.005/i386-linux-thread'; use Pg; use CGI; $cgi=new CGI; # connect to the database $db=Pg::connectdb("host=lilys dbname=quimby user=readnear password=ManySNe"); if ($db->status!=PGRES_CONNECTION_OK) { print STDERR "connectdb failed: "; print STDERR $db->errorMessage,"\n"; die; } # execute the query $query="SELECT fun_name,priority,status FROM candidates WHERE priority > 0 ORDER BY priority,fun_name"; $result=$db->exec($query); if ($result->resultStatus!=PGRES_TUPLES_OK || $result->ntuples==0) { die; } # start the HTML page print $cgi->header; print $cgi->start_html('Nearby SNe Candidate Priorities'); # set up the table print $cgi->table({border=>'3'}); print $cgi->TR({align=>'center',valign=>'top'}); print $cgi->td({colspan=>'3'},'Table Key'); print "
Candidate Priorities | \n"; print "||||||||||||
\n"; print " | Photometry | \n"; print "\n"; print " | Spectra | \n"; print "|||||||||
\n"; print " | Name | \n"; print $cgi->td(['U','B','V','R','I']); print "\n"; print $cgi->td(['U','B','V','R','I']); # add each candidate for($i=$result->ntuples-1; $i>=0; $i--) { $photQuery="SELECT u,b,v,r,i FROM priorities WHERE fun_name='" .$result->getvalue($i,0)."'"." AND type='phot'"; $photResult=$db->exec($photQuery); $specQuery="SELECT u,b,v,r,i FROM priorities WHERE fun_name='" .$result->getvalue($i,0)."'"." AND type='spec'"; $specResult=$db->exec($specQuery); if ($photResult->ntuples > 0 && $specResult->ntuples > 0) { $value=int $result->getvalue($i,1); print " | ||||||||||
".$result->getvalue($i,0)." (".$result->getvalue($i,2).") | \n"; # put up the individual filter priorities for($j=0; $j < 5; $j++) { $value=int $photResult->getvalue(0,$j); print_table_value(0); } print "\n"; for($j=0; $j < 5; $j++) { $value=int $specResult->getvalue(0,$j); print_table_value(0); } } } print " |