Subversion Repositories DevTools

Rev

Rev 7245 | Rev 7286 | 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
'=====================================================
7244 dpurdie 4
'   wAddBuildMachine.asp
5357 dpurdie 5
'=====================================================
6
%>
7
<%
8
Option explicit
9
Response.Expires = 0
10
%>
11
<!--#include file="common/conf.asp"-->
12
<!--#include file="common/globals.asp"-->
13
<!--#include file="common/formating.asp"-->
14
<!--#include file="common/qstr.asp"-->
15
<!--#include file="common/common_subs.asp"-->
16
<!--#include file="common/_form_window_common.asp"-->
17
<%
18
'------------ ACCESS CONTROL ------------------
19
%>
6048 dpurdie 20
<!--#include file="_access_control_login.asp"-->
5357 dpurdie 21
<!--#include file="_access_control_general.asp"-->
22
<%
23
'------------ VARIABLE DEFINITION -------------
24
Dim sMessage
25
 
26
Dim display_name
27
Dim machine_hostname
28
Dim gbe_id
29
Dim active, activeChecked
30
Dim description
7244 dpurdie 31
Dim platformList
32
Dim bIsaClone : bIsaClone = FALSE
5357 dpurdie 33
 
34
'------------ CONSTANTS DECLARATION -----------
35
'------------ VARIABLE INIT -------------------
36
sMessage = NULL
37
Set objFormCollector = CreateObject("Scripting.Dictionary")
7244 dpurdie 38
If Request("type") = "clone" Then
39
    bIsaClone = TRUE
40
End If
5357 dpurdie 41
'------------ CONDITIONS ----------------------
42
'----------------------------------------------
43
%>
44
<%
45
'--------------------------------------------------------------------------------------------------------------------------
7244 dpurdie 46
'   Get the data for the display
47
'   On first request, it will get the data from the database
48
'   Otherwise the data will be fetched from form elements
49
Sub GetData
50
    If CBool(Request("action")) Then
51
 
52
		'   Recover the data from the form
53
		'   It may contain user changes
54
    	display_name            =   Request("display_name")
55
    	machine_hostname        =   Request("machine_hostname")
56
    	gbe_id                  =   Request("gbe_id")
57
    	active                  =   Request("active")
58
    	description             =   Request("description")
59
        platformList            =   "," & Request("platform") & ","
60
        platformList = Replace(platformList," ","",1,-1)
61
 
62
    	if active = "Y" Then activeChecked = "checked"
63
 
64
    ElseIf Request("bmcon_id") <> "" Then
65
 
66
		'   Extract data from the database
67
        Dim rsQry, query
68
 
69
    	query = "select * from build_machine_config bm, gbe_machtype gbe "&_
70
    	  " where bm.bmcon_id = "& Request("bmcon_id") &_
71
    	  " and gbe.gbe_id = bm.gbe_id"
72
 
73
    	Set rsQry = OraDatabase.DbCreateDynaset( query, cint(0))
74
 
75
    	display_name            =   rsQry("display_name")
76
    	machine_hostname        =   rsQry("machine_hostname")
77
    	gbe_id                  =   rsQry("gbe_id")
78
    	active                  =   rsQry("active")
79
    	description             =   rsQry("description")
80
 
81
    	activeChecked = ""
82
    	if active = "Y" Then activeChecked = "checked"
83
 
84
    	 If bIsaClone Then
85
            description = "Clone of " & machine_hostname & ".<br>" & description 
86
    		display_name = ""
87
    		machine_hostname = ""
88
    	 End If
89
 
90
    	rsQry.Close()
91
    	Set rsQry = Nothing
92
 
93
		'   Create a list of associated Platforms
94
		'
95
        platformList = ""
96
    	query = "select * from build_platforms_config2 bpc2 where bpc2.bmcon_id = "& Request("bmcon_id")
97
        Set rsQry = OraDatabase.DbCreateDynaset( query, ORADYN_DEFAULT )
98
        While (NOT rsQry.BOF) AND (NOT rsQry.EOF)
99
            platformList = platformList & "," & rsQry("BP_ID") 
100
           rsQry.MoveNext
101
        Wend
102
        rsQry.Close()
103
        Set rsQry = Nothing
104
        platformList = platformList & ","
105
 
106
    Else
107
        ' New Machine - set defaults
108
    	activeChecked = "checked"
109
	End If
110
End Sub
111
 
112
'--------------------------------------------------------------------------------------------------------------------------
113
'   Get MachTypes - to populate a dropdron list
5357 dpurdie 114
Function GetMachType ( ngbe_id )
115
   Dim rsQry, query
116
 
117
   OraDatabase.Parameters.Add "gbe_id",   ngbe_id,   ORAPARM_INPUT, ORATYPE_NUMBER
118
 
119
   query = GetQuery ("GBE_MACHTYPECombo.sql")
120
 
121
   Set rsQry = OraDatabase.DbCreateDynaset( query, ORADYN_DEFAULT )
122
   If (NOT rsQry.BOF) AND (NOT rsQry.EOF) Then
123
      GetMachType = rsQry.GetRows()
124
   Else
125
      GetMachType = NULL
126
   End If
127
 
128
   rsQry.Close()
129
   Set rsQry = Nothing
130
 
131
   OraDatabase.Parameters.Remove "gbe_id"
132
End Function
133
'--------------------------------------------------------------------------------------------------------------------------
7244 dpurdie 134
'   Get configured platforms
135
'
7240 dpurdie 136
Function GetPlatforms ()
7244 dpurdie 137
    Dim rsQry, query
7240 dpurdie 138
 
7246 dpurdie 139
    query = "SELECT bp.bp_id, bp.bp_active, bp.bp_name, bpc.gbe_id" &_
140
            " FROM build_platforms bp, build_platforms_config   bpc" &_
141
            " WHERE bp.bp_id = bpc.bp_id" &_
142
            " ORDER BY upper(bp.bp_name)"
7240 dpurdie 143
 
144
    Set rsQry = OraDatabase.DbCreateDynaset( query, ORADYN_DEFAULT )
145
    While (NOT rsQry.BOF) AND (NOT rsQry.EOF)
7246 dpurdie 146
        Dim checkText
147
        checkText = IIF(InStr(platformList, "," & rsQry("BP_ID") & ",") > 0, "checked", "")
7240 dpurdie 148
 
7246 dpurdie 149
        Dim bActive
150
		bActive = IIF(rsQry("BP_ACTIVE") = "Y", TRUE, FALSE)
151
 
152
		' Only include those that are active UNLESS they are currently selected
153
		' ie: Cannot select an inactive item, but can still use it
154
 
155
		If bActive OR checkText <> "" Then
156
            GetPlatforms = GetPlatforms & "<tr class='body_txt selPlat selPlat_" & rsQry("gbe_id") & "'>"
157
            GetPlatforms = GetPlatforms & "<td> <input style='margin:0px 3px' type=checkbox name=platform value='"& rsQry("BP_ID") &"' "& checkText &">" & rsQry("BP_NAME") & "</td>"
158
            GetPlatforms = GetPlatforms & "</tr>"
159
        End If
160
 
7240 dpurdie 161
       rsQry.MoveNext
162
    Wend
163
    rsQry.Close()
164
    Set rsQry = Nothing
165
 
7246 dpurdie 166
   GetPlatforms = "<table id=selPlat>" & GetPlatforms & "</table>"
7240 dpurdie 167
 
168
End Function
169
 
170
'--------------------------------------------------------------------------------------------------------------------------
5357 dpurdie 171
%>
172
<%
173
'------------ RUN BEFORE PAGE RENDER ----------
174
 
175
If CBool(Request("action")) Then
176
 
177
   If Request("bmcon_id") <> "" Then
178
 
179
      OraDatabase.Parameters.Add "BMCON_ID",              Request("bmcon_id"),              ORAPARM_INPUT, ORATYPE_NUMBER
180
      OraDatabase.Parameters.Add "DISPLAY_NAME",          Request("display_name"),          ORAPARM_INPUT, ORATYPE_VARCHAR2
181
      OraDatabase.Parameters.Add "MACHINE_HOSTNAME",      Request("machine_hostname"),      ORAPARM_INPUT, ORATYPE_VARCHAR2
182
      OraDatabase.Parameters.Add "GBE_ID",                Request("gbe_id"),                ORAPARM_INPUT, ORATYPE_NUMBER
183
      OraDatabase.Parameters.Add "DESCRIPTION",           Request("description"),           ORAPARM_INPUT, ORATYPE_VARCHAR2
184
      OraDatabase.Parameters.Add "ACTIVE",                Request("active"),                ORAPARM_INPUT, ORATYPE_CHAR
7244 dpurdie 185
      OraDatabase.Parameters.Add "PLATFORM",              Request("platform"),              ORAPARM_INPUT, ORATYPE_VARCHAR2
5357 dpurdie 186
 
5590 dpurdie 187
      objEH.ErrorRedirect = FALSE
5357 dpurdie 188
      objEH.TryORA ( OraSession )
189
      On Error Resume Next
190
 
191
      OraDatabase.ExecuteSQL _
7244 dpurdie 192
      "BEGIN  PK_BUILDAPI.UPDATE_BUILD_MACHINE(:BMCON_ID, :DISPLAY_NAME, :MACHINE_HOSTNAME, :GBE_ID, :DESCRIPTION, :ACTIVE, :PLATFORM);  END;"
5357 dpurdie 193
 
194
      objEH.CatchORA ( OraSession )
195
 
196
      OraDatabase.Parameters.Remove "BMCON_ID"
197
      OraDatabase.Parameters.Remove "DISPLAY_NAME"
198
      OraDatabase.Parameters.Remove "MACHINE_HOSTNAME"
199
      OraDatabase.Parameters.Remove "GBE_ID"
200
      OraDatabase.Parameters.Remove "DESCRIPTION"
201
      OraDatabase.Parameters.Remove "ACTIVE"
7244 dpurdie 202
      OraDatabase.Parameters.Remove "PLATFORM"
5357 dpurdie 203
 
204
      If objEH.Finally Then
205
         Call OpenInParentWindow ("admin_build_machine.asp?bmcon_id="&Request("bmcon_id"))
206
         Call CloseWindow()
207
      End If
208
 
209
      rsQry.Close
210
      Set rsQry = nothing
211
 
212
   Else
213
      OraDatabase.Parameters.Add "DISPLAY_NAME",          Request("display_name"),          ORAPARM_INPUT, ORATYPE_VARCHAR2
214
      OraDatabase.Parameters.Add "MACHINE_HOSTNAME",      Request("machine_hostname"),      ORAPARM_INPUT, ORATYPE_VARCHAR2
215
      OraDatabase.Parameters.Add "GBE_ID",                Request("gbe_id"),                ORAPARM_INPUT, ORATYPE_NUMBER
216
      OraDatabase.Parameters.Add "DESCRIPTION",           Request("description"),           ORAPARM_INPUT, ORATYPE_VARCHAR2
217
      OraDatabase.Parameters.Add "ACTIVE",                Request("active"),                ORAPARM_INPUT, ORATYPE_CHAR
7244 dpurdie 218
      OraDatabase.Parameters.Add "PLATFORM",              Request("platform"),              ORAPARM_INPUT, ORATYPE_VARCHAR2
5357 dpurdie 219
 
5590 dpurdie 220
      objEH.ErrorRedirect = FALSE
5357 dpurdie 221
      objEH.TryORA ( OraSession )
222
      On Error Resume Next
223
 
224
      OraDatabase.ExecuteSQL _
7244 dpurdie 225
      "BEGIN  PK_BUILDAPI.ADD_BUILD_MACHINE(:DISPLAY_NAME, :MACHINE_HOSTNAME, :GBE_ID, :DESCRIPTION, :ACTIVE, :PLATFORM);  END;"
5357 dpurdie 226
 
227
      objEH.CatchORA ( OraSession )
228
 
229
      OraDatabase.Parameters.Remove "DISPLAY_NAME"
230
      OraDatabase.Parameters.Remove "MACHINE_HOSTNAME"
231
      OraDatabase.Parameters.Remove "GBE_ID"
232
      OraDatabase.Parameters.Remove "DESCRIPTION"
233
      OraDatabase.Parameters.Remove "ACTIVE"
7244 dpurdie 234
      OraDatabase.Parameters.Remove "PLATFORM"
5357 dpurdie 235
 
236
      If objEH.Finally Then
237
         Call OpenInParentWindow ("admin_build_machine.asp?bmcon_id="&Request("bmcon_id"))
238
         Call CloseWindow()
239
      End If
240
 
241
      rsQry.Close
242
      Set rsQry = nothing
243
 
244
   End If
245
 
246
End If
7246 dpurdie 247
'----------------------------------------------
248
Sub InsertJavaScript %>
249
<script type="text/javascript" charset="utf-8">
250
    $(document).ready(function(){
5357 dpurdie 251
 
7246 dpurdie 252
        // Initial config of visible PLATFORMS
253
        setGbeId();
5357 dpurdie 254
 
7246 dpurdie 255
    	// Wire up the MachType selector to modify the available PLATFORMS
256
    	$('#selGbeId').change( setGbeId );
257
 
258
        // Update the available platforms when the user changes the GBE_MACHTYPE
259
        // Operation relies on the fact that
260
        //      Hidden items will not be submitted as a part of the form
261
        //      Platforms supported on multiple machines will appear multiple times
262
        function setGbeId(  )
263
        {
264
            var gbeId = $('#selGbeId').children("option:selected").val();
265
			var gbeClass = '.selPlat_' + gbeId;
266
 
267
            var elAll = $('#selPlat .selPlat');             // All Platform selectors
268
			var elSel = elAll.filter( gbeClass );           // This for current GbeId
269
			var elDeSel = elAll.not ( gbeClass );           // This not for current GbeId
270
 
271
            //  Disable so they are not submitted
272
            elDeSel.find(':input').prop('disabled', true);
273
            elSel.find(':input').prop('disabled', false);
274
 
275
            //  Show/Hide what the user can see
276
			elSel.show();
277
			elDeSel.hide();
278
        }
279
 
280
    });
281
</script>
282
<%End Sub
283
'-------------------------------------------------
5357 dpurdie 284
%>
7246 dpurdie 285
 
5357 dpurdie 286
<html>
287
<head>
288
<title>Release Manager</title>
289
<link rel="shortcut icon" href="<%=FavIcon%>"/>
290
<meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
291
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
6579 dpurdie 292
<link href="images/release_manager_style.css?ver=<%=VixVerNum%>" rel="stylesheet" type="text/css">
6676 dpurdie 293
<script language="JavaScript" src="scripts/common.js?ver=<%=VixVerNum%>"></script>
7246 dpurdie 294
<!--#include file="_jquery_includes.asp"-->
295
<%Call InsertJavaScript %>
5357 dpurdie 296
</head>
5590 dpurdie 297
<body leftmargin="0" topmargin="0" onLoad="self.focus();FormName.display_name.focus();">
5357 dpurdie 298
<table width="100%"  border="0" cellspacing="0" cellpadding="10">
299
   <tr>
5590 dpurdie 300
      <td class="body_txt">
5357 dpurdie 301
         Add a new Build Machine or edit an existing Build Machine.
302
      </td>
303
   </tr>
304
   <%
305
   '-- FROM START --------------------------------------------------------------------------------------------------------------
306
   objFormComponent.FormName = "FormName"
5590 dpurdie 307
   objFormComponent.FormClass = "form_tight"
5357 dpurdie 308
   objFormComponent.Action = ScriptName
309
   objFormComponent.OnSubmit = "ShowProgress();"
310
   Call objFormComponent.FormStart()
7244 dpurdie 311
   Call GetData()
5357 dpurdie 312
   %>
313
   <tr>
5590 dpurdie 314
      <td class="form_field_bg" >
5357 dpurdie 315
         <!-- NEW PRODUCT ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
316
         <%Call Messenger ( sMessage , 3, "100%" )%>
317
         <!-- MESSAGE +++++++++++++++++++++++++++++++++++++++++++++++++++ -->
318
         <!--#include file="messages/_msg_inline.asp"-->
319
         <%
7244 dpurdie 320
         If Request("bmcon_id") <> "" Then%>
321
			<%If NOT bIsaClone Then%>
322
				<input type="hidden" name="bmcon_id" value="<%=Request("bmcon_id")%>">
323
            <%End If
5357 dpurdie 324
          End If%>
325
         <table width="50%" border="0">
326
            <tr>
5590 dpurdie 327
               <td><span class="body_txt nowrap">Display Name</span></td>
5357 dpurdie 328
               <td>
329
                  <input name="display_name" type="text" class="body_txt" value="<%=display_name%>" size=24 maxlength=20>
330
               </td>
331
            </tr>
332
            <tr>
333
               <td><span class="body_txt">Machine HostName</span></td>
334
               <td>
7240 dpurdie 335
                  <input name="machine_hostname" type="text" class="body_txt" value="<%=machine_hostname%>" size=50 maxlength=50>
5357 dpurdie 336
               </td>
337
            </tr>
338
            <tr>
5590 dpurdie 339
               <td><span class="body_txt nowrap">GBE_MACHTYPE</span></td>
7246 dpurdie 340
               <td><%=objFormComponent.Combo ( "gbe_id", GetMachType( gbe_id ), CBool(Request("bmcon_id") = ""), "size=1 class='body_txt' id=selGbeId" )%></td>
5357 dpurdie 341
            </tr>
342
            <tr>
5590 dpurdie 343
               <td><span class="body_txt nowrap">Allow Use</span></td>
5357 dpurdie 344
               <td>
345
                  <input type="checkbox" name="active" value="Y" <%=activeChecked%>>
346
                  <span class="body_txt">Allow users to add this machine to a build set</span>
347
               </td>
348
            </tr>
349
            <tr>
5590 dpurdie 350
               <td><span class="body_txt nowrap">Description</span></td>
5357 dpurdie 351
               <td>
352
                  <textarea name="Description" cols=50 rows=5 class='body_txt'><%=Description%></textarea>
353
               </td>
354
            </tr>
7240 dpurdie 355
            <tr>
7245 dpurdie 356
               <td><span class="body_txt nowrap">Platforms</span></td>
7240 dpurdie 357
               <td style="border: darkgrey 1px solid">
7245 dpurdie 358
				<div style="overflow-y: scroll;height: 20em;">
7240 dpurdie 359
					  <%=GetPlatforms%>
360
				</div>
361
               </td>
362
            </tr>
363
 
5590 dpurdie 364
         </table>
365
      </td>
366
   </tr>
367
   <tr>
368
      <td>
369
         <table class="full_table">
5357 dpurdie 370
            <tr>
5590 dpurdie 371
               <td><%=ProgressBar()%></td>
372
               <td align="right">
373
                  <input name="btn" type="submit" class="form_btn" value="Add/Update">
374
                  <input name="btn" type="reset" class="form_btn" value="Cancel" onclick="parent.closeIFrame();">
375
               </td>
5357 dpurdie 376
            </tr>
377
         </table>
378
      </td>
379
   </tr>
380
   <%=objPMod.ComposeHiddenTags()%>
381
   <input type="hidden" name="action" value="true">
382
   <%
383
   Call objFormComponent.FormEnd()
384
   '-- FROM END ----------------------------------------------------------------------------------------------------------------
385
   %>
386
</table>
387
</body>
388
</html>
389
<%
390
'------------ RUN AFTER PAGE RENDER -----------
391
Set objFormCollector = Nothing
392
'----------------------------------------------
393
Call Destroy_All_Objects
394
%>
395
 
396