venice-main-classic/web/format/posts.jsp
Eric J. Bowersox a51fa644b7 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
2001-02-09 09:10:46 +00:00

337 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("topicops?" + data.getLocator() + "&cmd=HN") %>"><IMG
SRC="<%= rdat.getFullImagePath("bn_show_topic.gif") %>" ALT="Show Topic" WIDTH=80 HEIGHT=24
BORDER=0></A>
<% } else { %>
<A HREF="<%= rdat.getEncodedServletPath("topicops?" + data.getLocator() + "&cmd=HY") %>"><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) { %>
<A HREF="<%= rdat.getEncodedServletPath("confdisp?" + data.getNextLocator() + "&"
+ data.getRestoreLocator() + "&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("topicops?" + data.getLocator() + "&cmd=FN") %>"><IMG
SRC="<%= rdat.getFullImagePath("bn_unfreeze_topic.gif") %>" ALT="Unfreeze Topic" WIDTH=80 HEIGHT=24
BORDER=0></A>
<% } else { %>
<A HREF="<%= rdat.getEncodedServletPath("topicops?" + data.getLocator() + "&cmd=FY") %>"><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("topicops?" + data.getLocator() + "&cmd=AN") %>"><IMG
SRC="<%= rdat.getFullImagePath("bn_unarchive_topic.gif") %>" ALT="Unarchive Topic" WIDTH=80
HEIGHT=24 BORDER=0></A>
<% } else { %>
<A HREF="<%= rdat.getEncodedServletPath("topicops?" + data.getLocator() + "&cmd=AY") %>"><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("topicops?" + data.getLocator() + "&cmd=DEL") %>"><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 --><% } %>
<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 <%= data.getNumPostsPerPage() %></A>
<% } // end if %>
<% if (data.canScrollDown()) { %>
&nbsp;|&nbsp;
<A HREF="<%= rdat.getEncodedServletPath("confdisp?" + data.getLocator() + "&"
+ data.getScrollDownLocator()) %>">Scroll Down <%= data.getNumPostsPerPage() %></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;<%= data.getMessageReference(msg) %>&gt;</FONT>
<% if (data.showAdvanced() && msg.isHidden()) { %>
<B><EM>(Hidden)</EM></B>
<% } // end if %>
<BR>
<B><%= msg.getPseud() %></B>
(<EM>
<A HREF="<%= rdat.getEncodedServletPath("user/" + poster) %>" TARGET="_blank"><%= poster %></A>,
<%= rdat.formatDateForDisplay(msg.getPostDate()) %>
</EM>)
<% if (msg.hasAttachment()) { %>
<A HREF="<%= rdat.getEncodedServletPath("attachment?" + data.getConfLocator() + "&msg="
+ String.valueOf(msg.getPostID())) %>"><IMG
SRC="<%= rdat.getFullImagePath("attachment.gif") %>"
ALT="(Attachment <%= msg.getAttachmentFilename() %> - <%= msg.getAttachmentLength() %> bytes)"
WIDTH=16 HEIGHT=16 BORDER=0></A>
<% } // end if %>
</FONT><P>
<% if (msg.isScribbled()) { %>
<TT><EM><B>
(Scribbled by <%= data.getMessageBodyText(msg) %> on
<%= rdat.formatDateForDisplay(msg.getScribbleDate()) %>)
</B></EM></TT><P>
<% } 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><P>
<% } else { %>
<PRE><%= rdat.rewritePostData(data.getMessageBodyText(msg)) %></PRE>
<% } // end if %>
<% if (data.showAdvanced()) { %>
<% String po_loc = data.getLocator() + "&msg=" + String.valueOf(msg.getPostNumber()); %>
</TD><TD NOWRAP ALIGN=RIGHT>
<% if (!(msg.isScribbled())) { %>
<% if (msg.canHide()) { %>
<% if (msg.isHidden()) { %>
<A HREF="<%= rdat.getEncodedServletPath("postops?" + po_loc + "&cmd=HN") %>"><IMG
SRC="<%= rdat.getFullImagePath("bn_show.gif") %>" ALT="Show" WIDTH=80 HEIGHT=24 BORDER=0></A><P>
<% } else { %>
<A HREF="<%= rdat.getEncodedServletPath("postops?" + po_loc + "&cmd=HY") %>"><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("postops?" + po_loc + "&cmd=SCR") %>"><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("postops?" + po_loc + "&cmd=NUKE") %>"><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 --><% } %>
<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 <%= data.getNumPostsPerPage() %></A>
<% } // end if %>
<% if (data.canScrollDown()) { %>
&nbsp;|&nbsp;
<A HREF="<%= rdat.getEncodedServletPath("confdisp?" + data.getLocator() + "&"
+ data.getScrollDownLocator()) %>">Scroll Down <%= data.getNumPostsPerPage() %></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("topicops?" + data.getLocator() + "&cmd=HN") %>"><IMG
SRC="<%= rdat.getFullImagePath("bn_show_topic.gif") %>" ALT="Show Topic" WIDTH=80 HEIGHT=24
BORDER=0></A>
<% } else { %>
<A HREF="<%= rdat.getEncodedServletPath("topicops?" + data.getLocator() + "&cmd=HY") %>"><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) { %>
<A HREF="<%= rdat.getEncodedServletPath("confdisp?" + data.getNextLocator() + "&"
+ data.getRestoreLocator() + "&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="<%= rdat.getStaticFilePath("html-reference.html") %>" 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); %>