Subversion Repositories DevTools

Rev

Rev 7244 | 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"-->
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
 
139
    query = "SELECT bp.BP_ID, bp.BP_ACTIVE, bp.BP_NAME, bp.BP_DESCRIPTION FROM BUILD_PLATFORMS bp, BUILD_PLATFORMS_CONFIG bpc WHERE bp.bp_id = bpc.bp_id AND bpc.gbe_id = 90 ORDER BY UPPER(bp.BP_NAME)"
140
 
141
    Set rsQry = OraDatabase.DbCreateDynaset( query, ORADYN_DEFAULT )
142
    While (NOT rsQry.BOF) AND (NOT rsQry.EOF)
143
       Dim checkText
7244 dpurdie 144
       If InStr(platformList, "," & rsQry("BP_ID") & ",") > 0 Then
145
        checkText = "checked"
146
       else 
147
        checkText = ""
148
       End If
7240 dpurdie 149
       GetPlatforms = GetPlatforms & "<tr class=body_txt>"
7245 dpurdie 150
       GetPlatforms = GetPlatforms & "<td> <input style='margin:0px 3px' type=checkbox name=platform value='"& rsQry("BP_ID") &"' "& checkText &">" & rsQry("BP_NAME") & "</td>"
7240 dpurdie 151
       GetPlatforms = GetPlatforms & "</tr>"
152
 
153
       rsQry.MoveNext
154
    Wend
155
    rsQry.Close()
156
    Set rsQry = Nothing
157
 
158
   GetPlatforms = "<table>" & GetPlatforms & "</table>"
159
 
160
End Function
161
 
162
'--------------------------------------------------------------------------------------------------------------------------
5357 dpurdie 163
%>
164
<%
165
'------------ RUN BEFORE PAGE RENDER ----------
166
 
167
If CBool(Request("action")) Then
168
 
169
   If Request("bmcon_id") <> "" Then
170
 
171
      OraDatabase.Parameters.Add "BMCON_ID",              Request("bmcon_id"),              ORAPARM_INPUT, ORATYPE_NUMBER
172
      OraDatabase.Parameters.Add "DISPLAY_NAME",          Request("display_name"),          ORAPARM_INPUT, ORATYPE_VARCHAR2
173
      OraDatabase.Parameters.Add "MACHINE_HOSTNAME",      Request("machine_hostname"),      ORAPARM_INPUT, ORATYPE_VARCHAR2
174
      OraDatabase.Parameters.Add "GBE_ID",                Request("gbe_id"),                ORAPARM_INPUT, ORATYPE_NUMBER
175
      OraDatabase.Parameters.Add "DESCRIPTION",           Request("description"),           ORAPARM_INPUT, ORATYPE_VARCHAR2
176
      OraDatabase.Parameters.Add "ACTIVE",                Request("active"),                ORAPARM_INPUT, ORATYPE_CHAR
7244 dpurdie 177
      OraDatabase.Parameters.Add "PLATFORM",              Request("platform"),              ORAPARM_INPUT, ORATYPE_VARCHAR2
5357 dpurdie 178
 
5590 dpurdie 179
      objEH.ErrorRedirect = FALSE
5357 dpurdie 180
      objEH.TryORA ( OraSession )
181
      On Error Resume Next
182
 
183
      OraDatabase.ExecuteSQL _
7244 dpurdie 184
      "BEGIN  PK_BUILDAPI.UPDATE_BUILD_MACHINE(:BMCON_ID, :DISPLAY_NAME, :MACHINE_HOSTNAME, :GBE_ID, :DESCRIPTION, :ACTIVE, :PLATFORM);  END;"
5357 dpurdie 185
 
186
      objEH.CatchORA ( OraSession )
187
 
188
      OraDatabase.Parameters.Remove "BMCON_ID"
189
      OraDatabase.Parameters.Remove "DISPLAY_NAME"
190
      OraDatabase.Parameters.Remove "MACHINE_HOSTNAME"
191
      OraDatabase.Parameters.Remove "GBE_ID"
192
      OraDatabase.Parameters.Remove "DESCRIPTION"
193
      OraDatabase.Parameters.Remove "ACTIVE"
7244 dpurdie 194
      OraDatabase.Parameters.Remove "PLATFORM"
5357 dpurdie 195
 
196
      If objEH.Finally Then
197
         Call OpenInParentWindow ("admin_build_machine.asp?bmcon_id="&Request("bmcon_id"))
198
         Call CloseWindow()
199
      End If
200
 
201
      rsQry.Close
202
      Set rsQry = nothing
203
 
204
   Else
205
      OraDatabase.Parameters.Add "DISPLAY_NAME",          Request("display_name"),          ORAPARM_INPUT, ORATYPE_VARCHAR2
206
      OraDatabase.Parameters.Add "MACHINE_HOSTNAME",      Request("machine_hostname"),      ORAPARM_INPUT, ORATYPE_VARCHAR2
207
      OraDatabase.Parameters.Add "GBE_ID",                Request("gbe_id"),                ORAPARM_INPUT, ORATYPE_NUMBER
208
      OraDatabase.Parameters.Add "DESCRIPTION",           Request("description"),           ORAPARM_INPUT, ORATYPE_VARCHAR2
209
      OraDatabase.Parameters.Add "ACTIVE",                Request("active"),                ORAPARM_INPUT, ORATYPE_CHAR
7244 dpurdie 210
      OraDatabase.Parameters.Add "PLATFORM",              Request("platform"),              ORAPARM_INPUT, ORATYPE_VARCHAR2
5357 dpurdie 211
 
5590 dpurdie 212
      objEH.ErrorRedirect = FALSE
5357 dpurdie 213
      objEH.TryORA ( OraSession )
214
      On Error Resume Next
215
 
216
      OraDatabase.ExecuteSQL _
7244 dpurdie 217
      "BEGIN  PK_BUILDAPI.ADD_BUILD_MACHINE(:DISPLAY_NAME, :MACHINE_HOSTNAME, :GBE_ID, :DESCRIPTION, :ACTIVE, :PLATFORM);  END;"
5357 dpurdie 218
 
219
      objEH.CatchORA ( OraSession )
220
 
221
      OraDatabase.Parameters.Remove "DISPLAY_NAME"
222
      OraDatabase.Parameters.Remove "MACHINE_HOSTNAME"
223
      OraDatabase.Parameters.Remove "GBE_ID"
224
      OraDatabase.Parameters.Remove "DESCRIPTION"
225
      OraDatabase.Parameters.Remove "ACTIVE"
7244 dpurdie 226
      OraDatabase.Parameters.Remove "PLATFORM"
5357 dpurdie 227
 
228
      If objEH.Finally Then
229
         Call OpenInParentWindow ("admin_build_machine.asp?bmcon_id="&Request("bmcon_id"))
230
         Call CloseWindow()
231
      End If
232
 
233
      rsQry.Close
234
      Set rsQry = nothing
235
 
236
   End If
237
 
238
End If
239
 
240
 
241
'----------------------------------------------
242
%>
243
<html>
244
<head>
245
<title>Release Manager</title>
246
<link rel="shortcut icon" href="<%=FavIcon%>"/>
247
<meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
248
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
6579 dpurdie 249
<link href="images/release_manager_style.css?ver=<%=VixVerNum%>" rel="stylesheet" type="text/css">
6676 dpurdie 250
<script language="JavaScript" src="scripts/common.js?ver=<%=VixVerNum%>"></script>
5357 dpurdie 251
</head>
5590 dpurdie 252
<body leftmargin="0" topmargin="0" onLoad="self.focus();FormName.display_name.focus();">
5357 dpurdie 253
<table width="100%"  border="0" cellspacing="0" cellpadding="10">
254
   <tr>
5590 dpurdie 255
      <td class="body_txt">
5357 dpurdie 256
         Add a new Build Machine or edit an existing Build Machine.
257
      </td>
258
   </tr>
259
   <%
260
   '-- FROM START --------------------------------------------------------------------------------------------------------------
261
   objFormComponent.FormName = "FormName"
5590 dpurdie 262
   objFormComponent.FormClass = "form_tight"
5357 dpurdie 263
   objFormComponent.Action = ScriptName
264
   objFormComponent.OnSubmit = "ShowProgress();"
265
   Call objFormComponent.FormStart()
7244 dpurdie 266
   Call GetData()
5357 dpurdie 267
   %>
268
   <tr>
5590 dpurdie 269
      <td class="form_field_bg" >
5357 dpurdie 270
         <!-- NEW PRODUCT ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
271
         <%Call Messenger ( sMessage , 3, "100%" )%>
272
         <!-- MESSAGE +++++++++++++++++++++++++++++++++++++++++++++++++++ -->
273
         <!--#include file="messages/_msg_inline.asp"-->
274
         <%
7244 dpurdie 275
         If Request("bmcon_id") <> "" Then%>
276
			<%If NOT bIsaClone Then%>
277
				<input type="hidden" name="bmcon_id" value="<%=Request("bmcon_id")%>">
278
            <%End If
5357 dpurdie 279
          End If%>
280
         <table width="50%" border="0">
281
            <tr>
5590 dpurdie 282
               <td><span class="body_txt nowrap">Display Name</span></td>
5357 dpurdie 283
               <td>
284
                  <input name="display_name" type="text" class="body_txt" value="<%=display_name%>" size=24 maxlength=20>
285
               </td>
286
            </tr>
287
            <tr>
288
               <td><span class="body_txt">Machine HostName</span></td>
289
               <td>
7240 dpurdie 290
                  <input name="machine_hostname" type="text" class="body_txt" value="<%=machine_hostname%>" size=50 maxlength=50>
5357 dpurdie 291
               </td>
292
            </tr>
293
            <tr>
5590 dpurdie 294
               <td><span class="body_txt nowrap">GBE_MACHTYPE</span></td>
7244 dpurdie 295
               <td><%=objFormComponent.Combo ( "gbe_id", GetMachType( gbe_id ), CBool(Request("bmcon_id") = ""), "size=1 class='body_txt'" )%></td>
5357 dpurdie 296
            </tr>
297
            <tr>
5590 dpurdie 298
               <td><span class="body_txt nowrap">Allow Use</span></td>
5357 dpurdie 299
               <td>
300
                  <input type="checkbox" name="active" value="Y" <%=activeChecked%>>
301
                  <span class="body_txt">Allow users to add this machine to a build set</span>
302
               </td>
303
            </tr>
304
            <tr>
5590 dpurdie 305
               <td><span class="body_txt nowrap">Description</span></td>
5357 dpurdie 306
               <td>
307
                  <textarea name="Description" cols=50 rows=5 class='body_txt'><%=Description%></textarea>
308
               </td>
309
            </tr>
7240 dpurdie 310
            <tr>
7245 dpurdie 311
               <td><span class="body_txt nowrap">Platforms</span></td>
7240 dpurdie 312
               <td style="border: darkgrey 1px solid">
7245 dpurdie 313
				<div style="overflow-y: scroll;height: 20em;">
7240 dpurdie 314
					  <%=GetPlatforms%>
315
				</div>
316
               </td>
317
            </tr>
318
 
5590 dpurdie 319
         </table>
320
      </td>
321
   </tr>
322
   <tr>
323
      <td>
324
         <table class="full_table">
5357 dpurdie 325
            <tr>
5590 dpurdie 326
               <td><%=ProgressBar()%></td>
327
               <td align="right">
328
                  <input name="btn" type="submit" class="form_btn" value="Add/Update">
329
                  <input name="btn" type="reset" class="form_btn" value="Cancel" onclick="parent.closeIFrame();">
330
               </td>
5357 dpurdie 331
            </tr>
332
         </table>
333
      </td>
334
   </tr>
335
   <%=objPMod.ComposeHiddenTags()%>
336
   <input type="hidden" name="action" value="true">
337
   <%
338
   Call objFormComponent.FormEnd()
339
   '-- FROM END ----------------------------------------------------------------------------------------------------------------
340
   %>
341
</table>
342
</body>
343
</html>
344
<%
345
'------------ RUN AFTER PAGE RENDER -----------
346
Set objFormCollector = Nothing
347
'----------------------------------------------
348
Call Destroy_All_Objects
349
%>
350
 
351