<%-- 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.servlets.Variables" %> <%@ page import = "com.silverwrist.venice.servlets.format.*" %> <%! private static String getSIGHostName(SIGContext sig) { try { // get the host name for the specified SIG UserProfile prof = sig.getHostProfile(); return prof.getUserName(); } // end try catch (DataException e) { // just return NULL if an exception strikes return null; } // end catch } // end getSIGHostName private static int getSIGMemberCount(SIGContext sig) { try { // get the member count for the specified SIG return sig.getMemberCount(); } // end try catch (DataException e) { // just return -1 if an exception strikes return -1; } // end catch } // end getSIGMemberCount private static String getActivityString(SIGContext sig, RenderData rdat) { return rdat.getActivityString(sig.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_SIGS) { %> <% if (rdat.useHTMLComments()) { %><% } %> <%= rdat.getStdFontTag(null,4) %>Find SIGs:
<%= rdat.getStdFontTag(null,2) %> Display all SIGs whose  
<% } else if (data.getDisplayOption()==FindData.FD_USERS) { %> <% if (rdat.useHTMLComments()) { %><% } %> <%= rdat.getStdFontTag(null,4) %>Find Users:
<%= rdat.getStdFontTag(null,2) %> Display all users whose  
<% } else if (data.getDisplayOption()==FindData.FD_CATEGORIES) { %> <% if (rdat.useHTMLComments()) { %><% } %> <%= rdat.getStdFontTag(null,4) %>Find Categories:
<%= rdat.getStdFontTag(null,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(null,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(null,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(null,3) %> <%-- The initial search results --%> <% if (cat!=null) { %>SIGs 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(null,2) %> <% Object item = results.get(i); %> <% if (data.getDisplayOption()==FindData.FD_SIGS) { %> <% SIGContext sig = (SIGContext)item; String host_name = getSIGHostName(sig); int members = getSIGMemberCount(sig); %> "><%= StringUtil.encodeHTML(sig.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(sig,rdat) %>
<%= StringUtil.encodeHTML(sig.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) %> <% rdat.writeFooter(out); %>