fixed bugs in post nuke, base.jsp display (simplified it), and global

audit record display
This commit is contained in:
Eric J. Bowersox
2001-04-11 05:42:12 +00:00
parent 63fedc9db6
commit 7e226040d4
5 changed files with 113 additions and 85 deletions

View File

@@ -723,7 +723,7 @@ class TopicMessageUserContextImpl implements TopicMessageContext
// lock the tables we reference
stmt.executeUpdate("LOCK TABLES posts WRITE, postdata WRITE, postattach WRITE, postdogear WRITE, "
+ "postpublish WRITE;");
+ "postpublish WRITE, topics WRITE;");
try
{ // first, make sure we have the right status for our post
@@ -731,6 +731,13 @@ class TopicMessageUserContextImpl implements TopicMessageContext
if (nuked)
return; // nuking a nuked post is futile
// We need the post's topic ID and post number to renumber the topic afterwards, so grab 'em.
ResultSet rs = stmt.executeQuery("SELECT topicid, num FROM posts WHERE postid = " + postid + ";");
if (!(rs.next()))
throw new InternalStateError("lost the post to be nuked after refresh?");
int x_topic_id = rs.getInt(1);
int x_post_num = rs.getInt(2);
// Delete any and all references to this post!
stmt.executeUpdate("DELETE FROM posts WHERE postid = " + postid + ";");
stmt.executeUpdate("DELETE FROM postdata WHERE postid = " + postid + ";");
@@ -739,6 +746,14 @@ class TopicMessageUserContextImpl implements TopicMessageContext
if (stmt.executeUpdate("DELETE FROM postpublish WHERE postid = " + postid + ";")>0)
engine.unpublish(postid);
// Phase 1 of renumber - Renumber all posts that had a number higher than the one
// we just blew to hell.
stmt.executeUpdate("UPDATE posts SET num = (num - 1) WHERE num > " + x_post_num + ";");
// Phase 2 of renumber - The topic now has one less post in it. Reflect that.
stmt.executeUpdate("UPDATE topics SET top_message = (top_message - 1) WHERE topicid = "
+ x_topic_id + ";");
// Update our internal variables.
linecount = 0;
creator_uid = -1;

View File

@@ -78,7 +78,7 @@ class TopicUserContextImpl implements TopicContext
this.lastupdate = lastupdate;
this.name = name;
this.hidden = hidden;
this.unread = unread;
this.unread = (unread<0 ? 0 : unread);
} // end constructor
@@ -151,6 +151,8 @@ class TopicUserContextImpl implements TopicContext
lastupdate = SQLUtil.getFullDateTime(rs,8);
hidden = rs.getBoolean(10);
unread = rs.getInt(11);
if (unread<0)
unread = 0;
} // end if
else // this topic must have been deleted - fsck it

View File

@@ -64,6 +64,8 @@ public class AuditRecord implements AuditData
String getUserName(int uid) throws SQLException, DataException
{
if (uid==0)
return ""; // UID 0 = no user
Integer uid_x = new Integer(uid);
String rc = (String)(uname_cache.get(uid_x));
if (rc==null)