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-class>com.silverwrist.venice.servlets.AdminUserPhoto</servlet-class>
|
||||||
</servlet>
|
</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 -->
|
<!-- the following are test servlets, they should go away -->
|
||||||
|
|
||||||
<servlet>
|
<servlet>
|
||||||
|
@ -413,6 +421,11 @@
|
||||||
<url-pattern>/adminuserphoto</url-pattern>
|
<url-pattern>/adminuserphoto</url-pattern>
|
||||||
</servlet-mapping>
|
</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 -->
|
<!-- the following are test servlets, they should go away -->
|
||||||
<servlet-mapping>
|
<servlet-mapping>
|
||||||
<servlet-name>testformdata</servlet-name>
|
<servlet-name>testformdata</servlet-name>
|
||||||
|
|
|
@ -123,10 +123,9 @@ public interface UserContext extends SearchMode
|
||||||
|
|
||||||
public abstract boolean canSetUserPhoto() throws DataException;
|
public abstract boolean canSetUserPhoto() throws DataException;
|
||||||
|
|
||||||
public abstract List searchPosts(String search_terms, int offset, int count)
|
public abstract List searchPosts(String search_terms, int offset, int count) throws DataException;
|
||||||
throws AccessError, DataException;
|
|
||||||
|
|
||||||
public abstract int getSearchPostCount(String search_terms) throws AccessError, DataException;
|
public abstract int getSearchPostCount(String search_terms) throws DataException;
|
||||||
|
|
||||||
} // end interface UserContext
|
} // end interface UserContext
|
||||||
|
|
||||||
|
|
|
@ -1404,6 +1404,7 @@ class CommunityUserContextImpl implements CommunityContext, CommunityBackend
|
||||||
throw new IllegalArgumentException("invalid offset parameter");
|
throw new IllegalArgumentException("invalid offset parameter");
|
||||||
if (count<=0)
|
if (count<=0)
|
||||||
throw new IllegalArgumentException("invalid count parameter");
|
throw new IllegalArgumentException("invalid count parameter");
|
||||||
|
testConferenceAccess();
|
||||||
|
|
||||||
Connection conn = null;
|
Connection conn = null;
|
||||||
ArrayList rc = new ArrayList();
|
ArrayList rc = new ArrayList();
|
||||||
|
@ -1416,11 +1417,11 @@ class CommunityUserContextImpl implements CommunityContext, CommunityBackend
|
||||||
|
|
||||||
// create the SQL statement
|
// create the SQL statement
|
||||||
StringBuffer sql =
|
StringBuffer sql =
|
||||||
new StringBuffer("SELECT c.confid, t.topicid, t.topicnum, p.postid, p.num, p.creator_uid, "
|
new StringBuffer("SELECT c.confid, t.topicid, t.num, p.postid, p.num, p.creator_uid, p.posted, "
|
||||||
+ "p.posted, p.linecount, d.data FROM confs c, sigtoconf s, topics t, posts p, "
|
+ "p.linecount, d.data FROM confs c, sigtoconf s, topics t, posts p, postdata d, "
|
||||||
+ "postdata d, users u LEFT JOIN sigmember m ON (s.sigid = m.sigid "
|
+ "users u LEFT JOIN sigmember m ON (s.sigid = m.sigid AND u.uid = m.uid) "
|
||||||
+ "AND u.uid = m.uid) LEFT JOIN confmember x ON (c.confid = x.confid AND "
|
+ "LEFT JOIN confmember x ON (c.confid = x.confid AND u.uid = x.uid) "
|
||||||
+ "u.uid = x.uid) WHERE u.uid = ");
|
+ "WHERE u.uid = ");
|
||||||
sql.append(env.getUserID()).append(" AND c.confid = s.confid AND s.sigid = ");
|
sql.append(env.getUserID()).append(" AND c.confid = s.confid AND s.sigid = ");
|
||||||
sql.append(cid);
|
sql.append(cid);
|
||||||
sql.append(" AND GREATEST(u.base_lvl,IFNULL(m.granted_lvl,0),s.granted_lvl,IFNULL(x.granted_lvl,0)) "
|
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");
|
logger.debug("getSearchPostCount('" + search_terms + ") entry");
|
||||||
if (search_terms==null)
|
if (search_terms==null)
|
||||||
throw new NullPointerException("invalid search terms");
|
throw new NullPointerException("invalid search terms");
|
||||||
|
testConferenceAccess();
|
||||||
|
|
||||||
Connection conn = null;
|
Connection conn = null;
|
||||||
|
|
||||||
|
|
|
@ -1635,7 +1635,7 @@ class ConferenceUserContextImpl implements ConferenceContext, ConferenceBackend
|
||||||
throw new IllegalArgumentException("invalid offset parameter");
|
throw new IllegalArgumentException("invalid offset parameter");
|
||||||
if (count<=0)
|
if (count<=0)
|
||||||
throw new IllegalArgumentException("invalid count parameter");
|
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.");
|
throw new AccessError("You are not permitted to search for posts within this conference.");
|
||||||
|
|
||||||
Connection conn = null;
|
Connection conn = null;
|
||||||
|
@ -1649,8 +1649,8 @@ class ConferenceUserContextImpl implements ConferenceContext, ConferenceBackend
|
||||||
|
|
||||||
// create the SQL statement
|
// create the SQL statement
|
||||||
StringBuffer sql =
|
StringBuffer sql =
|
||||||
new StringBuffer("SELECT t.topicid, t.topicnum, p.postid, p.num, p.creator_uid, p.posted, "
|
new StringBuffer("SELECT t.topicid, t.num, p.postid, p.num, p.creator_uid, p.posted, p.linecount, "
|
||||||
+ "p.linecount, d.data FROM topics t, posts p, postdata d WHERE t.confid = ");
|
+ "d.data FROM topics t, posts p, postdata d WHERE t.confid = ");
|
||||||
sql.append(confid);
|
sql.append(confid);
|
||||||
sql.append(" AND t.topicid = p.topicid AND p.scribble_uid IS NULL AND p.postid = d.postid "
|
sql.append(" AND t.topicid = p.topicid AND p.scribble_uid IS NULL AND p.postid = d.postid "
|
||||||
+ "AND MATCH(d.data) AGAINST(");
|
+ "AND MATCH(d.data) AGAINST(");
|
||||||
|
@ -1691,7 +1691,7 @@ class ConferenceUserContextImpl implements ConferenceContext, ConferenceBackend
|
||||||
if (search_terms==null)
|
if (search_terms==null)
|
||||||
throw new NullPointerException("invalid search terms");
|
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.");
|
throw new AccessError("You are not permitted to search for posts within this conference.");
|
||||||
|
|
||||||
Connection conn = null;
|
Connection conn = null;
|
||||||
|
|
|
@ -73,7 +73,10 @@ class TopicMessageFoundImpl implements TopicMessageFound
|
||||||
|
|
||||||
private static final String transformText(String text)
|
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
|
} // end transformText
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@ import com.silverwrist.venice.core.internals.*;
|
||||||
import com.silverwrist.venice.db.*;
|
import com.silverwrist.venice.db.*;
|
||||||
import com.silverwrist.venice.except.*;
|
import com.silverwrist.venice.except.*;
|
||||||
import com.silverwrist.venice.security.*;
|
import com.silverwrist.venice.security.*;
|
||||||
|
import com.silverwrist.venice.svc.ServiceControl;
|
||||||
|
|
||||||
class UserContextImpl implements UserContext, UserBackend
|
class UserContextImpl implements UserContext, UserBackend
|
||||||
{
|
{
|
||||||
|
@ -1431,7 +1432,7 @@ class UserContextImpl implements UserContext, UserBackend
|
||||||
|
|
||||||
} // end canSetUserPhoto
|
} // 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())
|
if (logger.isDebugEnabled())
|
||||||
logger.debug("searchPosts('" + search_terms + "', " + offset + ", " + count + ") entry");
|
logger.debug("searchPosts('" + search_terms + "', " + offset + ", " + count + ") entry");
|
||||||
|
@ -1442,6 +1443,7 @@ class UserContextImpl implements UserContext, UserBackend
|
||||||
if (count<=0)
|
if (count<=0)
|
||||||
throw new IllegalArgumentException("invalid count parameter");
|
throw new IllegalArgumentException("invalid count parameter");
|
||||||
|
|
||||||
|
ServiceToken conf_token = env.getSCM().getTokenForSymbol(ServiceControl.SVCGRP_COMMUNITY,"Conference");
|
||||||
Connection conn = null;
|
Connection conn = null;
|
||||||
ArrayList rc = new ArrayList();
|
ArrayList rc = new ArrayList();
|
||||||
|
|
||||||
|
@ -1453,15 +1455,16 @@ class UserContextImpl implements UserContext, UserBackend
|
||||||
|
|
||||||
// create the SQL statement
|
// create the SQL statement
|
||||||
StringBuffer sql =
|
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, "
|
+ "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 = ");
|
+ "ON (c.confid = x.confid AND u.uid = x.uid) WHERE u.uid = ");
|
||||||
sql.append(uid);
|
sql.append(uid);
|
||||||
sql.append(" AND c.confid = s.confid AND s.sigid = m.sigid AND m.uid = u.uid AND "
|
sql.append(" AND s.sigid = m.sigid AND m.uid = u.uid AND s.sigid = f.sigid AND f.ftr_code = ");
|
||||||
+ "GREATEST(u.base_lvl,m.granted_lvl,s.granted_lvl,IFNULL(x.granted_lvl,0)) >= c.read_lvl "
|
sql.append(conf_token.getIndex());
|
||||||
+ "AND t.confid = c.confid AND t.topicid = p.topicid AND p.scribble_uid IS NULL AND "
|
sql.append(" AND c.confid = s.confid AND GREATEST(u.base_lvl,m.granted_lvl,s.granted_lvl,"
|
||||||
+ "p.postid = d.postid AND MATCH(d.data) AGAINST (");
|
+ "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(SQLUtil.encodeStringArg(search_terms)).append(") LIMIT ").append(offset).append(", ");
|
||||||
sql.append(count).append(';');
|
sql.append(count).append(';');
|
||||||
|
|
||||||
|
@ -1492,13 +1495,14 @@ class UserContextImpl implements UserContext, UserBackend
|
||||||
|
|
||||||
} // end searchPosts
|
} // end searchPosts
|
||||||
|
|
||||||
public int getSearchPostCount(String search_terms) throws AccessError, DataException
|
public int getSearchPostCount(String search_terms) throws DataException
|
||||||
{
|
{
|
||||||
if (logger.isDebugEnabled())
|
if (logger.isDebugEnabled())
|
||||||
logger.debug("getSearchPostCount('" + search_terms + ") entry");
|
logger.debug("getSearchPostCount('" + search_terms + ") entry");
|
||||||
if (search_terms==null)
|
if (search_terms==null)
|
||||||
throw new NullPointerException("invalid search terms");
|
throw new NullPointerException("invalid search terms");
|
||||||
|
|
||||||
|
ServiceToken conf_token = env.getSCM().getTokenForSymbol(ServiceControl.SVCGRP_COMMUNITY,"Conference");
|
||||||
Connection conn = null;
|
Connection conn = null;
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -1509,13 +1513,14 @@ class UserContextImpl implements UserContext, UserBackend
|
||||||
// create the SQL statement
|
// create the SQL statement
|
||||||
StringBuffer sql =
|
StringBuffer sql =
|
||||||
new StringBuffer("SELECT COUNT(*) FROM confs c, sigtoconf s, topics t, posts p, postdata d, "
|
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 "
|
+ "users u, sigmember m, sigftrs f LEFT JOIN confmember x ON (c.confid = x.confid "
|
||||||
+ "u.uid = x.uid) WHERE u.uid = ");
|
+ "AND u.uid = x.uid) WHERE u.uid = ");
|
||||||
sql.append(uid);
|
sql.append(uid);
|
||||||
sql.append(" AND c.confid = s.confid AND s.sigid = m.sigid AND m.uid = u.uid AND "
|
sql.append(" AND s.sigid = m.sigid AND m.uid = u.uid AND s.sigid = f.sigid AND f.ftr_code = ");
|
||||||
+ "GREATEST(u.base_lvl,m.granted_lvl,s.granted_lvl,IFNULL(x.granted_lvl,0)) >= c.read_lvl "
|
sql.append(conf_token.getIndex());
|
||||||
+ "AND t.confid = c.confid AND t.topicid = p.topicid AND p.scribble_uid IS NULL AND "
|
sql.append(" AND c.confid = s.confid AND GREATEST(u.base_lvl,m.granted_lvl,s.granted_lvl,"
|
||||||
+ "p.postid = d.postid AND MATCH(d.data) AGAINST (");
|
+ "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(");");
|
sql.append(SQLUtil.encodeStringArg(search_terms)).append(");");
|
||||||
|
|
||||||
// execute the query and load the results
|
// 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_COMMUNITIES = 0;
|
||||||
public static final int FD_USERS = 1;
|
public static final int FD_USERS = 1;
|
||||||
public static final int FD_CATEGORIES = 2;
|
public static final int FD_CATEGORIES = 2;
|
||||||
|
public static final int FD_POSTS = 3;
|
||||||
|
|
||||||
// The titles and URLs of the header data
|
// The titles and URLs of the header data
|
||||||
private static Vector header_titles = null;
|
private static Vector header_titles = null;
|
||||||
|
@ -78,12 +79,14 @@ public class FindData implements JSPRender, SearchMode
|
||||||
header_titles.add("Communities");
|
header_titles.add("Communities");
|
||||||
header_titles.add("Users");
|
header_titles.add("Users");
|
||||||
header_titles.add("Categories");
|
header_titles.add("Categories");
|
||||||
|
header_titles.add("Posts");
|
||||||
header_titles.trimToSize();
|
header_titles.trimToSize();
|
||||||
|
|
||||||
header_urls = new Vector();
|
header_urls = new Vector();
|
||||||
header_urls.add("find?disp=" + String.valueOf(FD_COMMUNITIES));
|
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_USERS));
|
||||||
header_urls.add("find?disp=" + String.valueOf(FD_CATEGORIES));
|
header_urls.add("find?disp=" + String.valueOf(FD_CATEGORIES));
|
||||||
|
header_urls.add("find?disp=" + String.valueOf(FD_POSTS));
|
||||||
header_urls.trimToSize();
|
header_urls.trimToSize();
|
||||||
|
|
||||||
} // end if
|
} // end if
|
||||||
|
@ -128,7 +131,7 @@ public class FindData implements JSPRender, SearchMode
|
||||||
|
|
||||||
public static int getNumChoices()
|
public static int getNumChoices()
|
||||||
{
|
{
|
||||||
return FD_CATEGORIES + 1;
|
return FD_POSTS + 1;
|
||||||
|
|
||||||
} // end getNumChoices
|
} // end getNumChoices
|
||||||
|
|
||||||
|
@ -303,7 +306,8 @@ public class FindData implements JSPRender, SearchMode
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FD_CATEGORIES:
|
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;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -311,11 +315,14 @@ public class FindData implements JSPRender, SearchMode
|
||||||
|
|
||||||
} // end switch
|
} // end switch
|
||||||
|
|
||||||
// Validate the search mode parameter.
|
if (disp!=FD_POSTS)
|
||||||
|
{ // Validate the search mode parameter.
|
||||||
mode = getParamInt(request,"mode",SEARCH_PREFIX);
|
mode = getParamInt(request,"mode",SEARCH_PREFIX);
|
||||||
if ((mode!=SEARCH_PREFIX) && (mode!=SEARCH_SUBSTRING) && (mode!=SEARCH_REGEXP))
|
if ((mode!=SEARCH_PREFIX) && (mode!=SEARCH_SUBSTRING) && (mode!=SEARCH_REGEXP))
|
||||||
throw new ValidationException("The search mode parameter is not valid.");
|
throw new ValidationException("The search mode parameter is not valid.");
|
||||||
|
|
||||||
|
} // end if
|
||||||
|
|
||||||
// Retrieve the search term parameter.
|
// Retrieve the search term parameter.
|
||||||
term = request.getParameter("term");
|
term = request.getParameter("term");
|
||||||
if (term==null)
|
if (term==null)
|
||||||
|
@ -379,6 +386,12 @@ public class FindData implements JSPRender, SearchMode
|
||||||
find_count = user.getSearchCategoryCount(mode,term);
|
find_count = user.getSearchCategoryCount(mode,term);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case FD_POSTS:
|
||||||
|
results = user.searchPosts(term,offset,count);
|
||||||
|
if (find_count<0)
|
||||||
|
find_count = user.getSearchPostCount(term);
|
||||||
|
break;
|
||||||
|
|
||||||
} // end switch
|
} // end switch
|
||||||
|
|
||||||
} // end loadPost
|
} // 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) %>
|
<% } // end if (conferences present) %>
|
||||||
<P>
|
<P>
|
||||||
<DIV ALIGN="LEFT" CLASS="content">
|
<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()) { %>
|
<% if (data.canManageConferences()) { %>
|
||||||
<A HREF="<%= rdat.getEncodedServletPath("confops?cmd=S&sig=" + data.getCommunityID()) %>"><IMG
|
<A HREF="<%= rdat.getEncodedServletPath("confops?cmd=S&sig=" + data.getCommunityID()) %>"><IMG
|
||||||
SRC="<%= rdat.getFullImagePath("bn_manage.gif") %>" ALT="Manage" WIDTH=80 HEIGHT=24
|
SRC="<%= rdat.getFullImagePath("bn_manage.gif") %>" ALT="Manage" WIDTH=80 HEIGHT=24
|
||||||
|
|
|
@ -32,6 +32,15 @@
|
||||||
<FORM METHOD="POST" ACTION="<%= rdat.getEncodedServletPath("find") %>"><DIV CLASS="content">
|
<FORM METHOD="POST" ACTION="<%= rdat.getEncodedServletPath("find") %>"><DIV CLASS="content">
|
||||||
<INPUT TYPE=HIDDEN NAME="disp" VALUE="<%= data.getDisplayOption() %>">
|
<INPUT TYPE=HIDDEN NAME="disp" VALUE="<%= data.getDisplayOption() %>">
|
||||||
<INPUT TYPE=HIDDEN NAME="ofs" VALUE="0">
|
<INPUT TYPE=HIDDEN NAME="ofs" VALUE="0">
|
||||||
|
<% 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) %>
|
||||||
|
Keywords:
|
||||||
|
<SPAN CLASS="cinput"><INPUT TYPE=TEXT CLASS="cinput" NAME="term" SIZE=64 MAXLENGTH=255
|
||||||
|
VALUE="<%= data.getSearchTerm() %>"></SPAN>
|
||||||
|
</FONT><BR>
|
||||||
|
<% } else { %>
|
||||||
<% if (data.getDisplayOption()==FindData.FD_COMMUNITIES) { %>
|
<% if (data.getDisplayOption()==FindData.FD_COMMUNITIES) { %>
|
||||||
<% if (rdat.useHTMLComments()) { %><!-- Find Communities Form --><% } %>
|
<% if (rdat.useHTMLComments()) { %><!-- Find Communities Form --><% } %>
|
||||||
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,4) %><B>Find Communities:</B></FONT><BR>
|
<%= rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,4) %><B>Find Communities:</B></FONT><BR>
|
||||||
|
@ -83,6 +92,8 @@
|
||||||
<% if (data.getDisplayOption()==FindData.FD_CATEGORIES) { %><BR><% } else { %> <% } %>
|
<% if (data.getDisplayOption()==FindData.FD_CATEGORIES) { %><BR><% } else { %> <% } %>
|
||||||
<SPAN CLASS="cinput"><INPUT TYPE=TEXT CLASS="cinput" NAME="term" SIZE=32 MAXLENGTH=255
|
<SPAN CLASS="cinput"><INPUT TYPE=TEXT CLASS="cinput" NAME="term" SIZE=32 MAXLENGTH=255
|
||||||
VALUE="<%= data.getSearchTerm() %>"></SPAN><BR>
|
VALUE="<%= data.getSearchTerm() %>"></SPAN><BR>
|
||||||
|
|
||||||
|
<% } // end if %>
|
||||||
<INPUT TYPE=IMAGE NAME="search" SRC="<%= rdat.getFullImagePath("bn_search.gif") %>"
|
<INPUT TYPE=IMAGE NAME="search" SRC="<%= rdat.getFullImagePath("bn_search.gif") %>"
|
||||||
ALT="Search" WIDTH=80 HEIGHT=24 BORDER=0><BR>
|
ALT="Search" WIDTH=80 HEIGHT=24 BORDER=0><BR>
|
||||||
</FONT>
|
</FONT>
|
||||||
|
@ -206,9 +217,44 @@
|
||||||
</TR></TABLE><BR>
|
</TR></TABLE><BR>
|
||||||
|
|
||||||
<%-- Display the results of the search --%>
|
<%-- 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++) { %>
|
<% for (int i=0; i<dcount; i++) { %>
|
||||||
<TR VALIGN=TOP>
|
<TR VALIGN=TOP>
|
||||||
|
<% 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>
|
<TD ALIGN=CENTER WIDTH=14>
|
||||||
<IMG SRC="<%= rdat.getFullImagePath("purple-ball.gif") %>" ALT="*" WIDTH=14 HEIGHT=14 BORDER=0>
|
<IMG SRC="<%= rdat.getFullImagePath("purple-ball.gif") %>" ALT="*" WIDTH=14 HEIGHT=14 BORDER=0>
|
||||||
</TD>
|
</TD>
|
||||||
|
@ -244,8 +290,9 @@
|
||||||
<% CategoryDescriptor cd = (CategoryDescriptor)item; %>
|
<% CategoryDescriptor cd = (CategoryDescriptor)item; %>
|
||||||
<A HREF="<%= data.getCatJumpLink(rdat,cd.getLinkedCategoryID()) %>"><%= StringUtil.encodeHTML(cd.toString()) %></A>
|
<A HREF="<%= data.getCatJumpLink(rdat,cd.getLinkedCategoryID()) %>"><%= StringUtil.encodeHTML(cd.toString()) %></A>
|
||||||
|
|
||||||
<% } %>
|
<% } // end if%>
|
||||||
</FONT></TD>
|
</FONT></TD>
|
||||||
|
<% } // end if %>
|
||||||
</TR>
|
</TR>
|
||||||
<% } // end for %>
|
<% } // 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 %>
|
||||||
<% } // 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
|
<A HREF="<%= rdat.getEncodedServletPath("topicops?" + data.getLocator()) %>"><IMG
|
||||||
SRC="<%= rdat.getFullImagePath("bn_manage.gif") %>" ALT="Manage" WIDTH=80 HEIGHT=24
|
SRC="<%= rdat.getFullImagePath("bn_manage.gif") %>" ALT="Manage" WIDTH=80 HEIGHT=24
|
||||||
BORDER=0></A>
|
BORDER=0></A>
|
||||||
|
|
|
@ -47,6 +47,9 @@
|
||||||
SRC="<%= rdat.getFullImagePath("bn_read_new.gif") %>" ALT="Read New" WIDTH=80 HEIGHT=24
|
SRC="<%= rdat.getFullImagePath("bn_read_new.gif") %>" ALT="Read New" WIDTH=80 HEIGHT=24
|
||||||
BORDER=0></A>
|
BORDER=0></A>
|
||||||
<% } // 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("confops?" + data.getLocator() + "&cmd=Q") %>"><IMG
|
<A HREF="<%= rdat.getEncodedServletPath("confops?" + data.getLocator() + "&cmd=Q") %>"><IMG
|
||||||
SRC="<%= rdat.getFullImagePath("bn_manage.gif") %>" ALT="Manage" WIDTH=80 HEIGHT=24
|
SRC="<%= rdat.getFullImagePath("bn_manage.gif") %>" ALT="Manage" WIDTH=80 HEIGHT=24
|
||||||
BORDER=0></A>
|
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