Subversion Repositories DevTools

Rev

Rev 183 | Blame | Compare with Previous | Last modification | View Log | RSS feed

<%@LANGUAGE="VBSCRIPT"%>
<%
Option explicit
Response.Expires = 0   ' always load the page, dont store
%>
<%
'=====================================================
'               System Unlock Package
'=====================================================
%>
<!--#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"-->
<%
'------------ 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 (bRunAdminTools)
   Dim objWSH

   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 (bRunAdminTools) Then
      Set objWSH = Server.CreateObject("WScript.Shell")

      objWSH.Run   "cmd.exe /c cscript.exe //B //NoLogo "& rootPath & SCRIPTS_FOLDER &"\Admin_Tools.wsf //job:onMakeUnofficial "&_
                  "/pv_id:"& Request("pv_id") , _
                  0, FALSE
   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 = objAccessControl.IsDataActive ("PROJECTS", DB_PROJ_ID, "EditProjects") AND objAccessControl.IsActive("UnlockPatch")
Else
  bcan_unlock = objAccessControl.IsActive("EditCriticalInfoForLockedPackage")
End If

If bcan_unlock  Then
  If rsQry("dlocked") = "Y" Then
    Call UnlockPackage (bis_patch)
    If bis_patch Then
      Response.Redirect ("dependencies.asp?rtag_id="& parRtag_id &"&pv_id="& parPv_id)
    Else
      Response.Redirect ( "fixed_issues.asp?rtag_id="& parRtag_id &"&pv_id="& parPv_id)
    End If
  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"-->