Subversion Repositories DevTools

Rev

Rev 6612 | Rev 6707 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

<%@LANGUAGE="VBSCRIPT"%>
<%
'=====================================================
'|                                                   |
'|          Edit/View Build Configuration            |
'|                                                   |
'=====================================================
%>
<%
Option explicit
' Good idea to set when using redirect
Response.Expires = 0    ' always load the page, dont store
%>
<!--#include file="common/conf.asp"-->
<!--#include file="common/globals.asp"-->
<!--#include file="common/formating.asp"-->
<!--#include file="common/qstr.asp"-->
<!--#include file="common/common_subs.asp"-->
<!--#include file="class/classSortHelper.asp"-->
<%
'------------ ACCESS CONTROL ------------------
%>
<!--#include file="_access_control_login_optional.asp"-->
<!--#include file="_access_control_general.asp"-->
<%
'------------ Variable Definition -------------
Dim rsRep
Dim parFPkgVersion
Dim sLink
Dim parPkgId
Dim PackageName
Dim imgLock
Dim imgData
Dim DestroyPackage
Dim CanDestroyProjectPackage
Dim CanDestroyPackage
Dim hideRipple
Dim rippleFilter
'------------ Constants Declaration -----------
Const IMG_OFFICIAL = "<img src='images/i_locked.gif' width='7' height='10' hspace='5' vspace='2' alt='Package is official'>"
Const IMG_NOT_OFFICIAL = "<img src='images/spacer.gif' width='7' height='10' hspace='5' vspace='2'>"
'------------ Variable Init -------------------
parFPkgVersion = RequestDefault("fpkgversion", "*")
parPkgId = Request("pkg_id")
If Request("hideRipple") = "True" Then 
    hideRipple = True
    rippleFilter = " AND PV.BUILD_TYPE != 'Y'"
Else
    hideRipple = False
    rippleFilter = ""
End If
'----------------------------------------------
'   Convert PKG_ID into a package name
Function GetPackageName ( nPkgId )
    Dim rsQry, query
    
    query = "SELECT PKG_NAME  FROM PACKAGES  WHERE PKG_ID = :PKG_ID"
    OraDatabase.Parameters.Add "PKG_ID", nPkgId, ORAPARM_INPUT, ORATYPE_NUMBER
    Set rsQry = OraDatabase.DbCreateDynaset( query, 0 )
    OraDatabase.Parameters.Remove "PKG_ID"
    GetPackageName = rsQry("pkg_name")
    
    rsQry.Close()
    Set rsQry = nothing
End Function

'----------------------------------------------
'   Determine if a PKG_ID has any package-versions
'   If not then it can be deleted
Function hasNoVersions ( nPkgId )
    Dim rsQry, query
    
    query = "select count(*) as count from package_versions where pkg_id = :PKG_ID"
    OraDatabase.Parameters.Add "PKG_ID", nPkgId, ORAPARM_INPUT, ORATYPE_NUMBER
    Set rsQry = OraDatabase.DbCreateDynaset( query, 0 )
    OraDatabase.Parameters.Remove "PKG_ID"

    hasNoVersions = NOT rsQry("count") <> 0
    
    rsQry.Close()
    Set rsQry = nothing
End Function

'==================== MAIN LINE ===============================
If (parPkgId = "") Then 
    Call Destroy_All_Objects
    Response.Redirect ("index.asp")
End If

PackageName = GetPackageName ( parPkgId )
'==============================================================
Sub MainPanelContent
%>
<!-- MainPanelContent -->
 <table width="100%" border="0" cellspacing="0" cellpadding="0">
   <tr> 
     <td width="1%"></td>
     <td width="100%" align="right"><img src="images/h_trsp_dot.gif" width="1" height="20"></td>
     <td width="1%"></td>
   </tr>
   <tr> 
     <td bgcolor="#FFFFFF"><img src="images/h_trsp_dot.gif" width="10" height="500"></td>
     <td bgcolor="#FFFFFF" valign="top"> 
       <!-- PACKAGE SEARCH ------------------------------------------------>
       <%
       
       Dim aVersions
       Dim lastRow
       Dim objSortHelper
       Dim i
       
       OraDatabase.Parameters.Add "PKG_VERSION",   Replace( parFPkgVersion, "*", "%" ), ORAPARM_INPUT, ORATYPE_VARCHAR2
       OraDatabase.Parameters.Add "PKG_ID",    parPkgId, ORAPARM_INPUT, ORATYPE_NUMBER
       
       Set rsRep = OraDatabase.DbCreateDynaset( GetQuery("FindPackageVersion.sql") & rippleFilter, 0 )
       
       OraDatabase.Parameters.Remove "PKG_ID"
       OraDatabase.Parameters.Remove "PKG_VERSION"
       
       
       %>
       
       <table id="versionTable" width="100%"  border="0" cellspacing="1" cellpadding="2">
           <thead>
             <tr>
               <td class="body_sect" colspan='10'>Package Versions</td>
             </tr>
             <tr class="form_field_bg">
               <td nowrap" class="body_txt" colspan='10'>
                   Results for <b><%=PackageName%></b>
               </td>
             </tr>
           <form name="versions" method="get" action="<%=ScriptName%>">
             <input type="hidden" name="pkg_id" value="<%=parPkgId%>">
             <input type="hidden" name="listby" value="<%=parListBy%>">
            <tr class="form_field_bg">
               <td width="20px" nowrap class="body_col"></td>
               <td width="10%" nowrap class="body_col">Version</td>
               <td width="80%" nowrap class="body_col">Reason for Release</td>
               <td width="1%" nowrap class="body_col tcenter" rowspan="2">Build<br>Reason</td>
               <td width="1%" nowrap class="body_col tcenter" rowspan="2">Lines of<br>Code</td>
               <td width="1%" nowrap class="body_col tcenter" rowspan="2">Auto<br>Tests</td>
               <td width="1%" nowrap class="body_col tcenter" rowspan="2">Build<br>Time</td>
               <td width="10%" nowrap class="body_col tcenter" colspan="2">Last Modified</td>
               <td width="21px" nowrap class="body_col"></td>
             </tr>
             <tr class="body_col form_field_bg">
               <td nowrap ></td>
               <td nowrap ><input name="fpkgversion" type="text" class="form_item" size="15" value="<%=parFPkgVersion%>"></td>
               <td nowrap >
                 <%
                 Response.write "<a href='"& scriptName &"?"& Persists_Query_String( "hideRipple=" & not hideRipple ) &"'>"
                     If hideRipple Then
                       Response.write "<img src='images/RippleSquareOff.gif' width='20' height='20' border='0' title='Rippled Versions Hidden. Toggle'>"
                     Else
                       Response.write "<img src='images/RippleSquare.gif' width='20' height='20' border='0' title='Rippled Versions Shown. Toggle'>"
                     End If
                 Response.write "</a>"
                 %>
               </td>
               <td nowrap class="tcenter">Who</td>
               <td nowrap class="tcenter">Date</td>
               <td nowrap ></td>
             </tr>
           </thead>
           <tbody>
           
           <%If rsRep.RecordCount = 0 Then%>
               <tr>
                <td colspan='10' class='body_row'>
                <%If hasNoVersions(parPkgId) Then %>
                    This package name has no versions.
                               <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>
                <%Else%>
                    Found 0 records - with current filters.
                <%End If%>
                </td>
               </tr>

           <%Else
               
               aVersions = rsRep.GetRows()
               lastRow = UBound( aVersions, 2 )
               
               ' Sort versions
               Set objSortHelper = New SortHelper
               Call objSortHelper.VersionSort( aVersions, 0, lastRow, rsRep.FieldIndex("pkg_version") )
               
               
               ' Not in a project context
               ' Only god-like users will have this permission
               CanDestroyProjectPackage = canShowControl( "DestroyPackage" )
               
             ' Descending order
             For i = lastRow To 0 Step -1
               imgLock = IMG_NOT_OFFICIAL
               imgData = 2
               If (aVersions( rsRep.FieldIndex("dlocked"), i ) = "Y")  OR (aVersions( rsRep.FieldIndex("dlocked"), i ) = "A") Then
                   imgLock = IMG_OFFICIAL
               imgData = 1
               End If
               
               sLink = "dependencies.asp?pv_id="& aVersions( rsRep.FieldIndex("pv_id"), i )

               ' User can try to delete package iff
               '   Have suffiecient access (unusual)
               '   They created it or is its owner
               '   The version is not in use by any release (allow to be in pending or WIP)
               '   [Not at the moment] The package was created less than xxxx days ago
               '   Is not locked or Approved for Autobuild
               CanDestroyPackage = CanDestroyProjectPackage
               If CanDestroyPackage = false Then
                   If  objAccessControl.UserId = aVersions( rsRep.FieldIndex("CREATOR_ID"), i ) OR objAccessControl.UserId = aVersions( rsRep.FieldIndex("OWNER_ID"), i )Then
                       If aVersions( rsRep.FieldIndex("inuse"), i ) = 0 Then
                           'If aVersions( rsRep.FieldIndex("age") , i ) < 1000 Then
                               If aVersions( rsRep.FieldIndex("dlocked"), i ) <> "Y" Then
                                   'If aVersions( rsRep.FieldIndex("dlocked"), i ) <> "A" Then
                                       CanDestroyPackage = true
                                   'End If
                               End If
                           'End If
                       End If
                   End If
               End If
               
               ' Set destroy package action
               ' title will be added by javascript
               If CanDestroyPackage Then
                    DestroyPackage = "<img src='icons/i_destroy_package_sml.gif' width='15' height='15' border='0' class='destroyThis'>"
               Else
                    DestroyPackage = ""
               End If

               Dim testCount
               testCount = aVersions( rsRep.FieldIndex("test_count"), i )
               If testCount = 0 Then testCount = ""

             %>
                 <tr valign="top" class="body_row form_field_grey_bg"> 
                   <td data-order='<%=imgData%>'><%=imgLock%></td>
                   <td nowrap><a href="<%=sLink%>" class="body_link"><%=aVersions( rsRep.FieldIndex("pkg_version"), i )%></a></td>
                   <td class="body_txt_gray"><%=NewLine_To_BR ( To_HTML( aVersions( rsRep.FieldIndex("comments"), i ) ) )%></td>
                   <td nowrap><%=aVersions( rsRep.FieldIndex("reason"), i )%></td>
                   <td nowrap class='tright'><%=aVersions( rsRep.FieldIndex("code_lines"), i )%></td>
                   <td nowrap class='tright'><%=testCount%></td>
                   <td nowrap class='tright'><%=aVersions( rsRep.FieldIndex("build_time"), i )%></td>
                   <td nowrap><%=emailField(enum_imgUser & aVersions( rsRep.FieldIndex("full_name"), i ),  aVersions( rsRep.FieldIndex("user_email"), i ))%></td>
                   <td nowrap><%=DisplayShortDateTime ( aVersions( rsRep.FieldIndex("modified_stamp"), i ) )%></td>
                   <td data-pvid='<%=aVersions( rsRep.FieldIndex("pv_id"), i )%>'><%=DestroyPackage%></td>
                 </tr>
             <%  
                 
             Next
             
             rsRep.Close()
             
           End If
             %>
         </form>
         </tbody>
       </table>
       <br>
       <!------------------------------------------------------------>         
       </td>
     <td bgcolor="#FFFFFF"><img src="images/h_trsp_dot.gif" width="10" height="500"></td>
   </tr>
 </table>
<%
End Sub
%>
<html>
   <head>
      <title>Release Manager</title>
      <link rel="shortcut icon" href="<%=FavIcon%>"/>
      <meta http-equiv="Pragma" content="no-cache">
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
      <link rel="stylesheet" href="images/release_manager_style.css?ver=<%=VixVerNum%>" type="text/css">
      <link rel="stylesheet" href="images/navigation.css?ver=<%=VixVerNum%>" type="text/css">
      <script language="JavaScript" src="images/common.js?ver=<%=VixVerNum%>"></script>
      <!-- DROPDOWN MENUS -->
      <%bJqueryDataTables=true%>
      <%sJqueryDataTablesCss="jquery/dataTables.vix.grey.css"%>
      <!--#include file="_jquery_includes.asp"-->
      <!--#include file="_menu_def.asp"-->
      <script language="JavaScript1.2" src="images/popup_menu.js?ver=<%=VixVerNum%>"></script>
      <script language="JavaScript" type="text/JavaScript">
      $(document).ready(function() {

        $('#versionTable').DataTable({
            "paging":   false,
            "ordering": true,
            "info":     true
            });

        // Add Title to icons
        $('.destroyThis').prop('title', 'Destroy this version of the package.');

        // Destroy a package version
        // 
        $( ".destroyThis" ).on( "click", function(event) {
            var pvid = $(this).closest('td').data('pvid');
            if (pvid) {
                var data = {
                    pv_id       : pvid,
                    bfile       : "<%=ScriptName%>",
                    pkg_id      : "<%=parPkgId%>",
                    listby      : "<%=parListBy%>",
                    fpkgversion : "<%=parFPkgVersion%>",
                };
                MM_openVixIFrame('_destroy_package.asp?' + encodeData(data), 'Destroy Package Version')
            }
        });
      });

      //  Encode data into URL
      function encodeData(data) {
          return Object.keys(data).map(function(key) {
              return [key, data[key]].map(encodeURIComponent).join("=");
          }).join("&");
      } 

      //# sourceURL=view_by_version.asp
      </script>
   </head>
   <body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0">
      <!-- HEADER -->
      <!--#include file="_header.asp"-->
      <!-- BODY ---->
      <table class="full_table">
         <tr>
            <td width="146px" class="panel_bg" valign="top">
               <!--#include file="_front_explorer.asp"-->
            </td>
            <td width="100%" rowspan="2" align="center" valign="top">
                <%Call MainPanelContent%>
            </td>
         </tr>
         <tr>
            <td class="panel_bg" valign="bottom" align="center" height="350">
                <img src="images/img_gear.gif" vspace="20" hspace="30"></td>
         </tr>
      </table>
      <!-- FOOTER -->
      <!--#include file="_footer.asp"-->
   </body>
</html>