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

@ -1,4 +1,3 @@
acmecity
advogato
ain't
@ -8,6 +7,7 @@ bajor
bios
boitano
boromax
bungee
can't
cartman
cdt
@ -25,7 +25,9 @@ dilithium
docking
doesn't
don't
downtime
edt
email
eminds
entil'zha
eps

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)

View File

@ -25,6 +25,10 @@
Variables.failIfNull(basedat);
UserContext user = Variables.getUserContext(application,request,session);
RenderData rdat = RenderConfig.createRenderData(application,request,response);
String header_font = rdat.getStdFontTag("white",3);
String stdfont = rdat.getStdFontTag(null,2);
String smallfont = rdat.getStdFontTag(null,1);
String partial_tgt, foo;
%>
<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">
<HTML>
@ -34,102 +38,105 @@
</HEAD>
<BODY BGCOLOR="#9999FF">
<TABLE ALIGN=LEFT BORDER=0 WIDTH="100%" CELLPADDING=2 CELLSPACING=0>
<% if (rdat.useHTMLComments()) { %><!-- BEGIN PAGE HEADER --><% } %>
<TR VALIGN=TOP BGCOLOR="#6666CC"><TD ALIGN=CENTER>
<TABLE ALIGN=CENTER WIDTH="100%" BORDER=0 CELLPADDING=0 CELLSPACING=0><TR VALIGN=MIDDLE>
<TD ALIGN=LEFT WIDTH=150>
<% if (rdat.useHTMLComments()) { %><!-- Site logo --><% } %>
<%= rdat.getSiteImageTag(2,2) %>
</TD>
<% if (rdat.useHTMLComments()) { %><!-- BEGIN PAGE HEADER --><% } %>
<TABLE BORDER=0 BGCOLOR="#6666CC" WIDTH="100%" CELLPADDING=2 CELLSPACING=0>
<TR VALIGN=MIDDLE>
<TD ALIGN=LEFT WIDTH=150>
<% if (rdat.useHTMLComments()) { %><!-- Site logo --><% } %>
<%= rdat.getSiteImageTag(2,2) %>
</TD>
<TD ALIGN=LEFT WIDTH=150><%= rdat.getStdFontTag("white",3) %><B>
<% if (rdat.useHTMLComments()) { %><!-- Links to Front Page, Help, Find --><% } %>
<A HREF="<%= rdat.getEncodedServletPath("top") %>">Front Page</A><P>
<A HREF="/TODO">Help</A>&nbsp;|&nbsp;
<A HREF="<%= rdat.getEncodedServletPath("find") %>">Find</A>
</B></FONT></TD>
<TD ALIGN=LEFT WIDTH=150><%= header_font %><B>
<% if (rdat.useHTMLComments()) { %><!-- Links to Front Page, Help, Find --><% } %>
<A HREF="<%= rdat.getEncodedServletPath("top") %>"><FONT COLOR="yellow">Front Page</FONT></A><P>
<A HREF="/TODO"><FONT COLOR="yellow">Help</FONT></A>&nbsp;|&nbsp;
<A HREF="<%= rdat.getEncodedServletPath("find") %>"><FONT COLOR="yellow">Find</FONT></A>
</B></FONT></TD>
<TD ALIGN=RIGHT WIDTH=150>
<% if (rdat.useHTMLComments()) { %><!-- Banner Ad --><% } %>
<%-- BEGIN TEMP - Banner Ad code --%>
<IMG SRC="/venice/images/sample-banner.gif" ALT="Banner Ad - 468x60" ALIGN=RIGHT
WIDTH=468 HEIGHT=60 HSPACE=2 VSPACE=2>
<%-- END TEMP - Banner Ad Code --%>
</TD>
</TR></TABLE>
</TD></TR>
<TD ALIGN=RIGHT WIDTH=150>
<% if (rdat.useHTMLComments()) { %><!-- Banner Ad --><% } %>
<%-- BEGIN TEMP - Banner Ad code --%>
<IMG SRC="/venice/images/sample-banner.gif" ALT="Banner Ad - 468x60" ALIGN=RIGHT
WIDTH=468 HEIGHT=60 HSPACE=2 VSPACE=2>
<%-- END TEMP - Banner Ad Code --%>
</TD>
</TR>
<% if (rdat.useHTMLComments()) { %><!-- Login reminders --><% } %>
<TR VALIGN=MIDDLE BGCOLOR="#6666CC"><TD ALIGN=CENTER>
<%= rdat.getStdFontTag("white",3) %>
<TR VALIGN=MIDDLE><TD ALIGN=CENTER COLSPAN=3><%= header_font %>
<% if (user.isLoggedIn()) { %>
You are logged in as <B><%= StringUtil.encodeHTML(user.getUserName()) %></B>
<% if (basedat.displayLoginLinks()) { %>
<% String partial_tgt = "account?tgt=" + URLEncoder.encode(basedat.getLocation()) + "&cmd="; %>
&nbsp;-&nbsp;<A HREF="<%= rdat.getEncodedServletPath(partial_tgt + "L") %>">Log Out</A>
&nbsp;|&nbsp;<A HREF="<%= rdat.getEncodedServletPath(partial_tgt + "P") %>">Profile</A>
<%
partial_tgt = "account?tgt=" + URLEncoder.encode(basedat.getLocation()) + "&cmd=";
foo = rdat.getEncodedServletPath(partial_tgt + "L");
%>
&nbsp;-&nbsp;<A HREF="<%= foo %>"><FONT COLOR="yellow">Log Out</FONT></A>
<% foo = rdat.getEncodedServletPath(partial_tgt + "P"); %>
&nbsp;|&nbsp;<A HREF="<%= foo %>"><FONT COLOR="yellow">Profile</FONT></A>
<% } // end if %>
<% } else { %>
You are not logged in
<% if (basedat.displayLoginLinks()) { %>
<% String partial_tgt = "account?tgt=" + URLEncoder.encode(basedat.getLocation()) + "&cmd="; %>
&nbsp;-&nbsp;<A HREF="<%= rdat.getEncodedServletPath(partial_tgt + "L") %>">Log In</A>
&nbsp;|&nbsp;<A HREF="<%= rdat.getEncodedServletPath(partial_tgt + "C") %>">Create Account</A>
<%
partial_tgt = "account?tgt=" + URLEncoder.encode(basedat.getLocation()) + "&cmd=";
foo = rdat.getEncodedServletPath(partial_tgt + "L");
%>
&nbsp;-&nbsp;<A HREF="<%= foo %>"><FONT COLOR="yellow">Log In</FONT></A>
<% foo = rdat.getEncodedServletPath(partial_tgt + "C"); %>
&nbsp;|&nbsp;<A HREF="<%= foo %>"><FONT COLOR="yellow">Create Account</FONT></A>
<% } // end if %>
<% } // end if %>
</FONT>
</TR></TD>
</FONT></TD></TR>
<% if (rdat.useHTMLComments()) { %><!-- END PAGE HEADER --><% } %>
<TR VALIGN=TOP><TD ALIGN=CENTER>
<TABLE ALIGN=CENTER WIDTH="100%" BORDER=0 CELLPADDING=2 CELLSPACING=0>
<TR VALIGN=TOP>
<TD ALIGN=LEFT WIDTH=120 BGCOLOR="#9999FF">
<TABLE ALIGN=LEFT WIDTH=120 CELPADDING=0 CELLSPACING=0>
<% if (rdat.useHTMLComments()) { %><!-- BEGIN LEFT SIDEBAR --><% } %>
<TR VALIGN=TOP><TD VALIGN=LEFT><%= rdat.getStdFontTag(null,2) %>
<% if (rdat.useHTMLComments()) { %><!-- variable menu --><% } %>
<% basedat.renderMenu(session,out,rdat); %>
</FONT></TD></TR>
<TR VALIGN=TOP><TD VALIGN=LEFT>&nbsp;</TD></TR>
<TR VALIGN=TOP><TD VALIGN=LEFT><%= rdat.getStdFontTag(null,2) %>
<% if (rdat.useHTMLComments()) { %><!-- fixed menu --><% } %>
<% basedat.renderFixedMenu(out,rdat); %>
</FONT></TD></TR>
<% if (rdat.useHTMLComments()) { %><!-- END LEFT SIDEBAR --><% } %>
</TABLE>
</TD>
<TD ALIGN=LEFT WIDTH="100%" BGCOLOR="white">
<% if (rdat.useHTMLComments()) { %><!-- BEGIN PAGE CONTENT --><% } %>
<% basedat.renderContent(application,out,rdat); %>
<% if (rdat.useHTMLComments()) { %><!-- END PAGE CONTENT --><% } %>
</TD>
</TR>
<TR VALIGN=TOP>
<TD ALIGN=LEFT WIDTH=120 BGCOLOR="#9999FF">&nbsp;</TD>
<TD ALIGN=LEFT WIDTH="100%" BGCOLOR="white">
<% if (rdat.useHTMLComments()) { %><!-- PAGE FOOTER --><% } %>
<HR WIDTH="80%">
<TABLE ALIGN=CENTER BORDER=0 CELLPADDING=0 CELLSPACING=6><TR VALIGN=TOP>
<TD ALIGN=RIGHT><%= rdat.getStdFontTag(null,1) %>
<%= rdat.getStockMessage("footer-text") %>
</FONT></TD>
<TD ALIGN=LEFT>
<A HREF="http://venice.sourceforge.net" TARGET="_blank"><IMG
SRC="<%= rdat.getFullImagePath("powered-by-venice.gif") %>" ALT="Powered by Venice"
WIDTH=140 HEIGHT=80 BORDER=0 HSPACE=0 VSPACE=0></A>
</TD>
</TR></TABLE>
</TD>
</TR>
</TABLE>
</TD></TR>
</TABLE>
<% if (rdat.useHTMLComments()) { %><!-- END PAGE HEADER --><% } %>
<TABLE BORDER=0 WIDTH="100%" CELLPADDING=2 CELLSPACING=0>
<TR VALIGN=TOP>
<TD ALIGN=LEFT WIDTH=120 BGCOLOR="#9999FF">
<TABLE ALIGN=LEFT WIDTH=120 CELPADDING=0 CELLSPACING=0>
<% if (rdat.useHTMLComments()) { %><!-- BEGIN LEFT SIDEBAR --><% } %>
<TR VALIGN=TOP><TD VALIGN=LEFT><%= stdfont %>
<% if (rdat.useHTMLComments()) { %><!-- variable menu --><% } %>
<% basedat.renderMenu(session,out,rdat); %>
</FONT></TD></TR>
<TR VALIGN=TOP><TD VALIGN=LEFT>&nbsp;</TD></TR>
<TR VALIGN=TOP><TD VALIGN=LEFT><%= stdfont %>
<% if (rdat.useHTMLComments()) { %><!-- fixed menu --><% } %>
<% basedat.renderFixedMenu(out,rdat); %>
</FONT></TD></TR>
<% if (rdat.useHTMLComments()) { %><!-- END LEFT SIDEBAR --><% } %>
</TABLE>
</TD>
<TD ALIGN=LEFT WIDTH="100%" BGCOLOR="white">
<% if (rdat.useHTMLComments()) { %><!-- BEGIN PAGE CONTENT --><% } %>
<% basedat.renderContent(application,out,rdat); %>
<% if (rdat.useHTMLComments()) { %><!-- END PAGE CONTENT --><% } %>
</TD>
</TR>
<TR VALIGN=TOP>
<TD ALIGN=LEFT WIDTH=120 BGCOLOR="#9999FF">&nbsp;</TD>
<TD ALIGN=LEFT WIDTH="100%" BGCOLOR="white">
<% if (rdat.useHTMLComments()) { %><!-- PAGE FOOTER --><% } %>
<HR WIDTH="80%">
<TABLE ALIGN=CENTER BORDER=0 CELLPADDING=0 CELLSPACING=6><TR VALIGN=TOP>
<TD ALIGN=RIGHT><%= smallfont %><%= rdat.getStockMessage("footer-text") %></FONT></TD>
<TD ALIGN=LEFT>
<A HREF="http://venice.sourceforge.net" TARGET="_blank"><IMG
SRC="<%= rdat.getFullImagePath("powered-by-venice.gif") %>" ALT="Powered by Venice"
WIDTH=140 HEIGHT=80 BORDER=0 HSPACE=0 VSPACE=0></A>
</TD>
</TR></TABLE>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>