added customizable "HTML Escapes" for the top and bottom of the topic list

and post list pages; configurable through the host tools
This commit is contained in:
Eric J. Bowersox
2001-12-05 00:03:39 +00:00
parent 9cc34facf6
commit 9d34cc35f0
17 changed files with 699 additions and 58 deletions

View File

@@ -18,6 +18,8 @@
package com.silverwrist.venice.servlets.format;
import java.awt.Dimension;
import java.io.Writer;
import java.io.IOException;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
@@ -59,6 +61,8 @@ public class TopicPosts implements JSPRender
private TopicVisitOrder visit_order;
private String topic_stem;
private String topic_qid;
private String top_custom;
private String bottom_custom;
private String cache_locator = null;
private HashSet bozo_uids = new HashSet();
private Dimension photo_size = null;
@@ -97,6 +101,8 @@ public class TopicPosts implements JSPRender
List aliases = conf.getAliases();
topic_stem = (String)(aliases.get(0)) + "." + topic.getTopicNumber() + ".";
topic_qid = "go/" + comm.getAlias() + "!" + (String)(aliases.get(0)) + "." + topic.getTopicNumber();
top_custom = conf.getCustomBlock(ConferenceContext.CUST_BLOCK_TOP);
bottom_custom = conf.getCustomBlock(ConferenceContext.CUST_BLOCK_BOTTOM);
// build up the list of users IN THIS VIEW that are bozo-filtered
HashSet saw_users = new HashSet();
@@ -192,7 +198,7 @@ public class TopicPosts implements JSPRender
*--------------------------------------------------------------------------------
*/
public static String getPosterName(TopicMessageContext msg)
public static final String getPosterName(TopicMessageContext msg)
{
try
{ // have to guard agains a DataException here
@@ -207,7 +213,7 @@ public class TopicPosts implements JSPRender
} // end getPosterName
public static String getMessageBodyText(TopicMessageContext msg)
public static final String getMessageBodyText(TopicMessageContext msg)
{
try
{ // have to guard against a DataException here
@@ -222,25 +228,25 @@ public class TopicPosts implements JSPRender
} // end getMessageBodyText
public int getCommunityID()
public final int getCommunityID()
{
return comm.getCommunityID();
} // end getCommunityID
public int getConfID()
public final int getConfID()
{
return conf.getConfID();
} // end getConfID
public int getTopicNumber()
public final int getTopicNumber()
{
return topic.getTopicNumber();
} // end getTopicNumber
public int getNextTopicNumber()
public final int getNextTopicNumber()
{
if (visit_order!=null)
return visit_order.getNext();
@@ -249,7 +255,7 @@ public class TopicPosts implements JSPRender
} // end getNextTopicNumber
public String getConfLocator()
public final String getConfLocator()
{
StringBuffer buf = new StringBuffer("sig=");
buf.append(comm.getCommunityID()).append("&conf=").append(conf.getConfID());
@@ -257,7 +263,7 @@ public class TopicPosts implements JSPRender
} // end getConfLocator
public String getLocator()
public final String getLocator()
{
if (cache_locator==null)
{ // build up the standard locator
@@ -272,7 +278,7 @@ public class TopicPosts implements JSPRender
} // end getLocator
public String getNextLocator()
public final String getNextLocator()
{
StringBuffer buf = new StringBuffer("sig=");
buf.append(comm.getCommunityID()).append("&conf=").append(conf.getConfID());
@@ -282,7 +288,7 @@ public class TopicPosts implements JSPRender
} // end getNextLocator
public String getRestoreLocator()
public final String getRestoreLocator()
{
StringBuffer buf = new StringBuffer("rtop=");
buf.append(topic.getTopicNumber()).append("&rct=").append(unread);
@@ -290,7 +296,7 @@ public class TopicPosts implements JSPRender
} // end getRestoreLocator
public String getIdentifyingData()
public final String getIdentifyingData()
{
StringBuffer buf = new StringBuffer("Posts ");
buf.append(first).append(" through ").append(last).append(" in topic #").append(topic.getTopicID());
@@ -298,37 +304,37 @@ public class TopicPosts implements JSPRender
} // end getIdentifyingData
public String getTopicName()
public final String getTopicName()
{
return topic.getName();
} // end getTopicName
public int getTotalMessages()
public final int getTotalMessages()
{
return topic.getTotalMessages();
} // end getTotalMessages
public int getNewMessages()
public final int getNewMessages()
{
return unread;
} // end getNewMessages
public Date getLastUpdate()
public final Date getLastUpdate()
{
return topic.getLastUpdateDate();
} // end getLastUpdate
public boolean isTopicHidden()
public final boolean isTopicHidden()
{
return topic.isHidden();
} // end isTopicHidden
public boolean canDoNextTopic()
public final boolean canDoNextTopic()
{
if (visit_order!=null)
return visit_order.isNext();
@@ -337,43 +343,43 @@ public class TopicPosts implements JSPRender
} // end canDoNextTopic
public boolean canFreezeTopic()
public final boolean canFreezeTopic()
{
return topic.canFreeze();
} // end canFreezeTopic
public boolean isTopicFrozen()
public final boolean isTopicFrozen()
{
return topic.isFrozen();
} // end isTopicFrozen
public boolean canArchiveTopic()
public final boolean canArchiveTopic()
{
return topic.canArchive();
} // end canArchiveTopic
public boolean isTopicArchived()
public final boolean isTopicArchived()
{
return topic.isArchived();
} // end isTopicArchived
public boolean canDeleteTopic()
public final boolean canDeleteTopic()
{
return topic.canDelete();
} // end canDeleteTopic
public boolean canScrollUp()
public final boolean canScrollUp()
{
return (first>0);
} // end canScrollUp
public String getScrollUpLocator()
public final String getScrollUpLocator()
{
int new_first = first - engine.getNumPostsPerPage();
int new_last = first - 1;
@@ -390,13 +396,13 @@ public class TopicPosts implements JSPRender
} // end getScrollUpLocator
public boolean canScrollDown()
public final boolean canScrollDown()
{
return ((topic.getTotalMessages() - (1 + last))>0);
} // end canScrollDown
public String getScrollDownLocator()
public final String getScrollDownLocator()
{
int new_last = last + engine.getNumPostsPerPage();
int my_last = topic.getTotalMessages() - 1;
@@ -408,13 +414,13 @@ public class TopicPosts implements JSPRender
} // end getScrollDownLocator
public boolean canScrollToEnd()
public final boolean canScrollToEnd()
{
return ((topic.getTotalMessages() - (1 + last))>0);
} // end canScrollToEnd
public String getScrollToEndLocator()
public final String getScrollToEndLocator()
{
int my_last = topic.getTotalMessages();
StringBuffer buf = new StringBuffer("p1=");
@@ -423,25 +429,25 @@ public class TopicPosts implements JSPRender
} // end getScrollToEndLocator
public Iterator getMessageIterator()
public final Iterator getMessageIterator()
{
return messages.iterator();
} // end getMessageIterator()
public boolean emitBreakLinePoint(int msg)
public final boolean emitBreakLinePoint(int msg)
{
return (msg==(topic.getTotalMessages()-unread));
} // end emitBreakLinePoint
public boolean showAdvanced()
public final boolean showAdvanced()
{
return show_advanced && (last==first);
} // end showAdvanced
public boolean displayPostBox()
public final boolean displayPostBox()
{
boolean flag1 = conf.canPostToConference();
boolean flag2 = (topic.isFrozen() ? topic.canFreeze() : true);
@@ -450,25 +456,25 @@ public class TopicPosts implements JSPRender
} // end displayPostBox
public String getDefaultPseud()
public final String getDefaultPseud()
{
return conf.getDefaultPseud();
} // end getDefaultPseud
public String getMessageReference(TopicMessageContext msg)
public final String getMessageReference(TopicMessageContext msg)
{
return topic_stem + msg.getPostNumber();
} // end getMessageReference
public int getNumPostsPerPage()
public final int getNumPostsPerPage()
{
return engine.getNumPostsPerPage();
} // end getNumPostsPerPage
public boolean displayAttachmentInNewWindow(TopicMessageContext msg)
public final boolean displayAttachmentInNewWindow(TopicMessageContext msg)
{
if (!(msg.hasAttachment()))
return false;
@@ -477,7 +483,7 @@ public class TopicPosts implements JSPRender
} // end displayAttachmentInNewWindow
public boolean bozoFilterUser(int uid)
public final boolean bozoFilterUser(int uid)
{
if (no_bozos)
return false;
@@ -486,7 +492,7 @@ public class TopicPosts implements JSPRender
} // end bozoFilterUser
public boolean showBozoFilteredIndicator(int uid)
public final boolean showBozoFilteredIndicator(int uid)
{
if (no_bozos)
return bozo_uids.contains(new Integer(uid));
@@ -495,13 +501,13 @@ public class TopicPosts implements JSPRender
} // end showBozoFilteredIndicator
public boolean showFilterButton(int uid)
public final boolean showFilterButton(int uid)
{
return !(bozo_uids.contains(new Integer(uid))) && topic.canSetBozo(uid);
} // end showFilterButton
public String getUserPhotoTag(int uid, RenderData rdat)
public final String getUserPhotoTag(int uid, RenderData rdat)
{
if (photo_size==null)
return ""; // user photos not enabled
@@ -515,10 +521,24 @@ public class TopicPosts implements JSPRender
} // end getUserPhotoTag
public boolean displayPostPictures()
public final boolean displayPostPictures()
{
return (photo_size!=null);
} // end displayPostPictures
public final void writeTopCustom(Writer out) throws IOException
{
if (top_custom!=null)
out.write(top_custom);
} // end writeTopCustom
public final void writeBottomCustom(Writer out) throws IOException
{
if (bottom_custom!=null)
out.write(bottom_custom);
} // end writeBottomCustom
} // end class TopicPosts