Subversion Repositories DevTools

Rev

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

<%@LANGUAGE="VBSCRIPT"%>
<%
'=====================================================
'   _destroy_package.asp
'   Intended to be invoked within an Iframe
'=====================================================
%>
<%
Option explicit
Response.Expires = 0
%>
<!--#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="common/_form_window_common.asp"-->
<%
'------------ ACCESS CONTROL ------------------
%>
<!--#include file="_access_control_general.asp"-->
<%
'------------ VARIABLE DEFINITION -------------
Dim sMessage, sMessageType
Dim parPvId
Dim rsQry, rsView
Dim Qstring
Dim pName, pVersion
Dim illAdvised, canDoBad
'------------ CONSTANTS DECLARATION -----------
'------------ VARIABLE INIT -------------------
sMessage = NULL
sMessageType = 3
parPvId = Request("pv_id")
canDoBad = canShowControlInProject ("DestroyPackage")
illAdvised = FALSE
Set objFormCollector = CreateObject("Scripting.Dictionary")
'------------ CONDITIONS ----------------------
'----------------------------------------------
%>
<%
'------------------------------------------------------------------------------------------------------------------------------------------
'
' Add a line of text to the System Message
'   eLevel - 1 == Critical, 2==Warning, 3==Note
Sub sMessageAdd(eLevel, text)
    If NOT isNull(sMessage) Then
        sMessage = sMessage & "<br>"
    End If
    sMessage = sMessage & text

    If eLevel < sMessageType  Then
        sMessageType = eLevel
    End If
End Sub

Sub DestroyPackage ( nPvId, cOverrideWarnings, outSet )

   OraDatabase.Parameters.Add "PV_ID",             nPvId,             ORAPARM_INPUT,  ORATYPE_NUMBER
   OraDatabase.Parameters.Add "RTAG_ID",           parRtag_Id,        ORAPARM_INPUT,  ORATYPE_NUMBER
   OraDatabase.Parameters.Add "OVERRIDE_WARNINGS", cOverrideWarnings, ORAPARM_INPUT,  ORATYPE_NUMBER
   OraDatabase.Parameters.Add "RESULTS",          NULL,               ORAPARM_OUTPUT, ORATYPE_CURSOR

   objEH.ErrorRedirect = FALSE
   objEH.TryORA ( OraSession )
   On Error Resume Next

   OraDatabase.ExecuteSQL _
   "BEGIN "&_
   " PK_PACKAGE.destroy_package_extended (:PV_ID, :RTAG_ID, :OVERRIDE_WARNINGS, :RESULTS ); "&_
   "END; "

   objEH.CatchORA ( OraSession )

    ' NULL RESULTS list indicates that the operation did not generate any errors
    outSet = nothing
    If NOT isNull(OraDatabase.Parameters("RESULTS").Value) Then
        Set outSet = OraDatabase.Parameters("RESULTS").Value
    End If

   OraDatabase.Parameters.Remove "PV_ID"
   OraDatabase.Parameters.Remove "RTAG_ID"
   OraDatabase.Parameters.Remove "OVERRIDE_WARNINGS"
   OraDatabase.Parameters.Remove "RESULTS"
End Sub

Function getRecordCount( obj )
    getRecordCount = 0
    If NOT isNull(obj) Then
        If isObject(obj) Then
            getRecordCount = obj.RecordCount
        End If
    End If
End Function

'------------ RUN BEFORE PAGE RENDER ----------
' Setup persistance object
Call objPMod.StoreParameter ( "bfile", Request("bfile") )
Call objPMod.StoreParameter ( "rfile", Request("rfile") )
Call objPMod.StoreParameter ( "rtag_id", Request("rtag_id") )
Call objPMod.StoreParameter ( "pv_id", Request("pv_id") )
Call objPMod.StoreParameter ( "pkg_id", Request("pkg_id") )
Call objPMod.StoreParameter ( "OLDpv_id", Request("OLDpv_id") )
Call objPMod.StoreParameter ( "FLuser_name", Request("FLuser_name") )
Call objPMod.StoreParameter ( "FLpkg_version", Request("FLpkg_version") )
Call objPMod.StoreParameter ( "listby", Request("listby") )
Call objPMod.StoreParameter ( "index", Request("index") )
'   Basic sanity checks
'
If objAccessControl.UserId = "" Then
    sMessageAdd 1, "No longer logged in"
End If

If parPvId = "" Then
    sMessageAdd 1, "Internal: PVID not provided"
End If

If CBool(Request("action")) AND isNULL(sMessage) Then
    '
    '   Attempt to destroy the package    
    DestroyPackage parPvId, RequestDefault("destroy", 1), rsView
    If getRecordCount(rsView) = 0 Then
        If Request("bfile") <> "" Then
            OpenInParentWindow(objPMod.GetParamValue("bfile") &"?DESTROYED=OK"& objPMod.ComposeURLWithout("bfile,pv_id"))
        Else
            ReloadParentWindow()
        End If
        Call Destroy_All_Objects
        Response.End
    End If
Else
    '
    '   Show the current set of reasons for NOT destroying the package
    DestroyPackage parPvId, 0, rsView
End If

'   Need to generate a display
'   Get the Package Version information
'
Qstring = "SELECT p.pkg_name, pv.pkg_version" &_
          " FROM packages p, package_versions pv" &_
          " WHERE p.pkg_id = pv.pkg_id" &_
          "   AND pv.pv_id = " & parPvId

Set rsQry = OraDatabase.DbCreateDynaset( Qstring, cint(0))
If rsQry.RecordCount = 0 Then
    sMessageAdd 1, "Package Version no longer exists"
End If
pName = rsQry("pkg_name")
pVersion = rsQry("pkg_version") 
rsQry.Close
Set rsQry = nothing

'----------------------------------------------
%>
<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 href="images/release_manager_style.css" rel="stylesheet" type="text/css">
<script language="JavaScript" src="images/common.js"></script>
</head>
<body background="images/bg_bage_0.gif" leftmargin="0" topmargin="0" >
<table class="full_table body_txt" border="0" cellspacing="0" cellpadding="10">
   <tr>
      <td bgcolor="#FFFFFF" class="body_txt nowrap">
        <%=enum_IMG_Critical%><span>You are about to destroy <%=pName%>&nbsp;<%=pVersion%>. You cannot undo this operation.</span>
      </td>
   </tr>
   <%
   '-- FROM START --------------------------------------------------------------------------------------------------------------
   objFormComponent.FormName = "FormName"
   objFormComponent.FormClass = "form_tight"
   objFormComponent.Action = ScriptName
   Call objFormComponent.FormStart()
   %>
   <tr>
      <td>
         <!-- NEW PRODUCT +++++++++++++++++++++++++++++++++++++++++++++++ -->
         <%Call Messenger ( sMessage , sMessageType, "100%" )%>
         <!-- MESSAGE +++++++++++++++++++++++++++++++++++++++++++++++++++ -->
         <!--#include file="messages/_msg_inline.asp"-->

         <%If IsObject(rsView) Then %>
         <%If rsView.RecordCount > 0 Then %>
         <table width="50%" border="0" class=body_txt>
            <tr>
               <td colspan=3><b>This package is in use</b></th>
            </tr>
            <%
            Do Until ((rsView.BOF) OR (rsView.EOF))
                 Dim mtype
                 mtype = rsView("mtype")
                 Response.Write "<tr><td nowrap>"
                 If mtype <> "A" Then
                    Response.Write enum_imgCritical
                    illAdvised = TRUE
                 End If
                 Response.Write "<td nowrap>" & rsView("MSG") & "</td>"  
                 Response.Write "</tr>"          
                 rsView.MoveNext
              Loop
            %>
         </table>
         <%ElseIf isNULL(sMessage) Then%>
         There is no reasons that this package cannot be destroyed.
         <%End If%>
         <%End If%>
      </td>
   </tr>
<%If illAdvised Then %>
    <%If canDoBad Then %>
          <td bgcolor="#FFFFFF">
            <table class="full_table body_txt" >
                <tr>
                    <td>Destroy this version, even though it will affect other packages and releases. The package will be removed from:
                    <ul>
                        <li>All packages that depend on this version
                        <li>All SDKs that use this version
                        <li>All SBOMS that use this version
                    </ul>
                    This is strongly discouraged.
                    </td>
                    <td><input name=destroy value=2 type="checkbox"></td>
                </tr>
            </table>
          </td>
    <%Else%>
          <td bgcolor="#FFFFFF">
            You do not have permission to destroy this package. The side effects of destroying
            this package are wide ranging.
          </td>
    <%End If%>
<%End If%>
   <tr>
      <td bgcolor="#FFFFFF">
         <table class=full_table >
            <tr>
               <td><%=ProgressBar()%></td>
               <td align="right">
                  <%If isNULL(sMessage) Then%>
                  <input name="btn" type="submit" class="form_btn" value="Destroy">
                  <%End If%>
                  <input name="btn" type="reset" class="form_btn" value="Cancel" onclick="parent.closeIFrame();">
               </td>
            </tr>
         </table>
      </td>
   </tr>
   <%=objPMod.ComposeHiddenTags()%>
   <input type="hidden" name="action" value="true">
   <%
   Call objFormComponent.FormEnd()
   '-- FROM END ----------------------------------------------------------------------------------------------------------------
   %>
</table>
</body>
</html>
<%
'------------ RUN AFTER PAGE RENDER -----------
Set objFormCollector = Nothing
'----------------------------------------------
On Error Resume Next
rsView.Close
Set rsView = nothing
Call Destroy_All_Objects
%>