From 69e62acbb9d01c2b291196743549afada04ef55f Mon Sep 17 00:00:00 2001 From: "Eric J. Bowersox" Date: Sun, 6 May 2001 22:45:02 +0000 Subject: [PATCH] fixed a bug with the topic visit order and another one with the anyUnread function (it needs to ignore archived topics) --- TODO | 36 +++++++++++++++++ .../core/impl/ConferenceUserContextImpl.java | 9 +++-- .../venice/servlets/ConfDisplay.java | 22 ++++++----- .../servlets/format/TopicVisitOrder.java | 39 ++++++++++++------- 4 files changed, 78 insertions(+), 28 deletions(-) diff --git a/TODO b/TODO index 6059eb0..17a863c 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,41 @@ Lots! +- : Error messages that pop up because you haven't logged in + should reflect that fact. + +- : Enter key on Login activates Password Reminder, not + Log In. Fix. + +- : Should there be a "Keep New" button for the last topic + in a conference? + +- : The fixseen and set pseud functions should really + provide some visual feedback. + +- : Check Venice conferencing functions against 's + list at . + +- : document the functioning of the Administrator account + better somewhere + +- : more system stats like memory pool utilization, number + of current sessions, or ??? + +- : Make "New!" graphic hot, jump to first (unhidden) topic + with new posts + +- : make it easy for user to see his/her own profile as others + see it + +- : allow post attachments to be "linked" somehow to the + topic or conference, so they don't get lost (call it the "topic infobase" or + "conference infobase"?) + +- : are some of the pages using TABLE WIDTH=100% (notably the + conference list) when they shouldn't? + +- : move topics from one conf to another? + - Unimplemented functions on the SIG Administration page: Set SIG Features (sigadmin, command=F) diff --git a/src/com/silverwrist/venice/core/impl/ConferenceUserContextImpl.java b/src/com/silverwrist/venice/core/impl/ConferenceUserContextImpl.java index 9e775c6..5aa9139 100644 --- a/src/com/silverwrist/venice/core/impl/ConferenceUserContextImpl.java +++ b/src/com/silverwrist/venice/core/impl/ConferenceUserContextImpl.java @@ -834,16 +834,17 @@ class ConferenceUserContextImpl implements ConferenceContext, ConferenceBackend conn = datapool.getConnection(); // Build a query. The idea here is that we want to see the topic IDs of all topics within the - // conference which (a) are not hidden and (b) have one or more messages unread by this user. - // The need for the user's settings for both (a) and (b) necessitates the use of the LEFT JOIN - // to topicsettings, which in turn necessitates the IFNULL guards on references to topicsettings + // conference which (a) are not archived, (b) are not hidden and (c) have one or more messages unread + // by this user. The need for the user's settings for both (b) and (c) necessitates the use of the LEFT + // JOIN to topicsettings, which in turn necessitates the IFNULL guards on references to topicsettings // columns in the WHERE clause (as there's only a topicsettings row if the user has read anything // in this topic or otherwise set it). Statement stmt = conn.createStatement(); StringBuffer sql = new StringBuffer("SELECT t.topicid FROM topics t LEFT JOIN topicsettings s " + "ON t.topicid = s.topicid AND s.uid = "); sql.append(sig.realUID()).append(" WHERE t.confid = ").append(confid); - sql.append(" AND IFNULL(s.hidden,0) = 0 AND (t.top_message - IFNULL(s.last_message,-1)) > 0 LIMIT 1;"); + sql.append(" AND t.archived = 0 AND IFNULL(s.hidden,0) = 0 " + + "AND (t.top_message - IFNULL(s.last_message,-1)) > 0 LIMIT 1;"); if (logger.isDebugEnabled()) logger.debug("SQL: " + sql.toString()); diff --git a/src/com/silverwrist/venice/servlets/ConfDisplay.java b/src/com/silverwrist/venice/servlets/ConfDisplay.java index 2d5dcbf..17af294 100644 --- a/src/com/silverwrist/venice/servlets/ConfDisplay.java +++ b/src/com/silverwrist/venice/servlets/ConfDisplay.java @@ -250,14 +250,14 @@ public class ConfDisplay extends VeniceServlet } // end getInterval - private static void restorePosts(ServletRequest request, ConferenceContext conf) + private static boolean restorePosts(ServletRequest request, ConferenceContext conf, TopicContext curr_topic) { String xtopic = request.getParameter("rtop"); if (StringUtil.isStringEmpty(xtopic)) - return; + return true; String xcount = request.getParameter("rct"); if (StringUtil.isStringEmpty(xcount)) - return; + return true; TopicContext topic; try @@ -268,19 +268,19 @@ public class ConfDisplay extends VeniceServlet catch (NumberFormatException nfe) { // the topic number was invalid - forget it logger.warn("restorePosts: error translating topic number"); - return; + return true; } // end catch catch (DataException de) { // could not get the topic... logger.warn("restorePosts: DataException getting topic - " + de.getMessage(),de); - return; + return true; } // end catch catch (AccessError ae) { // no access to the topic logger.warn("restorePosts: AccessError getting topic - " + ae.getMessage(),ae); - return; + return true; } // end catch @@ -291,7 +291,7 @@ public class ConfDisplay extends VeniceServlet if ((nunread<=0) || (nunread>topic.getTotalMessages())) { // must be in the range [1, #messages]... logger.warn("restorePosts: unread post count out of range"); - return; + return true; } // end if @@ -299,7 +299,7 @@ public class ConfDisplay extends VeniceServlet catch (NumberFormatException nfe) { // the number of unread posts was invalid - forget it logger.warn("restorePosts: error translating unread post count"); - return; + return true; } // end catch @@ -314,6 +314,8 @@ public class ConfDisplay extends VeniceServlet } // end catch + return (topic.getTopicID()!=curr_topic.getTopicID()); + } // end restorePosts /*-------------------------------------------------------------------------------- @@ -356,11 +358,11 @@ public class ConfDisplay extends VeniceServlet setMyLocation(request,on_error + "&topic=" + topic.getTopicNumber()); // if this request is restoring the number of unread posts in another topic, try to do so - restorePosts(request,conf); + boolean do_readnew = restorePosts(request,conf,topic); // determine what the post interval is we want to display PostInterval piv = getInterval(engine,request,topic,on_error); - boolean read_new = !(StringUtil.isStringEmpty(request.getParameter("rnm"))); + boolean read_new = do_readnew && !(StringUtil.isStringEmpty(request.getParameter("rnm"))); boolean show_adv = !(StringUtil.isStringEmpty(request.getParameter("shac"))); // Create the post display. diff --git a/src/com/silverwrist/venice/servlets/format/TopicVisitOrder.java b/src/com/silverwrist/venice/servlets/format/TopicVisitOrder.java index d8ceef8..2dbc036 100644 --- a/src/com/silverwrist/venice/servlets/format/TopicVisitOrder.java +++ b/src/com/silverwrist/venice/servlets/format/TopicVisitOrder.java @@ -36,7 +36,6 @@ public class TopicVisitOrder *-------------------------------------------------------------------------------- */ - private int confid; private short[] topics; private boolean[] unread; private int ndx_next; @@ -46,9 +45,8 @@ public class TopicVisitOrder *-------------------------------------------------------------------------------- */ - protected TopicVisitOrder(int confid, List topiclist) + protected TopicVisitOrder(List topiclist) { - this.confid = confid; this.topics = new short[topiclist.size()]; this.unread = new boolean[topiclist.size()]; @@ -65,6 +63,25 @@ public class TopicVisitOrder } // end constructor + /*-------------------------------------------------------------------------------- + * Internal functions + *-------------------------------------------------------------------------------- + */ + + private static Map getInternalMap(HttpSession session) + { + Map rc = (Map)(session.getAttribute(ATTRIBUTE)); + if (rc==null) + { // create a new HashMap + rc = Collections.synchronizedMap(new HashMap()); + session.setAttribute(ATTRIBUTE,rc); + + } // end if + + return rc; + + } // end getInternalMap + private int moveNext() { int i = ndx_next; @@ -88,23 +105,17 @@ public class TopicVisitOrder public static TopicVisitOrder initialize(HttpSession session, int confid, List topic_list) { - TopicVisitOrder tvo = new TopicVisitOrder(confid,topic_list); - session.setAttribute(ATTRIBUTE,tvo); + TopicVisitOrder tvo = new TopicVisitOrder(topic_list); + Map tvo_map = getInternalMap(session); + tvo_map.put(new Integer(confid),tvo); return tvo; } // end initialize public static TopicVisitOrder retrieve(HttpSession session, int confid) { - TopicVisitOrder tvo = (TopicVisitOrder)(session.getAttribute(ATTRIBUTE)); - if (tvo!=null) - { // make sure the conference is OK - if (tvo.confid!=confid) // wrong conference - remove this - tvo = null; - - } // end if - - return tvo; + Map tvo_map = getInternalMap(session); + return (TopicVisitOrder)(tvo_map.get(new Integer(confid))); } // end retrieve