<%@ LANGUAGE="VBScript" %> <% Const OpenFileForAppending = 8 time_start_phsrv=Now() ' ' Check if people registered for shift/logbook writing ' 'response.write("hello") operator1="" operator2="" firstname1="" firstname2="" registered=0 changed=0 ' ' Counting House only ' cookies_OK=false If cloc="CH" Then If Request.Cookies("CTEST")="cookieset" Then cookies_OK=true If Request.Cookies("PHOBOSPORTAL").HasKeys Then strCookie1=Request.Cookies("PHOBOSPORTAL")("OPERATOR1") If Not (IsNull(strCookie1) OR ( Len(strCookie1) = 0)) Then registered=1 operator1=CStr(strCookie1) firstname1=CStr(Request.Cookies("PHOBOSPORTAL")("FIRSTNAME1")) strCookie2=Request.Cookies("PHOBOSPORTAL")("OPERATOR2") If Not (IsNull(strCookie2) OR ( Len(strCookie2) = 0)) Then operator2=CStr(strCookie2) firstname2=CStr(Request.Cookies("PHOBOSPORTAL")("FIRSTNAME2")) End If End If strCookie3=Request.Cookies("PHOBOSPORTAL")("CHANGED") If Not (IsNull(strCookie3) OR ( Len(strCookie3) = 0)) Then If Request.Cookies("PHOBOSPORTAL")("CHANGED")="changed" Then changed=1 Response.Cookies("PHOBOSPORTAL")="" Response.Cookies("PHOBOSPORTAL")("OPERATOR1")=CStr(operator1) Response.Cookies("PHOBOSPORTAL")("FIRSTNAME1")=CStr(firstname1) Response.Cookies("PHOBOSPORTAL")("OPERATOR2")=CStr(operator2) Response.Cookies("PHOBOSPORTAL")("FIRSTNAME2")=CStr(firstname2) Response.Cookies("PHOBOSPORTAL")("CHANGED")="same" Response.Cookies("PHOBOSPORTAL").Path="/" Response.Cookies("PHOBOSPORTAL").Domain=".bnl.gov" Else changed=0 End If End If End if Fullname1=operator1 Fullname2=operator2 If firstname1<>"" Then Fullname1=Ucase(Left(firstname1,1)) & ". " & operator1 End if If firstname2<>"" Then Fullname2=Ucase(Left(firstname2,1)) & ". " & operator2 End if Else cookies_OK=false End If End If ' ' Prepare input from database ' Set Connection = Server.CreateObject("ADODB.Connection") Connection.Mode = adModeRead time_start_phdb=Now() 'On Error Resume Next Connection.Open phdb_rd ' ' check if database is available ' %> <% If Err.Number=0 Then ' SQLStmt=" select sn.lastname1 L1,sn.lastname2 L2,substr(sn.firstname1,1,1) || '.' || ' ' || sn.lastname1 fullname1, " ' SQLStmt=SQLStmt & " substr(sn.firstname2,1,1) || '.' || ' ' || sn.lastname2 fullname2, " ' SQLStmt=SQLStmt & " st.shift_type,24*60*(sysdate-sn.shift_date) sdiff " ' SQLStmt=SQLStmt & " from secretary.shift_names sn,secretary.shift_types st where sn.shift_date= " ' SQLStmt=SQLStmt & " (select max(shift_date) shift_date from secretary.shift_names where shift_date between sysdate-1 and sysdate) " ' SQLStmt=SQLStmt & " and sn.shift_date=st.shift_date " ' Response.write(SQLStmt & "
") ' Set RS=Connection.Execute(SQLStmt) ' If IsNull(RS("L1")) And IsNull(RS("L2")) Then ' shift_crew="" ' Elseif Not IsNull(RS("L1")) Then ' If Not IsNull(RS("L2")) Then ' shift_crew=CStr(RS("Fullname1")) & " & " & CStr(RS("Fullname2")) ' Else ' shift_crew=CStr(RS("Fullname1")) ' End If ' Elseif Not IsNull(RS("L2")) Then ' shift_crew=CStr(RS("Fullname2")) ' End If ' If Not IsNull(RS("shift_type")) Then ' shift_type=CStr(RS("shift_type")) ' Else ' shift_type="" ' End If ' sdiff=CDbl(RS("sdiff")) ' Set RS=nothing shift_crew="" Else shift_crew="" End If If shift_type="A" Then ' Shift cancelled shift_crew="" End If 'response.write("Error Description " & Cstr(Err.Description)) If Err.Number=0 Then If InStr(Trim(Request.ServerVariables("SERVER_NAME")),"phobosdb.chm.bnl.gov")<>0 Then mirror=true Else mirror=false End If ' ' Check important detector parameters. Try to do it as fast as possible, ' no complicated calculations ! ' ' Time and date now ' If Not mirror then SQLStmt="select to_char(sysdate,'MM/DD/YYYY HH24:MI:SS') ddate, " Else SQLStmt="select to_char(sysdate,'SS:MI:HH24 YYYY\DD\MM') ddate, " End If SQLStmt=SQLStmt & " to_char(sysdate,'MMYYYY') moye1," SQLStmt=SQLStmt & " to_char(sysdate,'Month') moyedisp1," SQLStmt=SQLStmt & " to_char(add_months(sysdate,1),'MMYYYY') moye2," SQLStmt=SQLStmt & " to_char(add_months(sysdate,1),'Month') moyedisp2 " SQLStmt=SQLStmt & " from dual" Set RS=Connection.Execute(SQLStmt) ddate=CStr(RS("ddate")) moye1=CStr(RS("moye1")) moye2=CStr(RS("moye2")) moyedisp1=CStr(RS("moyedisp1")) moyedisp2=CStr(RS("moyedisp2")) Set RS=nothing ' ' Check latest run number ' SQLStmt=" select run,nevents from phoffline.runs where run=(select max(run) from phoffline.runs) " Set RS=Connection.Execute(SQLStmt) run=CStr(RS("run")) If IsNull(RS("nevents")) Then runstr="" & CStr(RS("run")) & "" Else runstr=CStr(RS("run")) End If Set RS=nothing ' ' Check latest reading of temperature and humidity ' SQLStmt=" select nvl(24*60*(sysdate-max(logdate)),99999) diff from phoffline.tunnel_monitoring " Set RS=Connection.Execute(SQLStmt) tunnel_monitoring_OK=CDbl(RS("diff")) Counting House <% If changed=1 Then %> <% End If %>
<% If shift_crew<>"" Then Response.write("" & shift_crew & "
on shift
") Else Response.write("

Counting House

") End If ' ' If data taking shift AND it is less than 30 mins since the start of the shift ' AND this script is run on logbook computer then pop up shift checklist window ' If shift_type="D" And sdiff<30 And iflog Then %>

<% End If %>

<%=ddate%>

Detector Status
Nominal Detector State
Temperature & Humidity <% If Not tunnel_monitoring_OK Then Response.write("(Old)") End If %>
Magnet <% If Not magnet_monitoring_OK Then Response.write("(Old)") End If %>
Beam Loss Monitors <% If Not BLM_monitoring_OK Then Response.write("(Old)") End If %>
UPS <% If Not ups_monitoring_OK Then Response.write("(Old)") End If %>
Si Power Supplies <% If Not Fec_supply_OK Then Response.write("(Old)") End If %>
Si Hybrids <% If Not Fec_monitoring_OK Then Response.write("(Old)") End If %>
Si Cooling System <% If Not cooling_monitoring_OK Then Response.write("(Old)") End If %>
ToF&Trigger Voltages <% If Not lchv_monitoring_OK Then Response.write("(Old)") End If %>
Si Latchup Vfp Summary<% If Not Fec_monitoring_OK Then Response.write("(Old)") End If %>
DAQ/StreamStor
DAQ Buffer Disk 
Utilities
Graph selected monitoring data
TLD Info And Actions
Radiation PR04

Radiation last 7 days
<% If cloc="CH" Then If registered=1 Then response.write(" ") rlink="Re-register" Else if cookies_OK Then response.write(" ") rlink="Register" Else response.write(" ") End if End If %> <% End If ' Counting House only %>
") If operator2<>"" Then response.write(fullname1 & " and " & fullname2) Else response.write(fullname1) End If response.write("
") response.write("You need to register before being able to write comments in the logbook") response.write("
") response.write("You must enable cookies in your browser") response.write("
<%=rlink%>
Shift and Run Logbooks
<% If registered=1 Then %>

Shift Logbook <% Else %>Shift Logbook <% End If %>
Complete Shift Logbook
Search Shift Logbook
Run Logbook, last 50 runs
Last Run(<%=runstr%>)
Complete Run Logbook 
Collision Counts-PR03

Daily Totals Picture-PR04 (AA)
Daily Totals Picture-PR05 (AA)

RHIC Info
RHIC Messages
Magnet and Beam Currents
RHIC Run V (2004-2005)
RHIC Computing Facility Contact
Shift Activities
How to take Data
Checklist
What to do on shift
Shifts for: <%=Trim(moyedisp1)%> <%=Trim(moyedisp2)%>
Fill in your shift availability
<% End If %>
Silicon Configuration
Geometrical Module assignments
Mercury parameter setting
All Silicon connection maps
Module Connection History
Cable and FEC Connection Worksheet
SiCalibrations
<% If registered=1 Then %> Create new map
ToF&Trigger Configuration
All Fastbus connection maps
FBCalibrations
Define Trigger Configurations and Prescalers
Trigger L0/L1/Bits
Display current Scaler rates <% If Not Scalers_OK Then Response.write("(Old)") End If %>
Data Validation
<%If registered=1 then %>

Change DV Status/Quality for indivdual sequences 
<%End if%> Sequence Processing Status
HPSS Cache/Tape Monitor
Data sinking Rate [all]
CRS Job Metrics
CRS Job Status

<% End If ' end the database open check ' ' Close the database ' Connection.Close Set Connection=nothing time_stop=Now() time_diff_phdb=Round(24*60*60*(time_stop-time_start_phdb),1) time_stop=Now() ' ' Keep track of usage ' 'Set fso = CreateObject("Scripting.FileSystemObject") 'On Error Resume Next 'Set DataFile = fso.OpenTextFile(ph_image_directory+"index_timing.txt",OpenFileForAppending, True) 'If Err.Number=0 Then ' ipaddr=Trim(Request.ServerVariables("REMOTE_ADDR")) ' timing_info=CStr(time_stop) & "," & ipaddr & "," & CStr(time_diff_phdb) ' DataFile.WriteLine(timing_info) 'End If 'DataFile.Close 'Set Datafile=nothing %> <%=time_diff_phdb%>