Subversion Repositories DevTools

Rev

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