<%-- The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at . Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is the Venice Web Communities System. The Initial Developer of the Original Code is Eric J. Bowersox , for Silverwrist Design Studios. Portions created by Eric J. Bowersox are Copyright (C) 2001-2004 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. Contributor(s): --%> <%@ page import = "java.util.Iterator" %> <%@ page import = "java.util.List" %> <%@ page import = "com.silverwrist.util.*" %> <%@ page import = "com.silverwrist.venice.core.*" %> <%@ page import = "com.silverwrist.venice.ui.view.FindView" %> <%@ taglib uri="/tlds/util" prefix="util" %> <%@ taglib uri="/tlds/global" prefix="global" %> <% FindView data = FindView.get(request); CategoryDescriptor cat = null; %> Find page <% if (data.testDisplayMode(FindView.FD_COMMUNITIES)) { %> find.js.vs?disp=<%= FindView.FD_COMMUNITIES %> Communities <% } else { %> find.js.vs?disp=<%= FindView.FD_COMMUNITIES %> Communities <% } // end if %> <% if (data.testDisplayMode(FindView.FD_USERS)) { %> find.js.vs?disp=<%= FindView.FD_USERS %> Users <% } else { %> find.js.vs?disp=<%= FindView.FD_USERS %> Users <% } // end if %> <% if (data.testDisplayMode(FindView.FD_CATEGORIES)) { %> find.js.vs?disp=<%= FindView.FD_CATEGORIES %> Categories <% } else { %> find.js.vs?disp=<%= FindView.FD_CATEGORIES %> Categories <% } // end if %> <% if (data.testDisplayMode(FindView.FD_POSTS)) { %> find.js.vs?disp=<%= FindView.FD_POSTS %> Posts <% } else { %> find.js.vs?disp=<%= FindView.FD_POSTS %> Posts <% } // end if %> <%-- Display the search form --%> Find form
<% if (data.testDisplayMode(FindView.FD_POSTS)) { %> Find Posts form Find Posts: Keywords:
<% } else { %> <% if (data.testDisplayMode(FindView.FD_COMMUNITIES)) { %> Find Communities form Find Communities: Display all communities whose  
<% } else if (data.testDisplayMode(FindView.FD_USERS)) { %> Find Users form Find Users: Display all users whose  
<% } else if (data.testDisplayMode(FindView.FD_CATEGORIES)) { %> Find Categories form Find Categories: Display all categories whose name   <%-- shouldn't get here --%>

Display parameter invalid!

<% } else { %> <%-- shouldn't get here --%>

Display parameter invalid!

<% } // end if %> <% if (data.testDisplayMode(FindView.FD_CATEGORIES)) { %>
<% } else { %>  <% } %>
<% } // end if %>
<%-- Display the current category --%> <% cat = data.getCategory(); %> <% if (cat!=null) { %> Display Category Name
Category: <% if (cat.getCategoryID()<0) { %> Top <% } else { %> find.js.vs?disp=<%= FindView.FD_COMMUNITIES %> Top <% for (int i=0; i <% if (i<(cat.getNumLevels()-1)) { %> : find.js.vs?disp=<%= FindView.FD_COMMUNITIES %>&cat=<%= cat.getIDAtLevel(i) %> <%= cat.getTitleAtLevel(i) %> <% } else { %> : <%= cat.getTitleAtLevel(i) %> <% } // end if %> <% } // end for %> <% } // end if (displaying the subcategory tree) %>

<%-- Display the subcategory list --%> <% List subcats = data.getSubCategories(); %> <% if ((subcats!=null) && (subcats.size()>0)) { %> Display Subcategory List Subcategories:
<% for (Iterator it = subcats.iterator(); it.hasNext(); ) { %> <% CategoryDescriptor c = (CategoryDescriptor)(it.next()); %> <% } // end for %>
find.js.vs?disp=<%= FindView.FD_COMMUNITIES %>&cat=<%= c.getLinkedCategoryID() %> <%= c.getTitleAtLevel(c.getNumLevels()-1) %> <% if (c.isSymbolicLink()) { %>@<% } %>
<% } // end if (displaying subcategory list) %> <% } // end if (category specified) %> <%-- Display the search results --%> <% List results = data.getResults(); %> <% if (results!=null) { %> Display Search Results <% // Determine the number of results to display and whether to display a "next" button int dcount = results.size(); boolean go_next = false; if (dcount>data.getMaxResults()) { // there's a "next" dcount = data.getMaxResults(); go_next = true; } // end if %>


<%-- The initial search results --%> <% if (cat!=null) { %>Communities in Category<% } else { %>Search Results<% } %> <% if (data.getFindCount()>0) { %> (Displaying <%= data.getOffset() + 1 %>-<%= data.getOffset() + dcount %> of <%= data.getFindCount() %>) <% } else { %>(None)<% } %> <% if (go_next || (data.getOffset()>0)) { %> <%-- The navigational form that allows us to page through the results --%> Navigational form
<% if (cat!=null) { %><% } %> <% if (data.getOffset()>0) { %> <% } else { %> <% } // end if %>    <% if (go_next) { %> <% } else { %> <% } // end if %>
<% } else { %> <% } %>

<%-- Display the results of the search --%> <% if (data.testDisplayMode(FindView.FD_POSTS) && (dcount>0)) { %> <% } // end if %> <% for (int i=0; i <% if (data.testDisplayMode(FindView.FD_POSTS)) { %> <% TopicMessageFound post = (TopicMessageFound)(results.get(i)); %> <% } else { %> <% } // end if %> <% } // end for %>
Post Link Author Post Date Lines  
go/<%= post.getIdentifier() %> <%= post.getIdentifier() %> user/<%= post.getAuthor() %> <%= post.getAuthor() %> <%= data.formatDate(post.getPostDate()) %> <%= post.getLineCount() %> <%= post.getText() %> <% Object item = results.get(i); %> <% if (data.testDisplayMode(FindView.FD_COMMUNITIES)) { %> <% CommunityContext comm = (CommunityContext)item; String host_name = FindView.getCommunityHostName(comm); int members = FindView.getCommunityMemberCount(comm); %> comm/<%= comm.getAlias() %> <%= comm.getName() %>
<% if (host_name!=null) { %> Host: user/<%= host_name %> <%= host_name %> <% } // end if (got host name) %> <% if (members>=0) { %> <% if (host_name!=null) { %> - <% } %> <%= members %> members <% } // end if (got member count) %> <% if ((host_name!=null) || (members>=0)) { %>
<% } %> Latest activity: <%= data.getActivityString(comm.getLastAccessDate()) %>
<%= comm.getSynopsis() %> <% } else if (data.testDisplayMode(FindView.FD_USERS)) { %> <% UserFound uf = (UserFound)item; String fullname = uf.getGivenName() + " " + uf.getFamilyName(); fullname = fullname.trim(); if (StringUtil.isStringEmpty(fullname)) fullname = uf.getName(); String whence = ""; if (!(StringUtil.isStringEmpty(uf.getLocality()))) { // combine locations if (!(StringUtil.isStringEmpty(uf.getRegion()))) whence = uf.getLocality() + ", " + uf.getRegion(); else whence = uf.getLocality(); } // end if else if (!(StringUtil.isStringEmpty(uf.getRegion()))) whence = uf.getRegion(); %> user/<%= uf.getName() %> <%= uf.getName() %>
<%= fullname %>, from <%= whence %> <% if (!(uf.getCountry().equals("XX"))) { %><%= uf.getCountry() %><% } %> <% if (uf.getDescription()!=null) { %>
<%= uf.getDescription() %> <% } // end if %> <% } else if (data.testDisplayMode(FindView.FD_CATEGORIES)) { %> <% CategoryDescriptor cd = (CategoryDescriptor)item; %> find.js.vs?disp=<%= FindView.FD_COMMUNITIES %>&cat=<%= cd.getLinkedCategoryID() %> <%= cd.toString() %> <% } // end if %>

<% } // end if (results found) %> <%-- EOF --%>