<%@LANGUAGE="VBSCRIPT"%> <% '===================================================== ' _delete_package_name.asp ' Intended to be invoked within an Iframe '===================================================== %> <% Option explicit Response.Expires = 0 %> <% '------------ ACCESS CONTROL ------------------ %> <% '------------ VARIABLE DEFINITION ------------- Dim sMessage, sMessageType Dim parPkgId Dim rsQry Dim Qstring Dim pName Dim canDoBad '------------ CONSTANTS DECLARATION ----------- '------------ VARIABLE INIT ------------------- sMessage = NULL sMessageType = 3 parPkgId = Request("pkgId") canDoBad = canShowControlInProject ("CreateNewVersion") 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 & "
" End If sMessage = sMessage & text If eLevel < sMessageType Then sMessageType = eLevel End If End Sub ' ' Check that the package is not in use ' Function GetPackageVersionCount (nPkgId) Dim SqlQry Dim rsQry GetPackageVersionCount = 0 OraDatabase.Parameters.Add "PKGID", nPkgId, ORAPARM_INPUT, ORATYPE_NUMBER objEH.ErrorRedirect = FALSE objEH.TryORA ( OraSession ) On Error Resume Next SqlQry = "select count(*) as count from PACKAGES pkg, PACKAGE_VERSIONS pv " &_ " where pv.PKG_ID = pkg.PKG_ID AND pkg.PKG_ID = :PKGID" Set rsQry = OraDatabase.DbCreateDynaset( SqlQry, ORADYN_DEFAULT ) objEH.CatchORA ( OraSession ) If objEH.Finally Then If ((NOT rsQry.BOF) AND (NOT rsQry.EOF)) Then GetPackageVersionCount = rsQry("count") End If End If rsQry.Close Set rsQry = Nothing OraDatabase.Parameters.Remove "PKGID" End Function ' ' Delete the package name Sub DestroyPackage ( nPkgId ) OraDatabase.Parameters.Add "PKGID", nPkgId, ORAPARM_INPUT, ORATYPE_NUMBER objEH.ErrorRedirect = FALSE objEH.TryORA ( OraSession ) On Error Resume Next OraDatabase.ExecuteSQL "delete from packages where pkg_id = :PKGID" objEH.CatchORA ( OraSession ) OraDatabase.Parameters.Remove "PKGID" End Sub '------------ RUN BEFORE PAGE RENDER ---------- ' Setup persistance object Call objPMod.StoreParameter ( "bfile", Request("bfile") ) Call objPMod.StoreParameter ( "pkgid", Request("pkgid") ) ' Basic sanity checks ' If objAccessControl.UserId = "" Then sMessageAdd 1, "No longer logged in" End If If parPkgId = "" Then sMessageAdd 1, "Internal: PKGID not provided" End If If CBool(Request("action")) AND isNULL(sMessage) Then ' ' Attempt to destroy the package name DestroyPackage parPkgId If GetPackageVersionCount(parPkgId) = 0 Then If Request("bfile") <> "" Then OpenInParentWindow(objPMod.GetParamValue("bfile") &"?DESTROYED=OK"& objPMod.ComposeURLWithout("bfile,pkgId")) Else ReloadParentWindow() End If Call Destroy_All_Objects Response.End End If End If ' Need to generate a display ' Get the Package Version information ' Qstring = "SELECT p.pkg_name" &_ " FROM packages p" &_ " WHERE p.pkg_id = " & parPkgId Set rsQry = OraDatabase.DbCreateDynaset( Qstring, cint(0)) If rsQry.RecordCount = 0 Then sMessageAdd 1, "Package Name no longer exists" End If If NOT canDoBad Then sMessageAdd 1, "You do not have permission to delete a unused package name" End If If GetPackageVersionCount(parPkgId) <> 0 Then sMessageAdd 1, "Package name is used. Cannot delete a name that is in use" End If pName = rsQry("pkg_name") rsQry.Close Set rsQry = nothing '---------------------------------------------- %> Release Manager <% '-- FROM START -------------------------------------------------------------------------------------------------------------- objFormComponent.FormName = "FormName" objFormComponent.FormClass = "form_tight" objFormComponent.Action = ScriptName Call objFormComponent.FormStart() %> <%=objPMod.ComposeHiddenTags()%> <% Call objFormComponent.FormEnd() '-- FROM END ---------------------------------------------------------------------------------------------------------------- %>
<%=enum_IMG_Critical%>You are about to delete the unused package name: <%=pName%>.
<%Call Messenger ( sMessage , sMessageType, "100%" )%>
<%If isNULL(sMessage) Then%> <%End If%>
<% '------------ RUN AFTER PAGE RENDER ----------- Set objFormCollector = Nothing '---------------------------------------------- On Error Resume Next Call Destroy_All_Objects %>