fixed a bug with the topic visit order and another one with the anyUnread

function (it needs to ignore archived topics)
This commit is contained in:
Eric J. Bowersox 2001-05-06 22:45:02 +00:00
parent 342a0041a5
commit 69e62acbb9
4 changed files with 78 additions and 28 deletions

36
TODO
View File

@ -1,5 +1,41 @@
Lots!
- <SiteHelp.4.104>: Error messages that pop up because you haven't logged in
should reflect that fact.
- <SiteHelp.4.101>: Enter key on Login activates Password Reminder, not
Log In. Fix.
- <SiteHelp.4.96>: Should there be a "Keep New" button for the last topic
in a conference?
- <SiteHelp.4.84-85>: The fixseen and set pseud functions should really
provide some visual feedback.
- <SiteHelp.7.51>: Check Venice conferencing functions against <dgrey>'s
list at <http://www.voght.com/cgi-bin/pywiki?CollabSpecs>.
- <SiteHelp.7.46-48>: document the functioning of the Administrator account
better somewhere
- <SiteHelp.7.22>: more system stats like memory pool utilization, number
of current sessions, or ???
- <SiteHelp.7.19>: Make "New!" graphic hot, jump to first (unhidden) topic
with new posts
- <SiteHelp.7.19>: make it easy for user to see his/her own profile as others
see it
- <SiteHelp.7.5-6>: 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"?)
- <SiteHelp.3.50>: are some of the pages using TABLE WIDTH=100% (notably the
conference list) when they shouldn't?
- <SiteHelp.3.38>: move topics from one conf to another?
- Unimplemented functions on the SIG Administration page:
Set SIG Features (sigadmin, command=F)

View File

@ -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());

View File

@ -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.

View File

@ -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