Subversion Repositories DevTools

Rev

Rev 6710 | Rev 6827 | 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.
6710 dpurdie 176
                               <br><a href='javascript:;' title='Delete unused package name' onClick="MM_openVixIFrame('_delete_package_name.asp?pkgId=<%=parPkgId%>&bfile=index.asp','Delete Unused Package');" >Delete this package name<img src='icons/i_destroy_package_sml.gif' width='15' height='15' border='0' align='absmiddle' hspace='2'></a>
6623 dpurdie 177
                <%Else%>
178
                    Found 0 records - with current filters.
179
                <%End If%>
180
                </td>
181
               </tr>
182
 
183
           <%Else
184
 
185
               aVersions = rsRep.GetRows()
186
               lastRow = UBound( aVersions, 2 )
187
 
188
               ' Sort versions
189
               Set objSortHelper = New SortHelper
190
               Call objSortHelper.VersionSort( aVersions, 0, lastRow, rsRep.FieldIndex("pkg_version") )
191
 
192
 
193
               ' Not in a project context
194
               ' Only god-like users will have this permission
195
               CanDestroyProjectPackage = canShowControl( "DestroyPackage" )
196
 
197
             ' Descending order
198
             For i = lastRow To 0 Step -1
199
               imgLock = IMG_NOT_OFFICIAL
200
               imgData = 2
201
               If (aVersions( rsRep.FieldIndex("dlocked"), i ) = "Y")  OR (aVersions( rsRep.FieldIndex("dlocked"), i ) = "A") Then
202
                   imgLock = IMG_OFFICIAL
203
               imgData = 1
204
               End If
205
 
206
               sLink = "dependencies.asp?pv_id="& aVersions( rsRep.FieldIndex("pv_id"), i )
207
 
208
               ' User can try to delete package iff
209
               '   Have suffiecient access (unusual)
210
               '   They created it or is its owner
211
               '   The version is not in use by any release (allow to be in pending or WIP)
212
               '   [Not at the moment] The package was created less than xxxx days ago
213
               '   Is not locked or Approved for Autobuild
214
               CanDestroyPackage = CanDestroyProjectPackage
215
               If CanDestroyPackage = false Then
216
                   If  objAccessControl.UserId = aVersions( rsRep.FieldIndex("CREATOR_ID"), i ) OR objAccessControl.UserId = aVersions( rsRep.FieldIndex("OWNER_ID"), i )Then
217
                       If aVersions( rsRep.FieldIndex("inuse"), i ) = 0 Then
218
                           'If aVersions( rsRep.FieldIndex("age") , i ) < 1000 Then
219
                               If aVersions( rsRep.FieldIndex("dlocked"), i ) <> "Y" Then
220
                                   'If aVersions( rsRep.FieldIndex("dlocked"), i ) <> "A" Then
221
                                       CanDestroyPackage = true
222
                                   'End If
223
                               End If
224
                           'End If
225
                       End If
226
                   End If
227
               End If
228
 
229
               ' Set destroy package action
230
               ' title will be added by javascript
231
               If CanDestroyPackage Then
232
                    DestroyPackage = "<img src='icons/i_destroy_package_sml.gif' width='15' height='15' border='0' class='destroyThis'>"
233
               Else
234
                    DestroyPackage = ""
235
               End If
236
 
237
               Dim testCount
238
               testCount = aVersions( rsRep.FieldIndex("test_count"), i )
239
               If testCount = 0 Then testCount = ""
240
 
241
             %>
242
                 <tr valign="top" class="body_row form_field_grey_bg"> 
243
                   <td data-order='<%=imgData%>'><%=imgLock%></td>
6790 dpurdie 244
                   <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 245
                   <td class="body_txt_gray"><%=NewLine_To_BR ( To_HTML( aVersions( rsRep.FieldIndex("comments"), i ) ) )%></td>
246
                   <td nowrap><%=aVersions( rsRep.FieldIndex("reason"), i )%></td>
247
                   <td nowrap class='tright'><%=aVersions( rsRep.FieldIndex("code_lines"), i )%></td>
248
                   <td nowrap class='tright'><%=testCount%></td>
249
                   <td nowrap class='tright'><%=aVersions( rsRep.FieldIndex("build_time"), i )%></td>
6707 dpurdie 250
                   <td nowrap class='tright'><%=aVersions( rsRep.FieldIndex("licence"), i )%></td>
6623 dpurdie 251
                   <td nowrap><%=emailField(enum_imgUser & aVersions( rsRep.FieldIndex("full_name"), i ),  aVersions( rsRep.FieldIndex("user_email"), i ))%></td>
252
                   <td nowrap><%=DisplayShortDateTime ( aVersions( rsRep.FieldIndex("modified_stamp"), i ) )%></td>
253
                   <td data-pvid='<%=aVersions( rsRep.FieldIndex("pv_id"), i )%>'><%=DestroyPackage%></td>
254
                 </tr>
255
             <%  
256
 
257
             Next
258
 
259
             rsRep.Close()
260
 
261
           End If
262
             %>
263
         </tbody>
264
       </table>
6710 dpurdie 265
       </form>
6623 dpurdie 266
       <br>
267
       <!------------------------------------------------------------>         
268
       </td>
269
     <td bgcolor="#FFFFFF"><img src="images/h_trsp_dot.gif" width="10" height="500"></td>
270
   </tr>
271
 </table>
272
<%
273
End Sub
274
%>
5357 dpurdie 275
<html>
6623 dpurdie 276
   <head>
277
      <title>Release Manager</title>
278
      <link rel="shortcut icon" href="<%=FavIcon%>"/>
279
      <meta http-equiv="Pragma" content="no-cache">
280
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
281
      <link rel="stylesheet" href="images/release_manager_style.css?ver=<%=VixVerNum%>" type="text/css">
282
      <link rel="stylesheet" href="images/navigation.css?ver=<%=VixVerNum%>" type="text/css">
283
      <script language="JavaScript" src="images/common.js?ver=<%=VixVerNum%>"></script>
284
      <!-- DROPDOWN MENUS -->
285
      <%bJqueryDataTables=true%>
286
      <%sJqueryDataTablesCss="jquery/dataTables.vix.grey.css"%>
287
      <!--#include file="_jquery_includes.asp"-->
288
      <!--#include file="_menu_def.asp"-->
289
      <script language="JavaScript1.2" src="images/popup_menu.js?ver=<%=VixVerNum%>"></script>
290
      <script language="JavaScript" type="text/JavaScript">
291
      $(document).ready(function() {
6289 dpurdie 292
 
6710 dpurdie 293
        $.fn.dataTable.ext.errMode = 'none';
6623 dpurdie 294
        $('#versionTable').DataTable({
295
            "paging":   false,
296
            "ordering": true,
6710 dpurdie 297
            "info":     true,
6623 dpurdie 298
            });
5759 dpurdie 299
 
6623 dpurdie 300
        // Add Title to icons
301
        $('.destroyThis').prop('title', 'Destroy this version of the package.');
302
 
303
        // Destroy a package version
304
        // 
305
        $( ".destroyThis" ).on( "click", function(event) {
306
            var pvid = $(this).closest('td').data('pvid');
307
            if (pvid) {
308
                var data = {
309
                    pv_id       : pvid,
310
                    bfile       : "<%=ScriptName%>",
311
                    pkg_id      : "<%=parPkgId%>",
312
                    listby      : "<%=parListBy%>",
313
                    fpkgversion : "<%=parFPkgVersion%>",
314
                };
315
                MM_openVixIFrame('_destroy_package.asp?' + encodeData(data), 'Destroy Package Version')
316
            }
317
        });
318
      });
319
 
320
      //  Encode data into URL
321
      function encodeData(data) {
322
          return Object.keys(data).map(function(key) {
323
              return [key, data[key]].map(encodeURIComponent).join("=");
324
          }).join("&");
6710 dpurdie 325
      };
326
 
327
      // Functions to support the suffix filter
328
      // Need to work against the dataTables sorting event capture
329
      function submitForm(event) {
330
          soakEvent(event);
331
          document.forms["versions"].submit();
332
      };
6623 dpurdie 333
 
6710 dpurdie 334
      function soakEvent(event) {
335
          event.stopImmediatePropagation();
336
          event.stopPropagation();
337
      }
6623 dpurdie 338
      </script>
339
   </head>
340
   <body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0">
341
      <!-- HEADER -->
342
      <!--#include file="_header.asp"-->
343
      <!-- BODY ---->
344
      <table class="full_table">
345
         <tr>
346
            <td width="146px" class="panel_bg" valign="top">
347
               <!--#include file="_front_explorer.asp"-->
348
            </td>
349
            <td width="100%" rowspan="2" align="center" valign="top">
350
                <%Call MainPanelContent%>
351
            </td>
352
         </tr>
353
         <tr>
354
            <td class="panel_bg" valign="bottom" align="center" height="350">
355
                <img src="images/img_gear.gif" vspace="20" hspace="30"></td>
356
         </tr>
5357 dpurdie 357
      </table>
6623 dpurdie 358
      <!-- FOOTER -->
359
      <!--#include file="_footer.asp"-->
360
   </body>
5357 dpurdie 361
</html>
6623 dpurdie 362