Subversion Repositories DevTools

Rev

Rev 5590 | Rev 5957 | 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
Option explicit
4
Response.Expires = 0   ' always load the page, dont store
5
%>
6
<%
7
'=====================================================
8
'              Change Group
9
'=====================================================
10
%>
11
<!--#include file="common/conf.asp"-->
12
<!--#include file="common/globals.asp"-->
13
<!--#include file="common/qstr.asp"-->
14
<!--#include file="common/common_subs.asp"-->
15
<!--#include file="common/common_dbedit.asp"-->
16
<!--#include file="common/_popup_window_common.asp"-->
17
<!--#include file="common/daemon_instructions.asp"-->
18
<%
19
'------------ ACCESS CONTROL ------------------
20
%>
21
<!--#include file="_access_control_general.asp"-->
22
<!--#include file="_access_control_project.asp"-->
23
<%
24
'------------ Variable Definition -------------
5590 dpurdie 25
Dim sMessage, sMessageType
5357 dpurdie 26
Dim parPv_id
27
Dim parProj_id
28
Dim parNewRtag_id
29
Dim parRfile
30
Dim bPreventSubmit
31
'------------ Constants Declaration -----------
32
'------------ Variable Init -------------------
5590 dpurdie 33
sMessage = NULL
34
sMessageType = 3
5357 dpurdie 35
Set pkgInfoHash = CreateObject("Scripting.Dictionary")
36
parPv_id = QStrPar("pv_id")
5590 dpurdie 37
parProj_id= QStrParDefault("proj_id",DB_PROJ_ID)
38
parNewRtag_id = QStrParDefault("new_rtag_id", parRtag_id)
5357 dpurdie 39
parRfile = Request("rfile")
40
If IsNull(parProj_id) Then parProj_id = "0"
41
If IsNull(parNewRtag_id) Then parNewRtag_id = "0"
42
If IsNull(parRfile) Then parRfile = "dependencies.asp"
43
bPreventSubmit = false
44
'----------------------------------------------
45
%>
46
<%
5590 dpurdie 47
'------------------------------------------------------------------------------------------------------------------------------------------
48
' Add a line of text to the System Message
49
'
50
Sub sMessageAdd(eLevel, text)
51
    If NOT isNull(sMessage) Then
52
        sMessage = sMessage & "<br>"
53
    End If
54
    sMessage = sMessage & text
55
 
56
    If eLevel < sMessageType  Then
57
        sMessageType = eLevel
58
    End If
59
End Sub
60
'------------------------------------------------------------------------------------------------------------------------------------------
5357 dpurdie 61
Sub Get_Pkg_Info_From_Rel ( SSrtag_id, SSpv_id )
62
   Dim rsTemp, Query_String
63
 
64
   Query_String = _
65
   " SELECT pkg.pkg_name, pv.pkg_version, wip.view_id, vi.view_name"&_
66
   "  FROM packages pkg, package_versions pv, work_in_progress wip, views vi"&_
67
   " WHERE     pkg.pkg_id = pv.pkg_id"&_
68
   "        AND pv.pv_id = wip.pv_id"&_
69
   "        AND vi.view_id = wip.view_id"&_
70
   "        AND wip.rtag_id = "& SSrtag_id &_
71
   "        AND wip.pv_id = "& SSpv_id
72
 
73
   Set rsTemp = OraDatabase.DbCreateDynaset( Query_String, cint(0))
74
 
75
   If ((NOT rsTemp.BOF) AND (NOT rsTemp.EOF)) Then
76
      pkgInfoHash.Add "pkg_name", (rsTemp.Fields("pkg_name"))
77
      pkgInfoHash.Add "pkg_version", (rsTemp.Fields("pkg_version"))
78
      pkgInfoHash.Add "view_id", (rsTemp.Fields("view_id"))
79
      pkgInfoHash.Add "view_name", (rsTemp.Fields("view_name"))
80
   End If
81
 
82
   rsTemp.Close
83
   Set rsTemp = nothing
84
End Sub
85
 
86
 
87
 
88
'------------------------------------------------------------------------------------------------------------------------------------------
89
' Formulate the HTML for a combo box listing all the Projects, and select the one that matches
90
' the proj-id passed in as a parameter. If the parameter value could not be found, correct it to the first valid proj-id
91
' in the list.
92
'------------------------------------------------------------------------------------------------------------------------------------------
93
Function Get_Projects ( NNproj_id )
94
   Dim rsTemp, Query_String, projName, tempLINK, selectedFound, s
95
 
96
   selectedFound = False
97
   Query_String = "SELECT * FROM projects ORDER BY  UPPER( proj_name )"
98
 
99
   Set rsTemp = OraDatabase.DbCreateDynaset( Query_String, cint(0))
100
 
101
   s = "<td class='form_field' background='images/bg_form_lightbluedark.gif' >Project</td>"
5590 dpurdie 102
   s = s + "<td background='images/bg_form_lightbluedark.gif'><select id='proj_id_list' name='proj_id_list' class='form_item' onChange=""MM_jumpMenu('window',this,0)"">"
5357 dpurdie 103
 
104
   While ((NOT rsTemp.BOF) AND (NOT rsTemp.EOF))
105
      projName = UCase(rsTemp.Fields("proj_name"))
106
 
107
      tempLINK = scriptName & "?proj_id=" & rsTemp.Fields("proj_id") &_
108
                              "&rtag_id="& parRtag_id &_
109
                              "&new_rtag_id="& parNewRtag_id &_
110
                              "&pv_id="& parPv_id &_
111
                              "&rfile="& parRfile
112
 
5590 dpurdie 113
      If ((CStr(NNproj_id) = Cstr(rsTemp.Fields("proj_id"))) OR (NNproj_id = "0")) AND (selectedFound = False) Then
5357 dpurdie 114
         s = s + "<option value='"& tempLINK &"' selected>"& projName &"</option>"
115
         selectedFound = True
116
         NNproj_id = CStr(rsTemp.Fields("proj_id"))
117
      Else
118
         s = s + "<option value='"& tempLINK &"'>"& projName &"</option>"
119
      End If
120
 
121
      rsTemp.MoveNext
122
   WEnd
123
   s = s + "</select>"
124
 
125
   ' Correct for a situation where selectedFound is still FALSE.
126
   If NOT selectedFound Then
127
      rsTemp.MoveFirst
128
      If ((NOT rsTemp.BOF) AND (NOT rsTemp.EOF)) Then
129
         NNproj_id = CStr(rsTemp.Fields("proj_id"))
130
      Else
131
         NNproj_id = "0"
132
      End If
133
   End If
134
 
135
   rsTemp.Close
136
   Set rsTemp = nothing
137
 
138
   s = s + "</td>"
139
 
140
   Get_Projects = s
141
End Function
142
 
143
 
144
'------------------------------------------------------------------------------------------------------------------------------------------
145
' Formulate the HTML for a combo box listing all the Release for a specified project, and select the one that matches
146
' the release-tag passed in as a parameter. If the parameter value could not be found, correct it to the first valid release-tag
147
' in the list.
148
'------------------------------------------------------------------------------------------------------------------------------------------
149
Function Get_Releases ( NNproj_id, NNrtag_id )
150
   Dim rsTemp, Query_String, releaseName, tempLINK, selectedFound, s, numReleases
151
 
152
   selectedFound = False
153
 
154
   numReleases = 0
155
 
156
   Query_String = "SELECT rtag_id, rtag_name "&_
157
                  "  FROM release_tags rt"&_
158
                  " WHERE rt.proj_id = "& NNproj_id &_
159
                  "   AND ((rt.official = 'N') OR (rt.official = 'C') OR (rt.official = 'R'))"&_
160
                  " ORDER BY UPPER(rtag_name)"
161
   Set rsTemp = OraDatabase.DbCreateDynaset( Query_String, cint(0))
162
 
5590 dpurdie 163
   s = "<select id='rtag_id_list' name='rtag_id_list' class='form_item' onChange=""MM_jumpMenu('window',this,0)"">"
5357 dpurdie 164
 
165
   While ((NOT rsTemp.BOF) AND (NOT rsTemp.EOF))
166
      releaseName = rsTemp.Fields("rtag_name")
167
 
168
      tempLINK = scriptName & "?proj_id="& NNproj_id &_
169
                              "&rtag_id="& parRtag_id &_
170
                              "&new_rtag_id="& rsTemp.Fields("rtag_id") &_
171
                              "&pv_id="& parPv_id &_
172
                              "&rfile="& parRfile
173
 
5590 dpurdie 174
      If ((CStr(NNrtag_id) = CStr(rsTemp.Fields("rtag_id"))) OR (NNrtag_id = "0")) AND (selectedFound = False) Then
5357 dpurdie 175
            s = s + "<option value='"& tempLINK &"' selected>"& releaseName &"</option>"
176
         selectedFound = True
177
         NNrtag_id = Cstr(rsTemp.Fields("rtag_id"))
178
      Else
179
         s = s + "<option value='"& tempLINK &"'>"& releaseName &"</option>"
180
      End If
181
 
182
      numReleases = numReleases + 1
183
 
184
      rsTemp.MoveNext
185
   WEnd
186
   s = s + "</select>"
187
 
188
   ' Correct for a situation where selectedFound is still FALSE.
189
   If NOT selectedFound Then
190
      rsTemp.MoveFirst
191
      If ((NOT rsTemp.BOF) AND (NOT rsTemp.EOF)) Then
192
         NNrtag_id = CStr(rsTemp.Fields("rtag_id"))
193
      Else
194
         NNrtag_id = "0"
195
      End If
196
   End If
197
 
198
   ' If no releases were found then replace drop down list with some warning text and disable form submission
199
   If numReleases = 0 Then
200
      bPreventSubmit = True
5590 dpurdie 201
      s = "<a class=err_alert>No active releases</a>"
202
      Call sMessageAdd( 1,  "No active releases found. The operation cannot be performed")
5357 dpurdie 203
   End If
204
 
205
   rsTemp.Close
206
   Set rsTemp = nothing
207
 
5590 dpurdie 208
   s = "<td class='form_field'  background='images/bg_form_lightbluedark.gif' >Release</td>" + "<td background='images/bg_form_lightbluedark.gif' >" + s + "<td>"
5357 dpurdie 209
 
210
   Get_Releases = s
211
End Function
212
 
213
'-------------------------------------------------------------------------------------------------------
214
' Call stored procedures to move the WIP from the source release to the destination release
5590 dpurdie 215
' Return false on failure
5357 dpurdie 216
'-------------------------------------------------------------------------------------------------------
5590 dpurdie 217
Function MoveWip(source_RtagId, destination_RtagId, pvId, viewId)
5357 dpurdie 218
 
5590 dpurdie 219
    MoveWip = False
5357 dpurdie 220
 
5590 dpurdie 221
    OraDatabase.Parameters.Add "RTAG_ID", source_RtagId,           ORAPARM_INPUT, ORATYPE_NUMBER
222
    OraDatabase.Parameters.Add "PV_ID",   pvId,                    ORAPARM_INPUT, ORATYPE_VARCHAR2
223
    OraDatabase.Parameters.Add "USER_ID", objAccessControl.UserId, ORAPARM_INPUT, ORATYPE_NUMBER
224
    OraDatabase.Parameters.Add "VIEW_ID", viewId,                  ORAPARM_INPUT, ORATYPE_NUMBER
5357 dpurdie 225
 
5590 dpurdie 226
    objEH.ErrorRedirect = FALSE
227
    objEH.TryORA ( OraSession )
228
    On Error Resume Next
229
    OraDatabase.ExecuteSQL _
230
        "BEGIN   PK_WORK_IN_PROGRESS.REMOVE_PACKAGE ( :PV_ID, :RTAG_ID, :USER_ID );   END;"
5357 dpurdie 231
 
5590 dpurdie 232
    If Err.Number = 0 Then
233
        ' First step is OK
234
        OraDatabase.Parameters.Remove "RTAG_ID"
235
        OraDatabase.Parameters.Add "RTAG_ID", destination_RtagId, ORAPARM_INPUT, ORATYPE_NUMBER
5357 dpurdie 236
 
5590 dpurdie 237
        objEH.ErrorRedirect = FALSE
238
        objEH.TryORA ( OraSession )
239
        On Error Resume Next
5357 dpurdie 240
 
5590 dpurdie 241
        OraDatabase.ExecuteSQL _
242
            "BEGIN   PK_WORK_IN_PROGRESS.ADD_PACKAGE ( :PV_ID, :VIEW_ID, :RTAG_ID, :USER_ID );   END;"
5357 dpurdie 243
 
5590 dpurdie 244
    End If
5357 dpurdie 245
 
5590 dpurdie 246
    objEH.CatchORA ( OraSession )
247
    If objEH.Finally Then
248
        MoveWip = True
249
    End IF
5357 dpurdie 250
 
5590 dpurdie 251
    OraDatabase.Parameters.Remove "RTAG_ID"
252
    OraDatabase.Parameters.Remove "PV_ID"
253
    OraDatabase.Parameters.Remove "USER_ID"
254
    OraDatabase.Parameters.Remove "VIEW_ID"
255
 
256
End Function
257
 
5357 dpurdie 258
%>
259
<%
260
' get pkgInfoHash items for the source WIP
261
Call Get_Pkg_Info_From_Rel ( parRtag_id, parPv_id )
262
 
5590 dpurdie 263
' Access control
264
If NOT objAccessControl.UserLogedIn Then
265
    Call sMessageAdd (1,"User is no longer logged in")
266
    bPreventSubmit = True
267
ElseIf NOT canActionInProject() Then
268
    Call sMessageAdd (1, "You have been denied permission to modify the source release")
269
    bPreventSubmit = True
5357 dpurdie 270
' Make sure this WIP can be moved - prevent if it has a pending test build instruction, etc
5590 dpurdie 271
ElseIf (DaemonInstructionPreventsEditing(Request("rtag_id"), Request("pv_id"))) Then
272
    bPreventSubmit = True
273
   Call sMessageAdd (1, "This WIP has one or more daemon instructions present.<br>"&_
274
                        "Please delete them or allow them to complete before moving WIPs.")
5357 dpurdie 275
Else
276
   ' check for form submission
277
   If CBool(QStrPar("action")) AND (QStrPar("btn") = "Move") AND objAccessControl.UserLogedIn Then
278
      'Process submition
5590 dpurdie 279
      If MoveWip(parRtag_id, parNewRtag_id, parPv_id, pkgInfoHash.Item("view_id")) Then
280
        Call OpenInParentWindow (parRfile &"?pv_id="& parPv_id &"&rtag_id="& parNewRtag_id )
281
        Call CloseWindow
282
      End If
5357 dpurdie 283
   Else
284
      ' Call HTML rendering functions, but throw away the strings returned since we only want to ensure that
285
      ' the current state of the bPreventSubmit flag has been acquired in order to show/hide the submit button
286
      Call Get_Projects(parProj_id)
287
      Call Get_Releases(parProj_id, parNewRtag_id)
288
   End If
289
End If
290
 
5590 dpurdie 291
' Prevent moving to myself
292
If (parNewRtag_id = parRtag_id) Then
293
    Call sMessageAdd (3,"Select a release")
294
    bPreventSubmit = True
295
End If
296
 
5357 dpurdie 297
%>
298
 
299
<html>
300
<head>
301
<title>Release Manager</title>
302
<link rel="shortcut icon" href="<%=FavIcon%>"/>
303
<meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
304
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
305
<link rel="stylesheet" href="images/release_manager_style.css" type="text/css">
306
<link rel="stylesheet" href="images/navigation.css" type="text/css">
307
<script language="JavaScript" src="images/tipster.js"></script>
308
<script language="JavaScript" src="images/_help_tips.js"></script>
309
<script language="JavaScript" src="images/common.js"></script>
310
</head>
311
<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" onload="self.focus();">
5590 dpurdie 312
<form name="chgroup" method="post" action="<%=scriptName%>" class="form_tight">
313
   <table border="0" cellspacing="0" cellpadding="2">
5357 dpurdie 314
      <tr>
5590 dpurdie 315
        <td>
316
       <!-- MESSAGE ++++++++++++++++++++++++++++++++++++++++++++++ -->
317
       <%Call Messenger ( sMessage , sMessageType, "100%" )%>
318
       <!-- MESSAGE +++++++++++++++++++++++++++++++++++++++++++++++++++ -->
319
       <!--#include file="messages/_msg_inline.asp"-->
320
      </td>
321
      <tr>
322
         <td valign="top" nowrap class="wform_ttl" background="images/bg_form_lightgray.gif">
5357 dpurdie 323
            <table width="100%" border="0" cellspacing="1" cellpadding="2">
324
               <tr>
325
                  <td width="1%"><img src="images/h_trsp_dot.gif" width="10" height="30"></td>
5590 dpurdie 326
                  <td width="1%" nowrap class="form_group" valign="bottom" colspan="2">WIP Details</td>
5357 dpurdie 327
               </tr>
328
               <tr>
329
                  <td width="1%">&nbsp;</td>
5590 dpurdie 330
                  <td width="1%" nowrap class="form_field" background="images/bg_form_lightbluedark.gif">Package</td>
5357 dpurdie 331
                  <td nowrap width="100%" background="images/bg_form_lightbluedark.gif" class="form_txt">
332
                     <%=pkgInfoHash.Item("pkg_name")%>
333
                  </td>
334
               </tr>
335
               <tr>
336
                  <td width="1%">&nbsp;</td>
5590 dpurdie 337
                  <td width="1%" nowrap class="form_field" background="images/bg_form_lightbluedark.gif">Version</td>
5357 dpurdie 338
                  <td nowrap width="100%" background="images/bg_form_lightbluedark.gif" class="form_txt">
339
                     <%=pkgInfoHash.Item("pkg_version")%>
340
                  </td>
341
               </tr>
342
               <tr>
343
                  <td width="1%">&nbsp;</td>
344
                  <td width="1%" nowrap class="form_field" background="images/bg_form_lightbluedark.gif">View<a href="#" onMouseOver="formTips.show('group')" onMouseOut="formTips.hide()"></a></td>
345
                  <td nowrap width="100%" background="images/bg_form_lightbluedark.gif" class="form_txt">
346
                     <%=pkgInfoHash.Item("view_name")%>
347
                  </td>
348
               </tr>
349
 
350
               <tr>
351
                  <td width="1%"><img src="images/h_trsp_dot.gif" width="10" height="30"></td>
5590 dpurdie 352
                  <td width="1%" nowrap class="form_group" valign="bottom" colspan="2">Select Destination Release</td>
5357 dpurdie 353
               </tr>
354
               <tr>
355
                  <td width="1%">&nbsp;</td>
356
                  <%=Get_Projects(parProj_id)%>
357
                  <td nowrap width="100%">&nbsp; </td>
358
               </tr>
359
               <tr>
360
                  <td width="1%">&nbsp;</td>
361
                  <%=Get_Releases(parProj_id, parNewRtag_id)%>
362
                  <td nowrap width="100%">&nbsp; </td>
363
               </tr>
364
            </table>
365
         </td>
366
      </tr>
367
      <tr>
5590 dpurdie 368
         <td valign="top" nowrap class="wform_ttl" background="images/bg_form_lightgray.gif">
5357 dpurdie 369
            <table width="100%" border="0" cellspacing="1" cellpadding="2">
370
               <tr>
371
                  <td width="1%" wrap class="form_group" valign="bottom">
5597 dpurdie 372
                     <img src="images/i_warning.gif" width="16" height="16">
5357 dpurdie 373
                     The destination release may not satisfy any or all the dependencies that come with
374
                     the WIP you are about to move. It is your responsibility to rectify this in the
375
                     destination release.
376
                  </td>
377
               </tr>
378
            </table>
379
         </td>
380
      </tr>
5597 dpurdie 381
      <tr>
382
         <td align="right">
383
            <input type="submit" name="btn" value="Move" <%=Iif(bPreventSubmit, "disabled", "")%> class="form_btn_comp form_btn">
384
            <input type="reset" name="btn" value="Cancel" class="form_btn_comp" onclick="parent.closeIFrame();">
385
         </td>
386
      </tr>
5357 dpurdie 387
   </table>
5597 dpurdie 388
   <input type="hidden" name="pv_id" value="<%=parPv_id%>">
389
   <input type="hidden" name="rtag_id" value="<%=parRtag_id%>">
390
   <input type="hidden" name="new_rtag_id" value="<%=parNewRtag_id%>">
391
   <input type="hidden" name="view_id" value="<%=pkgInfoHash.Item("view_id")%>">
392
   <input type="hidden" name="rfile" value="<%=parRfile%>">
393
   <input type="hidden" name="action" value="true">
5357 dpurdie 394
</form>
395
<!-- TIPS LAYERS -------------------------------------->
396
<div id="formTipsLayer" style="position: absolute; z-index: 1000; visibility: hidden; left:0; top: 0; width: 10">&nbsp;</div>
397
<!----------------------------------------------------->
398
</body>
399
</html>
400
 
401
 
402
<!-- DESTRUCTOR ------->
403
<!--#include file="common/destructor.asp"-->