Subversion Repositories DevTools

Rev

Rev 6579 | Blame | Compare with Previous | Last modification | View Log | RSS feed

<%@LANGUAGE="VBSCRIPT"%>
<%
'=====================================================
'|                                                   |
'|             SEARCH RESULT                         |
'|               PACKAGES                            |
'|                                                   |
'=====================================================
%>
<%
Option explicit
' Good idea to set when using redirect
Response.Expires = 0   ' always load the page, dont store
%>
<!--#include file="common/conf.asp"-->
<!--#include file="common/globals.asp"-->
<!--#include file="common/formating.asp"-->
<!--#include file="common/qstr.asp"-->
<!--#include file="common/common_subs.asp"-->
<%
' 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 ------------------
%>
<!--#include file="_access_control_login.asp"-->
<!--#include file="_access_control_general.asp"-->
<%
'------------ 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
%>
<html>
<head>
<title>Release Manager</title>
<link rel="shortcut icon" href="<%=FavIcon%>"/>
<meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="images/release_manager_style.css?ver=<%=VixVerNum%>" type="text/css">
<link rel="stylesheet" href="images/navigation.css?ver=<%=VixVerNum%>" type="text/css">
<script language="JavaScript" src="images/common.js?ver=<%=VixVerNum%>"></script>
<!-- DROPDOWN MENUS -->
<!--#include file="_jquery_includes.asp"-->
<!--#include file="_menu_def.asp"-->
<script language="JavaScript1.2" src="images/popup_menu.js?ver=<%=VixVerNum%>"></script>
</head>
<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" onload="self.focus();document.pkgnames.btnnext.focus();">
<!-- HEADER -->
<!--#include file="_header.asp"-->
<!-- BODY ---->
<table width="100%" height="80%" border="0" cellpadding="0" cellspacing="0">
   <tr>
      <td align="center" valign="top" class='bg_grey'>
         <!-- MIDDLE ---------------------------------------->
         <div>
             <div class=Panel style='width:650px;margin-top: 30px;'>
                 <div class=rounded_box_caption><%=Page_Title ( parAdd_type )%></div>
                 <div class='rounded_box'>
                     <div class=rounded_box_pad>
                   <!-- Body -->
                   <br>
                   <table width="100%" border="0" cellspacing="0" cellpadding="0">
                      <tr>
                         <td valign="bottom" nowrap>
                            <span class="form_txt">Search result for <strong><%=parPkgfind%></strong></span>
                         </td>
                         <td align="right" valign="top" nowrap>
                            <a href="form_new_version.asp?rtag_id=<%=parRtag_id%>&pkgName=<%=parPkgfind%>" class="body_txt_drk">
                            <strong>Not found what you looking for?</strong>
                            <br>
                            <img src="images/i_new_pkg.gif" width="20" height="21" hspace="3" border="0" align="absmiddle">Create new package name.</a>
                         </td>
                      </tr>
                   </table>
                   <br>
                   <div class=textPanel>
                    Select desired packages and click Next.
                    </div>
                    <form name="pkgnames" method="post" action="form_add_pkg_versions.asp?add_type=<%=parAdd_type%>">
                    <table width="100%" border="0" cellspacing="1" cellpadding="2" class=stdGrey>
                         <thead>
                            <th width="1%"></th>
                            <th>Package Name</th>
                         </thead>
                         <%Set rsFind = OraDatabase.DbCreateDynaset( Search_For_Package_Names ( parPkgfind ), cint(0))%>
                         <%RecCount = CInt(rsFind.RecordCount)%>
                         <%While ((NOT rsFind.BOF) AND (NOT rsFind.EOF)) %>
                            <tr>
                               <td>
                                  <%If ( (NOT IsNull(parAdd_type)) AND ((parAdd_type = Cstr(enum_ADD_DEPENDENCIES)) OR (parAdd_type = Cstr(enum_ADD_RUNTIME_DEPENDENCIES))) ) Then%>
                                     <input name="pkg_list" id="pkg_list" type="checkbox" value="<%=rsFind("pv_id")%>" <%If RecCount = 1 Then%>checked<%End If%>>
                                  <%Else%>
                                     <input name="pkg_list" id="pkg_list" type="checkbox" value="<%=rsFind("pkg_id")%>" <%If RecCount = 1 Then%>checked<%End If%>>
                                  <%End If%>
                               </td>
                               <td>
                                  <%
                                  Dim ver_ext
                                  ver_ext = ""
                                  If ( (NOT IsNull(parAdd_type)) AND (NOT IsNull(parRtag_id)) AND ((parAdd_type = Cstr(enum_ADD_DEPENDENCIES)) OR (parAdd_type = Cstr(enum_ADD_RUNTIME_DEPENDENCIES))) ) Then
                                     ver_ext = rsFind("v_ext")
                                     If NOT IsNull(ver_ext) AND ver_ext <> "" Then
                                        ' Remove leading dot character, if there is one
                                        If Left(ver_ext,1) = "." AND Len(ver_ext) > 1 Then
                                           ver_ext = Mid(ver_ext, 2, Len(ver_ext)-1)
                                        Else
                                           ver_ext = ""
                                        End If
                                     End If
                                  End If
                                  %>

                                  <%If NOT IsNull(ver_ext) AND Len(ver_ext) > 0 Then%>
                                     <%=Highlight_Substring ( rsFind("pkg_name"), parPkgfind )%>&nbsp&nbsp&nbsp&nbsp(<%=ver_ext%>)
                                  <%Else%>
                                     <%=Highlight_Substring ( rsFind("pkg_name"), parPkgfind )%>
                                  <%End If%>
                               </td>
                            </tr>
                            <%rsFind.MoveNext
                         WEnd

                         rsFind.Close
                         Set rsFind = nothing
                         %>
                   </table>
                     </div>
               <%If Request("errmsg") <> "" Then %>
                <div class='textPanel rounded_box_pad'>
                   <%Call DisplayInfo( "PKG_NAME_REQUIRED", 200 )%>
                </div>
               <%End If%>
               <div class='buttonPanel'>
                   <input type="reset" name="btn" value="&laquo; Back" onClick="history.back();">
                   <input type="submit" name="btn" value="Next &raquo;" id="btnnext">
                   <input type="reset" name="btn" value="Cancel" onClick="history.go(-2);">
                   <input type="hidden" name="pv_id" value="<%=parPv_id%>">
                   <input type="hidden" name="rtag_id" value="<%=parRtag_id%>">
                   <input type="hidden" name="add_type" value="<%=parAdd_type%>">
                   <input type="hidden" name="pkgfind" value="<%=parPkgfind%>">
               </div>
               </form>
            <!-- END Body-->
                </div>
            </div>
        </div>
    </td>
</tr>
</table>
 <!-- FOOTER -->
 <!--#include file="_footer.asp"-->
</body>
</html>