Subversion Repositories DevTools

Rev

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