#!/usr/bin/perl # #.file susi.cgi #.purpose send an set-up request for EMMI #.version 2004-06-07 #.history 2003-04-01 creation from astrolabe.cgi ohainaut # # 2006-01-05 Adapted for new remedy server - wlsremdy.ls.eso.org jparra #---------------------------------------------------------------------- use CGI; $query = new CGI; # a directory where web user can write $writePath="/tmp/"; # email to which the form content must be sent. # (escape \@) $suEmail="ls-ntt\@eso.org"; # email of Remedy $remedyEmail="esoarsls\@eso.org"; # which email command to use $whichMail="/usr/bin/mailx"; $sendmail = '/usr/sbin/sendmail -t'; #--- INSTRUMENT DEFINITION: # # Instrument Scientist, this is where you want to modify things # # In this section, define the authorized values for the various # optical elements. %labelFilt = ('00', ' - ', '02', 'Bessel U #810 ', '03', 'Bessel B #811 ', '04', 'Bessel B #817 ', '05', 'Bessel V #812 ', '06', 'Bessel R #813 ', '07', 'Bessel I #814 ', '08', 'Bessel Z #815 ', '09', 'He II #880 ', '10', 'H Beta #881 ', '11', 'O III #882 ', '12', 'O III/Cont #883 ', '13', 'H alpha #884 ', '14', 'H alpha/Cont #885 ', '15', 'r #822 ', '16', 'WB 490 #824 ', '17', 'WB 655 #825 ', '18', 'U\' #823', '99', 'Special - see note'); #-- end of instrument definition #============================================================================== # FORM HANDLING print $query->header; $|=0; # FIRST CASE: we get parameters, so the form is filled: if ($query->param) { $formStep = substr($query->param(formstep),0,1); # - FORMSTEP = 1: ANALYSE AND DISPLAY THE REPORT FOR CONFIRMATION if ( $formStep == 1 ) { #- date ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday) = localtime(time); $thishour = (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24) [(localtime) [2]]; $thismonth = (Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec)[(localtime)[4]]; $thisday = (Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday)[(localtime)[6]]; #-- output files $suRemedy = "suRemedy_$obsName_$year$thismonth$yday_$thishour$min.txt"; $suRemedyTail = "suRemedyTail_$obsName_$year$thismonth$yday_$thishour$min.txt"; $suFile = "suEmail_$obsName_$year$thismonth$yday_$thishour$min.txt"; $suCommon = "suCommon_$obsName_$year$thismonth$yday_$thishour$min.txt"; #- remove the output file unlink("$writePath/$suRemedy"); unlink("$writePath/$suRemedyTail"); unlink("$writePath/$suFile"); unlink("$writePath/$suCommon"); #-- read the parameters in, and filter the # values returned for strange input $mobserver = substr($query->param(observer),0,32); $mprogId = substr($query->param(progId),0,10); $msuDateYr = substr($query->param(suDateYr),0,4); $msuDateYr =~ s/[^\d]/9/g; $msuDateMo = substr($query->param(suDateMo),0,2); $msuDateMo =~ s/[^\d]/9/g; $msuDateDy = substr($query->param(suDateDy),0,2); $msuDateDy =~ s/[^\d]/9/g; $mp2pp = substr($query->param(p2pp),0,10); $mFilt1 = substr($query->param(filt1), 0,2); $mFilt1 =~ s/[^\d]/9/g; $mFilt2 = substr($query->param(filt2), 0,2); $mFilt2 =~ s/[^\d]/9/g; $mFilt3 = substr($query->param(filt3), 0,2); $mFilt3 =~ s/[^\d]/9/g; $mFilt4 = substr($query->param(filt4), 0,2); $mFilt4 =~ s/[^\d]/9/g; $mFilt5 = substr($query->param(filt5), 0,2); $mFilt5 =~ s/[^\d]/9/g; $mFilt6 = substr($query->param(filt6), 0,2); $mFilt6 =~ s/[^\d]/9/g; $comCom = substr($query->param(comCom),0,2000); $comCom =~ s/[^a-z0-9A-Z .\-_\n]//g; #--- print the output open (SUFILE,">> $writePath/$suFile"); open (SUCOMMON,">> $writePath/$suCommon"); open (SUREMEDY,">> $writePath/$suRemedy"); open (SUREMEDYTAIL,">> $writePath/$suRemedyTail"); print SUFILE "To: $suEmail \n"; print SUFILE "CC: ls-openg\@eso.org \n"; print SUFILE "From: lasilla@eso.org\n"; print SUFILE "Subject: SuSI2 SetUp Request: $mprogId, $msuDateYr-$msuDateMo-$msuDateDy\n"; print SUFILE "Content-type: text/plain\n\n"; print SUFILE "NTT/SuSI-2 SETUP REQUEST\n"; print SUFILE "\n"; print SUFILE "OBSERVER: $mobserver\n"; print SUFILE "PROGRAM ID: $mprogId\n"; print SUFILE "P2PP PassWd: $mp2pp\n"; print SUFILE "Set Up Date: $msuDateYr-$msuDateMo-$msuDateDy\n"; print SUREMEDY "To: $remedyEmail \n"; print SUREMEDY "Content-type: text/plain\n\n"; print SUREMEDY "#\n"; print SUREMEDY "# File exported Thu Jun 10 15:17:12 2004\n"; print SUREMEDY "#\n"; print SUREMEDY "#AR-Message-Begin Do Not Delete This Line\n"; print SUREMEDY "Schema: SetUpRequest\n"; print SUREMEDY "Server: wlsremdy.ls.eso.org\n"; print SUREMEDY "Login: setusr\n"; print SUREMEDY "Password: setusr\n"; print SUREMEDY "Action: Submit\n"; print SUREMEDY "# Values: Submit, Query\n"; print SUREMEDY "Format: Short\n"; print SUREMEDY "\n"; print SUREMEDY " Submitter ! 2!: $USER$ \n\n"; print SUREMEDY " Telescope !536870913!: NTT\n"; print SUREMEDY " Instrument !536870932!: SUSI2\n"; print SUREMEDY " Month !536870920!: $msuDateMo\n"; print SUREMEDY " Year !536870917!: $msuDateYr\n"; print SUREMEDY " Beginning_of_Night !536870916!: $msuDateDy\n"; print SUREMEDY " Assigned-to ! 4!: \n"; print SUREMEDY " Observer !536870915!: $mobserver\n"; print SUREMEDY " ObsProgID ! 8!: $mprogId\n"; print SUREMEDY " Actions taken: !536870918!: \n"; print SUREMEDY " Status ! 7!: New\n"; print SUREMEDY " Team E-Mail !536870914!: ls-ntt\@eso.org \n"; print SUREMEDY " Telescope Email !536870997!: ls-ntt\@eso.org \n"; print SUREMEDY " Detailed description: !536870921!: [\$\$\n"; print SUREMEDYTAIL "$$]\n"; print SUREMEDYTAIL "#AR-Message-End Do Not Delete This Line\n"; print SUCOMMON "==============================================\n"; print SUCOMMON "Filter Wheel\n"; print SUCOMMON " 1: $labelFilt{$mFilt1}\n"; print SUCOMMON " 2: $labelFilt{$mFilt2}\n"; print SUCOMMON " 3: $labelFilt{$mFilt3}\n"; print SUCOMMON " 4: $labelFilt{$mFilt4}\n"; print SUCOMMON " 5: $labelFilt{$mFilt5}\n"; print SUCOMMON " 6: $labelFilt{$mFilt6}\n"; print SUCOMMON "==============================================\n"; print SUCOMMON "COMMENTS:\n"; print SUCOMMON "$comCom\n"; print SUCOMMON "==============================================\n"; print SUCOMMON "created on $thisday, $thismonth, $mday, 200"; print SUCOMMON $year-100; print SUCOMMON ", $thishour:$min:$sec \$\$]\n\n"; close (SUFILE); close (SUCOMMON); close (SUREMEDY); close (SUREMEDYTAIL); #-- show request and ask for confirmation print <

Your Set-Up request is reproduced below. Remember that this form does not perform any test: double check it.

To submit it to Science Operation, press

To edit it again, press the [Back] button on your browser. END #- writes the content of output file to html output print "


\n";
       foreach $i (`tail --lines=+6  $writePath/$suFile ; cat $writePath/$suCommon`)
       {print $i ;}
       print "

\n"; # print "
\n";
#       foreach $i (`cat  $writePath/$suRemedy  $writePath/$suCommon $writePath/$suRemedyTail`)
#       {print $i ;}
#       print "

\n"; } #============================================================================== if ( $formStep == 2 ) { # # - FORMSTEP = 2: CONFIRMED REPORT - SEND IT # $suRemedy = substr($query->param(suRemedy),0,72); $suRemedy =~ s/[^a-z0-9A-Z.\-_]//g; $suFile = substr($query->param(suFile),0,72); $suFile =~ s/[^a-z0-9A-Z.\-_]//g; $suCommon = substr($query->param(suCommon),0,72); $suCommon =~ s/[^a-z0-9A-Z.\-_]//g; #- send the instruction files via email open(SENDMAIL, "|$sendmail") or die "Cannot open $sendmail: $!" ; foreach $i (`cat $writePath/$suFile $writePath/$suCommon `) {print SENDMAIL $i ;} close (SENDMAIL); print "...email sent\n"; open(SENDREM, "|$sendmail") or die "Cannot open $sendmail: $!" ; foreach $i (`cat $writePath/$suRemedy $writePath/$suCommon $writePath/$suRemedyTail`) {print SENDREM $i ;} close (SENDREM); print "...database filled\n"; print "

Your set-up has been submitted. It is reproduced below for your convenience in case you want to print it."; #- writes the content of output file to html output print "


\n";
       foreach $i (`tail --lines=+6  $writePath/$suFile ; cat $writePath/$suCommon`)
       {print $i ;}
       print "

\n"; } #============================================================================== # WE GOT NO PARAMETER, SO WE ARE AT STEP 0: DISPLAY THE EMPTY FORM } else { print $query->startform; print < SuSI-2 Set-up Form
 [ ESO ] La Silla

La Silla - Science Operation Department
SciOp
SuSI-2 Set-Up Form


Please use the following form to submit your set-up request for SuSI-2. If your setup is special and does not follow the standard setup form, please contact your support astronomer. Note that it is critical that you discuss the set-up with your support astronomer prior to submitting the form.

This set-up form has to be submitted at the latest at 07:00 local on the day you start observing. If you submit it later, it is likely that either your set-up will not be ready in time and/or that you will be waken up early in the morning.

Please do not overfill this form: select only the optical elements you need. This form is not performing any verification on the consistency of the set-up you request: be sure to check that you are not requesting duplicate or incompatible elements. END #--page 0 table print ""; print "
"; print ""; print "
Observer"; print $query->textfield('observer'); print " First name and name \n"; print "
Prog.Id"; print $query->textfield('progId'); print " Format: 075.D-01234(A); see schedule\n"; print "
Date of Setup"; print < First night of observations. Format: YYYY-MM-DD
P2PP Password"; print $query->textfield('p2pp'); print "Required for identification
"; print "
"; #--page 1 table print ""; #--- BIMG #--page 1 table print "
"; print ""; print "

SuSI-2

"; print "
Filters "; print "
1"; print $query->popup_menu(-name=>'filt1', -Values=>['00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10','11', '12', '13', '14', '15', '16', '17', '18', '99'], -labels=>\%labelFilt, -default=>'02'); print "
2"; print $query->popup_menu(-name=>'filt2', -Values=>['00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10','11', '12', '13', '14', '15', '16', '17', '18', '99'], -labels=>\%labelFilt, -default=>'03'); print "
3"; print $query->popup_menu(-name=>'filt3', -Values=>['00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10','11', '12', '13', '14', '15', '16', '17', '18', '99'], -labels=>\%labelFilt, -default=>'05'); print "
4"; print $query->popup_menu(-name=>'filt4', -Values=>['00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10','11', '12', '13', '14', '15', '16', '17', '18', '99'], -labels=>\%labelFilt, -default=>'06'); print "
5"; print $query->popup_menu(-name=>'filt5', -Values=>['00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10','11', '12', '13', '14', '15', '16', '17', '18', '99'], -labels=>\%labelFilt, -default=>'07'); print "
6"; print $query->popup_menu(-name=>'filt6', -Values=>['00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10','11', '12', '13', '14', '15', '16', '17', '18', '99'], -labels=>\%labelFilt, -default=>'13'); print "
"; #---p 2 table print <

Additional Comments:
In case you selected a special optical element ("Special - see note"), please give the specifications here after.

END print $query->submit(-value=>'SUBMIT'); print $query->reset; print $query->endform; }