implemented the rest of the functions on the "posts" page; fixed post links

so they work now; added the HTML Reference (originally from CW); added the
post output filtering to turn the "pseudo-URIs" in the database into real
URIs
This commit is contained in:
Eric J. Bowersox
2001-02-09 09:10:46 +00:00
parent 70774ead7d
commit a51fa644b7
58 changed files with 3326 additions and 123 deletions

View File

@@ -38,6 +38,7 @@ public class TopicPosts implements JSPRender
*--------------------------------------------------------------------------------
*/
private VeniceEngine engine;
private SIGContext sig;
private ConferenceContext conf;
private TopicContext topic;
@@ -47,6 +48,7 @@ public class TopicPosts implements JSPRender
private int unread;
private List messages;
private TopicVisitOrder visit_order;
private String topic_stem;
private String cache_locator = null;
/*--------------------------------------------------------------------------------
@@ -54,10 +56,11 @@ public class TopicPosts implements JSPRender
*--------------------------------------------------------------------------------
*/
public TopicPosts(HttpServletRequest request, SIGContext sig, ConferenceContext conf, TopicContext topic,
int first, int last, boolean read_new, boolean show_advanced)
public TopicPosts(HttpServletRequest request, VeniceEngine engine, SIGContext sig, ConferenceContext conf,
TopicContext topic, int first, int last, boolean read_new, boolean show_advanced)
throws DataException, AccessError
{
this.engine = engine;
this.sig = sig;
this.conf = conf;
this.topic = topic;
@@ -70,6 +73,8 @@ public class TopicPosts implements JSPRender
this.messages = topic.getMessages(first,last);
this.visit_order = TopicVisitOrder.retrieve(request.getSession(true),conf.getConfID());
visit_order.visit(topic.getTopicNumber());
List aliases = conf.getAliases();
topic_stem = (String)(aliases.get(0)) + "." + String.valueOf(topic.getTopicNumber()) + ".";
} // end constructor
@@ -192,6 +197,14 @@ public class TopicPosts implements JSPRender
} // end getNextLocator
public String getRestoreLocator()
{
StringBuffer buf = new StringBuffer("rtop=");
buf.append(topic.getTopicNumber()).append("&rct=").append(unread);
return buf.toString();
} // end getRestoreLocator
public String getIdentifyingData()
{
StringBuffer buf = new StringBuffer("Posts ");
@@ -262,7 +275,7 @@ public class TopicPosts implements JSPRender
public boolean canDeleteTopic()
{
return false; // TODO: fix me
return topic.canDelete();
} // end canDeleteTopic
@@ -274,7 +287,7 @@ public class TopicPosts implements JSPRender
public String getScrollUpLocator()
{
int new_first = first - 20; // TODO: configurable
int new_first = first - engine.getNumPostsPerPage();
int new_last = last - 1;
if (new_first<0)
{ // normalize so we start at 0
@@ -291,14 +304,14 @@ public class TopicPosts implements JSPRender
public boolean canScrollDown()
{
return ((topic.getTotalMessages() - (1 + last))>=20); // TODO: configurable
return ((topic.getTotalMessages() - (1 + last))>=engine.getNumPostsPerPage());
} // end canScrollDown
public String getScrollDownLocator()
{
StringBuffer buf = new StringBuffer("p1=");
buf.append(last+1).append("&p2=").append(last+20); // TODO: configurable
buf.append(last+1).append("&p2=").append(last+engine.getNumPostsPerPage());
return buf.toString();
} // end getScrollDownLocator
@@ -313,7 +326,7 @@ public class TopicPosts implements JSPRender
{
int my_last = topic.getTotalMessages();
StringBuffer buf = new StringBuffer("p1=");
buf.append(my_last-20).append("&p2=").append(my_last-1); // TODO: configurable
buf.append(my_last-engine.getNumPostsPerPage()).append("&p2=").append(my_last-1);
return buf.toString();
} // end getScrollToEndLocator
@@ -351,4 +364,16 @@ public class TopicPosts implements JSPRender
} // end getDefaultPseud
public String getMessageReference(TopicMessageContext msg)
{
return topic_stem + String.valueOf(msg.getPostNumber());
} // end getMessageReference
public int getNumPostsPerPage()
{
return engine.getNumPostsPerPage();
} // end getNumPostsPerPage
} // end class TopicPosts