%@LANGUAGE="VBSCRIPT"%> <% '===================================================== '| | '| SEARCH RESULT | '| PACKAGES | '| | '===================================================== %> <% 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") = "" AND Request("rtag_id") = "" Then Call Destroy_All_Objects Response.Redirect("index.asp") End If objPMod.PersistInQryString ( aPersistList(enumPAR_ADD_TYPE) ) objPMod.PersistInCookie("pkgfind") %> <% '------------ ACCESS CONTROL ------------------ %> <% '------------ Variable Definition ------------- Dim parAdd_type Dim parPkgfind Dim rsFind Dim parPv_id Dim RecCount '------------ Constants Declaration ----------- '------------ Variable Init ------------------- parAdd_type = Request("add_type") parPkgfind = Request("pkgfind") parPv_id = Request("pv_id") '---------------------------------------------- %> <% Function Page_Title ( NNadd_type ) If NNadd_type = Cstr(enum_ADD_PACKAGES) Then Page_Title = "ADD package" ElseIf NNadd_type = Cstr(enum_ADD_DEPENDENCIES) Then Page_Title = "ADD dependency" ElseIf NNadd_type = Cstr(enum_ADD_RUNTIME_DEPENDENCIES) Then Page_Title = "ADD Runtime Dependency" Else Page_Title = "" End If End Function Function Search_For_Package_Names ( SSpkgfind ) Dim pkg_name_like, SQLor, pkglistARR SQLor = "" If Len( Replace( SSpkgfind, " ", "" ) ) = 0 Then ' Show all pkg names SQLor = " OR pkg.pkg_name LIKE '%'" Else ' Search for ... pkglistARR = Split( Trim( SSpkgfind ), " ") If Ubound( pkglistARR ) > 0 Then ' Multiple pkg_name search For Each pkg_name_like In pkglistARR If pkg_name_like <> "" Then SQLor = SQLor &" OR UPPER(pkg.pkg_name) LIKE UPPER('%"& pkg_name_like &"%')" End If Next Else ' Single pkg_name search SQLor = " OR UPPER(pkg.pkg_name) LIKE UPPER('%"& Trim( SSpkgfind ) &"%')" End If End If ' Search may be restricted to those packages that have versions in the specified release, so alter the ' query accordingly. If ( (NOT IsNull(parAdd_type)) AND (NOT IsNull(parRtag_id)) AND (parAdd_type = Cstr(enum_ADD_DEPENDENCIES)) ) Then ' find all packages matching wildcard, that have versions in the specified release, and that are not already ' configured as a build dependency, and that is not the actual package we are configuring dependencies for Search_For_Package_Names = _ " SELECT pkg.*, pv.pv_id, pv.v_ext"&_ " FROM packages pkg, release_content rc, package_versions pv"&_ " WHERE pkg.pkg_id != 0"&_ " AND pv.pkg_id = pkg.pkg_id"&_ " AND pv.pv_id = rc.pv_id"&_ " AND rc.pv_id NOT IN (SELECT pd.dpv_id FROM package_dependencies pd WHERE pd.pv_id = "& parPv_id & ")"&_ " AND pkg.pkg_id NOT IN (SELECT pvv.pkg_id FROM package_versions pvv WHERE pvv.pv_id = "& parPv_id & ")"&_ " AND rc.rtag_id = "& parRtag_id &_ " AND ( pkg.pkg_name = ''"&_ SQLor &_ " )"&_ "ORDER BY UPPER(pkg.pkg_name)" Else If ( (NOT IsNull(parAdd_type)) AND (NOT IsNull(parRtag_id)) AND (parAdd_type = Cstr(enum_ADD_RUNTIME_DEPENDENCIES)) ) Then ' find all packages matching wildcard, that have versions in the specified release, and that are not already ' configured as a runtime dependency, and that is not the actual package we are configuring dependencies for Search_For_Package_Names = _ " SELECT pkg.*, pv.pv_id, pv.v_ext"&_ " FROM packages pkg, release_content rc, package_versions pv"&_ " WHERE pkg.pkg_id != 0"&_ " AND pv.pkg_id = pkg.pkg_id"&_ " AND pv.pv_id = rc.pv_id"&_ " AND pv.pv_id NOT IN (SELECT rtd.rtd_id FROM runtime_dependencies rtd WHERE rtd.pv_id = "& parPv_id & ")"&_ " AND pkg.pkg_id NOT IN (SELECT pvv.pkg_id FROM package_versions pvv WHERE pvv.pv_id = "& parPv_id & ")"&_ " AND rc.rtag_id = "& parRtag_id &_ " AND ( pkg.pkg_name = ''"&_ SQLor &_ " )"&_ "ORDER BY UPPER(pkg.pkg_name)" Else ' simply find all packages matching wildcard, regardless of the specified release or any other constraint ' This is needed when user is adding package versions to a release. ' Only allow the addition of package names that have versions Search_For_Package_Names = _ " SELECT pkg.*"&_ " FROM packages pkg"&_ " WHERE pkg.pkg_id != 0"&_ " AND ( pkg.pkg_name = ''"&_ SQLor &_ " )"&_ " AND exists (select 1 from PACKAGE_VERSIONS pv where pv.PKG_ID = pkg.PKG_ID)" &_ "ORDER BY UPPER(pkg.pkg_name)" End If End If End Function %>
|
<%=Page_Title ( parAdd_type )%>
Select desired packages and click Next.
<%Call DisplayInfo( "PKG_NAME_REQUIRED", 200 )%>
<%End If%>
|