Subversion Repositories DevTools

Rev

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