Subversion Repositories DevTools

Rev

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