Subversion Repositories DevTools

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
5357 dpurdie 1
<%@LANGUAGE="VBSCRIPT"%>
2
<%
3
'=====================================================
4
'|                                                   |
5
'|                   wAddDaemon                      |
6
'|                                                   |
7
'=====================================================
8
%>
9
<%
10
Option explicit
11
Response.Expires = 0
12
%>
13
<!--#include file="common/conf.asp"-->
14
<!--#include file="common/globals.asp"-->
15
<!--#include file="common/formating.asp"-->
16
<!--#include file="common/qstr.asp"-->
17
<!--#include file="common/common_subs.asp"-->
18
<!--#include file="common/_form_window_common.asp"-->
19
<%
20
'------------ ACCESS CONTROL ------------------
21
%>
22
<!--#include file="_access_control_general.asp"-->
23
<!--#include file="_access_control_login.asp"-->
24
<%
25
'------------ VARIABLE DEFINITION -------------
26
Dim rsQry, healthTag, cmdInterface, pkgOwner, isInterface, package, procDesc
27
Dim sMessage
28
Dim Query_String
29
Dim RecordCount
30
Dim bmcon_id
31
Dim gbe_id
32
Dim gbe_value
33
Dim daemon_mode
34
Dim gbe_buildfilter
35
Dim bShowEmpty
36
'------------ CONSTANTS DECLARATION -----------
37
'------------ VARIABLE INIT -------------------
38
sMessage = NULL
39
 
40
parRtag_id = Request("rtag_id")
41
 
42
Set objFormCollector = CreateObject("Scripting.Dictionary")
43
'------------ CONDITIONS ----------------------
44
'----------------------------------------------
45
%>
46
<%
47
'--------------------------------------------------------------------------------------------------------------------------
48
'-------------------------------------------------
49
' Function:     GetMachHost    
50
' Description:  Determine the current Display Host Information for a given BMCON_ID
51
'               Do not show build machines that are no longer 'allowed' unless
52
'               it is currently selected.
53
' Arguments:    abmcon_id   - A BMCON_ID
54
'
55
' Returns:      An array with 5 elements in it - to be used in creating a multicolum drop down list
56
'                   
57
Function GetMachHost (abmcon_id)
58
   Dim rsQry, query
59
 
5503 dpurdie 60
   OraDatabase.Parameters.Add "bmcon_id", abmcon_id,            ORAPARM_INPUT, ORATYPE_NUMBER
61
   OraDatabase.Parameters.Add "rtag_id",  Request("rtag_id"),   ORAPARM_INPUT, ORATYPE_NUMBER
5357 dpurdie 62
 
5503 dpurdie 63
   query = ReadFile( rootPath & "queries\available_build_machines.sql" )
5357 dpurdie 64
 
65
   Set rsQry = OraDatabase.DbCreateDynaset( query, ORADYN_DEFAULT )
66
   If (NOT rsQry.BOF) AND (NOT rsQry.EOF) Then
67
      GetMachHost = rsQry.GetRows()
68
   Else
69
      GetMachHost = NULL
70
   End If
71
 
72
   rsQry.Close()
73
   Set rsQry = Nothing
74
 
75
   OraDatabase.Parameters.Remove "bmcon_id"
5503 dpurdie 76
   OraDatabase.Parameters.Remove "rtag_id"
5357 dpurdie 77
End Function
78
 
79
'--------------------------------------------------------------------------------------------------------------------------
80
%>
81
<%
82
'------------ RUN BEFORE PAGE RENDER ----------
83
 
84
If CBool(Request("action")) Then
85
 
86
    If  Request("bmcon_id") = "" Then
87
        sMessage = "Select a Build Machine before updating the entry"
88
    Else
89
 
90
       '    Add or Update after the users edit session
91
       If Request("rcon_id") <> "" Then
92
 
93
          OraDatabase.Parameters.Add "RCON_ID",         Request("rcon_id"),         ORAPARM_INPUT, ORATYPE_NUMBER
94
          OraDatabase.Parameters.Add "BMCON_ID",        Request("bmcon_id"),        ORAPARM_INPUT, ORATYPE_NUMBER
95
          OraDatabase.Parameters.Add "DAEMON_MODE",     Request("daemon_mode"),     ORAPARM_INPUT, ORATYPE_VARCHAR2
96
          OraDatabase.Parameters.Add "GBE_BUILDFILTER", Request("gbe_buildfilter"), ORAPARM_INPUT, ORATYPE_VARCHAR2
97
 
98
          objEH.TryORA ( OraSession )
99
          On Error Resume Next
100
 
101
          OraDatabase.ExecuteSQL "BEGIN  PK_BUILDAPI.UPDATE_DAEMON_CONFIG(:RCON_ID, :BMCON_ID, :DAEMON_MODE, :GBE_BUILDFILTER);  END;"
102
          OraSession.CommitTrans
103
 
104
          objEH.CatchORA ( OraSession )
105
 
106
          OraDatabase.Parameters.Remove "RCON_ID"
107
          OraDatabase.Parameters.Remove "BMCON_ID"
108
          OraDatabase.Parameters.Remove "DAEMON_MODE"
109
          OraDatabase.Parameters.Remove "GBE_BUILDFILTER"
110
 
111
          If objEH.Finally Then
112
             Call OpenInParentWindow ("release_config.asp?rtag_id="&parRtag_id)
113
             Call CloseWindow()
114
          End If
115
 
116
          rsQry.Close
117
          Set rsQry = nothing
118
 
119
       Else
120
          OraDatabase.Parameters.Add "RTAG_ID",         Request("rtag_id"),         ORAPARM_INPUT, ORATYPE_NUMBER
121
          OraDatabase.Parameters.Add "BMCON_ID",        Request("bmcon_id"),        ORAPARM_INPUT, ORATYPE_NUMBER
122
          OraDatabase.Parameters.Add "DAEMON_MODE",     Request("daemon_mode"),     ORAPARM_INPUT, ORATYPE_VARCHAR2
123
          OraDatabase.Parameters.Add "GBE_BUILDFILTER", Request("gbe_buildfilter"), ORAPARM_INPUT, ORATYPE_VARCHAR2
124
 
125
          objEH.TryORA ( OraSession )
126
          On Error Resume Next
127
 
128
          OraDatabase.ExecuteSQL "BEGIN  PK_BUILDAPI.ADD_DAEMON_CONFIG(:RTAG_ID, :BMCON_ID, :DAEMON_MODE, :GBE_BUILDFILTER);  END;"
129
 
130
          objEH.CatchORA ( OraSession )
131
 
132
          OraDatabase.Parameters.Remove "RTAG_ID"
133
          OraDatabase.Parameters.Remove "BMCON_ID"
134
          OraDatabase.Parameters.Remove "DAEMON_MODE"
135
          OraDatabase.Parameters.Remove "GBE_BUILDFILTER"
136
 
137
          If objEH.Finally Then
138
             Call OpenInParentWindow ("release_config.asp?rtag_id="&parRtag_id)
139
             Call CloseWindow()
140
          End If
141
 
142
          rsQry.Close
143
          Set rsQry = nothing
144
 
145
       End If
146
    End If
147
End If
148
'----------------------------------------------
149
%>
150
<html>
151
<head>
152
<title>Release Manager</title>
153
<link rel="shortcut icon" href="<%=FavIcon%>"/>
154
<meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
155
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
156
<link href="images/release_manager_style.css" rel="stylesheet" type="text/css">
157
<script language="JavaScript" src="scripts/common.js"></script>
158
</head>
159
 
160
<body background="images/bg_bage_0.gif" leftmargin="0" topmargin="0" onLoad="self.focus();FormName.bmcon_id.focus();">
161
<table width="100%"  border="0" cellspacing="0" cellpadding="10">
162
   <tr>
163
      <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>
164
         Add a new DAEMON or edit an existing DAEMON.
165
      </td>
166
   </tr>
167
 
168
   <%
169
   '-- FROM START --------------------------------------------------------------------------------------------------------------
170
   objFormComponent.FormName = "FormName"
171
   objFormComponent.Action = ScriptName
172
   objFormComponent.OnSubmit = "ShowProgress();"
173
   Call objFormComponent.FormStart()
174
 
175
   %>
176
   <tr>
177
      <td background="images/bg_login.gif">
178
         <table width="50%"  border="0" cellspacing="0" cellpadding="0">
179
            <tr>
180
               <td><%=ProgressBar()%></td>
181
               <td align="right"><input name="btn" type="submit" class="form_btn" value="Add/Update">
182
                  <input name="btn" type="reset" class="form_btn" value="Cancel" onClick="self.close();">
183
               </td>
184
            </tr>
185
         </table>
186
      </td>
187
   </tr>
188
   <tr>
189
      <td>
190
         <!-- NEW PRODUCT ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
191
         <%Call Messenger ( sMessage , 3, "100%" )%>
192
         <!-- MESSAGE +++++++++++++++++++++++++++++++++++++++++++++++++++ -->
193
         <!--#include file="messages/_msg_inline.asp"-->
194
         <%
195
         '  Determine if any daemons have been configured in this release
196
         '  Will be used to determine if a new entry should be a MASTER or a SLAVE
197
         '
198
         Query_String = "select * " &_
199
                        " from release_config rc," &_
200
                        "      gbe_machtype gbe " &_
201
                        " where rc.rtag_id = "& parRtag_id &_
202
                        "   and gbe.gbe_id = rc.gbe_id"
203
 
204
         Set rsQry = OraDatabase.DbCreateDynaset( Query_String, cint(0))
205
 
206
         RecordCount = rsQry.RecordCount
207
         If RecordCount = 0 Then
208
            daemon_mode = "M"
209
         else   
210
            daemon_mode = "S"
211
         End If
212
         rsQry.Close()
213
 
214
         Set rsQry = Nothing
215
         %>
216
         <%If Request("rcon_id") <> "" Then%>
217
             <input type="hidden" name="rcon_id" value="<%=Request("rcon_id")%>">
218
         <%
219
            ' Edit an existing entry
220
            '   May have a link into the build_machine_config - or it may not
221
            '   Check first
222
            Dim rsTemp
223
            bShowEmpty = TRUE
224
 
225
            Query_String = "SELECT * " &_
226
                           " FROM RELEASE_CONFIG rc," &_
227
                           "      gbe_machtype gb" &_
228
                           " WHERE rc.rcon_id = "& Request("rcon_id") &_
229
                           "   AND rc.gbe_id = gb.gbe_id"
230
 
231
            Set rsTemp = OraDatabase.DbCreateDynaset( Query_String, cint(0))
232
 
233
            If rsTemp.RecordCount > 0 Then
234
                bmcon_id        =  rsTemp("bmcon_id")
235
                daemon_mode     =  rsTemp("daemon_mode")
236
                gbe_id          =  rsTemp("gbe_id")
237
                gbe_value       =  rsTemp("gbe_value")
238
                gbe_buildfilter =  rsTemp("gbe_buildfilter")
239
            End If
240
 
241
            rsTemp.Close()
242
            Set rsTemp = Nothing
243
 
244
            If NOT isNULL(bmcon_id) AND bmcon_id <> "" Then
245
 
246
                '   Extract information from the machine config
247
                Query_String = "SELECT * " &_
248
                               " FROM build_machine_config bc, " &_
249
                               "      gbe_machtype gb " &_
250
                               "WHERE bc.bmcon_id = " & bmcon_id &_
251
                               "  AND bc.gbe_id = gb.gbe_id"
252
 
253
                Set rsTemp = OraDatabase.DbCreateDynaset( Query_String, cint(0))
254
 
255
                If rsTemp.RecordCount > 0 Then
256
                    bmcon_id        =  rsTemp("bmcon_id")
257
                    gbe_id          =  rsTemp("gbe_id")
258
                    gbe_value       =  rsTemp("gbe_value")
259
                    bShowEmpty      = FALSE
260
                End If
261
 
262
                rsTemp.Close()
263
                Set rsTemp = Nothing
264
            End If
265
         End   If
266
         %>
267
         <table width="50%" border="0">
268
            <tr>
269
               <td><span class="body_txt">Daemon Host</span></td>
270
               <td>
271
                  <%=objFormComponent.Combo_Multi ( "bmcon_id", GetMachHost(bmcon_id), bShowEmpty, "class='body_txt'",3,"20,20,50")%>
272
               </td>
273
            </tr>
274
            <tr>
275
               <td><span class="body_txt">Daemon Mode</span></td>
276
               <td>
277
                 <select name="daemon_mode" class='body_txt'>
278
                   <option value=M <%=iif(daemon_mode="M","selected","")%>>MASTER</option>
279
                   <option value=S <%=iif(daemon_mode="S","selected","")%>>SLAVE</option>
280
                 </select>
281
               </td>
282
            </tr>
283
            <tr>
284
               <tr>
285
                  <td><span class="body_txt">GBE_BUILDFILTER</span></td>
286
                  <td><input name="gbe_buildfilter" type="text" class="body_txt" size="80" value="<%=gbe_buildfilter%>"></td>
287
               </tr>
288
            </tr>
289
            <tr>
290
               <td>&nbsp;</td>
291
               <td>&nbsp;</td>
292
            </tr>
293
         </table>
294
      </td>
295
   </tr>
296
   <%=objPMod.ComposeHiddenTags()%>
297
   <input type="hidden" name="action" value="true">
298
 
299
   <%
300
   Call objFormComponent.FormEnd()
301
   '-- FROM END ----------------------------------------------------------------------------------------------------------------
302
   %>
303
</table>
304
</body>
305
</html>
306
<%
307
'------------ RUN AFTER PAGE RENDER -----------
308
Set objFormCollector = Nothing
309
'----------------------------------------------
310
Call Destroy_All_Objects
311
%>