Subversion Repositories DevTools

Rev

Rev 4296 | Blame | 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 Query_String
Dim RecordCount
Dim bmcon_id
Dim gbe_id
Dim gbe_value
Dim daemon_mode
Dim gbe_buildfilter
Dim bShowEmpty
'------------ CONSTANTS DECLARATION -----------
'------------ VARIABLE INIT -------------------
sMessage = NULL

parRtag_id = Request("rtag_id")

Set objFormCollector = CreateObject("Scripting.Dictionary")
'------------ CONDITIONS ----------------------
'----------------------------------------------
%>
<%
'--------------------------------------------------------------------------------------------------------------------------
'-------------------------------------------------
' Function:     GetMachHost    
' Description:  Determine the current Display Host Information for a given BMCON_ID
'               Do not show build machines that are no longer 'allowed' unless
'               it is currently selected.
' Arguments:    abmcon_id   - A BMCON_ID
'
' Returns:      An array with 5 elements in it - to be used in creating a multicolum drop down list
'                   
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 " &_
           "  and (bm.active = 'Y' OR bm.bmcon_id = :bmcon_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 "bmcon_id"
End Function

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

If CBool(Request("action")) Then

    If  Request("bmcon_id") = "" Then
        sMessage = "Select a Build Machine before updating the entry"
    Else

       '    Add or Update after the users edit session
       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
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"-->
         <%
         '  Determine if any daemons have been configured in this release
         '  Will be used to determine if a new entry should be a MASTER or a SLAVE
         '
         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
         If RecordCount = 0 Then
            daemon_mode = "M"
         else   
            daemon_mode = "S"
         End If
         rsQry.Close()

         Set rsQry = Nothing
         %>
         <%If Request("rcon_id") <> "" Then%>
             <input type="hidden" name="rcon_id" value="<%=Request("rcon_id")%>">
         <%
            ' Edit an existing entry
            '   May have a link into the build_machine_config - or it may not
            '   Check first
            Dim rsTemp
            bShowEmpty = TRUE

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

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

            If rsTemp.RecordCount > 0 Then
                bmcon_id        =  rsTemp("bmcon_id")
                daemon_mode     =  rsTemp("daemon_mode")
                gbe_id          =  rsTemp("gbe_id")
                gbe_value       =  rsTemp("gbe_value")
                gbe_buildfilter =  rsTemp("gbe_buildfilter")
            End If

            rsTemp.Close()
            Set rsTemp = Nothing

            If NOT isNULL(bmcon_id) AND bmcon_id <> "" Then

                '   Extract information from the machine config
                Query_String = "SELECT * " &_
                               " FROM build_machine_config bc, " &_
                               "      gbe_machtype gb " &_
                               "WHERE bc.bmcon_id = " & bmcon_id &_
                               "  AND bc.gbe_id = gb.gbe_id"

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

                If rsTemp.RecordCount > 0 Then
                    bmcon_id        =  rsTemp("bmcon_id")
                    gbe_id          =  rsTemp("gbe_id")
                    gbe_value       =  rsTemp("gbe_value")
                    bShowEmpty      = FALSE
                End If

                rsTemp.Close()
                Set rsTemp = Nothing
            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), bShowEmpty, "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
%>