Subversion Repositories DevTools

Rev

Rev 7225 | Rev 7286 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
7225 dpurdie 1
<%@LANGUAGE="VBSCRIPT"%>
2
<%
3
'=====================================================
4
'	wAddBuildPlatform.asp
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
 
19
<%
20
'------------ ACCESS CONTROL ------------------
21
%>
22
<!--#include file="_access_control_login.asp"-->
23
<!--#include file="_access_control_general.asp"-->
24
<%
25
'------------ VARIABLE DEFINITION -------------
26
Dim rsQry
27
Dim sMessage
28
Dim Query_String
29
 
30
Dim name
31
Dim bp_id
32
Dim active, activeChecked
33
Dim description
34
 
35
'------------ CONSTANTS DECLARATION -----------
36
'------------ VARIABLE INIT -------------------
37
sMessage = NULL
38
Set objFormCollector = CreateObject("Scripting.Dictionary")
39
'------------ CONDITIONS ----------------------
40
'----------------------------------------------
7235 dpurdie 41
'--------------------------------------------------------------------------------------------------------------------------
42
Function GetMachType ()
43
    Dim rsQry, query
44
    Dim selectData
45
 
46
    OraDatabase.Parameters.Add "BP_ID",                 Request("bp_id"),             ORAPARM_INPUT, ORATYPE_NUMBER
47
 
48
    ' Where to get the selection data
49
    ' If this is a form re-display, then its comming from a Request
50
    If CBool(Request("action")) Then
51
    	selectData = "," & Request("machType") & ","
52
        selectData = Replace(selectData," ","",1,-1)
53
    Else
54
        selectData = ""
55
        query = "SELECT bfc.gbe_id FROM build_platforms_config bfc WHERE  bfc.bp_id = :BP_ID"
56
        Set rsQry = OraDatabase.DbCreateDynaset( query, ORADYN_DEFAULT )
57
        While (NOT rsQry.BOF) AND (NOT rsQry.EOF)
58
            selectData = selectData & "," & rsQry("GBE_ID") 
59
           rsQry.MoveNext
60
        Wend
61
        rsQry.Close()
62
        Set rsQry = Nothing
63
        selectData = selectData & ","
64
    End If
65
 
66
   GetMachType = "<table>"
67
   query = "SELECT gm.gbe_id,gm.gbe_value FROM gbe_machtype gm ORDER BY gbe_value"
68
 
69
   Set rsQry = OraDatabase.DbCreateDynaset( query, ORADYN_DEFAULT )
70
   While (NOT rsQry.BOF) AND (NOT rsQry.EOF)
71
       Dim checkText
72
	   If InStr(selectData, "," & rsQry("GBE_ID") & ",") > 0 Then
73
        checkText = "checked"
74
       else 
75
        checkText = ""
76
       End If
77
       GetMachType = GetMachType & "<tr class=body_txt>"
78
       GetMachType = GetMachType & "<td> <input type=checkbox name=machType value='"& rsQry("GBE_ID") &"' "& checkText &">" & rsQry("GBE_VALUE") & "</td>"
79
       GetMachType = GetMachType & "</tr>"
80
 
81
       rsQry.MoveNext
82
   Wend
83
   rsQry.Close()
84
   Set rsQry = Nothing
85
 
86
   OraDatabase.Parameters.Remove "BP_ID"
87
   GetMachType = GetMachType & "</table>"
88
 
89
End Function
7225 dpurdie 90
%>
91
<%
92
'------------ RUN BEFORE PAGE RENDER ----------
93
 
94
If CBool(Request("action")) Then
95
 
7235 dpurdie 96
	If Len(Request("name")) <= 0 Then
97
		sMessage = "Platform name must be specified"
98
	ElseIf Len(Request("name")) <= 3 Then
99
		sMessage = "Platform name is too short"
100
	Else
101
        If Request("bp_id") <> "" Then
102
            ' UPDATE an existing entry
7225 dpurdie 103
 
7235 dpurdie 104
            OraDatabase.Parameters.Add "BP_ID",                 Request("bp_id"),             ORAPARM_INPUT, ORATYPE_NUMBER
105
            OraDatabase.Parameters.Add "NAME",          		Request("name"),          	  ORAPARM_INPUT, ORATYPE_VARCHAR2
106
            OraDatabase.Parameters.Add "DESCRIPTION",           Request("description"),       ORAPARM_INPUT, ORATYPE_VARCHAR2
107
            OraDatabase.Parameters.Add "ACTIVE",                Request("active"),            ORAPARM_INPUT, ORATYPE_CHAR
108
            OraDatabase.Parameters.Add "MACHTYPE",              Request("machType"),          ORAPARM_INPUT, ORATYPE_VARCHAR2
7225 dpurdie 109
 
7235 dpurdie 110
            Query_String = "SELECT * FROM BUILD_PLATFORMS WHERE BP_ID <> :BP_ID AND UPPER(BP_NAME) = UPPER(:NAME)"
111
            Set rsQry = OraDatabase.DbCreateDynaset( Query_String, cint(0))
112
            If rsQry.RecordCount = 0 Then
7225 dpurdie 113
 
7235 dpurdie 114
                objEH.ErrorRedirect = FALSE
115
                objEH.TryORA ( OraSession )
116
                On Error Resume Next
7225 dpurdie 117
 
7235 dpurdie 118
                OraDatabase.ExecuteSQL _
119
                "BEGIN  PK_BUILDAPI.UPDATE_BUILD_PLATFORM(:BP_ID, :NAME, :DESCRIPTION, :ACTIVE, :MACHTYPE);  END;"
7225 dpurdie 120
 
7235 dpurdie 121
                objEH.CatchORA ( OraSession )
7225 dpurdie 122
 
7235 dpurdie 123
            Else
124
                sMessage = "A Platform of that name already exists"
125
            End If
7225 dpurdie 126
 
7235 dpurdie 127
            OraDatabase.Parameters.Remove "BP_ID"
128
            OraDatabase.Parameters.Remove "NAME"
129
            OraDatabase.Parameters.Remove "DESCRIPTION"
130
            OraDatabase.Parameters.Remove "ACTIVE"
131
            OraDatabase.Parameters.Remove "MACHTYPE"
7225 dpurdie 132
 
7235 dpurdie 133
            rsQry.Close
134
            Set rsQry = nothing
7225 dpurdie 135
 
7235 dpurdie 136
            If IsNULL(sMessage) Then
137
                If objEH.Finally Then
138
                    Call OpenInParentWindow ("admin_build_platforms.asp?bp_id="&Request("bp_id"))
139
                    Call CloseWindow()
140
                End If
141
            End If
7225 dpurdie 142
 
7235 dpurdie 143
        Else
144
            ' Add A new entry
145
            OraDatabase.Parameters.Add "NAME",            Request("name"),          ORAPARM_INPUT, ORATYPE_VARCHAR2
146
            OraDatabase.Parameters.Add "DESCRIPTION",     Request("description"),   ORAPARM_INPUT, ORATYPE_VARCHAR2
147
            OraDatabase.Parameters.Add "ACTIVE",          Request("active"),        ORAPARM_INPUT, ORATYPE_CHAR
148
            OraDatabase.Parameters.Add "MACHTYPE",        Request("machType"),      ORAPARM_INPUT, ORATYPE_VARCHAR2
7225 dpurdie 149
 
7235 dpurdie 150
            Query_String = "SELECT * FROM BUILD_PLATFORMS WHERE UPPER(BP_NAME) = UPPER(:NAME)"
151
            Set rsQry = OraDatabase.DbCreateDynaset( Query_String, cint(0))
152
            If rsQry.RecordCount = 0 Then
7225 dpurdie 153
 
7235 dpurdie 154
                objEH.ErrorRedirect = FALSE
155
                objEH.TryORA ( OraSession )
156
                On Error Resume Next
7225 dpurdie 157
 
7235 dpurdie 158
                OraDatabase.ExecuteSQL _
159
                "BEGIN  PK_BUILDAPI.ADD_BUILD_PLATFORM(:NAME, :DESCRIPTION, :ACTIVE, :MACHTYPE);  END;"
7225 dpurdie 160
 
7235 dpurdie 161
                objEH.CatchORA ( OraSession )
7225 dpurdie 162
 
7235 dpurdie 163
            Else
164
                sMessage = "A Platform of that name already exists"
165
            End If
7225 dpurdie 166
 
7235 dpurdie 167
            OraDatabase.Parameters.Remove "NAME"
168
            OraDatabase.Parameters.Remove "DESCRIPTION"
169
            OraDatabase.Parameters.Remove "ACTIVE"
170
            OraDatabase.Parameters.Remove "MACHTYPE"
7225 dpurdie 171
 
7235 dpurdie 172
            rsQry.Close
173
            Set rsQry = nothing
7225 dpurdie 174
 
7235 dpurdie 175
            If IsNULL(sMessage) Then
176
              If objEH.Finally Then
177
            	 Call OpenInParentWindow ("admin_build_platforms.asp")
178
            	 Call CloseWindow()
179
              End If
180
            End If
181
        End If
182
    End If
183
End If
7225 dpurdie 184
'----------------------------------------------
185
%>
186
<html>
187
<head>
188
<title>Release Manager</title>
189
<link rel="shortcut icon" href="<%=FavIcon%>"/>
190
<meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
191
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
192
<link href="images/release_manager_style.css?ver=<%=VixVerNum%>" rel="stylesheet" type="text/css">
193
<script language="JavaScript" src="scripts/common.js?ver=<%=VixVerNum%>"></script>
194
</head>
7235 dpurdie 195
<body leftmargin="0" topmargin="0" onLoad="self.focus();FormName.name.focus();">
7225 dpurdie 196
<table width="100%"  border="0" cellspacing="0" cellpadding="10">
197
   <tr>
198
      <td class="body_txt">
199
         Add a new Build Platform or edit an existing Build Platform.
200
      </td>
201
   </tr>
202
   <%
203
   '-- FROM START --------------------------------------------------------------------------------------------------------------
204
   objFormComponent.FormName = "FormName"
205
   objFormComponent.FormClass = "form_tight"
206
   objFormComponent.Action = ScriptName
207
   objFormComponent.OnSubmit = "ShowProgress();"
208
   Call objFormComponent.FormStart()
209
   %>
210
   <tr>
211
      <td class="form_field_bg" >
212
         <!-- NEW PRODUCT ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
213
         <%Call Messenger ( sMessage , 3, "100%" )%>
214
         <!-- MESSAGE +++++++++++++++++++++++++++++++++++++++++++++++++++ -->
215
         <!--#include file="messages/_msg_inline.asp"-->
216
         <br>
217
         <%
7235 dpurdie 218
         If CBool(Request("action")) Then
219
 
220
            name            = Request("name")   
221
            active          = Request("active")   
222
            description     = Request("description")  
223
 
224
         ElseIf Request("bp_id") <> "" Then
7225 dpurdie 225
            Dim rsTemp
7235 dpurdie 226
            Query_String = "select * from build_platforms bp where bp.bp_id = "& Request("bp_id")
7225 dpurdie 227
            Set rsTemp = OraDatabase.DbCreateDynaset( Query_String, cint(0))
228
 
229
            name            =   rsTemp("bp_name")
230
            active          =   rsTemp("bp_active")
231
            description     =   rsTemp("bp_description")
232
 
233
            rsTemp.Close()
234
            Set rsTemp = Nothing      
235
          Else
7235 dpurdie 236
            active = "Y"
237
          End If
238
 
239
          activeChecked = ""
240
          if active = "Y" Then activeChecked = "checked"
241
 
242
		  If Request("bp_id") <> "" Then%>
243
			<input type="hidden" name="bp_id" value="<%=Request("bp_id")%>">
244
		  <%End If%>
7225 dpurdie 245
 
246
         <table width="50%" border="0">
247
            <tr>
248
               <td><span class="body_txt nowrap">Platform Name</span></td>
249
               <td>
250
                  <input name="name" type="text" class="body_txt" value="<%=name%>" size=50 maxlength=50>
251
               </td>
252
            </tr>
253
            <tr>
254
               <td><span class="body_txt nowrap">Allow Use</span></td>
255
               <td>
256
                  <input type="checkbox" name="active" value="Y" <%=activeChecked%>>
257
                  <span class="body_txt">Allow users to add this platform to a build filter</span>
258
               </td>
259
            </tr>
260
            <tr>
261
               <td><span class="body_txt nowrap">Description</span></td>
262
               <td>
263
                  <textarea name="Description" cols=50 rows=5 class='body_txt'><%=Description%></textarea>
264
               </td>
265
            </tr>
7235 dpurdie 266
			 <tr>
267
               <td><span class="body_txt nowrap">Supported<br>MachTypes</span></td>
268
				<td style="border: darkgrey 1px solid;">
269
				<%=GetMachType()%>
270
				</td>
271
			 </tr>
7225 dpurdie 272
         </table>
273
      </td>
274
   </tr>
275
   <tr>
276
      <td>
277
         <table class="full_table">
278
            <tr>
279
               <td><%=ProgressBar()%></td>
280
               <td align="right">
281
                  <input name="btn" type="submit" class="form_btn" value="Add/Update">
282
                  <input name="btn" type="reset" class="form_btn" value="Cancel" onclick="parent.closeIFrame();">
283
               </td>
284
            </tr>
285
         </table>
286
      </td>
287
   </tr>
288
   <%=objPMod.ComposeHiddenTags()%>
289
   <input type="hidden" name="action" value="true">
290
   <%
291
   Call objFormComponent.FormEnd()
292
   '-- FROM END ----------------------------------------------------------------------------------------------------------------
293
   %>
294
</table>
295
</body>
296
</html>
297
<%
298
'------------ RUN AFTER PAGE RENDER -----------
299
Set objFormCollector = Nothing
300
'----------------------------------------------
301
Call Destroy_All_Objects
302
%>
303
 
304