Rev 7240 | Rev 7245 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
<%@LANGUAGE="VBSCRIPT"%><%'=====================================================' wAddBuildMachine.asp'=====================================================%><%Option explicitResponse.Expires = 0%><!--#include file="common/conf.asp"--><!--#include file="common/globals.asp"--><!--#include file="common/formating.asp"--><!--#include file="common/qstr.asp"--><!--#include file="common/common_subs.asp"--><!--#include file="common/_form_window_common.asp"--><%'------------ ACCESS CONTROL ------------------%><!--#include file="_access_control_login.asp"--><!--#include file="_access_control_general.asp"--><%'------------ VARIABLE DEFINITION -------------Dim sMessageDim display_nameDim machine_hostnameDim gbe_idDim active, activeCheckedDim descriptionDim platformListDim bIsaClone : bIsaClone = FALSE'------------ CONSTANTS DECLARATION -----------'------------ VARIABLE INIT -------------------sMessage = NULLSet objFormCollector = CreateObject("Scripting.Dictionary")If Request("type") = "clone" ThenbIsaClone = TRUEEnd If'------------ CONDITIONS ----------------------'----------------------------------------------%><%'--------------------------------------------------------------------------------------------------------------------------' Get the data for the display' On first request, it will get the data from the database' Otherwise the data will be fetched from form elementsSub GetDataIf CBool(Request("action")) Then' Recover the data from the form' It may contain user changesdisplay_name = Request("display_name")machine_hostname = Request("machine_hostname")gbe_id = Request("gbe_id")active = Request("active")description = Request("description")platformList = "," & Request("platform") & ","platformList = Replace(platformList," ","",1,-1)if active = "Y" Then activeChecked = "checked"ElseIf Request("bmcon_id") <> "" Then' Extract data from the databaseDim rsQry, queryquery = "select * from build_machine_config bm, gbe_machtype gbe "&_" where bm.bmcon_id = "& Request("bmcon_id") &_" and gbe.gbe_id = bm.gbe_id"Set rsQry = OraDatabase.DbCreateDynaset( query, cint(0))display_name = rsQry("display_name")machine_hostname = rsQry("machine_hostname")gbe_id = rsQry("gbe_id")active = rsQry("active")description = rsQry("description")activeChecked = ""if active = "Y" Then activeChecked = "checked"If bIsaClone Thendescription = "Clone of " & machine_hostname & ".<br>" & descriptiondisplay_name = ""machine_hostname = ""End IfrsQry.Close()Set rsQry = Nothing' Create a list of associated Platforms'platformList = ""query = "select * from build_platforms_config2 bpc2 where bpc2.bmcon_id = "& Request("bmcon_id")Set rsQry = OraDatabase.DbCreateDynaset( query, ORADYN_DEFAULT )While (NOT rsQry.BOF) AND (NOT rsQry.EOF)platformList = platformList & "," & rsQry("BP_ID")rsQry.MoveNextWendrsQry.Close()Set rsQry = NothingplatformList = platformList & ","Else' New Machine - set defaultsactiveChecked = "checked"End IfEnd Sub'--------------------------------------------------------------------------------------------------------------------------' Get MachTypes - to populate a dropdron listFunction GetMachType ( ngbe_id )Dim rsQry, queryOraDatabase.Parameters.Add "gbe_id", ngbe_id, ORAPARM_INPUT, ORATYPE_NUMBERquery = GetQuery ("GBE_MACHTYPECombo.sql")Set rsQry = OraDatabase.DbCreateDynaset( query, ORADYN_DEFAULT )If (NOT rsQry.BOF) AND (NOT rsQry.EOF) ThenGetMachType = rsQry.GetRows()ElseGetMachType = NULLEnd IfrsQry.Close()Set rsQry = NothingOraDatabase.Parameters.Remove "gbe_id"End Function'--------------------------------------------------------------------------------------------------------------------------' Get configured platforms'Function GetPlatforms ()Dim rsQry, queryquery = "SELECT bp.BP_ID, bp.BP_ACTIVE, bp.BP_NAME, bp.BP_DESCRIPTION FROM BUILD_PLATFORMS bp, BUILD_PLATFORMS_CONFIG bpc WHERE bp.bp_id = bpc.bp_id AND bpc.gbe_id = 90 ORDER BY UPPER(bp.BP_NAME)"Set rsQry = OraDatabase.DbCreateDynaset( query, ORADYN_DEFAULT )While (NOT rsQry.BOF) AND (NOT rsQry.EOF)Dim checkTextIf InStr(platformList, "," & rsQry("BP_ID") & ",") > 0 ThencheckText = "checked"elsecheckText = ""End IfGetPlatforms = GetPlatforms & "<tr class=body_txt>"GetPlatforms = GetPlatforms & "<td> <input type=checkbox name=platform value='"& rsQry("BP_ID") &"' "& checkText &">" & rsQry("BP_NAME") & "</td>"GetPlatforms = GetPlatforms & "</tr>"rsQry.MoveNextWendrsQry.Close()Set rsQry = NothingGetPlatforms = "<table>" & GetPlatforms & "</table>"End Function'--------------------------------------------------------------------------------------------------------------------------%><%'------------ RUN BEFORE PAGE RENDER ----------If CBool(Request("action")) ThenIf Request("bmcon_id") <> "" ThenOraDatabase.Parameters.Add "BMCON_ID", Request("bmcon_id"), ORAPARM_INPUT, ORATYPE_NUMBEROraDatabase.Parameters.Add "DISPLAY_NAME", Request("display_name"), ORAPARM_INPUT, ORATYPE_VARCHAR2OraDatabase.Parameters.Add "MACHINE_HOSTNAME", Request("machine_hostname"), ORAPARM_INPUT, ORATYPE_VARCHAR2OraDatabase.Parameters.Add "GBE_ID", Request("gbe_id"), ORAPARM_INPUT, ORATYPE_NUMBEROraDatabase.Parameters.Add "DESCRIPTION", Request("description"), ORAPARM_INPUT, ORATYPE_VARCHAR2OraDatabase.Parameters.Add "ACTIVE", Request("active"), ORAPARM_INPUT, ORATYPE_CHAROraDatabase.Parameters.Add "PLATFORM", Request("platform"), ORAPARM_INPUT, ORATYPE_VARCHAR2objEH.ErrorRedirect = FALSEobjEH.TryORA ( OraSession )On Error Resume NextOraDatabase.ExecuteSQL _"BEGIN PK_BUILDAPI.UPDATE_BUILD_MACHINE(:BMCON_ID, :DISPLAY_NAME, :MACHINE_HOSTNAME, :GBE_ID, :DESCRIPTION, :ACTIVE, :PLATFORM); END;"objEH.CatchORA ( OraSession )OraDatabase.Parameters.Remove "BMCON_ID"OraDatabase.Parameters.Remove "DISPLAY_NAME"OraDatabase.Parameters.Remove "MACHINE_HOSTNAME"OraDatabase.Parameters.Remove "GBE_ID"OraDatabase.Parameters.Remove "DESCRIPTION"OraDatabase.Parameters.Remove "ACTIVE"OraDatabase.Parameters.Remove "PLATFORM"If objEH.Finally ThenCall OpenInParentWindow ("admin_build_machine.asp?bmcon_id="&Request("bmcon_id"))Call CloseWindow()End IfrsQry.CloseSet rsQry = nothingElseOraDatabase.Parameters.Add "DISPLAY_NAME", Request("display_name"), ORAPARM_INPUT, ORATYPE_VARCHAR2OraDatabase.Parameters.Add "MACHINE_HOSTNAME", Request("machine_hostname"), ORAPARM_INPUT, ORATYPE_VARCHAR2OraDatabase.Parameters.Add "GBE_ID", Request("gbe_id"), ORAPARM_INPUT, ORATYPE_NUMBEROraDatabase.Parameters.Add "DESCRIPTION", Request("description"), ORAPARM_INPUT, ORATYPE_VARCHAR2OraDatabase.Parameters.Add "ACTIVE", Request("active"), ORAPARM_INPUT, ORATYPE_CHAROraDatabase.Parameters.Add "PLATFORM", Request("platform"), ORAPARM_INPUT, ORATYPE_VARCHAR2objEH.ErrorRedirect = FALSEobjEH.TryORA ( OraSession )On Error Resume NextOraDatabase.ExecuteSQL _"BEGIN PK_BUILDAPI.ADD_BUILD_MACHINE(:DISPLAY_NAME, :MACHINE_HOSTNAME, :GBE_ID, :DESCRIPTION, :ACTIVE, :PLATFORM); END;"objEH.CatchORA ( OraSession )OraDatabase.Parameters.Remove "DISPLAY_NAME"OraDatabase.Parameters.Remove "MACHINE_HOSTNAME"OraDatabase.Parameters.Remove "GBE_ID"OraDatabase.Parameters.Remove "DESCRIPTION"OraDatabase.Parameters.Remove "ACTIVE"OraDatabase.Parameters.Remove "PLATFORM"If objEH.Finally ThenCall OpenInParentWindow ("admin_build_machine.asp?bmcon_id="&Request("bmcon_id"))Call CloseWindow()End IfrsQry.CloseSet rsQry = nothingEnd IfEnd If'----------------------------------------------%><html><head><title>Release Manager</title><link rel="shortcut icon" href="<%=FavIcon%>"/><meta HTTP-EQUIV="Pragma" CONTENT="no-cache"><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><link href="images/release_manager_style.css?ver=<%=VixVerNum%>" rel="stylesheet" type="text/css"><script language="JavaScript" src="scripts/common.js?ver=<%=VixVerNum%>"></script></head><body leftmargin="0" topmargin="0" onLoad="self.focus();FormName.display_name.focus();"><table width="100%" border="0" cellspacing="0" cellpadding="10"><tr><td class="body_txt">Add a new Build Machine or edit an existing Build Machine.</td></tr><%'-- FROM START --------------------------------------------------------------------------------------------------------------objFormComponent.FormName = "FormName"objFormComponent.FormClass = "form_tight"objFormComponent.Action = ScriptNameobjFormComponent.OnSubmit = "ShowProgress();"Call objFormComponent.FormStart()Call GetData()%><tr><td class="form_field_bg" ><!-- NEW PRODUCT ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --><%Call Messenger ( sMessage , 3, "100%" )%><!-- MESSAGE +++++++++++++++++++++++++++++++++++++++++++++++++++ --><!--#include file="messages/_msg_inline.asp"--><br><%If Request("bmcon_id") <> "" Then%><%If NOT bIsaClone Then%><input type="hidden" name="bmcon_id" value="<%=Request("bmcon_id")%>"><%End IfEnd If%><table width="50%" border="0"><tr><td><span class="body_txt nowrap">Display Name</span></td><td><input name="display_name" type="text" class="body_txt" value="<%=display_name%>" size=24 maxlength=20></td></tr><tr><td><span class="body_txt">Machine HostName</span></td><td><input name="machine_hostname" type="text" class="body_txt" value="<%=machine_hostname%>" size=50 maxlength=50></td></tr><tr><td><span class="body_txt nowrap">GBE_MACHTYPE</span></td><td><%=objFormComponent.Combo ( "gbe_id", GetMachType( gbe_id ), CBool(Request("bmcon_id") = ""), "size=1 class='body_txt'" )%></td></tr><tr><td><span class="body_txt nowrap">Allow Use</span></td><td><input type="checkbox" name="active" value="Y" <%=activeChecked%>><span class="body_txt">Allow users to add this machine to a build set</span></td></tr><tr><td><span class="body_txt nowrap">Description</span></td><td><textarea name="Description" cols=50 rows=5 class='body_txt'><%=Description%></textarea></td></tr><tr><td><span class="body_txt nowrap">Platfroms</span></td><td style="border: darkgrey 1px solid"><div style="overflow-y: scroll;height: 10em;"><%=GetPlatforms%></div></td></tr></table></td></tr><tr><td><table class="full_table"><tr><td><%=ProgressBar()%></td><td align="right"><input name="btn" type="submit" class="form_btn" value="Add/Update"><input name="btn" type="reset" class="form_btn" value="Cancel" onclick="parent.closeIFrame();"></td></tr></table></td></tr><%=objPMod.ComposeHiddenTags()%><input type="hidden" name="action" value="true"><%Call objFormComponent.FormEnd()'-- FROM END ----------------------------------------------------------------------------------------------------------------%></table></body></html><%'------------ RUN AFTER PAGE RENDER -----------Set objFormCollector = Nothing'----------------------------------------------Call Destroy_All_Objects%>