Subversion Repositories DevTools

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
119 ghuddy 1
<%@LANGUAGE="VBSCRIPT"%>
2
<%
3
'=====================================================
129 ghuddy 4
'                  MAKE UNOFFICIAL
119 ghuddy 5
'               --- PROCESS FORM ---
6
'=====================================================
7
%>
8
<%
9
Option explicit
10
' Good idea to set when using redirect
129 ghuddy 11
Response.Expires = 0   ' always load the page, dont store
119 ghuddy 12
%>
13
 
14
<!--#include file="common/conf.asp"-->
15
<!--#include file="common/globals.asp"-->
16
<!--#include file="common/formating.asp"-->
17
<!--#include file="common/qstr.asp"-->
18
<!--#include file="common/common_subs.asp"-->
19
<!--#include file="common/common_dbedit.asp"-->
20
<%
21
'------------ ACCESS CONTROL ------------------
22
%>
23
<!--#include file="_access_control_login.asp"-->
24
<!--#include file="_access_control_general.asp"-->
25
<!--#include file="_access_control_project.asp"-->
26
<%
27
'------------ Variable Definition -------------
143 ghuddy 28
Dim isDLocked
119 ghuddy 29
'------------ Constants Declaration -----------
30
'------------ Variable Init -------------------
31
'----------------------------------------------
32
%>
33
<%
34
Sub MakeReject ()
129 ghuddy 35
   Dim objWSH
36
   Set objWSH = Server.CreateObject("WScript.Shell")
37
 
38
   objEH.TryORA ( OraSession )
39
   On Error Resume Next
40
 
143 ghuddy 41
   OraDatabase.Parameters.Add "PV_ID",   Request("pv_id"),        ORAPARM_INPUT, ORATYPE_NUMBER
42
   OraDatabase.Parameters.Add "RTAG_ID", Request("rtag_id"),      ORAPARM_INPUT, ORATYPE_NUMBER
43
   OraDatabase.Parameters.Add "USER_ID", objAccessControl.UserId, ORAPARM_INPUT, ORATYPE_NUMBER
129 ghuddy 44
 
45
   OraDatabase.ExecuteSQL _
46
   "BEGIN "&_
47
   " PK_ENVIRONMENT.MAKE_REJECT ( :PV_ID, :RTAG_ID, :USER_ID ); "&_
48
   "END; "
49
 
50
   objEH.CatchORA ( OraSession )
51
 
52
   OraDatabase.Parameters.Remove "PV_ID"
53
   OraDatabase.Parameters.Remove "RTAG_ID"
54
   OraDatabase.Parameters.Remove "USER_ID"
55
 
56
   If objEH.LastOraFailed = FALSE Then
57
      objWSH.Run   "cmd.exe /c cscript.exe //B //NoLogo "& rootPath & SCRIPTS_FOLDER &"\Admin_Tools.wsf //job:onMakeUnofficial "&_
58
                  "/pv_id:"& Request("pv_id") , _
59
                  0, FALSE
60
   End If
61
 
119 ghuddy 62
End Sub
143 ghuddy 63
 
64
Sub RejectAutobuild()
65
 
66
   OraDatabase.Parameters.Add "PV_ID",            Request("pv_id"),        ORAPARM_INPUT, ORATYPE_NUMBER
67
   OraDatabase.Parameters.Add "RTAG_ID",          Request("rtag_id"),      ORAPARM_INPUT, ORATYPE_NUMBER
68
   OraDatabase.Parameters.Add "USER_ID",          objAccessControl.UserId, ORAPARM_INPUT, ORATYPE_NUMBER
69
   OraDatabase.Parameters.Add "ACTION_TYPE_NAME", "reject_package",        ORAPARM_INPUT, ORATYPE_VARCHAR2
70
   OraDatabase.Parameters.Add "DESCRIPTION",      "Rejected manually following autobuild failure", ORAPARM_INPUT, ORATYPE_VARCHAR2
71
 
72
   On Error Resume Next
73
   objEH.TryORA( OraSession )
74
 
75
   ' Move package back to work-in-progress table (changes dlocked to "R" in doing so)
76
   OraDatabase.ExecuteSQL _
77
   "BEGIN "&_
78
   " PK_ENVIRONMENT.MAKE_REJECT ( :PV_ID, :RTAG_ID, :USER_ID ); "&_
79
   "END; "
80
 
81
   If Err.Number = 0 Then
82
 
83
      ' Remove the entry from the do not ripple table but only if it is a direct exlusion entry caused by some build problem.
84
      ' This way, if user has deliberately excluded the package from the build (root_pv_id is null, root_cause is null
85
      ' and root_file is null) then it will remain exlcuded, as it will if there is some underlying package that has caused
86
      ' the exclusion.
87
      OraDatabase.ExecuteSQL ("DELETE FROM do_not_ripple "&_
88
                              "      WHERE pv_id   = :PV_ID "&_
89
                              "        AND rtag_id = :RTAG_ID "&_
90
                              "        AND root_pv_id IS NULL"&_
91
                              "        AND ((root_cause IS NOT NULL) OR (root_file IS NOT NULL))" )
92
 
93
      If Err.Number = 0 Then
94
 
95
         OraDatabase.ExecuteSQL ("BEGIN Log_Action ( :PV_ID, :ACTION_TYPE_NAME, :USER_ID, :DESCRIPTION ); END;")
96
 
97
      End If
98
 
99
   End If
100
 
101
   objEH.CatchORA( OraSession )
102
 
103
   OraDatabase.Parameters.Remove "PV_ID"
104
   OraDatabase.Parameters.Remove "RTAG_ID"
105
   OraDatabase.Parameters.Remove "USER_ID"
106
   OraDatabase.Parameters.Remove "ACTION_TYPE_NAME"
107
   OraDatabase.Parameters.Remove "DESCRIPTION"
108
 
109
End Sub
110
 
119 ghuddy 111
%>
112
<%
113
'-----------------------  MAIN LINE  ---------------------------
114
 
143 ghuddy 115
'--- Process submit ---
119 ghuddy 116
If (Request("rtag_id") <> "") AND (Request("pv_id") <> "")  Then
129 ghuddy 117
 
118
 
143 ghuddy 119
   Call Get_Pkg_Short_Info( Request("pv_id"), NULL, NULL, NULL, NULL, NULL, isDLocked )
129 ghuddy 120
 
143 ghuddy 121
   If isDLocked = "A" Then
122
      'Do the reject operation - this execution path rejects an Approved package version back to Pending
123
 
124
      'We can only do this operation if the build daemon is not going to be doing anything with the entry in
125
      'the "package versions" table. We can only guarantee this if the Daemon has failed to build the package version
126
      'and placed an entry for it in the "do not ripple" table, so check this.
127
      If isInDoNotRippleTable( Request("rtag_id"), Request("pv_id") ) = TRUE Then
128
         Call RejectAutobuild()
129
      Else
130
         Call RaiseMsg(enum_MSG_ERROR, "Cannot reject unless item is certain not to be examined concurrently by a build daemon during the reject operation. Wait for the build to fail.")
131
      End If
132
   Else
133
      'Do the reject operation - this execution path rejects a Pending package version back to Work In Progress
134
      Call MakeReject()
135
   End If
136
 
137
 
138
 
129 ghuddy 139
   If Request("rfile") <> "" Then
140
      Response.Redirect ( Request("rfile") &"?pv_id="& Request("pv_id") &"&rtag_id="& Request("rtag_id") )
141
   Else
142
      Response.Redirect ( "dependencies?pv_id="& Request("pv_id") &"&rtag_id="& Request("rtag_id") )
143
   End If
144
 
119 ghuddy 145
Else
129 ghuddy 146
   Response.write "Some mendatory parameters are missing!" & "<br>" 'TODO
147
   Response.write QSTR_All
119 ghuddy 148
End If
149
%>
150
 
151
<!-- DESTRUCTOR ------->
129 ghuddy 152
<!--#include file="common/destructor.asp"-->