| 119 |
ghuddy |
1 |
<%@LANGUAGE="VBSCRIPT"%>
|
|
|
2 |
<%
|
|
|
3 |
'=====================================================
|
|
|
4 |
' UPDATE dependencies
|
|
|
5 |
' --- PROCESS FORM ---
|
|
|
6 |
'=====================================================
|
|
|
7 |
%>
|
|
|
8 |
<%
|
|
|
9 |
Option explicit
|
|
|
10 |
' Good idea to set when using redirect
|
|
|
11 |
Response.Expires = 0 ' always load the page, dont store
|
|
|
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 |
' Set rfile parameter. This is a return page after Login
|
|
|
22 |
Call objPMod.StoreParameter ( "rfile", "dependencies.asp" )
|
|
|
23 |
'------------ ACCESS CONTROL ------------------
|
|
|
24 |
%>
|
|
|
25 |
<!--#include file="_access_control_login.asp"-->
|
|
|
26 |
<!--#include file="_access_control_general.asp"-->
|
|
|
27 |
<!--#include file="_access_control_project.asp"-->
|
|
|
28 |
<%
|
|
|
29 |
'------------ Variable Definition -------------
|
|
|
30 |
Dim depArray()
|
|
|
31 |
Dim array_is_empty
|
|
|
32 |
'------------ Constants Declaration -----------
|
|
|
33 |
Const enumlocal_DONOT_DELETE_OLD_DEPENDENCIES = 0
|
|
|
34 |
Const enumlocal_DELETE_OLD_DEPENDENCIES = 1
|
|
|
35 |
Const COL_pkg_name = 0
|
|
|
36 |
Const COL_pkg_version = 1
|
|
|
37 |
Const COL_build_type = 2
|
|
|
38 |
'------------ Variable Init -------------------
|
|
|
39 |
'----------------------------------------------
|
|
|
40 |
%>
|
|
|
41 |
<%
|
|
|
42 |
Sub Populate_depArray_from_Import ( SSdep_import, ARRdep, BBarray_is_empty )
|
|
|
43 |
Dim depList, lastItem, i, recCnt, pkg_name, pkg_version
|
|
|
44 |
|
|
|
45 |
If (SSdep_import = "") Then Exit Sub ' exit if no dependencies are submited
|
|
|
46 |
|
|
|
47 |
' Decode Server.URLEncode if present
|
|
|
48 |
SSdep_import = URLDecode( SSdep_import )
|
|
|
49 |
|
|
|
50 |
SSdep_import = Replace(SSdep_import, " ", "") ' remove spaces
|
|
|
51 |
SSdep_import = Replace(SSdep_import, VBTab, "") ' remove horizontal tabs
|
|
|
52 |
SSdep_import = Replace(SSdep_import, VBVerticalTab, "") ' remove vertical tabs
|
|
|
53 |
SSdep_import = Replace(SSdep_import, """", "'") ' replace " with '
|
|
|
54 |
|
|
|
55 |
depList = Split( SSdep_import, "'")
|
|
|
56 |
|
|
|
57 |
recCnt = 0
|
|
|
58 |
lastItem = UBound(depList)
|
|
|
59 |
For i = 1 To lastItem Step 4
|
|
|
60 |
pkg_name = depList(i)
|
|
|
61 |
pkg_version = depList(i+2)
|
|
|
62 |
|
|
|
63 |
' Proceed only if:
|
|
|
64 |
' pkg name is not empty,
|
|
|
65 |
' pkg version is not empty,
|
|
|
66 |
' line is not commented out with #
|
|
|
67 |
|
|
|
68 |
If ( pkg_name <> "" ) AND ( pkg_version <> "" ) AND (InStr(depList(i-1), "#") = 0) Then
|
|
|
69 |
ReDim Preserve ARRdep( 2, recCnt )
|
|
|
70 |
ARRdep( COL_pkg_name, recCnt ) = pkg_name
|
|
|
71 |
ARRdep( COL_pkg_version, recCnt ) = pkg_version
|
|
|
72 |
|
|
|
73 |
' Define build type
|
|
|
74 |
If InStr(depList(i-1), "BuildPkgArchive") > 0 Then
|
|
|
75 |
ARRdep( COL_build_type, recCnt ) = enum_BUILD_PKG_ARCHIVE
|
|
|
76 |
|
|
|
77 |
ElseIf InStr(depList(i-1), "LinkPkgArchive") > 0 Then
|
|
|
78 |
ARRdep( COL_build_type, recCnt ) = enum_LINK_PKG_ARCHIVE
|
|
|
79 |
|
|
|
80 |
Else
|
|
|
81 |
ARRdep( COL_build_type, recCnt ) = enum_BUILD_PKG_ARCHIVE 'neither build_package or link_package is found, hence set to...
|
|
|
82 |
|
|
|
83 |
End If
|
|
|
84 |
|
|
|
85 |
recCnt = recCnt + 1
|
|
|
86 |
BBarray_is_empty = FALSE
|
|
|
87 |
End If
|
|
|
88 |
|
|
|
89 |
Next
|
|
|
90 |
|
|
|
91 |
End Sub
|
|
|
92 |
|
|
|
93 |
|
|
|
94 |
Sub Populate_depArray_from_ADD_Custom ( NNpkg_list, ARRdep, BBarray_is_empty )
|
|
|
95 |
Dim depList, lastItem, i, recCnt, pkg_name, pkg_version, V_EXT
|
|
|
96 |
Dim rsTemp, Query_String, PkgBaseView
|
|
|
97 |
|
|
|
98 |
PkgBaseView = Get_Pkg_Base_View_ID ( Request("pv_id"), Request("rtag_id") )
|
|
|
99 |
|
|
|
100 |
Query_String = _
|
|
|
101 |
" SELECT pkg_id, pkg_name"&_
|
|
|
102 |
" FROM packages"&_
|
|
|
103 |
" WHERE pkg_id IN ("& NNpkg_list &")"
|
|
|
104 |
Set rsTemp = OraDatabase.DbCreateDynaset( Query_String, cint(0))
|
|
|
105 |
|
|
|
106 |
recCnt = 0
|
|
|
107 |
While ((NOT rsTemp.BOF) AND (NOT rsTemp.EOF))
|
|
|
108 |
ReDim Preserve ARRdep( 2, recCnt )
|
|
|
109 |
ARRdep( COL_pkg_name, recCnt ) = rsTemp("pkg_name")
|
|
|
110 |
ARRdep( COL_pkg_version, recCnt ) = Request( "pkgn"& rsTemp("pkg_id") )
|
|
|
111 |
|
|
|
112 |
'// Dependencies comming from custom dependency add are set to LinkPkgArchive by default, unless it is a product
|
|
|
113 |
If PkgBaseView = enumBASE_VIEW_PRODUCTS Then
|
|
|
114 |
ARRdep( COL_build_type, recCnt ) = enum_BUILD_PKG_ARCHIVE
|
|
|
115 |
Else
|
|
|
116 |
ARRdep( COL_build_type, recCnt ) = enum_LINK_PKG_ARCHIVE
|
|
|
117 |
End If
|
|
|
118 |
|
|
|
119 |
recCnt = recCnt + 1
|
|
|
120 |
BBarray_is_empty = FALSE
|
|
|
121 |
rsTemp.MoveNext
|
|
|
122 |
WEnd
|
|
|
123 |
|
|
|
124 |
rsTemp.Close
|
|
|
125 |
Set rsTemp = nothing
|
|
|
126 |
End Sub
|
|
|
127 |
|
|
|
128 |
|
|
|
129 |
Sub Populate_depArray_from_EDIT_Custom ( NNpv_id, ARRdep, BBarray_is_empty, sDependBlock )
|
|
|
130 |
Dim depList, lastItem, i, recCnt, pkg_name, pkg_version, V_EXT
|
|
|
131 |
Dim rsTemp, rsCurrent, Query_String
|
|
|
132 |
|
|
|
133 |
Query_String = _
|
|
|
134 |
" SELECT dpkg.pkg_name, dpv.pkg_version, dpv.pv_id"&_
|
|
|
135 |
" FROM package_dependencies dep,"&_
|
|
|
136 |
" package_versions dpv,"&_
|
|
|
137 |
" packages dpkg"&_
|
|
|
138 |
" WHERE dep.dpv_id = dpv.pv_id"&_
|
|
|
139 |
" AND dpv.pkg_id = dpkg.pkg_id"&_
|
|
|
140 |
" AND dep.pv_id = "& NNpv_id
|
|
|
141 |
|
|
|
142 |
Set rsTemp = OraDatabase.DbCreateDynaset( Query_String, cint(0))
|
|
|
143 |
|
|
|
144 |
recCnt = 0
|
|
|
145 |
While ((NOT rsTemp.BOF) AND (NOT rsTemp.EOF))
|
|
|
146 |
ReDim Preserve ARRdep( 2, recCnt )
|
|
|
147 |
ARRdep( COL_pkg_name, recCnt ) = rsTemp("pkg_name")
|
|
|
148 |
ARRdep( COL_pkg_version, recCnt ) = Request( "pkgn"& rsTemp("pv_id") )
|
|
|
149 |
ARRdep( COL_build_type, recCnt ) = Request( "bt"& rsTemp("pv_id") )
|
|
|
150 |
|
|
|
151 |
If not rsTemp("pkg_version") = Request( "pkgn"& rsTemp("pv_id") ) Then
|
|
|
152 |
sDependBlock = rsTemp("pkg_name") & " " & Request( "pkgn"& rsTemp("pv_id") )
|
|
|
153 |
End If
|
|
|
154 |
|
|
|
155 |
recCnt = recCnt + 1
|
|
|
156 |
BBarray_is_empty = FALSE
|
|
|
157 |
rsTemp.MoveNext
|
|
|
158 |
WEnd
|
|
|
159 |
|
|
|
160 |
rsTemp.Close
|
|
|
161 |
Set rsTemp = nothing
|
|
|
162 |
End Sub
|
|
|
163 |
|
|
|
164 |
Sub Update_Package_Dependencies ( ARRdep, NNpv_id, NNuser_id, NNdelete_old_dependency, sAction_type, sDependBlock )
|
|
|
165 |
Dim i, OraParameter, sComments
|
|
|
166 |
|
|
|
167 |
OraDatabase.Parameters.Add "PV_ID", NNpv_id, ORAPARM_INPUT, ORATYPE_NUMBER
|
|
|
168 |
OraDatabase.Parameters.Add "PKG_NAME", "", ORAPARM_INPUT, ORATYPE_VARCHAR2
|
|
|
169 |
OraDatabase.Parameters.Add "PKG_VERSION", "", ORAPARM_INPUT, ORATYPE_VARCHAR2
|
|
|
170 |
OraDatabase.Parameters.Add "BUILD_TYPE", "", ORAPARM_INPUT, ORATYPE_VARCHAR2
|
|
|
171 |
OraDatabase.Parameters.Add "USER_ID", NNuser_id, ORAPARM_INPUT, ORATYPE_NUMBER
|
|
|
172 |
OraDatabase.Parameters.Add "DELETE_PV_ID", NNdelete_old_dependency, ORAPARM_INPUT, ORATYPE_NUMBER
|
|
|
173 |
OraDatabase.Parameters.Add "ACTION_TYPE_NAME", sAction_type, ORAPARM_INPUT, ORATYPE_VARCHAR2
|
|
|
174 |
|
|
|
175 |
Set OraParameter = OraDatabase.Parameters
|
|
|
176 |
|
|
|
177 |
For i = 0 To UBound( ARRdep, 2 )
|
|
|
178 |
If not i = 0 Then
|
|
|
179 |
sComments = sComments & ", "
|
|
|
180 |
End If
|
|
|
181 |
sComments = sComments & depArray(COL_pkg_name, i) & " " & ARRdep( COL_pkg_version, i )
|
|
|
182 |
|
|
|
183 |
OraParameter("PKG_NAME").Value = ARRdep( COL_pkg_name, i )
|
|
|
184 |
OraParameter("PKG_VERSION").Value = ARRdep( COL_pkg_version, i )
|
|
|
185 |
OraParameter("BUILD_TYPE").Value = ARRdep( COL_build_type, i )
|
|
|
186 |
|
|
|
187 |
OraDatabase.ExecuteSQL "BEGIN Update_Package_Dependency ( :PV_ID, :PKG_NAME, :PKG_VERSION, :BUILD_TYPE, :USER_ID, :DELETE_PV_ID ); END;"
|
|
|
188 |
|
|
|
189 |
Next
|
|
|
190 |
|
|
|
191 |
Set OraParameter = Nothing
|
|
|
192 |
|
|
|
193 |
If sAction_type = "depend_add" Then
|
|
|
194 |
OraDatabase.Parameters.Add "COMMENTS", sComments, ORAPARM_INPUT, ORATYPE_VARCHAR2
|
|
|
195 |
Else
|
|
|
196 |
If Len(sDependBlock) <= 4000 Then
|
|
|
197 |
OraDatabase.Parameters.Add "COMMENTS", sDependBlock, ORAPARM_INPUT, ORATYPE_VARCHAR2
|
|
|
198 |
Else
|
|
|
199 |
OraDatabase.Parameters.Add "COMMENTS", "Description too long to be inserted!", ORAPARM_INPUT, ORATYPE_VARCHAR2
|
|
|
200 |
End If
|
|
|
201 |
End If
|
|
|
202 |
|
|
|
203 |
OraDatabase.ExecuteSQL _
|
|
|
204 |
"BEGIN Log_Action ( :PV_ID, :ACTION_TYPE_NAME, :USER_ID, :COMMENTS ); END;"
|
|
|
205 |
|
|
|
206 |
|
|
|
207 |
|
|
|
208 |
OraDatabase.Parameters.Remove "PV_ID"
|
|
|
209 |
OraDatabase.Parameters.Remove "PKG_NAME"
|
|
|
210 |
OraDatabase.Parameters.Remove "PKG_VERSION"
|
|
|
211 |
OraDatabase.Parameters.Remove "BUILD_TYPE"
|
|
|
212 |
OraDatabase.Parameters.Remove "USER_ID"
|
|
|
213 |
OraDatabase.Parameters.Remove "DELETE_PV_ID"
|
|
|
214 |
OraDatabase.Parameters.Remove "ACTION_TYPE_NAME"
|
|
|
215 |
OraDatabase.Parameters.Remove "COMMENTS"
|
|
|
216 |
End Sub
|
|
|
217 |
|
|
|
218 |
|
|
|
219 |
Sub Remove_Old_Dependencies ( SSpv_id )
|
|
|
220 |
OraDatabase.Parameters.Add "PV_ID", SSpv_id, ORAPARM_INPUT, ORATYPE_NUMBER
|
|
|
221 |
|
|
|
222 |
OraDatabase.ExecuteSQL "DELETE FROM package_dependencies WHERE pv_id = :PV_ID"
|
|
|
223 |
|
|
|
224 |
OraDatabase.Parameters.Remove "PV_ID"
|
|
|
225 |
End Sub
|
|
|
226 |
|
|
|
227 |
|
|
|
228 |
Sub Update_Mod_Details ( SSpv_id )
|
|
|
229 |
OraDatabase.Parameters.Add "PV_ID", SSpv_id, ORAPARM_INPUT, ORATYPE_NUMBER
|
|
|
230 |
OraDatabase.Parameters.Add "RTAG_ID", Request("rtag_id"), ORAPARM_INPUT, ORATYPE_NUMBER
|
|
|
231 |
OraDatabase.Parameters.Add "USER_ID", objAccessControl.UserId, ORAPARM_INPUT, ORATYPE_NUMBER
|
|
|
232 |
|
|
|
233 |
OraDatabase.ExecuteSQL _
|
|
|
234 |
" UPDATE package_versions "&_
|
|
|
235 |
" SET modified_stamp = "& ORA_SYSDATETIME &", modifier_id = :USER_ID"&_
|
|
|
236 |
" WHERE pv_id = :PV_ID"
|
|
|
237 |
|
|
|
238 |
If Request("rtag_id") <> "" Then
|
|
|
239 |
' Package in release view
|
|
|
240 |
OraDatabase.ExecuteSQL _
|
|
|
241 |
"BEGIN "&_
|
|
|
242 |
" Touch_Release ( :RTAG_ID ); "&_
|
|
|
243 |
"END; "
|
|
|
244 |
|
|
|
245 |
Else
|
|
|
246 |
' Package view
|
|
|
247 |
OraDatabase.ExecuteSQL _
|
|
|
248 |
"BEGIN "&_
|
|
|
249 |
" PK_RELEASE.RUN_POST_ACTIONS_BULK ( :PV_ID ); "&_
|
|
|
250 |
"END; "
|
|
|
251 |
|
|
|
252 |
End If
|
|
|
253 |
|
|
|
254 |
OraDatabase.Parameters.Remove "PV_ID"
|
|
|
255 |
OraDatabase.Parameters.Remove "RTAG_ID"
|
|
|
256 |
OraDatabase.Parameters.Remove "USER_ID"
|
|
|
257 |
End Sub
|
|
|
258 |
|
|
|
259 |
%>
|
|
|
260 |
<%
|
|
|
261 |
'----------------------- MAIN LINE ---------------------------
|
|
|
262 |
|
|
|
263 |
Dim sDependBlock
|
|
|
264 |
|
|
|
265 |
'--- Process submition ---
|
|
|
266 |
If (QStrPar("pv_id") <> "") Then
|
|
|
267 |
' All mendatory parameters FOUND
|
|
|
268 |
|
|
|
269 |
|
|
|
270 |
On Error Resume Next
|
|
|
271 |
OraSession.BeginTrans
|
|
|
272 |
|
|
|
273 |
|
|
|
274 |
|
|
|
275 |
array_is_empty = TRUE
|
|
|
276 |
If Request("update_type") = "add_custom" Then
|
|
|
277 |
'---- ADD CUSTOM dependency ----
|
|
|
278 |
Call Populate_depArray_from_ADD_Custom ( Request("pkg_list"), depArray, array_is_empty )
|
|
|
279 |
|
|
|
280 |
If NOT array_is_empty Then
|
|
|
281 |
Call Update_Package_Dependencies ( depArray, Request("pv_id"), objAccessControl.UserId, enumlocal_DELETE_OLD_DEPENDENCIES, "depend_add", null )
|
|
|
282 |
End If
|
|
|
283 |
|
|
|
284 |
|
|
|
285 |
ElseIf Request("update_type") = "edit_custom" Then
|
|
|
286 |
'---- EDIT CUSTOM dependency ----
|
|
|
287 |
Call Populate_depArray_from_EDIT_Custom ( Request("pv_id"), depArray, array_is_empty, sDependBlock )
|
|
|
288 |
Call Remove_Old_Dependencies ( Request("pv_id") )
|
|
|
289 |
|
|
|
290 |
If NOT array_is_empty Then
|
|
|
291 |
Call Update_Package_Dependencies ( depArray, Request("pv_id"), objAccessControl.UserId, enumlocal_DONOT_DELETE_OLD_DEPENDENCIES, "depend_update", sDependBlock )
|
|
|
292 |
End If
|
|
|
293 |
|
|
|
294 |
|
|
|
295 |
Else
|
|
|
296 |
'---- JATS, ANT dependency import ----
|
|
|
297 |
Call Populate_depArray_from_Import ( Request("FRdeps"), depArray, array_is_empty )
|
|
|
298 |
Call Remove_Old_Dependencies ( Request("pv_id") )
|
|
|
299 |
|
|
|
300 |
If NOT array_is_empty Then
|
|
|
301 |
Call Update_Package_Dependencies ( depArray, Request("pv_id"), objAccessControl.UserId, enumlocal_DONOT_DELETE_OLD_DEPENDENCIES, "depend_import", Request("FRdeps") )
|
|
|
302 |
End If
|
|
|
303 |
|
|
|
304 |
End If
|
|
|
305 |
|
|
|
306 |
|
|
|
307 |
|
|
|
308 |
Call Update_Mod_Details ( Request("pv_id") )
|
|
|
309 |
|
|
|
310 |
|
|
|
311 |
|
|
|
312 |
If Err.number <> 0 Then
|
|
|
313 |
OraSession.RollBack
|
|
|
314 |
Call RaiseMsg ( enum_MSG_ERROR, Err.description &"<br>"& Err.Source )
|
|
|
315 |
Else
|
|
|
316 |
OraSession.CommitTrans
|
|
|
317 |
End If
|
|
|
318 |
|
|
|
319 |
|
|
|
320 |
Response.Redirect("dependencies.asp?pv_id="& Request("pv_id") &"&rtag_id="& Request("rtag_id"))
|
|
|
321 |
|
|
|
322 |
|
|
|
323 |
Else
|
|
|
324 |
Response.write "Some mendatory parameters are missing!" & "<br>" 'TODO
|
|
|
325 |
Response.write QSTR_All
|
|
|
326 |
End If
|
|
|
327 |
%>
|
|
|
328 |
|
|
|
329 |
<!-- DESTRUCTOR ------->
|
|
|
330 |
<!--#include file="common/destructor.asp"-->
|