fixed bugs in post nuke, base.jsp display (simplified it), and global
audit record display
This commit is contained in:
		
							parent
							
								
									63fedc9db6
								
							
						
					
					
						commit
						7e226040d4
					
				@ -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
 | 
			
		||||
 | 
			
		||||
@ -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;
 | 
			
		||||
 | 
			
		||||
@ -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
 | 
			
		||||
 | 
			
		||||
@ -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)
 | 
			
		||||
 | 
			
		||||
@ -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,20 +38,19 @@
 | 
			
		||||
</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>
 | 
			
		||||
  <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>
 | 
			
		||||
      <TD ALIGN=LEFT WIDTH=150><%= header_font %><B>
 | 
			
		||||
        <% if (rdat.useHTMLComments()) { %><!-- Links to Front Page, Help, Find --><% } %>
 | 
			
		||||
	  <A HREF="<%= rdat.getEncodedServletPath("top") %>">Front Page</A><P>
 | 
			
		||||
	  <A HREF="/TODO">Help</A> | 
 | 
			
		||||
	  <A HREF="<%= rdat.getEncodedServletPath("find") %>">Find</A>
 | 
			
		||||
	<A HREF="<%= rdat.getEncodedServletPath("top") %>"><FONT COLOR="yellow">Front Page</FONT></A><P>
 | 
			
		||||
	<A HREF="/TODO"><FONT COLOR="yellow">Help</FONT></A> | 
 | 
			
		||||
	<A HREF="<%= rdat.getEncodedServletPath("find") %>"><FONT COLOR="yellow">Find</FONT></A>
 | 
			
		||||
      </B></FONT></TD>
 | 
			
		||||
 | 
			
		||||
      <TD ALIGN=RIGHT WIDTH=150>
 | 
			
		||||
@ -57,45 +60,50 @@
 | 
			
		||||
	 WIDTH=468 HEIGHT=60 HSPACE=2 VSPACE=2>
 | 
			
		||||
	<%-- END TEMP - Banner Ad Code --%>
 | 
			
		||||
      </TD>
 | 
			
		||||
      </TR></TABLE>
 | 
			
		||||
    </TD></TR>
 | 
			
		||||
    </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="; %>
 | 
			
		||||
           - <A HREF="<%= rdat.getEncodedServletPath(partial_tgt + "L") %>">Log Out</A>
 | 
			
		||||
           | <A HREF="<%= rdat.getEncodedServletPath(partial_tgt + "P") %>">Profile</A>
 | 
			
		||||
          <%
 | 
			
		||||
            partial_tgt = "account?tgt=" + URLEncoder.encode(basedat.getLocation()) + "&cmd=";
 | 
			
		||||
            foo = rdat.getEncodedServletPath(partial_tgt + "L");
 | 
			
		||||
          %>
 | 
			
		||||
           - <A HREF="<%= foo %>"><FONT COLOR="yellow">Log Out</FONT></A>
 | 
			
		||||
          <% foo = rdat.getEncodedServletPath(partial_tgt + "P"); %>
 | 
			
		||||
           | <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="; %>
 | 
			
		||||
           - <A HREF="<%= rdat.getEncodedServletPath(partial_tgt + "L") %>">Log In</A>
 | 
			
		||||
           | <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");
 | 
			
		||||
          %>
 | 
			
		||||
           - <A HREF="<%= foo %>"><FONT COLOR="yellow">Log In</FONT></A>
 | 
			
		||||
          <% foo = rdat.getEncodedServletPath(partial_tgt + "C"); %>
 | 
			
		||||
           | <A HREF="<%= foo %>"><FONT COLOR="yellow">Create Account</FONT></A>
 | 
			
		||||
        <% } // end if %>
 | 
			
		||||
      <% } // end if %>
 | 
			
		||||
      </FONT>
 | 
			
		||||
    </TR></TD>
 | 
			
		||||
    </FONT></TD></TR>
 | 
			
		||||
 | 
			
		||||
  </TABLE>
 | 
			
		||||
  <% if (rdat.useHTMLComments()) { %><!-- END PAGE HEADER --><% } %>
 | 
			
		||||
 | 
			
		||||
    <TR VALIGN=TOP><TD ALIGN=CENTER>
 | 
			
		||||
      <TABLE ALIGN=CENTER WIDTH="100%" BORDER=0 CELLPADDING=2 CELLSPACING=0>
 | 
			
		||||
  <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><%= rdat.getStdFontTag(null,2) %>
 | 
			
		||||
	  <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> </TD></TR>
 | 
			
		||||
              <TR VALIGN=TOP><TD VALIGN=LEFT><%= rdat.getStdFontTag(null,2) %>
 | 
			
		||||
          <TR VALIGN=TOP><TD VALIGN=LEFT><%= stdfont %>
 | 
			
		||||
	    <% if (rdat.useHTMLComments()) { %><!-- fixed menu --><% } %>
 | 
			
		||||
	    <% basedat.renderFixedMenu(out,rdat); %>
 | 
			
		||||
          </FONT></TD></TR>
 | 
			
		||||
@ -111,15 +119,14 @@
 | 
			
		||||
  	<% if (rdat.useHTMLComments()) { %><!-- END PAGE CONTENT --><% } %>
 | 
			
		||||
      </TD>
 | 
			
		||||
    </TR>
 | 
			
		||||
 | 
			
		||||
    <TR VALIGN=TOP>
 | 
			
		||||
      <TD ALIGN=LEFT WIDTH=120 BGCOLOR="#9999FF"> </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=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"
 | 
			
		||||
@ -128,8 +135,8 @@
 | 
			
		||||
        </TR></TABLE> 
 | 
			
		||||
      </TD>
 | 
			
		||||
    </TR>
 | 
			
		||||
 | 
			
		||||
  </TABLE>
 | 
			
		||||
    </TD></TR>
 | 
			
		||||
  </TABLE>
 | 
			
		||||
 | 
			
		||||
</BODY>
 | 
			
		||||
</HTML>
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user