<% '===================================================== ' COMMON MAKE RELEASE BUTTON SUBs '===================================================== ' ' Conventions within this code ' ' 1) Where a paramter list contains both RTAG_ID and PV_ID, the RTAG_ID will precede the PV_ID parameter ' 2) Functions/Subs that are not used externally, are name decorated PRIVATE_ ' 3) Functions/Subs that are used extennally, are name decorated PUBLIC_ ' ' ' %> <% Dim AutoBuildPermissionDenied Dim ManualBuildPermissionDenied Dim RaiseWIPExists AutoBuildPermissionDenied = FALSE ManualBuildPermissionDenied = FALSE '----------------------------------------------------------------------------------------------------------------------------- ' This is the pattern for approval determination. If the release is in open mode, permission is given. If the release is ' in restrictive/ccb mode, permission is given dependent on the accessControlObjectName being granted for the user. ' Function PRIVATE_Is_Allowed_To(NNrtag_id, accessControlObjectName) Dim ReleaseMode ReleaseMode = GetReleaseMode ( NNrtag_id ) PRIVATE_Is_Allowed_To = FALSE If ReleaseMode <> enumDB_RELEASE_IN_CLOSED_MODE AND ReleaseMode <> enumDB_RELEASE_IN_ARCHIVE_MODE Then If ( ReleaseMode = enumDB_RELEASE_IN_OPEN_MODE ) Then PRIVATE_Is_Allowed_To = TRUE Else If objAccessControl.IsActive(accessControlObjectName) Then PRIVATE_Is_Allowed_To = TRUE End If End If End If End Function '----------------------------------------------------------------------------------------------------------------------------- Function PRIVATE_Is_Allowed_To_Approve_Merge(NNrtag_id) PRIVATE_Is_Allowed_To_Approve_Merge = PRIVATE_Is_Allowed_To(NNrtag_id, "ApproveForAutoBuild") _ OR PRIVATE_Is_Allowed_To(NNrtag_id, "ApproveForManualBuild") End Function '---------------------------------------------------------------------------------------------------------------------------------------- Function PRIVATE_Is_Allowed_To_Approve_ManualBuild(NNrtag_id) PRIVATE_Is_Allowed_To_Approve_ManualBuild = PRIVATE_Is_Allowed_To(NNrtag_id, "ApproveForManualBuild") End Function '---------------------------------------------------------------------------------------------------------------------------------------- Function PRIVATE_Is_Allowed_To_Approve_AutoBuild(NNrtag_id) PRIVATE_Is_Allowed_To_Approve_AutoBuild = PRIVATE_Is_Allowed_To(NNrtag_id, "ApproveForAutoBuild") End Function '============================================================================================================================= ' APPROVING PENDING MERGE OPERATIONS - Used from _approve_merge.asp as well as from within this file itself ' ' All functions in this section originally came from _approve_merge.asp and were placed here to support their use in more ' than the original singular context. Being relocated here allows them to be used in the additional "Bulk Release" context. '============================================================================================================================= '----------------------------------------------------------------------------------------------------------------------------- ' USED to approve a pending merge operation. Used internally by the bulk release operation Sub PRIVATE_ApproveMerge ( NNrtag_id, NNpv_id, op) On Error Resume Next objEH.ErrorRedirect = TRUE OraDatabase.Parameters.Add "PV_ID", NNpv_id, ORAPARM_INPUT, ORATYPE_NUMBER OraDatabase.Parameters.Add "RTAG_ID", NNrtag_id, ORAPARM_INPUT, ORATYPE_NUMBER OraDatabase.Parameters.Add "USER_ID", objAccessControl.UserId, ORAPARM_INPUT, ORATYPE_NUMBER objEH.TryORA ( OraSession ) OraDatabase.ExecuteSQL _ "BEGIN "&_ " PK_ENVIRONMENT.APPROVE_MERGE ( :PV_ID, :RTAG_ID, :USER_ID );"&_ "END; " objEH.CatchORA ( OraSession ) OraDatabase.Parameters.Remove "PV_ID" OraDatabase.Parameters.Remove "RTAG_ID" OraDatabase.Parameters.Remove "USER_ID" If Not objEH.LastOraFailed Then Dim objRC: Set objRC = New ReleaseChanged Dim mode If op = "A" Then mode = enumRELEASE_CHANGE_MODE_PKG_ADDED ElseIf op = "S" Then mode = enumRELEASE_CHANGE_MODE_PKG_REMOVED End If Call objRC.Run_ReleaseChanged(NNrtag_id,NNpv_id,mode,true) Set objRC = Nothing End If End Sub '----------------------------------------------------------------------------------------------------------------------------- ' USED to approve a pending merge operation. Used externally from the _approve_merge.asp file, loaded when the btnApproveMerge ' action button is pressed. Sub PUBLIC_ApproveMerge ( NNrtag_id, NNpv_id ) Dim op: op = "" If PRIVATE_Is_A_Valid_Pending_Merge(NNrtag_id, NNpv_id, "A") Then op = "A" ElseIf PRIVATE_Is_A_Valid_Pending_Merge(NNrtag_id, NNpv_id, "S") Then op = "S" End If ' validate before carrying out the merge If op <> "" Then If PRIVATE_Is_Allowed_To_Approve_Merge(NNrtag_id) Then Call PRIVATE_ApproveMerge(parRtag_id, NNpv_id, op) End If End If End Sub '----------------------------------------------------------------------------------------------------------------------------- ' USED to validate an attempt to approve a pending merge operation Function PRIVATE_Is_A_Valid_Pending_Merge(NNrtag_id, NNpv_id, op) Dim rsQry OraDatabase.Parameters.Add "PV_ID", NNpv_id, ORAPARM_INPUT, ORATYPE_NUMBER OraDatabase.Parameters.Add "RTAG_ID", NNrtag_id, ORAPARM_INPUT, ORATYPE_NUMBER Set rsQry = OraDatabase.DbCreateDynaset( GetQuery("PlannedPackageVersionDetails.sql"), cint(0)) If ((NOT rsQry.BOF) AND (NOT rsQry.EOF)) Then ' Does the actual operation field in the database match that specified as a parameter? If (rsQry.Fields("operation") = op) Then PRIVATE_Is_A_Valid_Pending_Merge = TRUE Else PRIVATE_Is_A_Valid_Pending_Merge = FALSE End If Else PRIVATE_Is_A_Valid_Pending_Merge = FALSE End If OraDatabase.Parameters.Remove "PV_ID" OraDatabase.Parameters.Remove "RTAG_ID" rsQry.Close() Set rsQry = Nothing End Function '============================================================================================================================= ' APPROVING MANUAL BUILD PENDING VERSIONS - Used from _make_released.asp as well as from within this file itself ' ' All functions in this section originally came from _make_released.asp and were placed here to support their use in more ' than the original singular context. Being relocated here allows them to be used in the additional "Bulk Release" context. '============================================================================================================================= '---------------------------------------------------------------------------------------------------------------------------------------- ' This function came from _make_released.asp and is very similar to the PRIVATE_NotifyInterestAutoBuild, except the subject/body ' text is different. Unlike its auto-build counterpart, this one is called during the process of making a manual build release ' official. ' One question arises... can we not harmonize the email notification code somewhat, between manual and autobuild releases? ' ' Currently, the function is called internally as part of the bulk release operation, and from _generate_release_notes.asp, ' loaded by _make_released.asp which in turn is loaded when a user presses the btnMakeReleased action button for manual ' built pending versions. Sub PUBLIC_NotifyInterestManualBuild( NNrtag_id, NNpv_id ) Err.Clear On Error Resume Next Dim Query_String, rsQry Query_String = _ " SELECT * FROM PACKAGE_INTEREST PI, PACKAGES PKG, PACKAGE_VERSIONS PV, USERS U,"&_ " RELEASE_TAGS RT, PROJECTS PRJ WHERE PKG.PKG_ID = PI.PKG_ID AND "&_ " RT.RTAG_ID = "& NNrtag_id &""&_ " AND PV.PV_ID = "& NNpv_id &" AND PV.PKG_ID = PKG.PKG_ID AND "&_ " PRJ.PROJ_ID = RT.PROJ_ID AND PRJ.PROJ_ID = PI.PROJ_ID AND U.USER_ID = PI.USER_ID" Set rsQry = OraDatabase.DbCreateDynaset( Query_String , cint(0) ) If rsQry.RecordCount <> "" Then While ((NOT rsQry.BOF) AND (NOT rsQry.EOF)) If rsQry("user_email") <> "" Then Send_Email "Release Manager Notification",_ adminEmail, _ rsQry("user_email"),_ "Version "& rsQry("pkg_version") &" of Package "& rsQry("pkg_name") &" in Project " & rsQry("proj_name") &" on Release Branch " & rsQry("rtag_name") &" has been released.",_ "You have received this email as a result of your interest in this package. If you do not wish to receive further emails then remove your package interest from the notifications area in Release Manager.",_ NULL End If rsQry.MoveNext Wend End If rsQry.Close() set rsQry = nothing End Sub '---------------------------------------------------------------------------------------------------------------------------------------- ' Currently, this function is called internally as part of the bulk release operation, and from _generate_release_notes.asp, ' loaded by _make_released.asp which in turn is loaded when a user presses the btnMakeReleased action button for manual ' built pending versions. It initiates the execution of the windows script file that performs additional database updates ' that are needed to make official a package version that has already been built and published into dpkg_archive. This includes ' collecting info on all files that were published to dpkg_archive, and inserting that info into the RELEASED_COMPONENTS table. Function PUBLIC_Run_onMakeOfficial ( nRtag_id, nPv_id ) Dim objWSH, proj_id, Qry, sRtagName PUBLIC_Run_onMakeOfficial = FALSE On Error Resume Next objEH.TryORA ( OraSession ) OraDatabase.ExecuteSQL " UPDATE package_versions "&_ " SET release_notes_info = '"& enum_RELEASE_NOTES_GENERATING &"'"&_ " WHERE pv_id = "& nPv_id objEH.CatchORA ( OraSession ) If objEH.LastOraFailed = FALSE Then Set objWSH = Server.CreateObject("WScript.Shell") 'Used for getting the package name and package version OraDatabase.Parameters.Add "RTAG_ID", nRtag_id, ORAPARM_INPUT, ORATYPE_NUMBER Set Qry = OraDatabase.DbCreateDynaset( "SELECT * FROM RELEASE_TAGS WHERE RTAG_ID = :RTAG_ID", 0 ) proj_id = Qry("proj_id") sRtagName = UCase( Qry("rtag_name") ) Qry.Close() Set Qry = Nothing OraDatabase.Parameters.Remove "RTAG_ID" 'If proj_id = 281 Or proj_id = 221 Then ' objWSH.Run "cmd.exe /c cscript.exe //B //NoLogo "& rootPath & SCRIPTS_FOLDER_STEP &"\on_Make_Official.wsf //job:GetComponents //job:GenerateReleaseNotes //job:PostRun "&_ ' "/pv_id:"& nPv_id , _ ' 0, False 'Else objWSH.Run "cmd.exe /c cscript.exe //B //NoLogo "& rootPath & SCRIPTS_FOLDER &"\on_Make_Official.wsf //job:GetComponents //job:GenerateReleaseNotes //job:PostRun "&_ "/pv_id:"& nPv_id & " /proj_id:"& proj_id &" /rtag_name:"""&sRtagName&"", _ 0, False 'End If Set objWSH = nothing PUBLIC_Run_onMakeOfficial = TRUE End If End Function '----------------------------------------------------------------------------------------------------------------------------- ' This sub is used from _make_released.asp, loaded when a user presses the btnMakeReleased action button, as well as from ' internally within this file as part of the bulk release operation. ' This function basically removes the PV_ID entry from the WIP/PLANNED table, and adds it to the RELEASE_CONTENT table. Function PUBLIC_MakeRelease ( NNrtag_id, NNpv_id ) On Error Resume Next objEH.ErrorRedirect = TRUE OraDatabase.Parameters.Add "PV_ID", NNpv_id, ORAPARM_INPUT, ORATYPE_NUMBER OraDatabase.Parameters.Add "RTAG_ID", NNrtag_id, ORAPARM_INPUT, ORATYPE_NUMBER OraDatabase.Parameters.Add "USER_ID", objAccessControl.UserId, ORAPARM_INPUT, ORATYPE_NUMBER objEH.TryORA ( OraSession ) OraDatabase.ExecuteSQL _ "BEGIN "&_ " PK_ENVIRONMENT.MAKE_RELEASE ( :PV_ID, :RTAG_ID, :USER_ID );"&_ "END; " objEH.CatchORA ( OraSession ) OraDatabase.Parameters.Remove "PV_ID" OraDatabase.Parameters.Remove "RTAG_ID" OraDatabase.Parameters.Remove "USER_ID" ' return TRUE if operation was successful, else FALSE If objEH.LastOraFailed Then PUBLIC_MakeRelease = FALSE Else PUBLIC_MakeRelease = TRUE Dim objRC: Set objRC = New ReleaseChanged Call objRC.Run_ReleaseChanged(NNrtag_id,NNpv_id,enumRELEASE_CHANGE_MODE_PKG_RELEASED,true) Set objRC = Nothing End If End Function '============================================================================================================================= ' APPROVING AUTO/MANUAL BUILD PENDING VERSIONS - Used from _make_approved.asp as well as from within this file itself ' ' All functions in this section originally came from _make_approved.asp and were placed here to support their use in more ' than the original singular context. Being relocated here allows them to be used in the additional "Bulk Release" context. '============================================================================================================================= '---------------------------------------------------------------------------------------------------------------------------------------- Function PRIVATE_Get_CQ_Issues ( SSsql, OOrsCQ ) 'On Error Resume Next OOrsCQ.ActiveConnection = CQ_conn OOrsCQ.Source = SSsql OOrsCQ.CursorType = 0 OOrsCQ.CursorLocation = 2 OOrsCQ.LockType = 3 OOrsCQ.Open() PRIVATE_Get_CQ_Issues = Err.Number End Function '------------------------------------------------------------------------------------------------------------------------------------------ ' Currently, this function does not seem to be used. The call to it was commented out in the _make_approved.asp file from where it was ' originally called from. ' Sub PRIVATE_NotifyInterestAutoBuild( NNrtag_id, NNpv_id ) On Error Resume Next Dim Query_String, rsQry Query_String = _ " SELECT * FROM PACKAGE_INTEREST PI, PACKAGES PKG, PACKAGE_VERSIONS PV, USERS U,"&_ " RELEASE_TAGS RT, PROJECTS PRJ WHERE PKG.PKG_ID = PI.PKG_ID AND "&_ " RT.RTAG_ID = "& NNrtag_id &""&_ " AND PV.PV_ID = "& NNpv_id &" AND PV.PKG_ID = PKG.PKG_ID AND "&_ " PRJ.PROJ_ID = RT.PROJ_ID AND PRJ.PROJ_ID = PI.PROJ_ID AND U.USER_ID = PI.USER_ID" Set rsQry = OraDatabase.DbCreateDynaset( Query_String , cint(0) ) If rsQry.RecordCount <> "" Then While ((NOT rsQry.BOF) AND (NOT rsQry.EOF)) If rsQry("user_email") <> "" Then Send_Email "Release Manager Notification",_ adminEmail, _ rsQry("user_email"),_ "New Version of Package "& rsQry("pkg_name") &" in Project " & rsQry("proj_name") &" on Release Branch " & rsQry("rtag_name") &" would be autobuild soon.",_ "You have received this email as a result of your interest in this package. If you do not wish to receive further emails then remove your package interest from the notifications area in Release Manager.",_ NULL End If rsQry.MoveNext Wend End If rsQry.Close() set rsQry = nothing End Sub '------------------------------------------------------------------------------------- Sub PRIVATE_Get_Package_Issues(NNpv_id, SSsql) Dim sqlstr, rsTemp, DEVIiss sqlstr = "SELECT iss_db, iss_id, iss_state, notes FROM CQ_ISSUES WHERE pv_id="& NNpv_id &" AND iss_state = 1" Set rsTemp = OraDatabase.DbCreateDynaset( sqlstr, cint(0)) DEVIiss = "-1" While ((NOT rsTemp.BOF) AND (NOT rsTemp.EOF)) If CInt(rsTemp("iss_db")) = CInt(enumCLEARQUEST_DEVI_ID) Then DEVIiss = DEVIiss &","& rsTemp("iss_id") End If rsTemp.MoveNext WEnd ' Construct SQL statement for CQ database If Len(DEVIiss) <> 1 OR Len(TDSEiss) <> 1 Then SSsql = ReadFile( rootPath & "queries\cq_issues.sql" ) SSsql = Replace( SSsql, "/*enumCLEARQUEST_DEVI_ID*/", enumCLEARQUEST_DEVI_ID) SSsql = Replace( SSsql, "/*DEVIiss*/", DEVIiss) End If rsTemp.Close Set rsTemp = nothing End Sub '------------------------------------------------------------------------------------- Function PRIVATE_MakeApproved (NNrtag_id, NNpv_id) OraDatabase.Parameters.Add "PV_ID", NNpv_id, ORAPARM_INPUT, ORATYPE_NUMBER OraDatabase.Parameters.Add "RTAG_ID", NNrtag_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 "&_ " PK_ENVIRONMENT.MAKE_APPROVED ( :PV_ID, :RTAG_ID, :USER_ID ); "&_ "END; " objEH.CatchORA ( OraSession ) OraDatabase.Parameters.Remove "PV_ID" OraDatabase.Parameters.Remove "RTAG_ID" OraDatabase.Parameters.Remove "USER_ID" ' return TRUE if operation was successful, else FALSE If objEH.LastOraFailed Then PRIVATE_MakeApproved = FALSE Else PRIVATE_MakeApproved = TRUE End If End Function '------------------------------------------------------------------------------------- ' This function is called from _make_approved.asp, which is loaded when the btnApprovePackage ' action button is pressed. It is also called as part of the bulk release operation. Function PUBLIC_ApproveRelease(NNrtag_id, NNpv_id, ByRef retParameters, isBulk) Dim retERRmsg Dim retALRTmsg Dim pkgType retParameters = "" pkgType = 0 Set pkgInfoHash = CreateObject("Scripting.Dictionary") ' default return value PUBLIC_ApproveRelease = FALSE If ( NNrtag_id <> "") AND (NNpv_id <> "") Then '-- Get Package details Call Get_Pkg_Info ( NNpv_id, NNrtag_id ) If pkgInfoHash.Item("build_type") = "A" Then 'Check If There Already Exists A WIP Instance Of The Package In The Release If Check_Package_WIP_Already_Exists(NNrtag_id, NNpv_id) > 0 Then RaiseWIPExists = TRUE End If If PRIVATE_Is_Allowed_To_Approve_AutoBuild(NNrtag_id) Then '-- Approve Automatic-build package Call CheckRequirementsForMakeApproved ( NNpv_id, NNrtag_id, pkgType, retERRmsg, retALRTmsg, retParameters ) If IsNull(retERRmsg) Then Dim EmailBody If PRIVATE_MakeApproved (NNrtag_id, NNpv_id) = TRUE Then If ( RaiseWIPExists = TRUE ) AND ( isBulk = FALSE ) Then Call RaiseMsg ( enum_MSG_PACKAGE_WIP_EXISTS&"?rtag_id="& NNrtag_id & "&pv_id="& NNpv_id & "", NNpv_id ) ' RaiseMsg redirects loaded web page, so no return ' Deal with BulkMakeRelease elsewhere End If ' indicate success PUBLIC_ApproveRelease = TRUE End If Else Call RaiseMsg ( Eval(retERRmsg), NNrtag_id & "|" & NNpv_id & "|" & retParameters & "|" & "N" ) End If Else ' Indicate an auto-build permission problem was detected in the global variable. ' This is only used within the context of a bulk release. AutoBuildPermissionDenied = TRUE End If Else If PRIVATE_Is_Allowed_To_Approve_ManualBuild(NNrtag_id) Then '-- Approve a Manual Build Release Call CheckRequirementsForMakeRelease ( NNpv_id, NNrtag_id, pkgType, retERRmsg, retALRTmsg, retParameters ) If IsNull(retERRmsg) Then If PUBLIC_MakeRelease ( NNrtag_id, NNpv_id ) = TRUE Then ' If all went well, initiate the generation of release notes, and email any interested parties If PUBLIC_Run_onMakeOfficial ( NNrtag_id, NNpv_id ) = TRUE Then Call PUBLIC_NotifyInterestManualBuild( NNrtag_id, NNpv_id ) ' indicate success PUBLIC_ApproveRelease = TRUE End If End If Else Call RaiseMsg ( Eval(retERRmsg), NNrtag_id & "|" & NNpv_id & "|" & retParameters & "|" & "N" ) End If Else ' Indicate a manual-build permission problem was detected in the global variable ' This is only used within the context of a bulk release. ManualBuildPermissionDenied = TRUE End If End If End If End Function '----------------------------------------------------------------------------------------------------------------------------- '============================================================================================================================= ' MAKING A BULK RELEASE from a list of PV_IDs for a specified release ' ' This section contains the new "Bulk Release' code. This function is tied to the use of the make bulk release button. ' '============================================================================================================================= '----------------------------------------------------------------------------------------------------------------------------- ' This public function is called from the make_bulk_release.asp file, loaded when a user presses the Make Bulk Release ' button when viewing items on the Pending Tab of a release area. ' ' The function processes a list of PV_ID's that cam from the pending tab of a release, formed from each item whose checkbox ' was checked. There are 3 different types of item to deal with, and this function will deal with them in the order shown ' below: ' 1) Subtractive merge operations ' 2) Additive merge operations ' 3) Manual/Auto build items ' ' This order was chosen by design to ensure that in the end effect upon a release, the manual and auto build items ' take precedence over merge candidates. This occurs naturally if we process manual/auto build items last. ' ' Parameters: ' NNrtag_id The release area ' NN_pv_id_list A list of PV_IDs representing pending items to be approved for release or merge. ' Sub PUBLIC_MakeBulkRelease (NNrtag_id, NN_pv_id_list) Dim initialList ' holds all items Dim remainingList1() ' To hold additive merge items Dim remainingList2() ' To hold auto/manual build items that need to be validated before processing Dim remainingList3() ' To hold auto/manual build items that can be processed Dim remainingList4() ' To hold auto/manual build items that cannot be processed due to validation failures Dim len_remainingList1 Dim len_remainingList2 Dim len_remainingList3 Dim len_remainingList4 Dim pvId Dim retParameters Dim allowedToApproveMerge ' determine in advance if user is allowed to approve merges allowedToApproveMerge = PRIVATE_Is_Allowed_To_Approve_Merge(NNrtag_id) ' ready the remaining list index to extract additive merges and manual/auto build items len_remainingList1 = 0 AutoBuildPermissionDenied = FALSE ManualBuildPermissionDenied = FALSE ' Remove any spaces and split the pv_id list into a string array initialList = Split ( Replace(NN_pv_id_list, " ", "" ), "," ) ' Process each subtractive merge item in the string array. ' We do these first to cleanup the release somewhat before we start adding new stuff in For Each pvId In initialList If IsNumeric(pvId) Then ' Test to see if this PV_ID represents a pending SUBTRACTIVE merge operation, and proceed with it if permissions allow If PRIVATE_Is_A_Valid_Pending_Merge(NNrtag_id, pvId, "S") Then If allowedToApproveMerge Then Call PRIVATE_ApproveMerge(NNrtag_id, pvId, "S") Else AutoBuildPermissionDenied = TRUE ManualBuildPermissionDenied = TRUE End If Else ' add item to the remaining list for the next loop to process len_remainingList1 = len_remainingList1 + 1 ReDim Preserve remainingList1(len_remainingList1) remainingList1(len_remainingList1 - 1) = pvId End If End If Next ' ready the remaining list index to extract manual/auto build items len_remainingList2 = 0 ' Now process each additive merge item in the string array ' We do these before finally processing any auto/manual build items so that the latter take precedence in their eventual ' effect upon the release. For Each pvId In remainingList1 ' Test to see if this PV_ID represents a pending ADDITIVE merge operation, and proceed with it if permissions allow If PRIVATE_Is_A_Valid_Pending_Merge(NNrtag_id, pvId, "A") Then If allowedToApproveMerge Then Call PRIVATE_ApproveMerge(NNrtag_id, pvId, "A") Else AutoBuildPermissionDenied = TRUE ManualBuildPermissionDenied = TRUE End If Else ' add item to the remaining list for the next loop to process len_remainingList2 = len_remainingList2 + 1 ReDim Preserve remainingList2(len_remainingList2) remainingList2(len_remainingList2 - 1) = pvId End If Next ' ready the remaining list index to extract manual/auto build items len_remainingList3 = 0 len_remainingList4 = 0 ' We cannot bulk release multiple WIPS of the same pkg_id because the modified_stamp in the package versions ' table for each one will become identical upon doing so (since they are simultaneously being bulk released) ' and the build daemon will therefore not necessarily build them in the order the user needs them to be built in. ' This is especially the case with multiple WIPS for packages that are in fact database patches. ' We have to bust out those pv_ids from the ones we can bulk release, and tell the user about them afterwards, ' basically forcing the user to approve them one by one. ' We use a few dictionaries to bust apart the pv_id's Dim pkgIdsAndCounts Dim pkgIdsAndPvIds Dim pkgId Set pkgIdsAndCounts = Server.CreateObject("Scripting.Dictionary") Set pkgIdsAndPvIds = Server.CreateObject("Scripting.Dictionary") ' Count instances of pkg_id's and for each pkg_id, create a list of pv_id's, using the dictionaries declared earlier For Each pvId In remainingList2 If ( NNrtag_id <> "") AND (pvId <> "") Then pkgId = Get_Pkg_Id_For_Pv_Id(pvId) If pkgIdsAndCounts.Exists(pkgId) Then pkgIdsAndCounts.Item(pkgId) = CStr(CInt(pkgIdsAndCounts.Item(pkgId)) + 1) pkgIdsAndPvIds.Item(pkgId) = pkgIdsAndPvIds.Item(pkgId) & "," & pvId Else pkgIdsAndCounts.Add pkgId, "1" pkgIdsAndPvIds.Add pkgId, pvId End If End If Next ' Now use the pkg_id counts to distinguish between the pv_id's we can proceed with and those we cannot. ' The ones we can proceed with are accumulated into remainingList3, and the ones we cannot are ' accumulated into remainingList4 Dim i,a a = pkgIdsAndCounts.Keys For i=0 to pkgIdsAndCounts.Count-1 If pkgIdsAndCounts.Item(a(i)) = "1" Then len_remainingList3 = len_remainingList3 + 1 ReDim Preserve remainingList3(len_remainingList3) remainingList3(len_remainingList3 - 1) = pkgIdsAndPvIds.Item(a(i)) Else len_remainingList4 = len_remainingList4 + 1 ReDim Preserve remainingList4(len_remainingList4) remainingList4(len_remainingList4 - 1) = pkgIdsAndPvIds.Item(a(i)) End If Next ' free dictionaries Set pkgIdsAndCounts = nothing Set pkgIdsAndPvIds = nothing ' Now process each new and valid Auto/Manaul build item in the string array RaiseWIPExists = FALSE For Each pvId In remainingList3 Call PUBLIC_ApproveRelease(NNrtag_id, pvId, retParameters, TRUE) Next If ( RaiseWIPExists = TRUE ) Then Call RaiseMsg ( enum_MSG_PACKAGE_WIP_EXISTS & "?rtag_id="& request("rtag_id") & "&pv_id="& request("pv_id") & "", "" ) ' RaiseMsg redirects loaded web page, so no return End If ' Issue a warning for when some items could not be bulk released due to having the same package ID's If len_remainingList4 > 0 Then Call RaiseMsg ( enum_MSG_PACKAGE_WIP_EXISTS_BULK_RELEASE & "?rtag_id="& request("rtag_id") & "&pv_id="& request("pv_id") & "", "" ) End If ' If any items were not approved for release due to permission errors, issue an alert to the user If AutoBuildPermissionDenied = TRUE OR ManualBuildPermissionDenied = TRUE Then Call RaiseMsg( enum_MSG_PERMISSION_PROBLEMS_BULK_RELEASE & "?rtag_id="& request("rtag_id") & "&pv_id="& request("pv_id") & "", "" ) End If End Sub '----------------------------------------------------------------------------------------------------------------------------- %>