implemented UI for find posts, debugged and tweaked the engine implementation
This commit is contained in:
parent
4b1acef325
commit
ae129e5410
13
etc/web.xml
13
etc/web.xml
|
@ -270,6 +270,14 @@
|
|||
<servlet-class>com.silverwrist.venice.servlets.AdminUserPhoto</servlet-class>
|
||||
</servlet>
|
||||
|
||||
<servlet>
|
||||
<servlet-name>findpost</servlet-name>
|
||||
<description>
|
||||
Searches for posts in communities, conferences, or topics.
|
||||
</description>
|
||||
<servlet-class>com.silverwrist.venice.servlets.FindPost</servlet-class>
|
||||
</servlet>
|
||||
|
||||
<!-- the following are test servlets, they should go away -->
|
||||
|
||||
<servlet>
|
||||
|
@ -413,6 +421,11 @@
|
|||
<url-pattern>/adminuserphoto</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<servlet-mapping>
|
||||
<servlet-name>findpost</servlet-name>
|
||||
<url-pattern>/findpost</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<!-- the following are test servlets, they should go away -->
|
||||
<servlet-mapping>
|
||||
<servlet-name>testformdata</servlet-name>
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
113
src/com/silverwrist/venice/servlets/FindPost.java
Normal file
113
src/com/silverwrist/venice/servlets/FindPost.java
Normal file
|
@ -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 <http://www.mozilla.org/MPL/>.
|
||||
*
|
||||
* 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 <erbo@silcom.com>,
|
||||
* 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
|
|
@ -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
|
||||
|
|
275
src/com/silverwrist/venice/servlets/format/FindPostData.java
Normal file
275
src/com/silverwrist/venice/servlets/format/FindPostData.java
Normal file
|
@ -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 <http://www.mozilla.org/MPL/>.
|
||||
*
|
||||
* 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 <erbo@silcom.com>,
|
||||
* 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("<INPUT TYPE=\"HIDDEN\" NAME=\"sig\" VALUE=\"");
|
||||
buf.append(comm.getCommunityID()).append("\">");
|
||||
if (conf!=null)
|
||||
{ // append the conference number parameter
|
||||
buf.append("\n<INPUT TYPE=\"HIDDEN\" NAME=\"conf\" VALUE=\"").append(conf.getConfID()).append("\">");
|
||||
if (topic!=null)
|
||||
{ // append the topic number parameter
|
||||
buf.append("\n<INPUT TYPE=\"HIDDEN\" NAME=\"top\" VALUE=\"").append(topic.getTopicNumber());
|
||||
buf.append("\">");
|
||||
|
||||
} // end if
|
||||
|
||||
} // end if
|
||||
|
||||
return buf.toString();
|
||||
|
||||
} // end getExtraParameters
|
||||
|
||||
public final String getReturnLink(RenderData rdat)
|
||||
{
|
||||
if (topic!=null)
|
||||
return "<A HREF=\"" + rdat.getEncodedServletPath("confdisp?sig=" + comm.getCommunityID()
|
||||
+ "&conf=" + conf.getConfID() + "&top="
|
||||
+ topic.getTopicNumber()) + "\">Return to Topic</A>";
|
||||
else if (conf!=null)
|
||||
return "<A HREF=\"" + rdat.getEncodedServletPath("confdisp?sig=" + comm.getCommunityID()
|
||||
+ "&conf=" + conf.getConfID())
|
||||
+ "\">Return to Topic List</A>";
|
||||
else
|
||||
return "<A HREF=\"" + rdat.getEncodedServletPath("confops?sig=" + comm.getCommunityID())
|
||||
+ "\">Return to Topic List</A>";
|
||||
|
||||
} // 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
|
|
@ -62,6 +62,9 @@
|
|||
<% } // end if (conferences present) %>
|
||||
<P>
|
||||
<DIV ALIGN="LEFT" CLASS="content">
|
||||
<A HREF="<%= rdat.getEncodedServletPath("findpost?sig=" + data.getCommunityID()) %>"><IMG
|
||||
SRC="<%= rdat.getFullImagePath("bn_find.gif") %>" ALT="Find" WIDTH=80 HEIGHT=24
|
||||
BORDER=0></A>
|
||||
<% if (data.canManageConferences()) { %>
|
||||
<A HREF="<%= rdat.getEncodedServletPath("confops?cmd=S&sig=" + data.getCommunityID()) %>"><IMG
|
||||
SRC="<%= rdat.getFullImagePath("bn_manage.gif") %>" ALT="Manage" WIDTH=80 HEIGHT=24
|
||||
|
|
|
@ -32,57 +32,68 @@
|
|||
<FORM METHOD="POST" ACTION="<%= rdat.getEncodedServletPath("find") %>"><DIV CLASS="content">
|
||||
<INPUT TYPE=HIDDEN NAME="disp" VALUE="<%= data.getDisplayOption() %>">
|
||||
<INPUT TYPE=HIDDEN NAME="ofs" VALUE="0">
|
||||
<% if (data.getDisplayOption()==FindData.FD_COMMUNITIES) { %>
|
||||
<% if (rdat.useHTMLComments()) { %><!-- Find Communities Form --><% } %>
|
||||
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,4) %><B>Find Communities:</B></FONT><BR>
|
||||
<% if (data.getDisplayOption()==FindData.FD_POSTS) { %>
|
||||
<% if (rdat.useHTMLComments()) { %><!-- Find Posts Form --><% } %>
|
||||
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,4) %><B>Find Posts:</B></FONT><BR>
|
||||
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>
|
||||
Display all communities whose
|
||||
<SELECT NAME="field" SIZE=1>
|
||||
<OPTION VALUE="<%= SearchMode.FIELD_COMMUNITY_NAME %>"
|
||||
<% if (data.searchFieldIs(SearchMode.FIELD_COMMUNITY_NAME)) { %>SELECTED<% } %> >name</OPTION>
|
||||
<OPTION VALUE="<%= SearchMode.FIELD_COMMUNITY_SYNOPSIS %>"
|
||||
<% if (data.searchFieldIs(SearchMode.FIELD_COMMUNITY_SYNOPSIS)) { %>SELECTED<% } %> >synopsis</OPTION>
|
||||
</SELECT><BR>
|
||||
|
||||
<% } else if (data.getDisplayOption()==FindData.FD_USERS) { %>
|
||||
<% if (rdat.useHTMLComments()) { %><!-- Find Users Form --><% } %>
|
||||
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,4) %><B>Find Users:</B></FONT><BR>
|
||||
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>
|
||||
Display all users whose
|
||||
<SELECT NAME="field" SIZE=1>
|
||||
<OPTION VALUE="<%= SearchMode.FIELD_USER_NAME %>"
|
||||
<% if (data.searchFieldIs(SearchMode.FIELD_USER_NAME)) { %>SELECTED<% } %> >user name</OPTION>
|
||||
<OPTION VALUE="<%= SearchMode.FIELD_USER_DESCRIPTION %>"
|
||||
<% if (data.searchFieldIs(SearchMode.FIELD_USER_DESCRIPTION)) { %>SELECTED<% } %> >description</OPTION>
|
||||
<OPTION VALUE="<%= SearchMode.FIELD_USER_GIVEN_NAME %>"
|
||||
<% if (data.searchFieldIs(SearchMode.FIELD_USER_GIVEN_NAME)) { %>SELECTED<% } %> >first name</OPTION>
|
||||
<OPTION VALUE="<%= SearchMode.FIELD_USER_FAMILY_NAME %>"
|
||||
<% if (data.searchFieldIs(SearchMode.FIELD_USER_FAMILY_NAME)) { %>SELECTED<% } %> >last name</OPTION>
|
||||
</SELECT><BR>
|
||||
|
||||
<% } else if (data.getDisplayOption()==FindData.FD_CATEGORIES) { %>
|
||||
<% if (rdat.useHTMLComments()) { %><!-- Find Categories Form --><% } %>
|
||||
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,4) %><B>Find Categories:</B></FONT><BR>
|
||||
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>
|
||||
Display all categories whose name
|
||||
|
||||
Keywords:
|
||||
<SPAN CLASS="cinput"><INPUT TYPE=TEXT CLASS="cinput" NAME="term" SIZE=64 MAXLENGTH=255
|
||||
VALUE="<%= data.getSearchTerm() %>"></SPAN>
|
||||
</FONT><BR>
|
||||
<% } else { %>
|
||||
<%-- shouldn't get here --%>
|
||||
<H1><FONT COLOR="red">Display parameter invalid!</FONT></H1>
|
||||
<% } // end if %>
|
||||
<% if (data.getDisplayOption()==FindData.FD_COMMUNITIES) { %>
|
||||
<% if (rdat.useHTMLComments()) { %><!-- Find Communities Form --><% } %>
|
||||
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,4) %><B>Find Communities:</B></FONT><BR>
|
||||
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>
|
||||
Display all communities whose
|
||||
<SELECT NAME="field" SIZE=1>
|
||||
<OPTION VALUE="<%= SearchMode.FIELD_COMMUNITY_NAME %>"
|
||||
<% if (data.searchFieldIs(SearchMode.FIELD_COMMUNITY_NAME)) { %>SELECTED<% } %> >name</OPTION>
|
||||
<OPTION VALUE="<%= SearchMode.FIELD_COMMUNITY_SYNOPSIS %>"
|
||||
<% if (data.searchFieldIs(SearchMode.FIELD_COMMUNITY_SYNOPSIS)) { %>SELECTED<% } %> >synopsis</OPTION>
|
||||
</SELECT><BR>
|
||||
|
||||
<SELECT NAME="mode" SIZE=1>
|
||||
<OPTION VALUE="<%= SearchMode.SEARCH_PREFIX %>"
|
||||
<% if (data.searchModeIs(SearchMode.SEARCH_PREFIX)) { %>SELECTED<% } %> >starts with the string</OPTION>
|
||||
<OPTION VALUE="<%= SearchMode.SEARCH_SUBSTRING %>"
|
||||
<% if (data.searchModeIs(SearchMode.SEARCH_SUBSTRING)) { %>SELECTED<% } %> >contains the string</OPTION>
|
||||
<OPTION VALUE="<%= SearchMode.SEARCH_REGEXP %>"
|
||||
<% if (data.searchModeIs(SearchMode.SEARCH_REGEXP)) { %>SELECTED<% } %> >matches the regular
|
||||
expression</OPTION>
|
||||
</SELECT>
|
||||
<% if (data.getDisplayOption()==FindData.FD_CATEGORIES) { %><BR><% } else { %> <% } %>
|
||||
<SPAN CLASS="cinput"><INPUT TYPE=TEXT CLASS="cinput" NAME="term" SIZE=32 MAXLENGTH=255
|
||||
VALUE="<%= data.getSearchTerm() %>"></SPAN><BR>
|
||||
<% } else if (data.getDisplayOption()==FindData.FD_USERS) { %>
|
||||
<% if (rdat.useHTMLComments()) { %><!-- Find Users Form --><% } %>
|
||||
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,4) %><B>Find Users:</B></FONT><BR>
|
||||
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>
|
||||
Display all users whose
|
||||
<SELECT NAME="field" SIZE=1>
|
||||
<OPTION VALUE="<%= SearchMode.FIELD_USER_NAME %>"
|
||||
<% if (data.searchFieldIs(SearchMode.FIELD_USER_NAME)) { %>SELECTED<% } %> >user name</OPTION>
|
||||
<OPTION VALUE="<%= SearchMode.FIELD_USER_DESCRIPTION %>"
|
||||
<% if (data.searchFieldIs(SearchMode.FIELD_USER_DESCRIPTION)) { %>SELECTED<% } %> >description</OPTION>
|
||||
<OPTION VALUE="<%= SearchMode.FIELD_USER_GIVEN_NAME %>"
|
||||
<% if (data.searchFieldIs(SearchMode.FIELD_USER_GIVEN_NAME)) { %>SELECTED<% } %> >first name</OPTION>
|
||||
<OPTION VALUE="<%= SearchMode.FIELD_USER_FAMILY_NAME %>"
|
||||
<% if (data.searchFieldIs(SearchMode.FIELD_USER_FAMILY_NAME)) { %>SELECTED<% } %> >last name</OPTION>
|
||||
</SELECT><BR>
|
||||
|
||||
<% } else if (data.getDisplayOption()==FindData.FD_CATEGORIES) { %>
|
||||
<% if (rdat.useHTMLComments()) { %><!-- Find Categories Form --><% } %>
|
||||
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,4) %><B>Find Categories:</B></FONT><BR>
|
||||
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>
|
||||
Display all categories whose name
|
||||
|
||||
<% } else { %>
|
||||
<%-- shouldn't get here --%>
|
||||
<H1><FONT COLOR="red">Display parameter invalid!</FONT></H1>
|
||||
<% } // end if %>
|
||||
|
||||
<SELECT NAME="mode" SIZE=1>
|
||||
<OPTION VALUE="<%= SearchMode.SEARCH_PREFIX %>"
|
||||
<% if (data.searchModeIs(SearchMode.SEARCH_PREFIX)) { %>SELECTED<% } %> >starts with the string</OPTION>
|
||||
<OPTION VALUE="<%= SearchMode.SEARCH_SUBSTRING %>"
|
||||
<% if (data.searchModeIs(SearchMode.SEARCH_SUBSTRING)) { %>SELECTED<% } %> >contains the string</OPTION>
|
||||
<OPTION VALUE="<%= SearchMode.SEARCH_REGEXP %>"
|
||||
<% if (data.searchModeIs(SearchMode.SEARCH_REGEXP)) { %>SELECTED<% } %> >matches the regular
|
||||
expression</OPTION>
|
||||
</SELECT>
|
||||
<% if (data.getDisplayOption()==FindData.FD_CATEGORIES) { %><BR><% } else { %> <% } %>
|
||||
<SPAN CLASS="cinput"><INPUT TYPE=TEXT CLASS="cinput" NAME="term" SIZE=32 MAXLENGTH=255
|
||||
VALUE="<%= data.getSearchTerm() %>"></SPAN><BR>
|
||||
|
||||
<% } // end if %>
|
||||
<INPUT TYPE=IMAGE NAME="search" SRC="<%= rdat.getFullImagePath("bn_search.gif") %>"
|
||||
ALT="Search" WIDTH=80 HEIGHT=24 BORDER=0><BR>
|
||||
</FONT>
|
||||
|
@ -206,46 +217,82 @@
|
|||
</TR></TABLE><BR>
|
||||
|
||||
<%-- Display the results of the search --%>
|
||||
<TABLE BORDER=0 ALIGN=LEFT CELLPADDING=0 CELLSPACING=4>
|
||||
<TABLE BORDER=0 ALIGN=LEFT CELLPADDING=0 CELLSPACING=6>
|
||||
<% if ((data.getDisplayOption()==FindData.FD_POSTS) && (results.size()>0)) { %>
|
||||
<TR VALIGN=TOP>
|
||||
<TH ALIGN=LEFT CLASS="CONTENT">
|
||||
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %><B><U>Post Link</U></B></FONT>
|
||||
</TH>
|
||||
<TH ALIGN=LEFT CLASS="CONTENT">
|
||||
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %><B><U>Author</U></B></FONT>
|
||||
</TH>
|
||||
<TH ALIGN=LEFT CLASS="CONTENT">
|
||||
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %><B><U>Post Date</U></B></FONT>
|
||||
</TH>
|
||||
<TH ALIGN=LEFT CLASS="CONTENT">
|
||||
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %><B><U>Lines</U></B></FONT>
|
||||
</TH>
|
||||
<TH ALIGN=LEFT CLASS="CONTENT"> </TH>
|
||||
</TR>
|
||||
<% } // end if %>
|
||||
<% for (int i=0; i<dcount; i++) { %>
|
||||
<TR VALIGN=TOP>
|
||||
<TD ALIGN=CENTER WIDTH=14>
|
||||
<IMG SRC="<%= rdat.getFullImagePath("purple-ball.gif") %>" ALT="*" WIDTH=14 HEIGHT=14 BORDER=0>
|
||||
</TD>
|
||||
<TD ALIGN=LEFT CLASS="content"><%= 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);
|
||||
%>
|
||||
<A HREF="<%= rdat.getEncodedServletPath("sig/" + comm.getAlias()) %>"><%= StringUtil.encodeHTML(comm.getName()) %></A><BR>
|
||||
<% if (host_name!=null) { %>
|
||||
Host: <A HREF="<%= rdat.getEncodedServletPath("user/" + host_name) %>"><%= host_name %></A>
|
||||
<% } // 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)) { %><BR><% } %>
|
||||
Latest activity: <%= FindData.getActivityString(comm,rdat) %><BR>
|
||||
<EM><%= StringUtil.encodeHTML(comm.getSynopsis()) %></EM>
|
||||
<% if (data.getDisplayOption()==FindData.FD_POSTS) { %>
|
||||
<% TopicMessageFound post = (TopicMessageFound)(results.get(i)); %>
|
||||
<TD ALIGN=LEFT CLASS="content"><%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>
|
||||
<A HREF="<%= rdat.getEncodedServletPath("go/" + post.getIdentifier()) %>"><%= post.getIdentifier() %></A>
|
||||
</FONT></TD>
|
||||
<TD ALIGN=LEFT CLASS="content"><%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>
|
||||
<A HREF="<%= rdat.getEncodedServletPath("user/" + post.getAuthor()) %>"><%= post.getAuthor() %></A>
|
||||
</FONT></TD>
|
||||
<TD ALIGN=LEFT CLASS="content" NOWRAP><%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>
|
||||
<%= rdat.formatDateForDisplay(post.getPostDate()) %>
|
||||
</FONT></TD>
|
||||
<TD ALIGN=LEFT CLASS="content"><%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>
|
||||
<%= post.getLineCount() %>
|
||||
</FONT></TD>
|
||||
<TD ALIGN=LEFT CLASS="content"><%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>
|
||||
<%= StringUtil.encodeHTML(post.getText()) %>
|
||||
</FONT></TD>
|
||||
<% } else { %>
|
||||
<TD ALIGN=CENTER WIDTH=14>
|
||||
<IMG SRC="<%= rdat.getFullImagePath("purple-ball.gif") %>" ALT="*" WIDTH=14 HEIGHT=14 BORDER=0>
|
||||
</TD>
|
||||
<TD ALIGN=LEFT CLASS="content"><%= 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);
|
||||
%>
|
||||
<A HREF="<%= rdat.getEncodedServletPath("sig/" + comm.getAlias()) %>"><%= StringUtil.encodeHTML(comm.getName()) %></A><BR>
|
||||
<% if (host_name!=null) { %>
|
||||
Host: <A HREF="<%= rdat.getEncodedServletPath("user/" + host_name) %>"><%= host_name %></A>
|
||||
<% } // 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)) { %><BR><% } %>
|
||||
Latest activity: <%= FindData.getActivityString(comm,rdat) %><BR>
|
||||
<EM><%= StringUtil.encodeHTML(comm.getSynopsis()) %></EM>
|
||||
|
||||
<% } else if (data.getDisplayOption()==FindData.FD_USERS) { %>
|
||||
<% UserFound uf = (UserFound)item; %>
|
||||
<A HREF="<%= rdat.getEncodedServletPath("user/" + uf.getName()) %>"><%= uf.getName() %></A><BR>
|
||||
<%= StringUtil.encodeHTML(uf.getGivenName()) %> <%= StringUtil.encodeHTML(uf.getFamilyName()) %>,
|
||||
from <%= StringUtil.encodeHTML(uf.getLocality()) %>, <%= StringUtil.encodeHTML(uf.getRegion()) %>
|
||||
<%= uf.getCountry() %>
|
||||
<% if (uf.getDescription()!=null) { %><BR><EM><%= StringUtil.encodeHTML(uf.getDescription()) %></EM><% } %>
|
||||
<% } else if (data.getDisplayOption()==FindData.FD_USERS) { %>
|
||||
<% UserFound uf = (UserFound)item; %>
|
||||
<A HREF="<%= rdat.getEncodedServletPath("user/" + uf.getName()) %>"><%= uf.getName() %></A><BR>
|
||||
<%= StringUtil.encodeHTML(uf.getGivenName()) %> <%= StringUtil.encodeHTML(uf.getFamilyName()) %>,
|
||||
from <%= StringUtil.encodeHTML(uf.getLocality()) %>, <%= StringUtil.encodeHTML(uf.getRegion()) %>
|
||||
<%= uf.getCountry() %>
|
||||
<% if (uf.getDescription()!=null) { %><BR><EM><%= StringUtil.encodeHTML(uf.getDescription()) %></EM><% } %>
|
||||
|
||||
<% } else if (data.getDisplayOption()==FindData.FD_CATEGORIES) { %>
|
||||
<% CategoryDescriptor cd = (CategoryDescriptor)item; %>
|
||||
<A HREF="<%= data.getCatJumpLink(rdat,cd.getLinkedCategoryID()) %>"><%= StringUtil.encodeHTML(cd.toString()) %></A>
|
||||
<% } else if (data.getDisplayOption()==FindData.FD_CATEGORIES) { %>
|
||||
<% CategoryDescriptor cd = (CategoryDescriptor)item; %>
|
||||
<A HREF="<%= data.getCatJumpLink(rdat,cd.getLinkedCategoryID()) %>"><%= StringUtil.encodeHTML(cd.toString()) %></A>
|
||||
|
||||
<% } %>
|
||||
</FONT></TD>
|
||||
<% } // end if%>
|
||||
</FONT></TD>
|
||||
<% } // end if %>
|
||||
</TR>
|
||||
<% } // end for %>
|
||||
|
||||
|
|
135
web/format/findpost.jsp
Normal file
135
web/format/findpost.jsp
Normal file
|
@ -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 <http://www.mozilla.org/MPL/>.
|
||||
|
||||
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 <erbo@silcom.com>,
|
||||
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()) { %><!-- Find Posts --><% } %>
|
||||
<% rdat.writeContentHeader(out,"Find Posts",data.getSubtitle()); %>
|
||||
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %><%= data.getReturnLink(rdat) %></FONT><P>
|
||||
|
||||
<FORM METHOD="POST" ACTION="<%= rdat.getEncodedServletPath("findpost") %>"><DIV CLASS="content">
|
||||
<%= data.getExtraParameters() %>
|
||||
<INPUT TYPE="HIDDEN" NAME="ofs" VALUE="0">
|
||||
<INPUT TYPE="HIDDEN" NAME="fcount" VALUE="-1">
|
||||
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>
|
||||
Keywords:
|
||||
<SPAN CLASS="cinput"><INPUT TYPE=TEXT CLASS="cinput" NAME="term" SIZE=64 MAXLENGTH=255
|
||||
VALUE="<%= data.getTerm() %>"></SPAN>
|
||||
</FONT><BR>
|
||||
<INPUT TYPE=IMAGE NAME="search" SRC="<%= rdat.getFullImagePath("bn_search.gif") %>"
|
||||
ALT="Search" WIDTH=80 HEIGHT=24 BORDER=0>
|
||||
</DIV></FORM><P>
|
||||
|
||||
<% List results = data.getResults(); %>
|
||||
<% if (results!=null) { %>
|
||||
<% if (rdat.useHTMLComments()) { %><!-- 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
|
||||
%>
|
||||
<HR>
|
||||
<TABLE WIDTH="100%" BORDER=0 ALIGN=CENTER><TR VALIGN=MIDDLE>
|
||||
<TD WIDTH="50%" ALIGN=LEFT CLASS="content"><%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,3) %>
|
||||
<%-- The initial search results --%>
|
||||
<B>Search Results</B>
|
||||
<% if (data.getFindCount()>0) { %>
|
||||
(Displaying <%= data.getOffset() + 1 %>-<%= data.getOffset() + dcount %> of
|
||||
<%= data.getFindCount() %>)
|
||||
<% } else { %>(None)<% } %>
|
||||
</FONT></TD>
|
||||
|
||||
<TD WIDTH="50%" ALIGN=RIGHT CLASS="content">
|
||||
<% if (go_next || (data.getOffset()>0)) { %>
|
||||
<%-- The navigational form that allows us to page through the results --%>
|
||||
<% if (rdat.useHTMLComments()) { %><!-- Navigational Form --><% } %>
|
||||
<FORM METHOD="POST" ACTION="<%= rdat.getEncodedServletPath("findpost") %>"><DIV CLASS="content">
|
||||
<%= data.getExtraParameters() %>
|
||||
<INPUT TYPE=HIDDEN NAME="term" VALUE="<%= data.getTerm() %>">
|
||||
<INPUT TYPE=HIDDEN NAME="ofs" VALUE="<%= data.getOffset() %>">
|
||||
<INPUT TYPE=HIDDEN NAME="fcount" VALUE="<%= data.getFindCount() %>">
|
||||
<% if (data.getOffset()>0) { %>
|
||||
<INPUT TYPE=IMAGE NAME="previous" SRC="<%= rdat.getFullImagePath("bn_ar_previous.gif") %>"
|
||||
ALT="Previous" WIDTH=80 HEIGHT=24 BORDER=0>
|
||||
<% } else { %>
|
||||
<IMG SRC="<%= rdat.getFullImagePath("bn_transparent.gif") %>" WIDTH=80 HEIGHT=24 BORDER=0>
|
||||
<% } // end if %>
|
||||
|
||||
<% if (go_next) { %>
|
||||
<INPUT TYPE=IMAGE NAME="next" SRC="<%= rdat.getFullImagePath("bn_ar_next.gif") %>"
|
||||
ALT="Next" WIDTH=80 HEIGHT=24 BORDER=0>
|
||||
<% } else { %>
|
||||
<IMG SRC="<%= rdat.getFullImagePath("bn_transparent.gif") %>" WIDTH=80 HEIGHT=24 BORDER=0>
|
||||
<% } // end if %>
|
||||
</DIV></FORM>
|
||||
<% } else { %> <% } %>
|
||||
</TD>
|
||||
</TR></TABLE><BR>
|
||||
|
||||
<%-- Display the results of the search --%>
|
||||
<TABLE BORDER=0 ALIGN=LEFT CELLPADDING=0 CELLSPACING=6>
|
||||
<TR VALIGN=TOP>
|
||||
<TH ALIGN=LEFT CLASS="CONTENT">
|
||||
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %><B><U>Post Link</U></B></FONT>
|
||||
</TH>
|
||||
<TH ALIGN=LEFT CLASS="CONTENT">
|
||||
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %><B><U>Author</U></B></FONT>
|
||||
</TH>
|
||||
<TH ALIGN=LEFT CLASS="CONTENT">
|
||||
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %><B><U>Post Date</U></B></FONT>
|
||||
</TH>
|
||||
<TH ALIGN=LEFT CLASS="CONTENT">
|
||||
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %><B><U>Lines</U></B></FONT>
|
||||
</TH>
|
||||
<TH ALIGN=LEFT CLASS="CONTENT"> </TH>
|
||||
</TR>
|
||||
<% for (int i=0; i<dcount; i++) { %>
|
||||
<TR VALIGN=TOP>
|
||||
<% TopicMessageFound post = (TopicMessageFound)(results.get(i)); %>
|
||||
<TD ALIGN=LEFT CLASS="content"><%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>
|
||||
<A HREF="<%= rdat.getEncodedServletPath("go/" + post.getIdentifier()) %>"><%= post.getIdentifier() %></A>
|
||||
</FONT></TD>
|
||||
<TD ALIGN=LEFT CLASS="content"><%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>
|
||||
<A HREF="<%= rdat.getEncodedServletPath("user/" + post.getAuthor()) %>"><%= post.getAuthor() %></A>
|
||||
</FONT></TD>
|
||||
<TD ALIGN=LEFT CLASS="content" NOWRAP><%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>
|
||||
<%= rdat.formatDateForDisplay(post.getPostDate()) %>
|
||||
</FONT></TD>
|
||||
<TD ALIGN=LEFT CLASS="content"><%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>
|
||||
<%= post.getLineCount() %>
|
||||
</FONT></TD>
|
||||
<TD ALIGN=LEFT CLASS="content"><%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2) %>
|
||||
<%= StringUtil.encodeHTML(post.getText()) %>
|
||||
</FONT></TD>
|
||||
</TR>
|
||||
<% } // end for %>
|
||||
</TABLE><BR CLEAR=LEFT>
|
||||
<% } // end if %>
|
|
@ -69,6 +69,9 @@
|
|||
|
||||
<% } // end if %>
|
||||
<% } // end if %>
|
||||
<A HREF="<%= rdat.getEncodedServletPath("findpost?" + data.getLocator()) %>"><IMG
|
||||
SRC="<%= rdat.getFullImagePath("bn_find.gif") %>" ALT="Find" WIDTH=80 HEIGHT=24
|
||||
BORDER=0></A>
|
||||
<A HREF="<%= rdat.getEncodedServletPath("topicops?" + data.getLocator()) %>"><IMG
|
||||
SRC="<%= rdat.getFullImagePath("bn_manage.gif") %>" ALT="Manage" WIDTH=80 HEIGHT=24
|
||||
BORDER=0></A>
|
||||
|
|
|
@ -47,6 +47,9 @@
|
|||
SRC="<%= rdat.getFullImagePath("bn_read_new.gif") %>" ALT="Read New" WIDTH=80 HEIGHT=24
|
||||
BORDER=0></A>
|
||||
<% } // end if %>
|
||||
<A HREF="<%= rdat.getEncodedServletPath("findpost?" + data.getLocator()) %>"><IMG
|
||||
SRC="<%= rdat.getFullImagePath("bn_find.gif") %>" ALT="Find" WIDTH=80 HEIGHT=24
|
||||
BORDER=0></A>
|
||||
<A HREF="<%= rdat.getEncodedServletPath("confops?" + data.getLocator() + "&cmd=Q") %>"><IMG
|
||||
SRC="<%= rdat.getFullImagePath("bn_manage.gif") %>" ALT="Manage" WIDTH=80 HEIGHT=24
|
||||
BORDER=0></A>
|
||||
|
|
BIN
web/images/bn_find.gif
Normal file
BIN
web/images/bn_find.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 875 B |
Loading…
Reference in New Issue
Block a user