Subversion Repositories DevTools

Rev

Rev 161 | Blame | Compare with Previous | Last modification | View Log | RSS feed

<%@LANGUAGE="VBSCRIPT"%>
<%
'=====================================================
'|                                                   |
'|                   wAddDaemon                      |
'|                                                   |
'=====================================================
%>
<%
Option explicit
Response.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_general.asp"-->
<!--#include file="_access_control_login.asp"-->
<%
'------------ VARIABLE DEFINITION -------------
Dim rsQry, healthTag, cmdInterface, pkgOwner, isInterface, package, procDesc
Dim sMessage
Dim GBE_MACHTYPE
Dim Query_String
Dim RecordCount
Dim daemon_hostname
Dim bmcon_id
Dim gbe_id
Dim gbe_value
Dim daemon_mode
Dim gbe_buildfilter
'------------ CONSTANTS DECLARATION -----------
Const LIMG_PRODUCT = "<img src='icons/i_product.gif' width='19' height='19' hspace='2' align='absmiddle'>"
Const LIMG_PRODUCT_UNPACKAGED = "<img src='icons/i_product_unpackaged.gif' width='19' height='19' hspace='2' align='absmiddle' title='Product is unofficial'>"
Const LIMG_PRODUCT_PATCH = "<img src='icons/i_patch_small.gif' hspace='2' align='absmiddle'>"
'------------ VARIABLE INIT -------------------
sMessage = NULL

parRtag_id = Request("rtag_id")

Set objFormCollector = CreateObject("Scripting.Dictionary")
'------------ CONDITIONS ----------------------
'----------------------------------------------
%>
<%
'--------------------------------------------------------------------------------------------------------------------------
Function GetMachHost (abmcon_id)
   Dim rsQry, query

   OraDatabase.Parameters.Add "bmcon_id",  abmcon_id,   ORAPARM_INPUT, ORATYPE_NUMBER

   query = "SELECT bm.bmcon_id,display_name, gbe_value, COALESCE(SUBSTR(description,1,INSTR(description,CHR(10),1,1)),description) as description, DECODE(:bmcon_id, bm.bmcon_id, 'selected', NULL) AS SELECTED" &_
           " FROM build_machine_config bm, gbe_machtype gb WHERE bm.gbe_id = gb.gbe_id order by bm.display_name"

   Set rsQry = OraDatabase.DbCreateDynaset( query, ORADYN_DEFAULT )
   If (NOT rsQry.BOF) AND (NOT rsQry.EOF) Then
      GetMachHost = rsQry.GetRows()
   Else
      GetMachHost = NULL
   End If

   rsQry.Close()
   Set rsQry = Nothing

   OraDatabase.Parameters.Remove "display_name"
End Function

'--------------------------------------------------------------------------------------------------------------------------
%>
<%
'------------ RUN BEFORE PAGE RENDER ----------


If CBool(Request("action")) Then

   If Request("rcon_id") <> "" Then

      OraDatabase.Parameters.Add "RCON_ID",         Request("rcon_id"),         ORAPARM_INPUT, ORATYPE_NUMBER
      OraDatabase.Parameters.Add "BMCON_ID",        Request("bmcon_id"),        ORAPARM_INPUT, ORATYPE_NUMBER
      OraDatabase.Parameters.Add "DAEMON_MODE",     Request("daemon_mode"),     ORAPARM_INPUT, ORATYPE_VARCHAR2
      OraDatabase.Parameters.Add "GBE_BUILDFILTER", Request("gbe_buildfilter"), ORAPARM_INPUT, ORATYPE_VARCHAR2

      objEH.TryORA ( OraSession )
      On Error Resume Next

      OraDatabase.ExecuteSQL _
      "BEGIN  PK_BUILDAPI.UPDATE_DAEMON_CONFIG(:RCON_ID, :BMCON_ID, :DAEMON_MODE, :GBE_BUILDFILTER);  END;"
      OraSession.CommitTrans

      objEH.CatchORA ( OraSession )

      OraDatabase.Parameters.Remove "RCON_ID"
      OraDatabase.Parameters.Remove "BMCON_ID"
      OraDatabase.Parameters.Remove "DAEMON_MODE"
      OraDatabase.Parameters.Remove "GBE_BUILDFILTER"

      If objEH.Finally Then
         Call OpenInParentWindow ("release_config.asp?rtag_id="&parRtag_id)
         Call CloseWindow()
      End If

      rsQry.Close
      Set rsQry = nothing

   Else
      OraDatabase.Parameters.Add "RTAG_ID",         Request("rtag_id"),         ORAPARM_INPUT, ORATYPE_NUMBER
      OraDatabase.Parameters.Add "BMCON_ID",        Request("bmcon_id"),        ORAPARM_INPUT, ORATYPE_NUMBER
      OraDatabase.Parameters.Add "DAEMON_MODE",     Request("daemon_mode"),     ORAPARM_INPUT, ORATYPE_VARCHAR2
      OraDatabase.Parameters.Add "GBE_BUILDFILTER", Request("gbe_buildfilter"), ORAPARM_INPUT, ORATYPE_VARCHAR2

      objEH.TryORA ( OraSession )
      On Error Resume Next

      OraDatabase.ExecuteSQL _
      "BEGIN  PK_BUILDAPI.ADD_DAEMON_CONFIG(:RTAG_ID, :BMCON_ID, :DAEMON_MODE, :GBE_BUILDFILTER);  END;"

      objEH.CatchORA ( OraSession )

      OraDatabase.Parameters.Remove "RTAG_ID"
      OraDatabase.Parameters.Remove "BMCON_ID"
      OraDatabase.Parameters.Remove "DAEMON_MODE"
      OraDatabase.Parameters.Remove "GBE_BUILDFILTER"

      If objEH.Finally Then
         Call OpenInParentWindow ("release_config.asp?rtag_id="&parRtag_id)
         Call CloseWindow()
      End If

      rsQry.Close
      Set rsQry = nothing

   End If

End If


'----------------------------------------------
%>
<html>
<head>
<title>Release Manager</title>
<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" rel="stylesheet" type="text/css">
<script language="JavaScript" src="scripts/common.js"></script>
</head>

<body background="images/bg_bage_0.gif" leftmargin="0" topmargin="0" onLoad="self.focus();FormName.bmcon_id.focus();">
<table width="100%"  border="0" cellspacing="0" cellpadding="10">
   <tr>
      <td bgcolor="#FFFFFF" class="body_txt"><span class="body_h1"><img src="icons/i_linkarrow_black.gif" width="11" height="11" align="absmiddle">&nbsp;Add/Update DAEMON</span> <br>
         Add a new DAEMON or edit an existing DAEMON.
      </td>
   </tr>

   <%
   '-- FROM START --------------------------------------------------------------------------------------------------------------
   objFormComponent.FormName = "FormName"
   objFormComponent.Action = ScriptName
   objFormComponent.OnSubmit = "ShowProgress();"
   Call objFormComponent.FormStart()

   %>
   <tr>
      <td background="images/bg_login.gif">
         <table width="50%"  border="0" cellspacing="0" cellpadding="0">
            <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="self.close();">
               </td>
            </tr>
         </table>
      </td>
   </tr>
   <tr>
      <td>
         <!-- NEW PRODUCT ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
         <%Call Messenger ( sMessage , 3, "100%" )%>
         <!-- MESSAGE +++++++++++++++++++++++++++++++++++++++++++++++++++ -->
         <!--#include file="messages/_msg_inline.asp"-->
         <%
         Query_String = "select * from release_config rc, gbe_machtype gbe "&_
         " where rc.rtag_id = "& parRtag_id &" and gbe.gbe_id = rc.gbe_id"

         Set rsQry = OraDatabase.DbCreateDynaset( Query_String, cint(0))

         RecordCount = rsQry.RecordCount

         rsQry.Close()

         Set rsQry = Nothing
         %>
         <br>
         <%
         If Request("rcon_id") <> "" Then
            %>
            <input type="hidden" name="rcon_id" value="<%=Request("rcon_id")%>">
            <%
            Dim rsTemp

            Query_String = "SELECT * FROM RELEASE_CONFIG rc, build_machine_config bm, gbe_machtype gb WHERE rc.rcon_id = "& Request("rcon_id") & " AND rc.daemon_hostname = bm.machine_hostname AND bm.gbe_id = gb.gbe_id"

            Set rsTemp = OraDatabase.DbCreateDynaset( Query_String, cint(0))

            bmcon_id   =   rsTemp("bmcon_id")
            daemon_mode   =   rsTemp("daemon_mode")

            daemon_hostname   =   rsTemp("daemon_hostname")
            gbe_id   =   rsTemp("gbe_id")
            gbe_value   =   rsTemp("gbe_value")
            gbe_buildfilter = rsTemp("gbe_buildfilter")

            rsTemp.Close()
            Set rsTemp = Nothing
         else
           If RecordCount = 0 Then
             daemon_mode = "M"
           else   
             daemon_mode = "S"
           End If
         End   If
         %>
         <table width="50%" border="0">
            <tr>
               <td><span class="body_txt">Daemon Host</span></td>
               <td>
                  <%=objFormComponent.Combo_Multi ( "bmcon_id", GetMachHost(bmcon_id), FALSE, "class='body_txt'",3,"20,20,50")%>
               </td>
            </tr>
            <tr>
               <td><span class="body_txt">Daemon Mode</span></td>
               <td>
                 <select name="daemon_mode" class='body_txt'>
                   <option value=M <%=iif(daemon_mode="M","selected","")%>>MASTER</option>
                   <option value=S <%=iif(daemon_mode="S","selected","")%>>SLAVE</option>
                 </select>
               </td>
            </tr>
            <tr>
               <tr>
                  <td><span class="body_txt">GBE_BUILDFILTER</span></td>
                  <td><input name="gbe_buildfilter" type="text" class="body_txt" size="80" value="<%=gbe_buildfilter%>"></td>
               </tr>
            </tr>
            <tr>
               <td>&nbsp;</td>
               <td>&nbsp;</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
%>