jford       2004/10/06 15:12:26

  Modified:    applications/pam/src/java/org/apache/jetspeed/portlets/pam
                        PortletApplicationBrowser.java
               applications/pam/src/webapp/WEB-INF/view pam-browser.jsp
  Log:
  Add search component to PAM
  
  Revision  Changes    Path
  1.14      +12 -1     
jakarta-jetspeed-2/applications/pam/src/java/org/apache/jetspeed/portlets/pam/PortletApplicationBrowser.java
  
  Index: PortletApplicationBrowser.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/applications/pam/src/java/org/apache/jetspeed/portlets/pam/PortletApplicationBrowser.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- PortletApplicationBrowser.java    22 Sep 2004 17:03:26 -0000      1.13
  +++ PortletApplicationBrowser.java    6 Oct 2004 22:12:25 -0000       1.14
  @@ -36,6 +36,7 @@
   import org.apache.jetspeed.om.common.portlet.PortletDefinitionComposite;
   import org.apache.jetspeed.portlet.ServletPortlet;
   import org.apache.jetspeed.portlets.pam.beans.TabBean;
  +import org.apache.jetspeed.search.SearchEngine;
   import org.apache.pluto.om.portlet.PortletDefinition;
   import org.apache.webapp.admin.TreeControl;
   import org.apache.webapp.admin.TreeControlNode;
  @@ -54,6 +55,7 @@
       private String template;
       private PortletContext context;
       private PortletRegistryComponent registry;
  +    private SearchEngine searchEngine;
       
       public void init(PortletConfig config)
       throws PortletException 
  @@ -61,6 +63,7 @@
           super.init(config);
           context = getPortletContext();                
           registry = 
(PortletRegistryComponent)context.getAttribute(PortletApplicationResources.CPS_REGISTRY_COMPONENT);
  +        searchEngine = 
(SearchEngine)context.getAttribute(PortletApplicationResources.CPS_SEARCH_COMPONENT);
           if (null == registry)
           {
               throw new PortletException("Failed to find the Portlet Registry on 
portlet initialization");
  @@ -80,6 +83,7 @@
                request.getPortletSession().setAttribute("j2_tree", control);
           }
           request.setAttribute("j2_tree", control);
  +        request.setAttribute("search_results", 
request.getPortletSession().getAttribute("search_results"));
           
           super.doView(request, response);
           
  @@ -92,6 +96,13 @@
                //assert control != null
                if(control != null)
                {
  +                 String searchString = actionRequest.getParameter("query");
  +                 if(searchString != null)
  +                 {
  +                     Iterator results = searchEngine.search(searchString);
  +                     
actionRequest.getPortletSession().setAttribute("search_results", results);
  +                 }
  +                 
                        String node = actionRequest.getParameter("node");
                        if(node != null)
                        {
  
  
  
  1.7       +1 -1      
jakarta-jetspeed-2/applications/pam/src/webapp/WEB-INF/view/pam-browser.jsp
  
  Index: pam-browser.jsp
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/applications/pam/src/webapp/WEB-INF/view/pam-browser.jsp,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- pam-browser.jsp   16 Sep 2004 23:20:30 -0000      1.6
  +++ pam-browser.jsp   6 Oct 2004 22:12:25 -0000       1.7
  @@ -1 +1 @@
  -<%--
Copyright 2004 The Apache Software Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
    http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
--%>
<%@ page language="java" import="javax.portlet.*, java.util.List, java.util.Iterator, 
org.apache.jetspeed.om.common.portlet.MutablePortletApplication" session="true" %>
<%@ taglib uri='/WEB-INF/portlet.tld' prefix='portlet'%>
<%@ taglib uri="http://java.sun.com/jstl/core"; prefix="c" %>
<%@ taglib uri="/WEB-INF/pam.tld" prefix="pam" %>
<portlet:defineObjects/>
<h2>Portlet Application Manager</h2>
<h3>Application Tree View</h3>
<portlet:actionURL var="nodeLink" >
        <portlet:param name="node" value="${name}" />
</portlet:actionURL>

<pam:tree tree="j2_tree" images="/pam/images" scope="portlet_request"
          action="<%= nodeLink %>"
  />
  
  <%--
  style="tree-control"
        styleSelected="tree-control-selected"
      styleUnselected="tree-control-unselected"
      --%>


  \ No newline at end of file
  +<%--
Copyright 2004 The Apache Software Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
    http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
--%>
<%@ page language="java" import="javax.portlet.*, java.util.List, java.util.Iterator, 
org.apache.jetspeed.om.common.portlet.MutablePortletApplication" session="true" %>
<%@ taglib uri='/WEB-INF/portlet.tld' prefix='portlet'%>
<%@ taglib uri="http://java.sun.com/jstl/core"; prefix="c" %>
<%@ taglib uri="/WEB-INF/pam.tld" prefix="pam" %>
<portlet:defineObjects/>
<h2>Portlet Application Manager</h2>
<h3>Application Tree View</h3>

<hr />

<portlet:actionURL var="searchLink" />

<form action="<c:out value="${searchLink}"/>" method="post">

        <input type="text" name="query" value="" /> <input type="submit" 
value="Search"/>

</form>

<c:set var="results" value="${requestScope.search_results}" />

<c:if test="${results != null}">
        <c:forEach var="result" items="${search_results}">
                <c:out value="${result.title}"/> | <c:out 
value="${result.description}"/> <br />
        </c:forEach>
</c:if>

<hr />



<portlet:actionURL var="nodeLink" >
        <portlet:param name="node" value="${name}" />
</portlet:actionURL>

<pam:tree tree="j2_tree" images="/pam/images" scope="portlet_request"
          action="<%= nodeLink %>"
  />
  
  <%--
  style="tree-control"
        styleSelected="tree-control-selected"
      styleUnselected="tree-control-unselected"
      --%>


  \ No newline at end of file
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to