Subversion Repositories DevTools

Rev

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