<%@LANGUAGE="VBSCRIPT"%> <% '===================================================== '| form_edit_deps.asp '| Used by JATS and ANT import pages to sanitize the package versions to be used '| Do not allow user to name packages that do not exist '| Do not allow the user to name package-versions that do not exist '| Used by Edit Dependencies button '| Restrict users to versions that exist '| '===================================================== %> <% Option explicit ' Good idea to set when using redirect Response.Expires = 0 ' always load the page, dont store %> <% ' Make sure rtag_id is always present If Request("pv_id") = "" Then Call Destroy_All_Objects Response.Redirect("index.asp") End If %> <% '------------ ACCESS CONTROL ------------------ %> <% '------------ Variable Definition ------------- Dim parPv_id Dim rsPkgs Dim HTML_pkg_list Dim DataFound Dim recCnt '------------ Constants Declaration ----------- '------------ Variable Init ------------------- parPv_id = Request("pv_id") Set pkgInfoHash = CreateObject("Scripting.Dictionary") recCnt = 0 '------------------------------------------------- ' Function: Populate_from_Import ' Description: Generate the body of the display based on user imported data Sub Populate_from_Import ( SSdep_import, SShtml_pkg_list, BBDataFound) Dim pkg_name, pkg_version, build_type, re, Matches, Match Dim Query_String, rsDeps, PVID, PKGID, builtTypeEnum, LatestVisible Dim OraParameter DataFound = false If (SSdep_import = "") Then Exit Sub ' exit if no dependencies are submited ' Decode Server.URLEncode if present SSdep_import = URLDecode( SSdep_import ) SSdep_import = Replace(SSdep_import, " ", "") ' remove spaces SSdep_import = Replace(SSdep_import, VBTab, "") ' remove horizontal tabs SSdep_import = Replace(SSdep_import, VBVerticalTab, "") ' remove vertical tabs SSdep_import = Replace(SSdep_import, """", "'") ' replace " with ' Set re = New RegExp re.IgnoreCase = True re.Global = True 'The following regular expression captures the package name and version on each matching line. 'The following is an example of the format of the input string, SSdep_import. ' 'BuildPkgArchive ( 'linux_kernel_viper' , '2.6.24.6.5000.cots' ); ' '# Packages for creating the debian package '#LinkPkgArchive ( 'debian_dpkg' , '1.13.25000.cots' ); 'LinkPkgArchive ( 'debian_packager' , '1.1.0000.cr' ); 'LinkPkgArchive ( 'Jasper Patch (JBoss/Tomcat Hotfix)' , '1.6.0,REV=2006.11.29.02.51' ); 'LinkPkgArchive ( 'Java 2 SDK, Enterprise Edition (J2EE)' , '1.6.0,REV=2006.11.29.02.51' ); ' ' Note. Ant dependencies are formatted to look like: ' AntStyle('PackageName','PackageVersion'); re.Pattern = "(^|\n)\s*([_A-Za-z0-9]+)\s*\(\s*\'([^\']*)\'\s*\,\s*\'([^\']*)\'\s*\)" Set Matches = re.Execute(SSdep_import) Query_String = ReadFile( rootPath & "queries\form_edit_import_deps.sql" ) OraDatabase.Parameters.Add "RTAG_ID", parRtag_id, ORAPARM_INPUT, ORATYPE_NUMBER OraDatabase.Parameters.Add "PKG_NAME", pkg_name , ORAPARM_INPUT, ORATYPE_STRING OraDatabase.Parameters.Add "PKG_VERSION", pkg_version, ORAPARM_INPUT, ORATYPE_STRING Set OraParameter = OraDatabase.Parameters recCnt=0 For Each Match in Matches build_type = Match.SubMatches(1) pkg_name = Match.SubMatches(2) pkg_version = Match.SubMatches(3) ' Proceed only if: ' pkg name is not empty, ' pkg version is not empty, If ( pkg_name <> "" ) AND ( pkg_version <> "" ) Then ' Define build type ' Unknown will be a BuildPkgArchive If LCase(build_type) = LCase("BuildPkgArchive") Then builtTypeEnum = enum_BUILD_PKG_ARCHIVE ElseIf LCase(build_type) = LCase("LinkPkgArchive") Then builtTypeEnum = enum_LINK_PKG_ARCHIVE Else builtTypeEnum = enum_BUILD_PKG_ARCHIVE End If ' ' Create one entry ' OraParameter("PKG_NAME").Value = pkg_name OraParameter("PKG_VERSION").Value = pkg_version Set rsDeps = OraDatabase.DbCreateDynaset( Query_String, cint(0)) If rsDeps.RecordCount <> 0 Then SShtml_pkg_list = SShtml_pkg_list & GenerateEntry( recCnt, rsDeps("pkg_id"), rsDeps("pv_id"), rsDeps("pkg_name"), rsDeps("pkg_version"), builtTypeEnum, rsDeps("lpkg_version")) recCnt = recCnt + 1 DataFound = true End If rsDeps.Close Set rsDeps = Nothing End If Next OraDatabase.Parameters.Remove "RTAG_ID" OraDatabase.Parameters.Remove "PKG_NAME" OraDatabase.Parameters.Remove "PKG_VERSION" Set OraParameter = Nothing End Sub '------------------------------------------------- ' Function: Populate_from_Package ' Description: Generate the body of the display based on package-versions in the current package ' Sub Populate_from_Package( NNpv_id, nRtag_id, SShtml_pkg_list, BBDataFound ) Dim rsDeps, Query_String BBDataFound = FALSE recCnt = 0 Query_String = ReadFile( rootPath & "queries\edit_dependencies.sql" ) OraDatabase.Parameters.Add "RTAG_ID", nRtag_id, ORAPARM_INPUT, ORATYPE_NUMBER OraDatabase.Parameters.Add "PV_ID", NNpv_id, ORAPARM_INPUT, ORATYPE_NUMBER Set rsDeps = OraDatabase.DbCreateDynaset( Query_String, cint(0)) While ((NOT rsDeps.BOF) AND (NOT rsDeps.EOF)) SShtml_pkg_list = SShtml_pkg_list & GenerateEntry( recCnt, rsDeps("pkg_id"), rsDeps("pv_id"), rsDeps("pkg_name"), rsDeps("pkg_version"), rsDeps("build_type"), rsDeps("lpkg_version")) recCnt = recCnt + 1 BBDataFound = TRUE rsDeps.MoveNext WEnd OraDatabase.Parameters.Remove "RTAG_ID" OraDatabase.Parameters.Remove "PV_ID" End Sub '------------------------------------------------- ' Function: GenerateEntry ' Description: Generate one line of the import display Function GenerateEntry( idx, pkgId, pvId, pName, pVersion, pBuildType, pLversion) Dim LatestVisible GenerateEntry = GenerateEntry &" " ' Package Name - will always be present GenerateEntry = GenerateEntry &" " & pName GenerateEntry = GenerateEntry &" " GenerateEntry = GenerateEntry &" " GenerateEntry = GenerateEntry &" " ' Package Version specified by user ' If package does not exist, then this is a text field ' If isNULL(pkgId) Then GenerateEntry = GenerateEntry &" " &_ " " &_ " " GenerateEntry = GenerateEntry &" " GenerateEntry = GenerateEntry &" Package Name does not exist" GenerateEntry = GenerateEntry &" " Else GenerateEntry = GenerateEntry &" " &_ " " GenerateEntry = GenerateEntry &" " If isNull(pvId) Then GenerateEntry = GenerateEntry &" "&_ ""&_ "" End If GenerateEntry = GenerateEntry &" " ' Latest Versions GenerateEntry = GenerateEntry &" " LatestVisible = "" If NOT IsNull(pLversion) Then If ( pVersion = pLversion ) Then LatestVisible = "style='display:none;'" End If GenerateEntry = GenerateEntry &"
"&_ ""&_ ""&_ ""& pLversion &"
" End If GenerateEntry = GenerateEntry &" " End If GenerateEntry = GenerateEntry &"" End Function %> <% '=================== MAIN LINE ===================== ' Determine call mode On Error GoTo 0 If (Request("action") = "TextImport") Then Call Populate_from_Import ( Request("FRdeps"), HTML_pkg_list, DataFound ) Else Call Populate_from_Package ( parPv_id, parRtag_id, HTML_pkg_list, DataFound ) If Not DataFound Then Call Destroy_All_Objects Response.Redirect ("form_search_pkgs.asp?pv_id="& parPv_id &"&rtag_id="& parRtag_id &"&add_type="& enum_ADD_DEPENDENCIES) End If End If %> Release Manager
<%If HTML_pkg_list = "" Then%> <%End If%>
EDIT dependencies
<%=pkgInfoHash.Item ("pkg_name")%> <%=pkgInfoHash.Item ("pkg_version")%>
<%=HTML_pkg_list%>
Package Name Version Released
&rtag_id=<%=Request("rtag_id")%>';">
No Packages Specified. All dependencies will be deleted