%@LANGUAGE="VBSCRIPT"%>
<%
'=====================================================
' sdk_add_release
' Add and SDK to a given Release
' Called with two parameters
' The page will either:
' add the SDKTAG to the Release - and then redirect to the dependencies tab
' or
' Fail in adding the SDK to the Release - and display a page of conflicting package-versions
'
'=====================================================
%>
<%
Option explicit
' Good idea to set when using redirect
Response.Expires = 0 ' always load the page, dont store
Const allowNoPackage = TRUE ' Allow page display without pvid being present
Const showReleaseSdk = TRUE ' Show the Release SDK div
%>
<%
'------------ ACCESS CONTROL ------------------
%>
<%
'------------ Variable Definition -------------
Dim sdkAdded
Dim rsQry
Dim rsView
'------------ Constants Declaration -----------
'------------ Variable Init -------------------
sdkAdded = FALSE
Set pkgInfoHash = CreateObject("Scripting.Dictionary")
'----------------------------------------------
%>
<%
'-------------------------------------------------
' Function: AddReleaseSDK
' Description: Add the nominated sdktag to the release
' Args: dMode. 0: No Delete, 1:Delete non-sdk packages
' Returns: Number of Packages Inserted
' < 0 - Error. Conflict list populated
' rsView is set to a list of PV_ID that cause the conflict
' = 0 - No packages inserted
' > 0 - Number of packages inserted
Function AddReleaseSDK ( nRtagId, nSdktagId, dMode )
OraDatabase.Parameters.Add "RTAG_ID", nRtagId, ORAPARM_INPUT, ORATYPE_NUMBER
OraDatabase.Parameters.Add "SDKTAG_ID", nSdktagId, ORAPARM_INPUT, ORATYPE_NUMBER
OraDatabase.Parameters.Add "USER_ID", objAccessControl.UserId, ORAPARM_INPUT, ORATYPE_NUMBER
OraDatabase.Parameters.Add "DMODE", dMode, ORAPARM_INPUT, ORATYPE_NUMBER
OraDatabase.Parameters.Add "INSERT_COUNT", NULL, ORAPARM_OUTPUT, ORATYPE_NUMBER
OraDatabase.Parameters.Add "CONFLICT_LIST", NULL, ORAPARM_OUTPUT, ORATYPE_CURSOR
objEH.TryORA ( OraSession )
On Error Resume Next
OraDatabase.ExecuteSQL _
" BEGIN "&_
" PK_RELEASE.ADD_RELEASE_SDK ( :RTAG_ID, :SDKTAG_ID, :USER_ID, :DMODE, :INSERT_COUNT, :CONFLICT_LIST ); "&_
" END; "
objEH.CatchORA ( OraSession )
' INSERT_COUNT < 0 - Error. Conflict list populated
' INSERT_COUNT = 0 - No packages inserted
' INSERT_COUNT > 0 - Number of packages inserted
AddReleaseSDK = OraDatabase.Parameters("INSERT_COUNT").Value
' NULL Conflict list indicates that the operation did not fail
' There may have been no items to insert
If NOT isNull(OraDatabase.Parameters("CONFLICT_LIST").Value) Then
Set rsView = OraDatabase.Parameters("CONFLICT_LIST").Value
AddReleaseSDK = -1
End If
OraDatabase.Parameters.Remove "RTAG_ID"
OraDatabase.Parameters.Remove "SDKTAG_ID"
OraDatabase.Parameters.Remove "USER_ID"
OraDatabase.Parameters.Remove "DMODE"
OraDatabase.Parameters.Remove "INSERT_COUNT"
OraDatabase.Parameters.Remove "CONFLICT_LIST"
End Function
%>
<%
'----------------------- MAIN LINE ---------------------------
'------ ACCESS CONTROL ----------
If NOT canShowControlInProject("AddSdk") Then
Call RaiseMsg(enum_MSG_ERROR, "User not authorized to add an SDK. User login may have expired.")
End If
'--------------------------------
If (Request("rtag_id") <> "") AND (Request("sdktag_id") <> "") AND (Request("dmode") <> "") Then
'--- Process submition ---
sdkAdded = AddReleaseSDK ( Request("rtag_id"), Request("sdktag_id"), Request("dmode") )
If sdkAdded >= 0 Then
Call Destroy_All_Objects
Response.Redirect( "dependencies.asp?rtag_id="& Request("rtag_id") )
End If
Else
Err.Raise 8, "This page requires more paramaters to run. "& objPMod.ComposeURL()
End If
'-------------------------------------------------
' Function: GetPackageInfo
' Description: Build up a hash of the required package information for the display
' Start with the results of one query that is a list of pv_ids
Sub GetPackageInfo
Dim listPvid : listPvid = ""
Dim joiner : joiner = ""
Dim rsTemp, sqlStr
Dim nRtagId : nRtagId = Request("rtag_id")
' Build up a list of pv_id's to process
While ((NOT rsView.BOF) AND (NOT rsView.EOF))
listPvid = listPvid & joiner & rsView(0)
joiner = ", "
rsView.MoveNext
WEnd
sqlStr = "Select pv.pv_id, pv.pkg_version, p.pkg_name, NVL(rc.sdktag_id,0) as sdktag_id, sn.sdk_name || '::' || st.sdktag_name as sdk_name" &_
" FROM RELEASE_CONTENT rc, PACKAGE_VERSIONS pv, PACKAGES p, SDK_TAGS st, SDK_NAMES sn" &_
" WHERE rc.pv_id = pv.pv_id" &_
" AND st.SDKTAG_ID(+) = rc.SDKTAG_ID" &_
" AND st.SDK_ID = sn.SDK_ID(+)" &_
" AND pv.PKG_ID = p.PKG_ID" &_
" AND rc.rtag_id = :RTAG_ID " &_
" AND pv.pv_id in ("&listPvid&")" &_
" ORDER BY UPPER(p.pkg_name)"
OraDatabase.Parameters.Add "RTAG_ID", nRtagId, ORAPARM_INPUT, ORATYPE_NUMBER
Set rsTemp = OraDatabase.DbCreateDynaset( sqlStr, 0 )
Do Until ((rsTemp.BOF) OR (rsTemp.EOF))
Response.Write "
"
Response.Write "
"
If rsTemp("sdktag_id") <> 0 Then Response.Write enum_imgSdkImport
Response.Write "
" & rsTemp("pkg_name")
Response.Write "
" & rsTemp("pkg_version")
Response.Write "
"
If rsTemp("sdktag_id") <> 0 Then Response.Write rsTemp("sdk_name")
Response.Write "
"
If rsTemp("sdktag_id") = 0 Then Response.Write ""
Response.Write "
"
rsTemp.MoveNext
Loop
rsTemp.Close
Set rsTemp = nothing
OraDatabase.Parameters.Remove "RTAG_ID"
End Sub
'----------------------------------------------------------------
'
' The body of this page will be displayed only if an error in the insertion process
' occured. Not packages will have been inserted as the transaction will have been
' rolled back. We have a list if PV_ID's that conflicted
'
' Generate a display showing:
' Conflicting package name and version
' If the package is imported via an SDK - then highlight this
' If the package is not, then allow the user to delete the package-version from the release
%>
<%=Title(Request("rtag_id"))%>