<% ' ***************************************** ' ******** switcher.asp ******** ' ***************************************** ' no required parms ' optional parms ' pord ' Values: ' p= provider search ' d= personal directory ' any other value=provider search ' ' status ' Values: ' change = toggle from Beech Comber ' to IPLU or vice versa ' any other value= no toggle ' ' Function Get_Parm_PorD() ' This function outputs a flag that tells whether ' to access the provider search or to access ' the personal directory ' dim bc_PorD dim tmp_PorD bc_PorD="P" tmp_PorD=Request.QueryString("pord") Select Case tmp_PorD Case "" bc_PorD="P" Case " " bc_PorD="P" Case "p" bc_PorD="P" Case "P" bc_PorD="P" Case "d" bc_PorD="D" Case "D" bc_PorD="D" End Select Get_Parm_PorD=bc_PorD End Function Function Get_Text_Status() ' This function read file status.txt and retrieves ' the Beech Comber Live status. The will be ' either ACTIVE when Beech Comber is Live or ' INACTIVE when IPLU is Live ' Dim fsoObject 'File System Object Dim tsObject 'Text Stream Object Dim filObject 'File Object Dim sgBcStatus 'Holds the Beech Comber Status 'Create a File System Object variable Set fsoObject = Server.CreateObject("Scripting.FileSystemObject") 'Initialise a File Object with the path and name of text file to open Set filObject = fsoObject.GetFile(Server.MapPath("status.txt")) 'Open the Beech Comber status text file Set tsObject = filObject.OpenAsTextStream 'Read in the Beech Comber status from the Beech Comber status file sgBcStatus = tsObject.ReadAll 'Reset server objects Set fsoObject = Nothing Set tsObject = Nothing Set filObject = Nothing Get_Text_Status=sgBcStatus End Function Function Toggle_BC_Status() Dim fsoObject 'File System Object Dim tsObject 'Text Stream Object Dim filObject 'File Object Dim sgBcStatus 'Holds the Beech Comber Status 'Create a File System Object variable Set fsoObject = Server.CreateObject("Scripting.FileSystemObject") 'Initialise a File Object with the path and name of text file to open Set filObject = fsoObject.GetFile(Server.MapPath("status.txt")) 'Open the Beech Comber status text file Set tsObject = filObject.OpenAsTextStream 'Read in the Beech Comber status from the Beech Comber status file sgBcStatus = tsObject.ReadAll sgBcStatus =UCASE(sgBcStatus) Select Case sgBcStatus Case "" sgBcStatus="ACTIVE" Case " " sgBcStatus="ACTIVE" Case "ACTIVE" sgBcStatus="INACTIVE" Case "INACTIVE" sgBcStatus="ACTIVE" End Select 'Replace current status.txt file Set tsObject = fsoObject.CreateTextFile(Server.MapPath("status.txt")) 'Write the new Beech Comber Status to the text file tsObject.Write CStr(sgBcStatus) 'Reset server objects Set fsoObject = Nothing Set tsObject = Nothing Set filObject = Nothing 'Return the new Beech Comber status Toggle_BC_Status=sgBcStatus End Function Function Get_Parm_Status() ' This function gets a passed parm to tell whether it is desired to ' force the application from Beech Comber to IPLU or ' force the application from IPLU to Beech Comber ' A value of 'NO_CHANGE is also allowed. ' Note url format: ' url ?status=ACTIVE --- no double quotes ' http://localhost/Test_Website/XML_Examples/BC_Status_XML_Editor/Switcher/switcher.asp?status=INACTIVE dim bc_status dim tmp_status bc_change_status="NO_CHANGE" tmp_status=UCASE(Request.QueryString("status")) Select Case tmp_status Case "" bc_change_status="NO_CHANGE" Case "CHANGE" bc_change_status="CHANGE" End Select Get_Parm_Status=bc_change_status End Function %> <% if (Get_Parm_Status()="CHANGE") then Toggle_BC_Status() if (Get_Text_Status()="ACTIVE") then 'Beech Comber Directory if (Get_Parm_PorD()="D") then Response.Redirect("http://beechplus.beechstreet.com/IPLU/Control?hJSPName=splash.jsp&hButtonMode=Directory") if (Get_Parm_PorD()="P") then Response.Redirect("http://beechplus.beechstreet.com/IPLU/Control?hJSPName=splash.jsp&hButtonMode=Search") else 'IPLU Live if (Get_Parm_PorD()="P") then Response.Redirect("http://beechplus.beechstreet.com/IPLU/Control?hJSPName=splash.jsp&hButtonMode=Search") ' http://beechplus.beechstreet.com/IPLU/Control?hJSPName=splash.jsp&hButtonMode=Search if (Get_Parm_PorD()="D") then Response.Redirect("http://beechplus.beechstreet.com/IPLU/Control?hJSPName=splash.jsp&hButtonMode=Directory") ' http://beechplus.beechstreet.com/IPLU/Control?hJSPName=splash.jsp&hButtonMode=Directory end if 'Get_Text_Status %>