diff --git a/etc/web.xml b/etc/web.xml index a2daa79..322f046 100644 --- a/etc/web.xml +++ b/etc/web.xml @@ -270,6 +270,14 @@ com.silverwrist.venice.servlets.AdminUserPhoto + + findpost + + Searches for posts in communities, conferences, or topics. + + com.silverwrist.venice.servlets.FindPost + + @@ -413,6 +421,11 @@ /adminuserphoto + + findpost + /findpost + + testformdata diff --git a/src/com/silverwrist/venice/core/UserContext.java b/src/com/silverwrist/venice/core/UserContext.java index d2bf68c..032c157 100644 --- a/src/com/silverwrist/venice/core/UserContext.java +++ b/src/com/silverwrist/venice/core/UserContext.java @@ -123,10 +123,9 @@ public interface UserContext extends SearchMode public abstract boolean canSetUserPhoto() throws DataException; - public abstract List searchPosts(String search_terms, int offset, int count) - throws AccessError, DataException; + public abstract List searchPosts(String search_terms, int offset, int count) throws DataException; - public abstract int getSearchPostCount(String search_terms) throws AccessError, DataException; + public abstract int getSearchPostCount(String search_terms) throws DataException; } // end interface UserContext diff --git a/src/com/silverwrist/venice/core/impl/CommunityUserContextImpl.java b/src/com/silverwrist/venice/core/impl/CommunityUserContextImpl.java index 9182262..374c3ed 100644 --- a/src/com/silverwrist/venice/core/impl/CommunityUserContextImpl.java +++ b/src/com/silverwrist/venice/core/impl/CommunityUserContextImpl.java @@ -1404,6 +1404,7 @@ class CommunityUserContextImpl implements CommunityContext, CommunityBackend throw new IllegalArgumentException("invalid offset parameter"); if (count<=0) throw new IllegalArgumentException("invalid count parameter"); + testConferenceAccess(); Connection conn = null; ArrayList rc = new ArrayList(); @@ -1416,11 +1417,11 @@ class CommunityUserContextImpl implements CommunityContext, CommunityBackend // create the SQL statement StringBuffer sql = - new StringBuffer("SELECT c.confid, t.topicid, t.topicnum, p.postid, p.num, p.creator_uid, " - + "p.posted, p.linecount, d.data FROM confs c, sigtoconf s, topics t, posts p, " - + "postdata d, users u LEFT JOIN sigmember m ON (s.sigid = m.sigid " - + "AND u.uid = m.uid) LEFT JOIN confmember x ON (c.confid = x.confid AND " - + "u.uid = x.uid) WHERE u.uid = "); + new StringBuffer("SELECT c.confid, t.topicid, t.num, p.postid, p.num, p.creator_uid, p.posted, " + + "p.linecount, d.data FROM confs c, sigtoconf s, topics t, posts p, postdata d, " + + "users u LEFT JOIN sigmember m ON (s.sigid = m.sigid AND u.uid = m.uid) " + + "LEFT JOIN confmember x ON (c.confid = x.confid AND u.uid = x.uid) " + + "WHERE u.uid = "); sql.append(env.getUserID()).append(" AND c.confid = s.confid AND s.sigid = "); sql.append(cid); sql.append(" AND GREATEST(u.base_lvl,IFNULL(m.granted_lvl,0),s.granted_lvl,IFNULL(x.granted_lvl,0)) " @@ -1462,6 +1463,7 @@ class CommunityUserContextImpl implements CommunityContext, CommunityBackend logger.debug("getSearchPostCount('" + search_terms + ") entry"); if (search_terms==null) throw new NullPointerException("invalid search terms"); + testConferenceAccess(); Connection conn = null; diff --git a/src/com/silverwrist/venice/core/impl/ConferenceUserContextImpl.java b/src/com/silverwrist/venice/core/impl/ConferenceUserContextImpl.java index 9fab3c4..15d40de 100644 --- a/src/com/silverwrist/venice/core/impl/ConferenceUserContextImpl.java +++ b/src/com/silverwrist/venice/core/impl/ConferenceUserContextImpl.java @@ -1635,7 +1635,7 @@ class ConferenceUserContextImpl implements ConferenceContext, ConferenceBackend throw new IllegalArgumentException("invalid offset parameter"); if (count<=0) throw new IllegalArgumentException("invalid count parameter"); - if (getConferenceData().canReadConference(level)) + if (!(getConferenceData().canReadConference(level))) throw new AccessError("You are not permitted to search for posts within this conference."); Connection conn = null; @@ -1649,8 +1649,8 @@ class ConferenceUserContextImpl implements ConferenceContext, ConferenceBackend // create the SQL statement StringBuffer sql = - new StringBuffer("SELECT t.topicid, t.topicnum, p.postid, p.num, p.creator_uid, p.posted, " - + "p.linecount, d.data FROM topics t, posts p, postdata d WHERE t.confid = "); + new StringBuffer("SELECT t.topicid, t.num, p.postid, p.num, p.creator_uid, p.posted, p.linecount, " + + "d.data FROM topics t, posts p, postdata d WHERE t.confid = "); sql.append(confid); sql.append(" AND t.topicid = p.topicid AND p.scribble_uid IS NULL AND p.postid = d.postid " + "AND MATCH(d.data) AGAINST("); @@ -1691,7 +1691,7 @@ class ConferenceUserContextImpl implements ConferenceContext, ConferenceBackend if (search_terms==null) throw new NullPointerException("invalid search terms"); - if (getConferenceData().canReadConference(level)) + if (!(getConferenceData().canReadConference(level))) throw new AccessError("You are not permitted to search for posts within this conference."); Connection conn = null; diff --git a/src/com/silverwrist/venice/core/impl/TopicMessageFoundImpl.java b/src/com/silverwrist/venice/core/impl/TopicMessageFoundImpl.java index 19c11ff..5d97765 100644 --- a/src/com/silverwrist/venice/core/impl/TopicMessageFoundImpl.java +++ b/src/com/silverwrist/venice/core/impl/TopicMessageFoundImpl.java @@ -73,7 +73,10 @@ class TopicMessageFoundImpl implements TopicMessageFound private static final String transformText(String text) { - return text; // TEMP + // TEMPORARY IMPLEMENTATION + if (text.length()<60) + return text; + return text.substring(0,60) + "..."; } // end transformText diff --git a/src/com/silverwrist/venice/core/impl/UserContextImpl.java b/src/com/silverwrist/venice/core/impl/UserContextImpl.java index f4da030..d4e0554 100644 --- a/src/com/silverwrist/venice/core/impl/UserContextImpl.java +++ b/src/com/silverwrist/venice/core/impl/UserContextImpl.java @@ -27,6 +27,7 @@ import com.silverwrist.venice.core.internals.*; import com.silverwrist.venice.db.*; import com.silverwrist.venice.except.*; import com.silverwrist.venice.security.*; +import com.silverwrist.venice.svc.ServiceControl; class UserContextImpl implements UserContext, UserBackend { @@ -1431,7 +1432,7 @@ class UserContextImpl implements UserContext, UserBackend } // end canSetUserPhoto - public List searchPosts(String search_terms, int offset, int count) throws AccessError, DataException + public List searchPosts(String search_terms, int offset, int count) throws DataException { if (logger.isDebugEnabled()) logger.debug("searchPosts('" + search_terms + "', " + offset + ", " + count + ") entry"); @@ -1442,6 +1443,7 @@ class UserContextImpl implements UserContext, UserBackend if (count<=0) throw new IllegalArgumentException("invalid count parameter"); + ServiceToken conf_token = env.getSCM().getTokenForSymbol(ServiceControl.SVCGRP_COMMUNITY,"Conference"); Connection conn = null; ArrayList rc = new ArrayList(); @@ -1453,15 +1455,16 @@ class UserContextImpl implements UserContext, UserBackend // create the SQL statement StringBuffer sql = - new StringBuffer("SELECT s.sigid, c.confid, t.topicid, t.topicnum, p.postid, p.num, p.creator_uid, " + new StringBuffer("SELECT s.sigid, c.confid, t.topicid, t.num, p.postid, p.num, p.creator_uid, " + "p.posted, p.linecount, d.data FROM confs c, sigtoconf s, topics t, posts p, " - + "postdata d, users u, sigmember m LEFT JOIN confmember x " + + "postdata d, users u, sigmember m, sigftrs f LEFT JOIN confmember x " + "ON (c.confid = x.confid AND u.uid = x.uid) WHERE u.uid = "); sql.append(uid); - sql.append(" AND c.confid = s.confid AND s.sigid = m.sigid AND m.uid = u.uid AND " - + "GREATEST(u.base_lvl,m.granted_lvl,s.granted_lvl,IFNULL(x.granted_lvl,0)) >= c.read_lvl " - + "AND t.confid = c.confid AND t.topicid = p.topicid AND p.scribble_uid IS NULL AND " - + "p.postid = d.postid AND MATCH(d.data) AGAINST ("); + sql.append(" AND s.sigid = m.sigid AND m.uid = u.uid AND s.sigid = f.sigid AND f.ftr_code = "); + sql.append(conf_token.getIndex()); + sql.append(" AND c.confid = s.confid AND GREATEST(u.base_lvl,m.granted_lvl,s.granted_lvl," + + "IFNULL(x.granted_lvl,0)) >= c.read_lvl AND t.confid = c.confid AND t.topicid = p.topicid " + + "AND p.scribble_uid IS NULL AND p.postid = d.postid AND MATCH(d.data) AGAINST ("); sql.append(SQLUtil.encodeStringArg(search_terms)).append(") LIMIT ").append(offset).append(", "); sql.append(count).append(';'); @@ -1492,13 +1495,14 @@ class UserContextImpl implements UserContext, UserBackend } // end searchPosts - public int getSearchPostCount(String search_terms) throws AccessError, DataException + public int getSearchPostCount(String search_terms) throws DataException { if (logger.isDebugEnabled()) logger.debug("getSearchPostCount('" + search_terms + ") entry"); if (search_terms==null) throw new NullPointerException("invalid search terms"); + ServiceToken conf_token = env.getSCM().getTokenForSymbol(ServiceControl.SVCGRP_COMMUNITY,"Conference"); Connection conn = null; try @@ -1509,13 +1513,14 @@ class UserContextImpl implements UserContext, UserBackend // create the SQL statement StringBuffer sql = new StringBuffer("SELECT COUNT(*) FROM confs c, sigtoconf s, topics t, posts p, postdata d, " - + "users u, sigmember m LEFT JOIN confmember x ON (c.confid = x.confid AND " - + "u.uid = x.uid) WHERE u.uid = "); + + "users u, sigmember m, sigftrs f LEFT JOIN confmember x ON (c.confid = x.confid " + + "AND u.uid = x.uid) WHERE u.uid = "); sql.append(uid); - sql.append(" AND c.confid = s.confid AND s.sigid = m.sigid AND m.uid = u.uid AND " - + "GREATEST(u.base_lvl,m.granted_lvl,s.granted_lvl,IFNULL(x.granted_lvl,0)) >= c.read_lvl " - + "AND t.confid = c.confid AND t.topicid = p.topicid AND p.scribble_uid IS NULL AND " - + "p.postid = d.postid AND MATCH(d.data) AGAINST ("); + sql.append(" AND s.sigid = m.sigid AND m.uid = u.uid AND s.sigid = f.sigid AND f.ftr_code = "); + sql.append(conf_token.getIndex()); + sql.append(" AND c.confid = s.confid AND GREATEST(u.base_lvl,m.granted_lvl,s.granted_lvl," + + "IFNULL(x.granted_lvl,0)) >= c.read_lvl AND t.confid = c.confid AND t.topicid = p.topicid " + + "AND p.scribble_uid IS NULL AND p.postid = d.postid AND MATCH(d.data) AGAINST ("); sql.append(SQLUtil.encodeStringArg(search_terms)).append(");"); // execute the query and load the results diff --git a/src/com/silverwrist/venice/servlets/FindPost.java b/src/com/silverwrist/venice/servlets/FindPost.java new file mode 100644 index 0000000..d9a543d --- /dev/null +++ b/src/com/silverwrist/venice/servlets/FindPost.java @@ -0,0 +1,113 @@ +/* + * 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): + */ +package com.silverwrist.venice.servlets; + +import java.io.*; +import javax.servlet.*; +import javax.servlet.http.*; +import com.silverwrist.venice.core.*; +import com.silverwrist.venice.except.*; +import com.silverwrist.venice.servlets.format.*; + +public class FindPost extends VeniceServlet +{ + /*-------------------------------------------------------------------------------- + * Overrides from class HttpServlet + *-------------------------------------------------------------------------------- + */ + + public String getServletInfo() + { + String rc = "FindPost servlet - Searches for posts in communities, conferences, and/or topics\n" + + "Part of the Venice Web Communities System\n"; + return rc; + + } // end getServletInfo + + /*-------------------------------------------------------------------------------- + * Overrides from class VeniceServlet + *-------------------------------------------------------------------------------- + */ + + protected VeniceContent doVeniceGet(HttpServletRequest request, VeniceEngine engine, + UserContext user, RenderData rdat) + throws ServletException, IOException, VeniceServletResult + { + CommunityContext comm = getCommunityParameter(request,user,true,"top"); + changeMenuCommunity(request,comm); + String locator = "sig=" + comm.getCommunityID(); + + ConferenceContext conf = getConferenceParameter(request,comm,false,"confops?" + locator); + TopicContext topic = null; + if (conf!=null) + { // find the topic parameter + locator += ("&conf=" + conf.getConfID()); + topic = getTopicParameter(request,conf,false,"confdisp?" + locator); + if (topic!=null) + locator += ("&top=" + topic.getTopicNumber()); + + } // end if + + setMyLocation(request,"findpost?" + locator); + return new FindPostData(comm,conf,topic); + + } // end doVeniceGet + + protected VeniceContent doVenicePost(HttpServletRequest request, VeniceEngine engine, + UserContext user, RenderData rdat) + throws ServletException, IOException, VeniceServletResult + { + CommunityContext comm = getCommunityParameter(request,user,true,"top"); + changeMenuCommunity(request,comm); + String locator = "sig=" + comm.getCommunityID(); + + ConferenceContext conf = getConferenceParameter(request,comm,false,"confops?" + locator); + TopicContext topic = null; + if (conf!=null) + { // find the topic parameter + locator += ("&conf=" + conf.getConfID()); + topic = getTopicParameter(request,conf,false,"confdisp?" + locator); + if (topic!=null) + locator += ("&top=" + topic.getTopicNumber()); + + } // end if + + setMyLocation(request,"findpost?" + locator); + FindPostData data = new FindPostData(comm,conf,topic); + + try + { // attempt to configure the display + data.doSearch(request,engine); + + } // end try + catch (AccessError ae) + { // error in find parameters + return new ErrorBox("Find Error",ae.getMessage(),"top"); + + } // end catch + catch (DataException de) + { // database error, man + return new ErrorBox("Database Error","Database error on find: " + de.getMessage(),"top"); + + } // end catch + + return data; + + } // end doVenicePost + +} // end class FindPost diff --git a/src/com/silverwrist/venice/servlets/format/FindData.java b/src/com/silverwrist/venice/servlets/format/FindData.java index ce46d84..4cbcd8b 100644 --- a/src/com/silverwrist/venice/servlets/format/FindData.java +++ b/src/com/silverwrist/venice/servlets/format/FindData.java @@ -39,6 +39,7 @@ public class FindData implements JSPRender, SearchMode public static final int FD_COMMUNITIES = 0; public static final int FD_USERS = 1; public static final int FD_CATEGORIES = 2; + public static final int FD_POSTS = 3; // The titles and URLs of the header data private static Vector header_titles = null; @@ -78,12 +79,14 @@ public class FindData implements JSPRender, SearchMode header_titles.add("Communities"); header_titles.add("Users"); header_titles.add("Categories"); + header_titles.add("Posts"); header_titles.trimToSize(); header_urls = new Vector(); header_urls.add("find?disp=" + String.valueOf(FD_COMMUNITIES)); header_urls.add("find?disp=" + String.valueOf(FD_USERS)); header_urls.add("find?disp=" + String.valueOf(FD_CATEGORIES)); + header_urls.add("find?disp=" + String.valueOf(FD_POSTS)); header_urls.trimToSize(); } // end if @@ -128,7 +131,7 @@ public class FindData implements JSPRender, SearchMode public static int getNumChoices() { - return FD_CATEGORIES + 1; + return FD_POSTS + 1; } // end getNumChoices @@ -303,7 +306,8 @@ public class FindData implements JSPRender, SearchMode break; case FD_CATEGORIES: - // no parameters to set here - there's no "field" for category search + case FD_POSTS: + // no parameters to set here - there's no "field" for category/post search break; default: @@ -311,10 +315,13 @@ public class FindData implements JSPRender, SearchMode } // end switch - // Validate the search mode parameter. - mode = getParamInt(request,"mode",SEARCH_PREFIX); - if ((mode!=SEARCH_PREFIX) && (mode!=SEARCH_SUBSTRING) && (mode!=SEARCH_REGEXP)) - throw new ValidationException("The search mode parameter is not valid."); + if (disp!=FD_POSTS) + { // Validate the search mode parameter. + mode = getParamInt(request,"mode",SEARCH_PREFIX); + if ((mode!=SEARCH_PREFIX) && (mode!=SEARCH_SUBSTRING) && (mode!=SEARCH_REGEXP)) + throw new ValidationException("The search mode parameter is not valid."); + + } // end if // Retrieve the search term parameter. term = request.getParameter("term"); @@ -379,6 +386,12 @@ public class FindData implements JSPRender, SearchMode find_count = user.getSearchCategoryCount(mode,term); break; + case FD_POSTS: + results = user.searchPosts(term,offset,count); + if (find_count<0) + find_count = user.getSearchPostCount(term); + break; + } // end switch } // end loadPost diff --git a/src/com/silverwrist/venice/servlets/format/FindPostData.java b/src/com/silverwrist/venice/servlets/format/FindPostData.java new file mode 100644 index 0000000..ba8e696 --- /dev/null +++ b/src/com/silverwrist/venice/servlets/format/FindPostData.java @@ -0,0 +1,275 @@ +/* + * 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): + */ +package com.silverwrist.venice.servlets.format; + +import java.io.Writer; +import java.io.IOException; +import java.util.*; +import javax.servlet.*; +import com.silverwrist.util.StringUtil; +import com.silverwrist.venice.core.*; +import com.silverwrist.venice.except.*; + +public class FindPostData implements JSPRender +{ + /*-------------------------------------------------------------------------------- + * Static data members + *-------------------------------------------------------------------------------- + */ + + // Attribute name for request attribute + protected static final String ATTR_NAME = "com.silverwrist.venice.content.FindPostData"; + + /*-------------------------------------------------------------------------------- + * Attributes + *-------------------------------------------------------------------------------- + */ + + private CommunityContext comm; + private ConferenceContext conf; + private TopicContext topic; + private String term = ""; + private int offset = 0; + private int find_count = 0; + private List results = null; + private int max_results = 0; + + /*-------------------------------------------------------------------------------- + * Constructor + *-------------------------------------------------------------------------------- + */ + + public FindPostData(CommunityContext comm, ConferenceContext conf, TopicContext topic) + { + this.comm = comm; + this.conf = conf; + this.topic = topic; + + } // end constructor + + /*-------------------------------------------------------------------------------- + * Internal static functions + *-------------------------------------------------------------------------------- + */ + + private static int getParamInt(ServletRequest request, String name, int default_val) + { + String str = request.getParameter(name); + if (str==null) + return -1; + + try + { // parse the integer value + return Integer.parseInt(str); + + } // end try + catch (NumberFormatException nfe) + { // in case of conversion error, fall through + } // end catch + + return default_val; + + } // end getParamInt + + private static boolean isImageButtonClicked(ServletRequest request, String name) + { + String val = request.getParameter(name + ".x"); + return (val!=null); + + } // end isImageButtonClicked + + /*-------------------------------------------------------------------------------- + * External static functions + *-------------------------------------------------------------------------------- + */ + + public static FindPostData retrieve(ServletRequest request) + { + return (FindPostData)(request.getAttribute(ATTR_NAME)); + + } // end retrieve + + /*-------------------------------------------------------------------------------- + * Implementations from interface VeniceContent + *-------------------------------------------------------------------------------- + */ + + public String getPageTitle(RenderData rdat) + { + return "Find Posts"; + + } // end getPageTitle + + public String getPageQID() + { + return null; + + } // end getPageQID + + /*-------------------------------------------------------------------------------- + * Implementations from interface JSPRender + *-------------------------------------------------------------------------------- + */ + + public void store(ServletRequest request) + { + request.setAttribute(ATTR_NAME,this); + + } // end store + + public String getTargetJSPName() + { + return "findpost.jsp"; + + } // end getTargetJSPName + + /*-------------------------------------------------------------------------------- + * External operations + *-------------------------------------------------------------------------------- + */ + + public final void doSearch(ServletRequest request, VeniceEngine engine) throws AccessError, DataException + { + max_results = engine.getStdNumSearchResults(); + + // Retrieve the search term parameter. + term = request.getParameter("term"); + if (term==null) + term = ""; + + // Retrieve the offset and find count parameters. + offset = getParamInt(request,"ofs",0); + find_count = getParamInt(request,"fcount",-1); + + // Adjust the search return offset based on the command button click. + if (isImageButtonClicked(request,"search")) + offset = 0; + else if (isImageButtonClicked(request,"previous")) + { // adjust the offset in the reverse direction + offset -= max_results; + if (offset<0) + offset = 0; + + } // end else if + else if (isImageButtonClicked(request,"next")) + offset += max_results; // go forwards instead + else + throw new InternalStateError("Unable to determine what action triggered the form."); + + if (topic!=null) + { // search the topic + results = topic.searchPosts(term,offset,max_results); + if (find_count<0) + find_count = topic.getSearchPostCount(term); + + } // end if + else if (conf!=null) + { // search the conference + results = conf.searchPosts(term,offset,max_results); + if (find_count<0) + find_count = conf.getSearchPostCount(term); + + } // end else if + else + { // search the community + results = comm.searchPosts(term,offset,max_results); + if (find_count<0) + find_count = comm.getSearchPostCount(term); + + } // end else + + } // end doSearch + + public final String getExtraParameters() + { + StringBuffer buf = new StringBuffer(""); + if (conf!=null) + { // append the conference number parameter + buf.append("\n"); + if (topic!=null) + { // append the topic number parameter + buf.append("\n"); + + } // end if + + } // end if + + return buf.toString(); + + } // end getExtraParameters + + public final String getReturnLink(RenderData rdat) + { + if (topic!=null) + return "Return to Topic"; + else if (conf!=null) + return "Return to Topic List"; + else + return "Return to Topic List"; + + } // end getReturnLink + + public final String getSubtitle() + { + if (topic!=null) + return "Topic: " + topic.getName(); + else if (conf!=null) + return "Conference: " + conf.getName(); + else + return "Community: " + comm.getName(); + + } // end getSubtitle + + public final String getTerm() + { + return term; + + } // end getTerm + + public final int getOffset() + { + return offset; + + } // end getOffset + + public final int getFindCount() + { + return find_count; + + } // end getFindCount + + public final List getResults() + { + return results; + + } // end getResults + + public final int getMaxResults() + { + return max_results; + + } // end getMaxResults + +} // end class FindPostData diff --git a/web/format/conferences.jsp b/web/format/conferences.jsp index 2ea9658..f839560 100644 --- a/web/format/conferences.jsp +++ b/web/format/conferences.jsp @@ -62,6 +62,9 @@ <% } // end if (conferences present) %>

+ " ALT="Find" WIDTH=80 HEIGHT=24 + BORDER=0>  <% if (data.canManageConferences()) { %> ">" ALT="Manage" WIDTH=80 HEIGHT=24 diff --git a/web/format/find.jsp b/web/format/find.jsp index 52e5a97..6e49c0a 100644 --- a/web/format/find.jsp +++ b/web/format/find.jsp @@ -32,57 +32,68 @@
">
- <% if (data.getDisplayOption()==FindData.FD_COMMUNITIES) { %> - <% if (rdat.useHTMLComments()) { %><% } %> - <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,4) %>Find Communities:
+ <% if (data.getDisplayOption()==FindData.FD_POSTS) { %> + <% if (rdat.useHTMLComments()) { %><% } %> + <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,4) %>Find Posts:
<%= 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   - + Keywords: + +
<% } else { %> - <%-- shouldn't get here --%> -

Display parameter invalid!

- <% } // end if %> + <% 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   +
- - <% if (data.getDisplayOption()==FindData.FD_CATEGORIES) { %>
<% } else { %>  <% } %> -
+ <% } 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 { %> + <%-- shouldn't get here --%> +

Display parameter invalid!

+ <% } // end if %> + + + <% if (data.getDisplayOption()==FindData.FD_CATEGORIES) { %>
<% } else { %>  <% } %> +
+ + <% } // end if %> " ALT="Search" WIDTH=80 HEIGHT=24 BORDER=0>
@@ -206,46 +217,82 @@
<%-- Display the results of the search --%> - +
+ <% if ((data.getDisplayOption()==FindData.FD_POSTS) && (results.size()>0)) { %> + + + + + + + + <% } // end if %> <% for (int i=0; i - - + + + + + <% } else { %> + + + <% } // end if%> + + <% } // end if %> <% } // end for %> diff --git a/web/format/findpost.jsp b/web/format/findpost.jsp new file mode 100644 index 0000000..0955f0a --- /dev/null +++ b/web/format/findpost.jsp @@ -0,0 +1,135 @@ +<%-- + 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.*" %> +<% + FindPostData data = FindPostData.retrieve(request); + Variables.failIfNull(data); + RenderData rdat = RenderConfig.createRenderData(application,request,response); +%> +<% if (rdat.useHTMLComments()) { %><% } %> +<% rdat.writeContentHeader(out,"Find Posts",data.getSubtitle()); %> +<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %><%= data.getReturnLink(rdat) %>

+ +">

+ <%= data.getExtraParameters() %> + + + <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> + Keywords: + +
+ " + ALT="Search" WIDTH=80 HEIGHT=24 BORDER=0> +

+ +<% List results = data.getResults(); %> +<% 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.getMaxResults()) + { // there's a "next" + dcount = data.getMaxResults(); + go_next = true; + + } // end if + %> +


+
+ <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>Post Link + + <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>Author + + <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>Post Date + + <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>Lines +  
- " 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 = FindData.getCommunityHostName(comm); - int members = FindData.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: <%= FindData.getActivityString(comm,rdat) %>
- <%= StringUtil.encodeHTML(comm.getSynopsis()) %> + <% if (data.getDisplayOption()==FindData.FD_POSTS) { %> + <% TopicMessageFound post = (TopicMessageFound)(results.get(i)); %> +
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> + "><%= post.getIdentifier() %> + <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> + "><%= post.getAuthor() %> + <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> + <%= rdat.formatDateForDisplay(post.getPostDate()) %> + <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> + <%= post.getLineCount() %> + <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> + <%= StringUtil.encodeHTML(post.getText()) %> + + " 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 = FindData.getCommunityHostName(comm); + int members = FindData.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: <%= FindData.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_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()) %> + <% } else if (data.getDisplayOption()==FindData.FD_CATEGORIES) { %> + <% CategoryDescriptor cd = (CategoryDescriptor)item; %> + <%= StringUtil.encodeHTML(cd.toString()) %> - <% } %> -
+ + + +
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,3) %> + <%-- The initial search results --%> + 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()) { %><% } %> +
">
+ <%= data.getExtraParameters() %> + + + + <% 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 + + <% TopicMessageFound post = (TopicMessageFound)(results.get(i)); %> + + + + + + + <% } // end for %> +
+ <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>Post Link + + <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>Author + + <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>Post Date + + <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>Lines +  
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> + "><%= post.getIdentifier() %> + <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> + "><%= post.getAuthor() %> + <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> + <%= rdat.formatDateForDisplay(post.getPostDate()) %> + <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> + <%= post.getLineCount() %> + <%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %> + <%= StringUtil.encodeHTML(post.getText()) %> +

+<% } // end if %> diff --git a/web/format/posts.jsp b/web/format/posts.jsp index 483b89f..c99b748 100644 --- a/web/format/posts.jsp +++ b/web/format/posts.jsp @@ -69,6 +69,9 @@   <% } // end if %> <% } // end if %> +
">" ALT="Find" WIDTH=80 HEIGHT=24 + BORDER=0>  ">" ALT="Manage" WIDTH=80 HEIGHT=24 BORDER=0>  diff --git a/web/format/topics.jsp b/web/format/topics.jsp index a79ffb4..646a9e9 100644 --- a/web/format/topics.jsp +++ b/web/format/topics.jsp @@ -47,6 +47,9 @@ SRC="<%= rdat.getFullImagePath("bn_read_new.gif") %>" ALT="Read New" WIDTH=80 HEIGHT=24 BORDER=0>  <% } // end if %> + ">" ALT="Find" WIDTH=80 HEIGHT=24 + BORDER=0>  ">" ALT="Manage" WIDTH=80 HEIGHT=24 BORDER=0>  diff --git a/web/images/bn_find.gif b/web/images/bn_find.gif new file mode 100644 index 0000000..25c47f5 Binary files /dev/null and b/web/images/bn_find.gif differ