venice-main-classic/web/format/posts.jsp
Eric J. Bowersox 66b7fea53b * landed support for reading topics and posting followup messages to a topic -
the basis of the conferencing engine is now firmly in place
* tweaks to the HTML Checker to make it better at breaking lines without
  leaving stranded punctuation at the beginning or end of a line
* also modified dictionary to better handle possessives and hyphenates
* as always, miscellaneous tweaks and bugfizes as I spot them
2001-02-07 21:12:38 +00:00

328 lines
16 KiB
Plaintext

<%--
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.*" %>
<%
TopicPosts data = TopicPosts.retrieve(request);
Variables.failIfNull(data);
RenderData rdat = RenderConfig.createRenderData(application,request,response);
%>
<% if (rdat.useHTMLComments()) { %><!-- <%= data.getIdentifyingData() %> --><% } %>
<%
String tmp;
if (data.isTopicArchived())
tmp = "(Archived) ";
else if (data.isTopicFrozen())
tmp = "(Frozen) ";
else
tmp = "";
rdat.writeContentHeader(out,data.getTopicName(),tmp + String.valueOf(data.getTotalMessages())
+ " Total; " + String.valueOf(data.getNewMessages()) + " New; Last: "
+ rdat.formatDateForDisplay(data.getLastUpdate()));
%>
<TABLE BORDER=0 WIDTH="100%" CELLPADDING=0 CELLSPACING=0>
<TR VALIGN=BOTTOM>
<TD NOWRAP ALIGN=LEFT>
<% if (rdat.useHTMLComments()) { %><!-- Topic user controls section --><% } %>
<A HREF="<%= rdat.getEncodedServletPath("confdisp?" + data.getConfLocator()) %>"><IMG
SRC="<%= rdat.getFullImagePath("bn_topic_list.gif") %>" ALT="Topic List" WIDTH=80 HEIGHT=24
BORDER=0></A>
&nbsp;&nbsp;
<% if (data.isTopicHidden()) { %>
<A HREF="<%= rdat.getEncodedServletPath("TODO?" + data.getLocator()) %>"><IMG
SRC="<%= rdat.getFullImagePath("bn_show_topic.gif") %>" ALT="Show Topic" WIDTH=80 HEIGHT=24
BORDER=0></A>
<% } else { %>
<A HREF="<%= rdat.getEncodedServletPath("TODO?" + data.getLocator()) %>"><IMG
SRC="<%= rdat.getFullImagePath("bn_hide_topic.gif") %>" ALT="Hide Topic" WIDTH=80 HEIGHT=24
BORDER=0></A>
<% } // end if %>
&nbsp;&nbsp;
<% if (data.canDoNextTopic()) { %>
<A HREF="<%= rdat.getEncodedServletPath("confdisp?" + data.getNextLocator() + "&rnm=1") %>"><IMG
SRC="<%= rdat.getFullImagePath("bn_next_topic.gif") %>" ALT="Next Topic" WIDTH=80 HEIGHT=24
BORDER=0></A>
&nbsp;&nbsp;
<% if (data.getNewMessages()>0) { %>
<%-- TODO: this doesn't do Keep New yet --%>
<A HREF="<%= rdat.getEncodedServletPath("confdisp?" + data.getNextLocator() + "&rnm=1") %>"><IMG
SRC="<%= rdat.getFullImagePath("bn_next_keep_new.gif") %>" ALT="Next & Keep New" WIDTH=80 HEIGHT=24
BORDER=0></A>
&nbsp;&nbsp;
<% } // end if %>
<% } // end if %>
</TD>
<TD NOWRAP ALIGN=RIGHT>
<% if (rdat.useHTMLComments()) { %><!-- Topic admin controls section --><% } %>
<% if (data.canFreezeTopic()) { %>
&nbsp;&nbsp;
<% if (data.isTopicFrozen()) { %>
<A HREF="<%= rdat.getEncodedServletPath("TODO?" + data.getLocator()) %>"><IMG
SRC="<%= rdat.getFullImagePath("bn_unfreeze_topic.gif") %>" ALT="Unfreeze Topic" WIDTH=80 HEIGHT=24
BORDER=0></A>
<% } else { %>
<A HREF="<%= rdat.getEncodedServletPath("TODO?" + data.getLocator()) %>"><IMG
SRC="<%= rdat.getFullImagePath("bn_freeze_topic.gif") %>" ALT="Freeze Topic" WIDTH=80 HEIGHT=24
BORDER=0></A>
<% } // end if %>
<% } // end if %>
<% if (data.canArchiveTopic()) { %>
&nbsp;&nbsp;
<% if (data.isTopicArchived()) { %>
<A HREF="<%= rdat.getEncodedServletPath("TODO?" + data.getLocator()) %>"><IMG
SRC="<%= rdat.getFullImagePath("bn_unarchive_topic.gif") %>" ALT="Unarchive Topic" WIDTH=80
HEIGHT=24 BORDER=0></A>
<% } else { %>
<A HREF="<%= rdat.getEncodedServletPath("TODO?" + data.getLocator()) %>"><IMG
SRC="<%= rdat.getFullImagePath("bn_archive_topic.gif") %>" ALT="Archive Topic" WIDTH=80 HEIGHT=24
BORDER=0></A>
<% } // end if %>
<% } // end if %>
<% if (data.canDeleteTopic()) { %>
&nbsp;&nbsp;
<A HREF="<%= rdat.getEncodedServletPath("TODO?" + data.getLocator()) %>"><IMG
SRC="<%= rdat.getFullImagePath("bn_delete_topic.gif") %>" ALT="Delete Topic" WIDTH=80 HEIGHT=24
BORDER=0></A>
<% } // end if %>
</TD>
</TR>
<TR><TD COLSPAN=2>&nbsp;</TD></TR>
<TR VALIGN=BOTTOM>
<TD NOWRAP ALIGN=LEFT>
<% if (rdat.useHTMLComments()) { %><!-- Go box --><% } %>
<FORM METHOD="GET" ACTION="<%= rdat.getEncodedServletPath("confdisp") %>">
<INPUT TYPE="HIDDEN" NAME="sig" VALUE="<%= data.getSIGID() %>">
<INPUT TYPE="HIDDEN" NAME="conf" VALUE="<%= data.getConfID() %>">
<INPUT TYPE="HIDDEN" NAME="top" VALUE="<%= data.getTopicNumber() %>">
<INPUT TYPE="TEXT" NAME="pxg" VALUE="" SIZE=6 MAXLENGTH=13>&nbsp;&nbsp;
<INPUT TYPE="IMAGE" SRC="<%= rdat.getFullImagePath("bn_go.gif") %>" NAME="Go" ALT="Go"
ALIGN=BOTTOM WIDTH=80 HEIGHT=24 BORDER=0>
</FORM>
</TD>
<TD NOWRAP ALIGN=RIGHT><%= rdat.getStdFontTag(null,2) %>
<% if (rdat.useHTMLComments()) { %><!-- Upper navigation linkset --><% } %>
<%-- TODO: the number "20" should be configurable --%>
<A NAME="top">[</A>&nbsp;
<A HREF="<%= rdat.getEncodedServletPath("confdisp?" + data.getLocator() + "&p1=0&p2=-1") %>">View All</A>
<% if (data.canScrollUp()) { %>
&nbsp;|&nbsp;
<A HREF="<%= rdat.getEncodedServletPath("confdisp?" + data.getLocator() + "&"
+ data.getScrollUpLocator()) %>">Scroll Up 20</A>
<% } // end if %>
<% if (data.canScrollDown()) { %>
&nbsp;|&nbsp;
<A HREF="<%= rdat.getEncodedServletPath("confdisp?" + data.getLocator() + "&"
+ data.getScrollDownLocator()) %>">Scroll Down 20</A>
<% } // end if %>
<% if (data.canScrollDown()) { %>
&nbsp;|&nbsp;
<A HREF="<%= rdat.getEncodedServletPath("confdisp?" + data.getLocator() + "&"
+ data.getScrollToEndLocator()) %>">Scroll To End</A>
<% } // end if %>
&nbsp;|&nbsp;
<A HREF="#bottom">Bottom</A>
&nbsp;]
</FONT></TD>
</TR>
</TABLE>
<% if (rdat.useHTMLComments()) { %><!-- Begin Actual Messages --><% } %>
<%
Iterator it = data.getMessageIterator();
String last_post = rdat.getEncodedServletPath("confdisp?" + data.getLocator() + "&shac=1&p1="
+ String.valueOf(data.getTotalMessages() - 1));
boolean can_line = false;
%>
<% while (it.hasNext()) { %>
<%
TopicMessageContext msg = (TopicMessageContext)(it.next());
String poster = data.getPosterName(msg);
%>
<% if (can_line && data.emitBreakLinePoint(msg.getPostNumber())) { %><HR WIDTH="70%"><% } %>
<% if (data.showAdvanced()) { %>
<BR>
<TABLE WIDTH="100%" BORDER=0 CELLPADDING=0 CELLSPACING=0><TR VALIGN=TOP><TD NOWRAP ALIGN=LEFT>
<% } // end if %>
<%= rdat.getStdFontTag(null,2) %>
<A HREF="<%= rdat.getEncodedServletPath("confdisp?" + data.getLocator() + "&shac=1&p1="
+ String.valueOf(msg.getPostNumber())) %>"><%= msg.getPostNumber() %></A> of
<A HREF="<%= last_post %>"><%= data.getTotalMessages() - 1 %></A>
<%= rdat.getStdFontTag(null,1) %>&lt;<%= "TODO" %>&gt;</FONT><BR>
<B><%= msg.getPseud() %></B>
(<EM>
<A HREF="<%= rdat.getEncodedServletPath("user/" + poster) %>" TARGET="_blank"><%= poster %></A>,
<%= rdat.formatDateForDisplay(msg.getPostDate()) %>
</EM>)
<%-- TODO: paperclip goes here if we have an attachment --%>
</FONT><P>
<% if (msg.isScribbled()) { %>
<TT><EM><B>
(Scribbled by <%= data.getMessageBodyText(msg) %> on
<%= rdat.formatDateForDisplay(msg.getScribbleDate()) %>)
</B></EM></TT>
<% } else if (msg.isHidden() && !(data.showAdvanced())) { %>
<TT><EM><B>
<A HREF="<%= rdat.getEncodedServletPath("confdisp?" + data.getLocator() + "&shac=1&p1="
+ String.valueOf(msg.getPostNumber())) %>">(Hidden
Message: <%= msg.getNumLines() %> <% if (msg.getNumLines()==1) { %>Line<% } else { %>Lines<% } %></A>
</B></EM></TT>
<% } else { %>
<PRE><%= data.getMessageBodyText(msg) %></PRE>
<% } // end if %>
<% if (data.showAdvanced()) { %>
</TD><TD NOWRAP ALIGN=RIGHT>
<% if (!(msg.isScribbled())) { %>
<% if (msg.canHide()) { %>
<% if (msg.isHidden()) { %>
<A HREF="<%= rdat.getEncodedServletPath("TODO?" + data.getLocator()) %>"><IMG
SRC="<%= rdat.getFullImagePath("bn_show.gif") %>" ALT="Show" WIDTH=80 HEIGHT=24 BORDER=0></A><P>
<% } else { %>
<A HREF="<%= rdat.getEncodedServletPath("TODO?" + data.getLocator()) %>"><IMG
SRC="<%= rdat.getFullImagePath("bn_hide.gif") %>" ALT="Hide" WIDTH=80 HEIGHT=24 BORDER=0></A><P>
<% } // end if %>
<% } // end if (can hide) %>
<% if (msg.canScribble()) { %>
<A HREF="<%= rdat.getEncodedServletPath("TODO?" + data.getLocator()) %>"><IMG
SRC="<%= rdat.getFullImagePath("bn_scribble.gif") %>" ALT="Scribble" WIDTH=80 HEIGHT=24
BORDER=0></A><P>
<% } // end if (can scribble) %>
<% } // end if (not already scribbled) %>
<% if (msg.canNuke()) { %>
<A HREF="<%= rdat.getEncodedServletPath("TODO?" + data.getLocator()) %>"><IMG
SRC="<%= rdat.getFullImagePath("bn_nuke.gif") %>" ALT="Nuke" WIDTH=80 HEIGHT=24
BORDER=0></A><P>
<% } // end if (can nuke) %>
</TD></TR></TABLE><BR>
<% } // end if (showing advanced controls) %>
<% can_line = true; %>
<% } // end while %>
<% if (rdat.useHTMLComments()) { %><!-- End Actual Messages --><% } %>
<TABLE BORDER=0 WIDTH="100%" CELLPADDING=0 CELLSPACING=0>
<TR VALIGN=BOTTOM>
<TD NOWRAP ALIGN=LEFT>&nbsp;</TD>
<TD NOWRAP ALIGN=RIGHT><%= rdat.getStdFontTag(null,2) %>
<% if (rdat.useHTMLComments()) { %><!-- Upper navigation linkset --><% } %>
<%-- TODO: the number "20" should be configurable --%>
<A NAME="bottom">[</A>&nbsp;
<A HREF="<%= rdat.getEncodedServletPath("confdisp?" + data.getLocator() + "&p1=0&p2=-1") %>">View All</A>
<% if (data.canScrollUp()) { %>
&nbsp;|&nbsp;
<A HREF="<%= rdat.getEncodedServletPath("confdisp?" + data.getLocator() + "&"
+ data.getScrollUpLocator()) %>">Scroll Up 20</A>
<% } // end if %>
<% if (data.canScrollDown()) { %>
&nbsp;|&nbsp;
<A HREF="<%= rdat.getEncodedServletPath("confdisp?" + data.getLocator() + "&"
+ data.getScrollDownLocator()) %>">Scroll Down 20</A>
<% } // end if %>
<% if (data.canScrollDown()) { %>
&nbsp;|&nbsp;
<A HREF="<%= rdat.getEncodedServletPath("confdisp?" + data.getLocator() + "&"
+ data.getScrollToEndLocator()) %>">Scroll To End</A>
<% } // end if %>
&nbsp;|&nbsp;
<A HREF="#top">Top</A>
&nbsp;]
</FONT></TD>
</TR>
<TR VALIGN=BOTTOM>
<TD NOWRAP ALIGN=LEFT>
<% if (rdat.useHTMLComments()) { %><!-- Topic user controls section --><% } %>
<A HREF="<%= rdat.getEncodedServletPath("confdisp?" + data.getConfLocator()) %>"><IMG
SRC="<%= rdat.getFullImagePath("bn_topic_list.gif") %>" ALT="Topic List" WIDTH=80 HEIGHT=24
BORDER=0></A>
&nbsp;&nbsp;
<% if (data.isTopicHidden()) { %>
<A HREF="<%= rdat.getEncodedServletPath("TODO?" + data.getLocator()) %>"><IMG
SRC="<%= rdat.getFullImagePath("bn_show_topic.gif") %>" ALT="Show Topic" WIDTH=80 HEIGHT=24
BORDER=0></A>
<% } else { %>
<A HREF="<%= rdat.getEncodedServletPath("TODO?" + data.getLocator()) %>"><IMG
SRC="<%= rdat.getFullImagePath("bn_hide_topic.gif") %>" ALT="Hide Topic" WIDTH=80 HEIGHT=24
BORDER=0></A>
<% } // end if %>
&nbsp;&nbsp;
<% if (data.canDoNextTopic()) { %>
<A HREF="<%= rdat.getEncodedServletPath("confdisp?" + data.getNextLocator() + "&rnm=1") %>"><IMG
SRC="<%= rdat.getFullImagePath("bn_next_topic.gif") %>" ALT="Next Topic" WIDTH=80 HEIGHT=24
BORDER=0></A>
&nbsp;&nbsp;
<% if (data.getNewMessages()>0) { %>
<%-- TODO: this doesn't do Keep New yet --%>
<A HREF="<%= rdat.getEncodedServletPath("confdisp?" + data.getNextLocator() + "&rnm=1") %>"><IMG
SRC="<%= rdat.getFullImagePath("bn_next_keep_new.gif") %>" ALT="Next & Keep New" WIDTH=80 HEIGHT=24
BORDER=0></A>
&nbsp;&nbsp;
<% } // end if %>
<% } // end if %>
</TD>
<TD NOWRAP ALIGN=RIGHT>&nbsp;</TD>
</TR>
</TABLE>
<% if (data.displayPostBox()) { %>
<HR><%= rdat.getStdFontTag(null,3) %><B>Post Message in &quot;<%= data.getTopicName() %>&quot;:</B></FONT>
<BR>
<FORM METHOD="POST" ACTION="<%= rdat.getEncodedServletPath("post") %>">
<INPUT TYPE="HIDDEN" NAME="sig" VALUE="<%= data.getSIGID() %>">
<INPUT TYPE="HIDDEN" NAME="conf" VALUE="<%= data.getConfID() %>">
<INPUT TYPE="HIDDEN" NAME="top" VALUE="<%= data.getTopicNumber() %>">
<% if (data.canDoNextTopic()) { %>
<INPUT TYPE="HIDDEN" NAME="next" VALUE="<%= data.getNextTopicNumber() %>">
<% } // end if %>
<INPUT TYPE="HIDDEN" NAME="sd" VALUE="<%= data.getTotalMessages() %>">
<TABLE BORDER=0 CELLPADDING=0>
<TR><TD ALIGN=LEFT COLSPAN=2>
<%= rdat.getStdFontTag(null,2) %>Your name/header:</FONT><BR>
<INPUT TYPE="TEXT" NAME="pseud" SIZE=37 MAXLENGTH=255 VALUE="<%= data.getDefaultPseud() %>">
<%= rdat.getStdFontTag(null,2) %><INPUT TYPE="CHECKBOX" NAME="attach" VALUE="Y"> Attach a file</FONT>
</TD></TR>
<TR>
<TD ALIGN=LEFT><%= rdat.getStdFontTag(null,2) %>Message:</FONT></TD>
<TD ALIGN=RIGHT><%= rdat.getStdFontTag(null,2) %>
<A HREF="TODO" TARGET="_blank">HTML Guide</A>
</FONT></TD>
</TR>
<TR><TD ALIGN=LEFT COLSPAN=2>
<TEXTAREA NAME="pb" WRAP=SOFT ROWS=7 COLS=51></TEXTAREA>
</TD></TR>
<TR><TD ALIGN=CENTER COLSPAN=2>
<INPUT TYPE="IMAGE" SRC="<%= rdat.getFullImagePath("bn_preview.gif") %>" ALT="Preview" NAME="preview"
WIDTH=80 HEIGHT=24 BORDER=0>
&nbsp;&nbsp;
<INPUT TYPE="IMAGE" SRC="<%= rdat.getFullImagePath("bn_post_reload.gif") %>" ALT="Post & Reload"
NAME="post" WIDTH=80 HEIGHT=24 BORDER=0>
<% if (data.canDoNextTopic()) { %>
&nbsp;&nbsp;
<INPUT TYPE="IMAGE" SRC="<%= rdat.getFullImagePath("bn_post_go_next.gif") %>" ALT="Post & Go Next"
NAME="postnext" WIDTH=80 HEIGHT=24 BORDER=0>
<% } // end if %>
</TD></TR>
</TABLE>
</FORM>
<% } else if (data.isTopicArchived()) { %>
<DIV ALIGN=CENTER><%= rdat.getStdFontTag(null,2) %><B>This is an <EM>Archived</EM> Topic</B></DIV>
<% } else if (data.isTopicFrozen()) { %>
<DIV ALIGN=CENTER><%= rdat.getStdFontTag(null,2) %><B>This is a <EM>Frozen</EM> Topic</B></DIV>
<% } // end if %>
<% rdat.writeFooter(out); %>