<%@ 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 ' ' connect quickly to phobos server database to get names of people on shift ' On Error Resume Next Connection.Open phdb_rd If Err.Number=0 Then 'If 1=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 sysdate>shift_date) " SQLStmt=SQLStmt & " and sn.shift_date=st.shift_date " Set RS=Connection.Execute(SQLStmt) ' Response.write(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 shift_type=CStr(RS("shift_type")) sdiff=CDbl(RS("sdiff")) Set RS=nothing Else shift_crew="" End If Connection.Close time_stop=Now() time_diff_phsrv=Round(24*60*60*(time_stop-time_start_phsrv),1) time_start_phdb=Now() On Error Resume Next Connection.Open phdb_rd ' ' check if database is available ' If Err.Number=&H80004005 Then Response.Write("Database is not available. " & "
") Response.Write("This page needs Main Phobos Database (phdb) to function properly." & "
") Response.Write("Database can be unavailable during cold backup or other Oracle maintenance. ") Response.Write("Check backup schedule and/or backup computer(s). If cold backup it taking place then simply wait, otherwise contact an Expert") Else ' ' Check important detector parameters. Try to do it as fast as possible, ' no complicated calculations ! ' ' Time and date now ' SQLStmt="select to_char(sysdate,'MM/DD/YYYY HH24:MI:SS') ddate, " 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 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 %>
<% 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
Complete Run Logbook

RHIC Info
RHIC Messages
RHIC Commissioning 2001
Magnet and Beam Currents
<% End If %>
Silicon Configuration
Geometrical Module assignments
Mercury parameter setting
All Silicon connection maps
Module Connection History
Cable and FEC Connection Worksheet
Calibrations
<% If registered=1 Then %> Create new map
ToF&Trigger Configuration
All Fastbus connection maps
Trigger configuration
<% 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() time_diff_tot=Round(24*60*60*(time_stop-time_start_phsrv),1) ' ' 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_phsrv) & "," & CStr(time_diff_phdb) & "," & CStr(time_diff_tot) ' DataFile.WriteLine(timing_info) 'End If 'DataFile.Close 'Set Datafile=nothing %> <%=time_diff_phsrv%>+<%=time_diff_phdb%>=<%=time_diff_tot%>