<%-- 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 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. Contributor(s): --%> <%@ page import = "java.util.*" %> <%@ page import = "com.silverwrist.util.StringUtil" %> <%@ page import = "com.silverwrist.venice.core.*" %> <%@ page import = "com.silverwrist.venice.except.*" %> <%@ page import = "com.silverwrist.venice.servlets.Variables" %> <%@ page import = "com.silverwrist.venice.servlets.format.*" %> <%! private static String getCommunityHostName(CommunityContext comm) { try { // get the host name for the specified community UserProfile prof = comm.getHostProfile(); return prof.getUserName(); } // end try catch (DataException e) { // just return NULL if an exception strikes return null; } // end catch } // end getCommunityHostName private static int getCommunityMemberCount(CommunityContext comm) { try { // get the member count for the specified community return comm.getMemberCount(); } // end try catch (DataException e) { // just return -1 if an exception strikes return -1; } // end catch } // end getCommunityMemberCount private static String getActivityString(CommunityContext comm, RenderData rdat) { return rdat.getActivityString(comm.getLastAccessDate()); } // end getActivityString %> <% FindData data = FindData.retrieve(request); Variables.failIfNull(data); RenderData rdat = RenderConfig.createRenderData(application,request,response); %> <% data.writeHeader(rdat,out); %> <%-- Display the search form --%> <% if (rdat.useHTMLComments()) { %><% } %>
">
<% if (data.getDisplayOption()==FindData.FD_COMMUNITIES) { %> <% if (rdat.useHTMLComments()) { %><% } %> <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,4) %>Find Communities:
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> Display all communities whose  
<% } else if (data.getDisplayOption()==FindData.FD_USERS) { %> <% if (rdat.useHTMLComments()) { %><% } %> <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,4) %>Find Users:
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> Display all users whose  
<% } else if (data.getDisplayOption()==FindData.FD_CATEGORIES) { %> <% if (rdat.useHTMLComments()) { %><% } %> <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,4) %>Find Categories:
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> Display all categories whose name   <% } else throw new InternalStateError("display parameter " + data.getDisplayOption() + " invalid"); %> <% if (data.getDisplayOption()==FindData.FD_CATEGORIES) { %>
<% } else { %>  <% } %>
" ALT="Search" WIDTH=80 HEIGHT=24 BORDER=0>
<%-- Display the current category --%> <% String a_head, a_tail; // used for formatting category display %> <% CategoryDescriptor cat = data.getCategory(); %> <% if (cat!=null) { %> <% if (rdat.useHTMLComments()) { %><% } %>
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,3) %>Category: <% a_head = ""; a_tail = ""; if (cat.getCategoryID()>=0) { // assign the anchor tags a_head = ""; a_tail = ""; } // end if %> <%= a_head %>Top<%= a_tail %> <% if (cat.getCategoryID()>=0) { %> <% for (int i=0; i <% a_head = ": "; a_tail = ""; if (i<(cat.getNumLevels()-1)) { // assign the anchor tags a_head = ": "; a_tail = ""; } // end if %> <%= a_head %><%= StringUtil.encodeHTML(cat.getTitleAtLevel(i)) %><%= a_tail %> <% } // end for %> <% } // end if (displaying the entire subcategory tree) %>

<%-- Display the subcategory list --%> <% List subcats = data.getSubCategoryList(); %> <% if ((subcats!=null) && (subcats.size()>0)) { %> <% if (rdat.useHTMLComments()) { %><% } %> Subcategories:
<% Iterator it = subcats.iterator(); %> <% while (it.hasNext()) { %> <% } // end while %>
" ALT="*" WIDTH=14 HEIGHT=14 BORDER=0> <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> <% CategoryDescriptor c = (CategoryDescriptor)(it.next()); a_head = ""; %> <%= a_head %><%= StringUtil.encodeHTML(c.getTitleAtLevel(c.getNumLevels()-1)) %> <% if (c.isSymbolicLink()) { %>@<% } %>
<% } // end if (displaying subcategory list) %> <% } // end if (category specified) %> <% List results = data.getResultsList(); %> <% if (results!=null) { %> <% if (rdat.useHTMLComments()) { %><% } %> <% // 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.getNumResultsDisplayed()) { // there's a "next" dcount = data.getNumResultsDisplayed(); go_next = true; } // end if %>


<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,3) %> <%-- 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 --%> <% if (rdat.useHTMLComments()) { %><% } %>
">
<% if (cat!=null) { %><% } %> <% if (data.getOffset()>0) { %> " ALT="Previous" WIDTH=80 HEIGHT=24 BORDER=0> <% } else { %> " WIDTH=80 HEIGHT=24 BORDER=0> <% } // end if %>    <% if (go_next) { %> " ALT="Next" WIDTH=80 HEIGHT=24 BORDER=0> <% } else { %> " WIDTH=80 HEIGHT=24 BORDER=0> <% } // end if %>
<% } else { %> <% } %>

<%-- Display the results of the search --%> <% for (int i=0; i <% } // end for %>
" ALT="*" WIDTH=14 HEIGHT=14 BORDER=0> <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> <% Object item = results.get(i); %> <% if (data.getDisplayOption()==FindData.FD_COMMUNITIES) { %> <% CommunityContext comm = (CommunityContext)item; String host_name = getCommunityHostName(comm); int members = getCommunityMemberCount(comm); %> "><%= StringUtil.encodeHTML(comm.getName()) %>
<% if (host_name!=null) { %> Host: "><%= 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: <%= getActivityString(comm,rdat) %>
<%= StringUtil.encodeHTML(comm.getSynopsis()) %> <% } else if (data.getDisplayOption()==FindData.FD_USERS) { %> <% UserFound uf = (UserFound)item; %> "><%= uf.getName() %>
<%= StringUtil.encodeHTML(uf.getGivenName()) %> <%= StringUtil.encodeHTML(uf.getFamilyName()) %>, from <%= StringUtil.encodeHTML(uf.getLocality()) %>, <%= StringUtil.encodeHTML(uf.getRegion()) %> <%= uf.getCountry() %> <% if (uf.getDescription()!=null) { %>
<%= StringUtil.encodeHTML(uf.getDescription()) %><% } %> <% } else if (data.getDisplayOption()==FindData.FD_CATEGORIES) { %> <% CategoryDescriptor cd = (CategoryDescriptor)item; %> <%= StringUtil.encodeHTML(cd.toString()) %> <% } %>

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