Subversion Repositories DevTools

Rev

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