Subversion Repositories DevTools

Rev

Rev 6790 | Rev 6873 | 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
'=====================================================
4
'|                                                   |
6623 dpurdie 5
'|          Edit/View Build Configuration            |
5357 dpurdie 6
'|                                                   |
7
'=====================================================
8
%>
9
<%
10
Option explicit
11
' Good idea to set when using redirect
6289 dpurdie 12
Response.Expires = 0    ' always load the page, dont store
5357 dpurdie 13
%>
14
<!--#include file="common/conf.asp"-->
15
<!--#include file="common/globals.asp"-->
16
<!--#include file="common/formating.asp"-->
17
<!--#include file="common/qstr.asp"-->
18
<!--#include file="common/common_subs.asp"-->
19
<!--#include file="class/classSortHelper.asp"-->
20
<%
21
'------------ ACCESS CONTROL ------------------
22
%>
6181 dpurdie 23
<!--#include file="_access_control_login_optional.asp"-->
5357 dpurdie 24
<!--#include file="_access_control_general.asp"-->
25
<%
26
'------------ Variable Definition -------------
27
Dim rsRep
28
Dim parFPkgVersion
29
Dim sLink
30
Dim parPkgId
31
Dim PackageName
32
Dim imgLock
6623 dpurdie 33
Dim imgData
5357 dpurdie 34
Dim DestroyPackage
5902 dpurdie 35
Dim CanDestroyProjectPackage
5357 dpurdie 36
Dim CanDestroyPackage
37
Dim hideRipple
38
Dim rippleFilter
39
'------------ Constants Declaration -----------
40
Const IMG_OFFICIAL = "<img src='images/i_locked.gif' width='7' height='10' hspace='5' vspace='2' alt='Package is official'>"
41
Const IMG_NOT_OFFICIAL = "<img src='images/spacer.gif' width='7' height='10' hspace='5' vspace='2'>"
42
'------------ Variable Init -------------------
6623 dpurdie 43
parFPkgVersion = RequestDefault("fpkgversion", "*")
5357 dpurdie 44
parPkgId = Request("pkg_id")
45
If Request("hideRipple") = "True" Then 
6289 dpurdie 46
    hideRipple = True
5357 dpurdie 47
    rippleFilter = " AND PV.BUILD_TYPE != 'Y'"
48
Else
6289 dpurdie 49
    hideRipple = False
5357 dpurdie 50
    rippleFilter = ""
51
End If
52
'----------------------------------------------
6623 dpurdie 53
'   Convert PKG_ID into a package name
5357 dpurdie 54
Function GetPackageName ( nPkgId )
6289 dpurdie 55
    Dim rsQry, query
56
 
6623 dpurdie 57
    query = "SELECT PKG_NAME  FROM PACKAGES  WHERE PKG_ID = :PKG_ID"
6289 dpurdie 58
    OraDatabase.Parameters.Add "PKG_ID", nPkgId, ORAPARM_INPUT, ORATYPE_NUMBER
59
    Set rsQry = OraDatabase.DbCreateDynaset( query, 0 )
60
    OraDatabase.Parameters.Remove "PKG_ID"
61
    GetPackageName = rsQry("pkg_name")
62
 
63
    rsQry.Close()
64
    Set rsQry = nothing
5357 dpurdie 65
End Function
6623 dpurdie 66
 
67
'----------------------------------------------
68
'   Determine if a PKG_ID has any package-versions
69
'   If not then it can be deleted
70
Function hasNoVersions ( nPkgId )
71
    Dim rsQry, query
72
 
73
    query = "select count(*) as count from package_versions where pkg_id = :PKG_ID"
74
    OraDatabase.Parameters.Add "PKG_ID", nPkgId, ORAPARM_INPUT, ORATYPE_NUMBER
75
    Set rsQry = OraDatabase.DbCreateDynaset( query, 0 )
76
    OraDatabase.Parameters.Remove "PKG_ID"
77
 
78
    hasNoVersions = NOT rsQry("count") <> 0
79
 
80
    rsQry.Close()
81
    Set rsQry = nothing
82
End Function
83
 
5357 dpurdie 84
'==================== MAIN LINE ===============================
5957 dpurdie 85
If (parPkgId = "") Then 
86
    Call Destroy_All_Objects
87
    Response.Redirect ("index.asp")
88
End If
5357 dpurdie 89
 
90
PackageName = GetPackageName ( parPkgId )
91
'==============================================================
6623 dpurdie 92
Sub MainPanelContent
5357 dpurdie 93
%>
6623 dpurdie 94
<!-- MainPanelContent -->
95
 <table width="100%" border="0" cellspacing="0" cellpadding="0">
96
   <tr> 
97
     <td width="1%"></td>
98
     <td width="100%" align="right"><img src="images/h_trsp_dot.gif" width="1" height="20"></td>
99
     <td width="1%"></td>
100
   </tr>
101
   <tr> 
102
     <td bgcolor="#FFFFFF"><img src="images/h_trsp_dot.gif" width="10" height="500"></td>
103
     <td bgcolor="#FFFFFF" valign="top"> 
104
       <!-- PACKAGE SEARCH ------------------------------------------------>
105
       <%
106
 
107
       Dim aVersions
108
       Dim lastRow
109
       Dim objSortHelper
110
       Dim i
111
 
112
       OraDatabase.Parameters.Add "PKG_VERSION",   Replace( parFPkgVersion, "*", "%" ), ORAPARM_INPUT, ORATYPE_VARCHAR2
113
       OraDatabase.Parameters.Add "PKG_ID",    parPkgId, ORAPARM_INPUT, ORATYPE_NUMBER
114
 
115
       Set rsRep = OraDatabase.DbCreateDynaset( GetQuery("FindPackageVersion.sql") & rippleFilter, 0 )
116
 
117
       OraDatabase.Parameters.Remove "PKG_ID"
118
       OraDatabase.Parameters.Remove "PKG_VERSION"
119
       %>
120
 
6710 dpurdie 121
       <form name="versions" method="get" action="<%=ScriptName%>">
122
         <input type="hidden" name="pkg_id" value="<%=parPkgId%>">
123
         <input type="hidden" name="listby" value="<%=parListBy%>">
124
       <table id='versionTable' width="100%"  border="0" cellspacing="1" cellpadding="2">
6623 dpurdie 125
           <thead>
126
             <tr>
6707 dpurdie 127
               <td class="body_sect" colspan='11'>Package Versions</td>
6623 dpurdie 128
             </tr>
129
             <tr class="form_field_bg">
6707 dpurdie 130
               <td nowrap" class="body_txt" colspan='11'>
6623 dpurdie 131
                   Results for <b><%=PackageName%></b>
132
               </td>
133
             </tr>
134
            <tr class="form_field_bg">
135
               <td width="20px" nowrap class="body_col"></td>
136
               <td width="10%" nowrap class="body_col">Version</td>
137
               <td width="80%" nowrap class="body_col">Reason for Release</td>
138
               <td width="1%" nowrap class="body_col tcenter" rowspan="2">Build<br>Reason</td>
139
               <td width="1%" nowrap class="body_col tcenter" rowspan="2">Lines of<br>Code</td>
140
               <td width="1%" nowrap class="body_col tcenter" rowspan="2">Auto<br>Tests</td>
141
               <td width="1%" nowrap class="body_col tcenter" rowspan="2">Build<br>Time</td>
6707 dpurdie 142
               <td width="1%" nowrap class="body_col tcenter" rowspan="2">Licence</td>
6623 dpurdie 143
               <td width="10%" nowrap class="body_col tcenter" colspan="2">Last Modified</td>
144
               <td width="21px" nowrap class="body_col"></td>
145
             </tr>
146
             <tr class="body_col form_field_bg">
147
               <td nowrap ></td>
148
               <td nowrap >
6710 dpurdie 149
                    <input name="fpkgversion" type="text" class="form_item" size="15" value="<%=parFPkgVersion%>" style="border-right: 0px;" onClick="soakEvent(event);" onKeyPress="if(event.keyCode==13) submitForm(event);">
150
                    <img class=top src="images/i_go2url.gif" onClick="submitForm(event);" title="Apply Filter">
151
               </td>
152
 
153
               <td nowrap >
6623 dpurdie 154
                 <%
155
                 Response.write "<a href='"& scriptName &"?"& Persists_Query_String( "hideRipple=" & not hideRipple ) &"'>"
156
                     If hideRipple Then
157
                       Response.write "<img src='images/RippleSquareOff.gif' width='20' height='20' border='0' title='Rippled Versions Hidden. Toggle'>"
158
                     Else
159
                       Response.write "<img src='images/RippleSquare.gif' width='20' height='20' border='0' title='Rippled Versions Shown. Toggle'>"
160
                     End If
161
                 Response.write "</a>"
162
                 %>
163
               </td>
164
               <td nowrap class="tcenter">Who</td>
165
               <td nowrap class="tcenter">Date</td>
166
               <td nowrap ></td>
167
             </tr>
168
           </thead>
169
           <tbody>
170
 
171
           <%If rsRep.RecordCount = 0 Then%>
172
               <tr>
6707 dpurdie 173
                <td colspan='11' class='body_row'>
6623 dpurdie 174
                <%If hasNoVersions(parPkgId) Then %>
175
                    This package name has no versions.
6827 dpurdie 176
                    <table>
177
                        <tr>
178
                            <%BuildActionButtonClick TRUE, "Delete this package name", "Delete", true, _
179
                                    "src='icons/i_destroy_package_sml.gif' width='15' height='15' border='0' align='absmiddle' hspace='2'", _
180
                                    "MM_openVixIFrame('_delete_package_name.asp?pkgId="&parPkgId&"&bfile=index.asp','Delete Unused Package');"%>
181
                        </tr>
182
                    </table>
6623 dpurdie 183
                <%Else%>
184
                    Found 0 records - with current filters.
185
                <%End If%>
186
                </td>
187
               </tr>
188
 
189
           <%Else
190
 
191
               aVersions = rsRep.GetRows()
192
               lastRow = UBound( aVersions, 2 )
193
 
194
               ' Sort versions
195
               Set objSortHelper = New SortHelper
196
               Call objSortHelper.VersionSort( aVersions, 0, lastRow, rsRep.FieldIndex("pkg_version") )
197
 
198
 
199
               ' Not in a project context
200
               ' Only god-like users will have this permission
201
               CanDestroyProjectPackage = canShowControl( "DestroyPackage" )
202
 
203
             ' Descending order
204
             For i = lastRow To 0 Step -1
205
               imgLock = IMG_NOT_OFFICIAL
206
               imgData = 2
207
               If (aVersions( rsRep.FieldIndex("dlocked"), i ) = "Y")  OR (aVersions( rsRep.FieldIndex("dlocked"), i ) = "A") Then
208
                   imgLock = IMG_OFFICIAL
209
               imgData = 1
210
               End If
211
 
212
               sLink = "dependencies.asp?pv_id="& aVersions( rsRep.FieldIndex("pv_id"), i )
213
 
214
               ' User can try to delete package iff
215
               '   Have suffiecient access (unusual)
216
               '   They created it or is its owner
217
               '   The version is not in use by any release (allow to be in pending or WIP)
218
               '   [Not at the moment] The package was created less than xxxx days ago
219
               '   Is not locked or Approved for Autobuild
220
               CanDestroyPackage = CanDestroyProjectPackage
221
               If CanDestroyPackage = false Then
222
                   If  objAccessControl.UserId = aVersions( rsRep.FieldIndex("CREATOR_ID"), i ) OR objAccessControl.UserId = aVersions( rsRep.FieldIndex("OWNER_ID"), i )Then
223
                       If aVersions( rsRep.FieldIndex("inuse"), i ) = 0 Then
224
                           'If aVersions( rsRep.FieldIndex("age") , i ) < 1000 Then
225
                               If aVersions( rsRep.FieldIndex("dlocked"), i ) <> "Y" Then
226
                                   'If aVersions( rsRep.FieldIndex("dlocked"), i ) <> "A" Then
227
                                       CanDestroyPackage = true
228
                                   'End If
229
                               End If
230
                           'End If
231
                       End If
232
                   End If
233
               End If
234
 
235
               ' Set destroy package action
236
               ' title will be added by javascript
237
               If CanDestroyPackage Then
238
                    DestroyPackage = "<img src='icons/i_destroy_package_sml.gif' width='15' height='15' border='0' class='destroyThis'>"
239
               Else
240
                    DestroyPackage = ""
241
               End If
242
 
243
               Dim testCount
244
               testCount = aVersions( rsRep.FieldIndex("test_count"), i )
245
               If testCount = 0 Then testCount = ""
246
 
247
             %>
248
                 <tr valign="top" class="body_row form_field_grey_bg"> 
249
                   <td data-order='<%=imgData%>'><%=imgLock%></td>
6790 dpurdie 250
                   <td nowrap><a name="<%=aVersions( rsRep.FieldIndex("pv_id"), i )%>" href="<%=sLink%>" class="body_link"><%=aVersions( rsRep.FieldIndex("pkg_version"), i )%></a></td>
6623 dpurdie 251
                   <td class="body_txt_gray"><%=NewLine_To_BR ( To_HTML( aVersions( rsRep.FieldIndex("comments"), i ) ) )%></td>
252
                   <td nowrap><%=aVersions( rsRep.FieldIndex("reason"), i )%></td>
253
                   <td nowrap class='tright'><%=aVersions( rsRep.FieldIndex("code_lines"), i )%></td>
254
                   <td nowrap class='tright'><%=testCount%></td>
255
                   <td nowrap class='tright'><%=aVersions( rsRep.FieldIndex("build_time"), i )%></td>
6707 dpurdie 256
                   <td nowrap class='tright'><%=aVersions( rsRep.FieldIndex("licence"), i )%></td>
6623 dpurdie 257
                   <td nowrap><%=emailField(enum_imgUser & aVersions( rsRep.FieldIndex("full_name"), i ),  aVersions( rsRep.FieldIndex("user_email"), i ))%></td>
258
                   <td nowrap><%=DisplayShortDateTime ( aVersions( rsRep.FieldIndex("modified_stamp"), i ) )%></td>
259
                   <td data-pvid='<%=aVersions( rsRep.FieldIndex("pv_id"), i )%>'><%=DestroyPackage%></td>
260
                 </tr>
261
             <%  
262
 
263
             Next
264
 
265
             rsRep.Close()
266
 
267
           End If
268
             %>
269
         </tbody>
270
       </table>
6710 dpurdie 271
       </form>
6623 dpurdie 272
       <br>
273
       <!------------------------------------------------------------>         
274
       </td>
275
     <td bgcolor="#FFFFFF"><img src="images/h_trsp_dot.gif" width="10" height="500"></td>
276
   </tr>
277
 </table>
278
<%
279
End Sub
280
%>
5357 dpurdie 281
<html>
6623 dpurdie 282
   <head>
283
      <title>Release Manager</title>
284
      <link rel="shortcut icon" href="<%=FavIcon%>"/>
285
      <meta http-equiv="Pragma" content="no-cache">
286
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
287
      <link rel="stylesheet" href="images/release_manager_style.css?ver=<%=VixVerNum%>" type="text/css">
288
      <link rel="stylesheet" href="images/navigation.css?ver=<%=VixVerNum%>" type="text/css">
289
      <script language="JavaScript" src="images/common.js?ver=<%=VixVerNum%>"></script>
290
      <!-- DROPDOWN MENUS -->
291
      <%bJqueryDataTables=true%>
292
      <%sJqueryDataTablesCss="jquery/dataTables.vix.grey.css"%>
293
      <!--#include file="_jquery_includes.asp"-->
294
      <!--#include file="_menu_def.asp"-->
295
      <script language="JavaScript1.2" src="images/popup_menu.js?ver=<%=VixVerNum%>"></script>
296
      <script language="JavaScript" type="text/JavaScript">
297
      $(document).ready(function() {
6289 dpurdie 298
 
6710 dpurdie 299
        $.fn.dataTable.ext.errMode = 'none';
6623 dpurdie 300
        $('#versionTable').DataTable({
301
            "paging":   false,
302
            "ordering": true,
6827 dpurdie 303
            "info":     true
6623 dpurdie 304
            });
5759 dpurdie 305
 
6623 dpurdie 306
        // Add Title to icons
307
        $('.destroyThis').prop('title', 'Destroy this version of the package.');
308
 
309
        // Destroy a package version
310
        // 
311
        $( ".destroyThis" ).on( "click", function(event) {
312
            var pvid = $(this).closest('td').data('pvid');
313
            if (pvid) {
314
                var data = {
315
                    pv_id       : pvid,
316
                    bfile       : "<%=ScriptName%>",
317
                    pkg_id      : "<%=parPkgId%>",
318
                    listby      : "<%=parListBy%>",
319
                    fpkgversion : "<%=parFPkgVersion%>",
320
                };
321
                MM_openVixIFrame('_destroy_package.asp?' + encodeData(data), 'Destroy Package Version')
322
            }
323
        });
324
      });
325
 
326
      //  Encode data into URL
327
      function encodeData(data) {
328
          return Object.keys(data).map(function(key) {
329
              return [key, data[key]].map(encodeURIComponent).join("=");
330
          }).join("&");
6710 dpurdie 331
      };
332
 
333
      // Functions to support the suffix filter
334
      // Need to work against the dataTables sorting event capture
335
      function submitForm(event) {
336
          soakEvent(event);
337
          document.forms["versions"].submit();
338
      };
6623 dpurdie 339
 
6710 dpurdie 340
      function soakEvent(event) {
341
          event.stopImmediatePropagation();
342
          event.stopPropagation();
343
      }
6827 dpurdie 344
      //# sourceURL=view_by_version.asp
6623 dpurdie 345
      </script>
346
   </head>
347
   <body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0">
348
      <!-- HEADER -->
349
      <!--#include file="_header.asp"-->
350
      <!-- BODY ---->
351
      <table class="full_table">
352
         <tr>
353
            <td width="146px" class="panel_bg" valign="top">
354
               <!--#include file="_front_explorer.asp"-->
355
            </td>
356
            <td width="100%" rowspan="2" align="center" valign="top">
357
                <%Call MainPanelContent%>
358
            </td>
359
         </tr>
360
         <tr>
361
            <td class="panel_bg" valign="bottom" align="center" height="350">
362
                <img src="images/img_gear.gif" vspace="20" hspace="30"></td>
363
         </tr>
5357 dpurdie 364
      </table>
6623 dpurdie 365
      <!-- FOOTER -->
366
      <!--#include file="_footer.asp"-->
367
   </body>
5357 dpurdie 368
</html>
6623 dpurdie 369