Subversion Repositories DevTools

Rev

Rev 6623 | Rev 6710 | 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
 
121
       %>
122
 
123
       <table id="versionTable" width="100%"  border="0" cellspacing="1" cellpadding="2">
124
           <thead>
125
             <tr>
6707 dpurdie 126
               <td class="body_sect" colspan='11'>Package Versions</td>
6623 dpurdie 127
             </tr>
128
             <tr class="form_field_bg">
6707 dpurdie 129
               <td nowrap" class="body_txt" colspan='11'>
6623 dpurdie 130
                   Results for <b><%=PackageName%></b>
131
               </td>
132
             </tr>
133
           <form name="versions" method="get" action="<%=ScriptName%>">
134
             <input type="hidden" name="pkg_id" value="<%=parPkgId%>">
135
             <input type="hidden" name="listby" value="<%=parListBy%>">
136
            <tr class="form_field_bg">
137
               <td width="20px" nowrap class="body_col"></td>
138
               <td width="10%" nowrap class="body_col">Version</td>
139
               <td width="80%" nowrap class="body_col">Reason for Release</td>
140
               <td width="1%" nowrap class="body_col tcenter" rowspan="2">Build<br>Reason</td>
141
               <td width="1%" nowrap class="body_col tcenter" rowspan="2">Lines of<br>Code</td>
142
               <td width="1%" nowrap class="body_col tcenter" rowspan="2">Auto<br>Tests</td>
143
               <td width="1%" nowrap class="body_col tcenter" rowspan="2">Build<br>Time</td>
6707 dpurdie 144
               <td width="1%" nowrap class="body_col tcenter" rowspan="2">Licence</td>
6623 dpurdie 145
               <td width="10%" nowrap class="body_col tcenter" colspan="2">Last Modified</td>
146
               <td width="21px" nowrap class="body_col"></td>
147
             </tr>
148
             <tr class="body_col form_field_bg">
149
               <td nowrap ></td>
150
               <td nowrap ><input name="fpkgversion" type="text" class="form_item" size="15" value="<%=parFPkgVersion%>"></td>
151
               <td nowrap >
152
                 <%
153
                 Response.write "<a href='"& scriptName &"?"& Persists_Query_String( "hideRipple=" & not hideRipple ) &"'>"
154
                     If hideRipple Then
155
                       Response.write "<img src='images/RippleSquareOff.gif' width='20' height='20' border='0' title='Rippled Versions Hidden. Toggle'>"
156
                     Else
157
                       Response.write "<img src='images/RippleSquare.gif' width='20' height='20' border='0' title='Rippled Versions Shown. Toggle'>"
158
                     End If
159
                 Response.write "</a>"
160
                 %>
161
               </td>
162
               <td nowrap class="tcenter">Who</td>
163
               <td nowrap class="tcenter">Date</td>
164
               <td nowrap ></td>
165
             </tr>
166
           </thead>
167
           <tbody>
168
 
169
           <%If rsRep.RecordCount = 0 Then%>
170
               <tr>
6707 dpurdie 171
                <td colspan='11' class='body_row'>
6623 dpurdie 172
                <%If hasNoVersions(parPkgId) Then %>
173
                    This package name has no versions.
174
                               <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 name<img src='icons/i_destroy_package_sml.gif' width='15' height='15' border='0' align='absmiddle' hspace='2'></a>
175
                <%Else%>
176
                    Found 0 records - with current filters.
177
                <%End If%>
178
                </td>
179
               </tr>
180
 
181
           <%Else
182
 
183
               aVersions = rsRep.GetRows()
184
               lastRow = UBound( aVersions, 2 )
185
 
186
               ' Sort versions
187
               Set objSortHelper = New SortHelper
188
               Call objSortHelper.VersionSort( aVersions, 0, lastRow, rsRep.FieldIndex("pkg_version") )
189
 
190
 
191
               ' Not in a project context
192
               ' Only god-like users will have this permission
193
               CanDestroyProjectPackage = canShowControl( "DestroyPackage" )
194
 
195
             ' Descending order
196
             For i = lastRow To 0 Step -1
197
               imgLock = IMG_NOT_OFFICIAL
198
               imgData = 2
199
               If (aVersions( rsRep.FieldIndex("dlocked"), i ) = "Y")  OR (aVersions( rsRep.FieldIndex("dlocked"), i ) = "A") Then
200
                   imgLock = IMG_OFFICIAL
201
               imgData = 1
202
               End If
203
 
204
               sLink = "dependencies.asp?pv_id="& aVersions( rsRep.FieldIndex("pv_id"), i )
205
 
206
               ' User can try to delete package iff
207
               '   Have suffiecient access (unusual)
208
               '   They created it or is its owner
209
               '   The version is not in use by any release (allow to be in pending or WIP)
210
               '   [Not at the moment] The package was created less than xxxx days ago
211
               '   Is not locked or Approved for Autobuild
212
               CanDestroyPackage = CanDestroyProjectPackage
213
               If CanDestroyPackage = false Then
214
                   If  objAccessControl.UserId = aVersions( rsRep.FieldIndex("CREATOR_ID"), i ) OR objAccessControl.UserId = aVersions( rsRep.FieldIndex("OWNER_ID"), i )Then
215
                       If aVersions( rsRep.FieldIndex("inuse"), i ) = 0 Then
216
                           'If aVersions( rsRep.FieldIndex("age") , i ) < 1000 Then
217
                               If aVersions( rsRep.FieldIndex("dlocked"), i ) <> "Y" Then
218
                                   'If aVersions( rsRep.FieldIndex("dlocked"), i ) <> "A" Then
219
                                       CanDestroyPackage = true
220
                                   'End If
221
                               End If
222
                           'End If
223
                       End If
224
                   End If
225
               End If
226
 
227
               ' Set destroy package action
228
               ' title will be added by javascript
229
               If CanDestroyPackage Then
230
                    DestroyPackage = "<img src='icons/i_destroy_package_sml.gif' width='15' height='15' border='0' class='destroyThis'>"
231
               Else
232
                    DestroyPackage = ""
233
               End If
234
 
235
               Dim testCount
236
               testCount = aVersions( rsRep.FieldIndex("test_count"), i )
237
               If testCount = 0 Then testCount = ""
238
 
239
             %>
240
                 <tr valign="top" class="body_row form_field_grey_bg"> 
241
                   <td data-order='<%=imgData%>'><%=imgLock%></td>
242
                   <td nowrap><a href="<%=sLink%>" class="body_link"><%=aVersions( rsRep.FieldIndex("pkg_version"), i )%></a></td>
243
                   <td class="body_txt_gray"><%=NewLine_To_BR ( To_HTML( aVersions( rsRep.FieldIndex("comments"), i ) ) )%></td>
244
                   <td nowrap><%=aVersions( rsRep.FieldIndex("reason"), i )%></td>
245
                   <td nowrap class='tright'><%=aVersions( rsRep.FieldIndex("code_lines"), i )%></td>
246
                   <td nowrap class='tright'><%=testCount%></td>
247
                   <td nowrap class='tright'><%=aVersions( rsRep.FieldIndex("build_time"), i )%></td>
6707 dpurdie 248
                   <td nowrap class='tright'><%=aVersions( rsRep.FieldIndex("licence"), i )%></td>
6623 dpurdie 249
                   <td nowrap><%=emailField(enum_imgUser & aVersions( rsRep.FieldIndex("full_name"), i ),  aVersions( rsRep.FieldIndex("user_email"), i ))%></td>
250
                   <td nowrap><%=DisplayShortDateTime ( aVersions( rsRep.FieldIndex("modified_stamp"), i ) )%></td>
251
                   <td data-pvid='<%=aVersions( rsRep.FieldIndex("pv_id"), i )%>'><%=DestroyPackage%></td>
252
                 </tr>
253
             <%  
254
 
255
             Next
256
 
257
             rsRep.Close()
258
 
259
           End If
260
             %>
261
         </form>
262
         </tbody>
263
       </table>
264
       <br>
265
       <!------------------------------------------------------------>         
266
       </td>
267
     <td bgcolor="#FFFFFF"><img src="images/h_trsp_dot.gif" width="10" height="500"></td>
268
   </tr>
269
 </table>
270
<%
271
End Sub
272
%>
5357 dpurdie 273
<html>
6623 dpurdie 274
   <head>
275
      <title>Release Manager</title>
276
      <link rel="shortcut icon" href="<%=FavIcon%>"/>
277
      <meta http-equiv="Pragma" content="no-cache">
278
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
279
      <link rel="stylesheet" href="images/release_manager_style.css?ver=<%=VixVerNum%>" type="text/css">
280
      <link rel="stylesheet" href="images/navigation.css?ver=<%=VixVerNum%>" type="text/css">
281
      <script language="JavaScript" src="images/common.js?ver=<%=VixVerNum%>"></script>
282
      <!-- DROPDOWN MENUS -->
283
      <%bJqueryDataTables=true%>
284
      <%sJqueryDataTablesCss="jquery/dataTables.vix.grey.css"%>
285
      <!--#include file="_jquery_includes.asp"-->
286
      <!--#include file="_menu_def.asp"-->
287
      <script language="JavaScript1.2" src="images/popup_menu.js?ver=<%=VixVerNum%>"></script>
288
      <script language="JavaScript" type="text/JavaScript">
289
      $(document).ready(function() {
6289 dpurdie 290
 
6623 dpurdie 291
        $('#versionTable').DataTable({
292
            "paging":   false,
293
            "ordering": true,
294
            "info":     true
295
            });
5759 dpurdie 296
 
6623 dpurdie 297
        // Add Title to icons
298
        $('.destroyThis').prop('title', 'Destroy this version of the package.');
299
 
300
        // Destroy a package version
301
        // 
302
        $( ".destroyThis" ).on( "click", function(event) {
303
            var pvid = $(this).closest('td').data('pvid');
304
            if (pvid) {
305
                var data = {
306
                    pv_id       : pvid,
307
                    bfile       : "<%=ScriptName%>",
308
                    pkg_id      : "<%=parPkgId%>",
309
                    listby      : "<%=parListBy%>",
310
                    fpkgversion : "<%=parFPkgVersion%>",
311
                };
312
                MM_openVixIFrame('_destroy_package.asp?' + encodeData(data), 'Destroy Package Version')
313
            }
314
        });
315
      });
316
 
317
      //  Encode data into URL
318
      function encodeData(data) {
319
          return Object.keys(data).map(function(key) {
320
              return [key, data[key]].map(encodeURIComponent).join("=");
321
          }).join("&");
322
      } 
323
 
324
      //# sourceURL=view_by_version.asp
325
      </script>
326
   </head>
327
   <body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0">
328
      <!-- HEADER -->
329
      <!--#include file="_header.asp"-->
330
      <!-- BODY ---->
331
      <table class="full_table">
332
         <tr>
333
            <td width="146px" class="panel_bg" valign="top">
334
               <!--#include file="_front_explorer.asp"-->
335
            </td>
336
            <td width="100%" rowspan="2" align="center" valign="top">
337
                <%Call MainPanelContent%>
338
            </td>
339
         </tr>
340
         <tr>
341
            <td class="panel_bg" valign="bottom" align="center" height="350">
342
                <img src="images/img_gear.gif" vspace="20" hspace="30"></td>
343
         </tr>
5357 dpurdie 344
      </table>
6623 dpurdie 345
      <!-- FOOTER -->
346
      <!--#include file="_footer.asp"-->
347
   </body>
5357 dpurdie 348
</html>
6623 dpurdie 349