Subversion Repositories DevTools

Rev

Rev 5172 | Blame | Last modification | View Log | RSS feed

<%@LANGUAGE="VBSCRIPT"%>
<%
'=====================================================
'   _s_unlock_package.asp
'   System Unlock Package
'=====================================================
Option explicit
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="common/common_dbedit.asp"-->
<!--#include file="common/release_changed.asp"-->
<%
'------------ ACCESS CONTROL ------------------
%>
<!--#include file="_access_control_login.asp"-->
<!--#include file="_access_control_general.asp"-->
<!--#include file="_access_control_project.asp"-->
<%
'------------ Variable Definition -------------
Dim parPv_id
Dim QueryString, rsQry
'------------ Constants Declaration -----------
'------------ Variable Init -------------------
parPv_id = QStrPar("pv_id")
parRtag_id = QStrPar("rtag_id")
'----------------------------------------------
%>
<%
Sub UnlockPackage (bIsPatch)

   OraDatabase.Parameters.Add "PV_ID",   Request("pv_id"),        ORAPARM_INPUT, ORATYPE_NUMBER
   OraDatabase.Parameters.Add "USER_ID", objAccessControl.UserId, ORAPARM_INPUT, ORATYPE_NUMBER

   objEH.TryORA ( OraSession )
   On Error Resume Next

   OraDatabase.ExecuteSQL _
   "BEGIN  Unlock_Package( :PV_ID, :USER_ID );  END;"

   objEH.CatchORA ( OraSession )

   OraDatabase.Parameters.Remove "PV_ID"
   OraDatabase.Parameters.Remove "USER_ID"

   If (objEH.LastOraFailed = FALSE) AND (bIsPatch) Then
        ' If this is a patch, then make the package, in dpkg_archive, writable
        ' This is UGLY
        '
        Dim objRC: Set objRC = New ReleaseChanged
        Call objRC.MakeWritable(parRtag_id, parPv_id )

   End If
End Sub
%>
<%

'Process submition
'---------------------------------------
' THIS IS FOR SYSTEM ADMIN ONLY
'---------------------------------------
QueryString = "SELECT pv.DLOCKED, pv.IS_PATCH FROM PACKAGE_VERSIONS pv WHERE pv.PV_ID = "& parPv_id
Set rsQry = OraDatabase.DbCreateDynaset( QueryString, cint(0))
Dim bis_patch: bis_patch = Not IsNull(rsQry("is_patch"))
Dim spkgtype: spkgtype = iif(bis_patch,"patch","package")
Dim bcan_unlock

If bis_patch Then
  bcan_unlock = canActionControlInProject("UnlockPatch")
Else
  bcan_unlock = canActionControlInProject("EditCriticalInfoForLockedPackage")
End If

If bcan_unlock  Then
  If rsQry("dlocked") = "Y" Then
    Call UnlockPackage (bis_patch)
    Response.Redirect ( "fixed_issues.asp?rtag_id="& parRtag_id &"&pv_id="& parPv_id)
  Else
    Call RaiseMsg(enum_MSG_ERROR, "Can only unlock a " & spkgtype & " that is currently locked." )
  End If
Else
  Call RaiseMsg(enum_MSG_ERROR, "You do not have permissions to lock/unlock " & spkgtype & "." )
End If

rsQry.Close
Set rsQry = nothing

%>

<!-- DESTRUCTOR ------->
<!--#include file="common/destructor.asp"-->