From e108be62da7abea8814f01471844b1e6d4f35ec4 Mon Sep 17 00:00:00 2001 From: "Eric J. Bowersox" Date: Thu, 28 Jun 2001 03:54:27 +0000 Subject: [PATCH] fixed bug with not allowing attachments with Post & Go Topics; fixed compile error with removal of Smart Tags; made "New!" flags on conferences actually *do* something (read new messages) --- .../venice/servlets/ConfDisplay.java | 85 +++++++++++++++---- .../venice/servlets/PostMessage.java | 46 +++++----- .../venice/servlets/format/RenderData.java | 2 +- .../servlets/format/SideBoxConferences.java | 5 +- web/format/conferences.jsp | 3 +- 5 files changed, 100 insertions(+), 41 deletions(-) diff --git a/src/com/silverwrist/venice/servlets/ConfDisplay.java b/src/com/silverwrist/venice/servlets/ConfDisplay.java index 17af294..cdd7cda 100644 --- a/src/com/silverwrist/venice/servlets/ConfDisplay.java +++ b/src/com/silverwrist/venice/servlets/ConfDisplay.java @@ -390,32 +390,85 @@ public class ConfDisplay extends VeniceServlet { // we're displaying the conference's topic list if (logger.isDebugEnabled()) logger.debug("MODE: display topics in conference"); - setMyLocation(request,"confdisp?sig=" + sig.getSIGID() + "&conf=" + conf.getConfID()); String on_error = "confops?sig=" + sig.getSIGID(); + String my_location = "confdisp?sig=" + sig.getSIGID() + "&conf=" + conf.getConfID(); + boolean read_new = !(StringUtil.isStringEmpty(request.getParameter("rnm"))); + if (read_new) + my_location += "&rn=1"; + setMyLocation(request,my_location); // get any changes to view or sort options TopicSortHolder opts = TopicSortHolder.retrieve(request.getSession(true)); getViewSortDefaults(request,conf.getConfID(),opts,on_error); - TopicListing tl = null; - try - { // create the topic lict - tl = new TopicListing(request,sig,conf,opts.getViewOption(conf.getConfID()), - opts.getSortOption(conf.getConfID())); + if (read_new) + { // we need to generate a TopicPosts view + TopicPosts tpos = null; - } // end try - catch (DataException de) - { // there was a database error retrieving topics - return new ErrorBox("Database Error","Database error listing topics: " + de.getMessage(),on_error); + try + { // generate a topic list first + List topic_list = conf.getTopicList(opts.getViewOption(conf.getConfID()), + opts.getSortOption(conf.getConfID())); - } // end catch - catch (AccessError ae) - { // we were unable to retrieve the topic list - return new ErrorBox("Access Error",ae.getMessage(),on_error); + // now generate the topic visit order + TopicVisitOrder ord = TopicVisitOrder.initialize(request.getSession(true),conf.getConfID(), + topic_list); - } // end catch + // use the new visit order to get the topic we need to visit + short topic_nbr = ord.getNext(); + Iterator it = topic_list.iterator(); + while (it.hasNext()) + { // locate the first topic to be read + topic = (TopicContext)(it.next()); + if (topic.getTopicNumber()==topic_nbr) + break; - return tl; + } // end while + + // determine what the post interval is we want to display + PostInterval piv = getInterval(engine,request,topic,on_error); + + // create the topic posts view + tpos = new TopicPosts(request,engine,sig,conf,topic,piv.getFirst(),piv.getLast(),true,false); + + } // end try + catch (DataException de) + { // there was a database error retrieving messages + return new ErrorBox("Database Error","Database error listing messages: " + de.getMessage(),on_error); + + } // end catch + catch (AccessError ae) + { // we were unable to retrieve the message list + return new ErrorBox("Access Error",ae.getMessage(),on_error); + + } // end catch + + return tpos; // this is what we need! + + } // end if (creating a "read new" topic list view) + else + { // topic listing only... + TopicListing tl = null; + try + { // create the topic lict + tl = new TopicListing(request,sig,conf,opts.getViewOption(conf.getConfID()), + opts.getSortOption(conf.getConfID())); + + } // end try + catch (DataException de) + { // there was a database error retrieving topics + return new ErrorBox("Database Error","Database error listing topics: " + de.getMessage(),on_error); + + } // end catch + catch (AccessError ae) + { // we were unable to retrieve the topic list + return new ErrorBox("Access Error",ae.getMessage(),on_error); + + } // end catch + + return tl; + + } // end else (not reading new messages, but just displaying topics) } // end else (topics in a conference) diff --git a/src/com/silverwrist/venice/servlets/PostMessage.java b/src/com/silverwrist/venice/servlets/PostMessage.java index 355877d..7806dc9 100644 --- a/src/com/silverwrist/venice/servlets/PostMessage.java +++ b/src/com/silverwrist/venice/servlets/PostMessage.java @@ -135,34 +135,38 @@ public class PostMessage extends VeniceServlet if (!(yes.equals(request.getParameter("slip")))) topic.fixSeen(); // no slippage = make sure we mark all as read - if (go_topics) // jump back to the topic list, puhleaze - throw new RedirectResult("confdisp?sig=" + sig.getSIGID() + "&conf=" + conf.getConfID()); + // where do we want to go now? + String target; + if (go_topics) + target = "confdisp?sig=" + sig.getSIGID() + "&conf=" + conf.getConfID(); + else + { // figure out what topic to go to next + short next; + try + { // attempt to get the value of the "next topic" parameter + if (go_next) + { // get the "next topic" parameter + String foo = request.getParameter("next"); + if (StringUtil.isStringEmpty(foo)) + next = topic.getTopicNumber(); + else + next = Short.parseShort(foo); - short next; - try - { // attempt to get the value of the "next topic" parameter - if (go_next) - { // get the "next topic" parameter - String foo = request.getParameter("next"); - if (StringUtil.isStringEmpty(foo)) - next = topic.getTopicNumber(); + } // end if else - next = Short.parseShort(foo); + next = topic.getTopicNumber(); - } // end if - else + } // end try + catch (NumberFormatException nfe) + { // just default me next = topic.getTopicNumber(); - } // end try - catch (NumberFormatException nfe) - { // just default me - next = topic.getTopicNumber(); + } // end catch - } // end catch + target = "confdisp?sig=" + sig.getSIGID() + "&conf=" + conf.getConfID() + "&top=" + + next + "&rnm=1"; - // where do we want to go now? - String target = "confdisp?sig=" + sig.getSIGID() + "&conf=" + conf.getConfID() + "&top=" - + next + "&rnm=1"; + } // end else if (yes.equals(request.getParameter("attach"))) return new AttachmentForm(sig,conf,msg,target); // go to upload an attachment diff --git a/src/com/silverwrist/venice/servlets/format/RenderData.java b/src/com/silverwrist/venice/servlets/format/RenderData.java index cafd1a4..8064d50 100644 --- a/src/com/silverwrist/venice/servlets/format/RenderData.java +++ b/src/com/silverwrist/venice/servlets/format/RenderData.java @@ -135,7 +135,7 @@ public class RenderData } // end canGZIPEncode - boolean noSmartTags() + public boolean noSmartTags() { return rconf.noSmartTags(); diff --git a/src/com/silverwrist/venice/servlets/format/SideBoxConferences.java b/src/com/silverwrist/venice/servlets/format/SideBoxConferences.java index a3abf90..1083baf 100644 --- a/src/com/silverwrist/venice/servlets/format/SideBoxConferences.java +++ b/src/com/silverwrist/venice/servlets/format/SideBoxConferences.java @@ -82,8 +82,9 @@ public class SideBoxConferences implements ContentRender + rdat.getEncodedServletPath(href) + "\">" + StringUtil.encodeHTML(conf.getName()) + " (" + StringUtil.encodeHTML(conf.getEnclosingSIG().getName()) + ")\n"); if (conf.anyUnread()) - out.write(" \"New!\"\n"); + out.write(" \"New!\"\n"); out.write("\n\n"); } // end while diff --git a/web/format/conferences.jsp b/web/format/conferences.jsp index 6595de9..723c9fe 100644 --- a/web/format/conferences.jsp +++ b/web/format/conferences.jsp @@ -39,7 +39,8 @@ <%= StringUtil.encodeHTML(data.getConferenceName(i)) %> - Latest activity: <%= rdat.getActivityString(data.getLastUpdateDate(i)) %> <% if (data.anyUnread(i)) { %> - " ALT=\"New!\" BORDER=0 WIDTH=40 HEIGHT=20> + ">" ALT="New!" BORDER=0 WIDTH=40 HEIGHT=20> <% } // end if %>
<% int count = data.getNumHosts(i); %>