From f19aab70fe8f42683241ea13a6ad290870e812e5 Mon Sep 17 00:00:00 2001 From: "Eric J. Bowersox" Date: Thu, 5 Apr 2001 05:12:20 +0000 Subject: [PATCH] First round of bugfixes after the opening of the public beta! - New words in the dictionary - Bugs fixed in HTML Checker tag stack which rejected and
  • and had a potential infinite loop - Multipart handling now handles Windows-uploaded filenames correctly - Bug fixed in PostOperations that was causing nuke to fail and scribble and hide to succeed but throw an internal servlet error - Enhanced conference listing now gives a better activity report in conferences - Top Content font enlarged - Null posts now work (they used to in WebbMe) - Slippage display corrected - Probably a couple of other things I can't think of just now. --- etc/erbo.dict | 19 ++ etc/logging-config.xml | 14 +- .../util/ServletMultipartHandler.java | 39 ++- .../htmlcheck/impl/HTMLCheckerConfigImpl.java | 3 +- .../htmlcheck/impl/HTMLCheckerImpl.java | 108 +++++-- .../venice/htmlcheck/impl/SimpleTag.java | 23 +- .../venice/htmlcheck/impl/TagRepository.java | 281 +++++++++--------- .../venice/servlets/Attachment.java | 2 + .../venice/servlets/PostMessage.java | 19 +- .../venice/servlets/PostOperations.java | 2 +- .../servlets/format/ConferenceListing.java | 6 + .../venice/servlets/format/RenderData.java | 29 +- web/format/conferences.jsp | 6 +- web/format/slippage.jsp | 2 +- web/format/top_content.jsp | 6 +- 15 files changed, 375 insertions(+), 184 deletions(-) diff --git a/etc/erbo.dict b/etc/erbo.dict index 7e5a055..98d706a 100644 --- a/etc/erbo.dict +++ b/etc/erbo.dict @@ -1,3 +1,5 @@ + +acmecity advogato ain't anime @@ -8,10 +10,12 @@ boitano boromax can't cartman +cdt checkouts couldn't crewmember crewmembers +cst deflector deflectors delenn @@ -20,10 +24,13 @@ dilithium docking doesn't don't +edt eminds entil'zha eps erbo +est +faux fett followup franklin @@ -47,19 +54,27 @@ lafou ma'am maddog marillion +mdt minbar minbari +mp mr +mst mustn't nacelle nacelles navigational ops padd +paperclip +pdt peachy +pic planitia planum +privs psi +pst refit refitting replicator @@ -70,9 +85,12 @@ runabout salchow salchows sarcastically +shouldn't silverwrist snarf snarfage +snarfer +snarfing snazzy sourceforge spaceport @@ -92,6 +110,7 @@ turbolift tuzanor umbilical umbilicals +unread url utne valen diff --git a/etc/logging-config.xml b/etc/logging-config.xml index 73e3080..7fe8a20 100644 --- a/etc/logging-config.xml +++ b/etc/logging-config.xml @@ -9,7 +9,7 @@ WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. - The Original Code is the Venice Web Community System. + The Original Code is the Venice Web Communities System. The Initial Developer of the Original Code is Eric J. Bowersox , for Silverwrist Design Studios. Portions created by Eric J. Bowersox are @@ -34,4 +34,16 @@ + + + + + + + + + + + + diff --git a/src/com/silverwrist/util/ServletMultipartHandler.java b/src/com/silverwrist/util/ServletMultipartHandler.java index 24fdb17..3fdb7f5 100644 --- a/src/com/silverwrist/util/ServletMultipartHandler.java +++ b/src/com/silverwrist/util/ServletMultipartHandler.java @@ -172,12 +172,49 @@ public class ServletMultipartHandler // Parse the Content-Disposition header. String[] cdstr = part.getHeader("Content-Disposition"); + if (logger.isDebugEnabled()) + logger.debug("Content-Disposition is " + cdstr[0]); ContentDisposition cdisp = new ContentDisposition(cdstr[0]); name = cdisp.getParameter("name"); filename = cdisp.getParameter("filename"); if (filename!=null) - { // Strip off everything but the base filename, if the browser happened to pass that. + { // EJB 4/4/2001 - Windows boxes pass the filename complete with the backslashed pathname on the + // front, and, for some reason, ContentDisposition strips out the backslashes while leaving the + // pathname components in place (including the drive letter!). So we have to go to manual here + // to extract the filename ourselves. + int pos = cdstr[0].indexOf("filename"); + pos += 8; + while ((cdstr[0].charAt(pos)==' ') || (cdstr[0].charAt(pos)=='\t')) + pos++; + if (cdstr[0].charAt(pos)!='=') + throw new RuntimeException("must have = sign after filename"); + pos++; + while ((cdstr[0].charAt(pos)==' ') || (cdstr[0].charAt(pos)=='\t')) + pos++; + if ((cdstr[0].charAt(pos)=='\'') || (cdstr[0].charAt(pos)=='"')) + { // filename enclosed in quotes... + char match = cdstr[0].charAt(pos++); + filename = cdstr[0].substring(pos); + pos = filename.lastIndexOf(match); + if (pos<0) + throw new RuntimeException("must have closing quote"); + filename = filename.substring(0,pos); + + } // end if + else + { // no quotes, just take the rest of the line + filename = cdstr[0].substring(pos); + pos = filename.lastIndexOf(';'); + if (pos>=0) + filename = filename.substring(0,pos); + + } // end else + + if (logger.isDebugEnabled()) + logger.debug("Raw filename: " + filename); + + // Strip off everything but the base filename, if the browser happened to pass that. int sep = filename.lastIndexOf('\\'); if (sep>=0) filename = filename.substring(sep+1); diff --git a/src/com/silverwrist/venice/htmlcheck/impl/HTMLCheckerConfigImpl.java b/src/com/silverwrist/venice/htmlcheck/impl/HTMLCheckerConfigImpl.java index 8bf083e..3a1c51d 100644 --- a/src/com/silverwrist/venice/htmlcheck/impl/HTMLCheckerConfigImpl.java +++ b/src/com/silverwrist/venice/htmlcheck/impl/HTMLCheckerConfigImpl.java @@ -7,7 +7,7 @@ * WARRANTY OF ANY KIND, either express or implied. See the License for the specific * language governing rights and limitations under the License. * - * The Original Code is the Venice Web Community System. + * The Original Code is the Venice Web Communities System. * * The Initial Developer of the Original Code is Eric J. Bowersox , * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are @@ -54,7 +54,6 @@ public class HTMLCheckerConfigImpl implements HTMLCheckerConfig HTMLCheckerConfigImpl() { - TagRepository.init(); TagRepository.configureNormalSet(allowed_tagsets); } // end constructor diff --git a/src/com/silverwrist/venice/htmlcheck/impl/HTMLCheckerImpl.java b/src/com/silverwrist/venice/htmlcheck/impl/HTMLCheckerImpl.java index 3a667ec..1dd4a33 100644 --- a/src/com/silverwrist/venice/htmlcheck/impl/HTMLCheckerImpl.java +++ b/src/com/silverwrist/venice/htmlcheck/impl/HTMLCheckerImpl.java @@ -18,6 +18,7 @@ package com.silverwrist.venice.htmlcheck.impl; import java.util.*; +import org.apache.log4j.*; import com.silverwrist.venice.htmlcheck.*; class HTMLCheckerImpl implements HTMLChecker, HTMLCheckerBackend, RewriterServices @@ -86,6 +87,13 @@ class HTMLCheckerImpl implements HTMLChecker, HTMLCheckerBackend, RewriterServic private static final int MARGIN_SLOP = 5; + /*-------------------------------------------------------------------------------- + * Static data members + *-------------------------------------------------------------------------------- + */ + + private static Category logger = Category.getInstance(HTMLCheckerImpl.class); + /*-------------------------------------------------------------------------------- * Attributes *-------------------------------------------------------------------------------- @@ -103,13 +111,13 @@ class HTMLCheckerImpl implements HTMLChecker, HTMLCheckerBackend, RewriterServic private boolean trigger_WBR = false; // word break trigger private StringBuffer output_buffer = null; // output buffer for characters private StringBuffer temp_buffer = null; // temporary buffer used within one state - private Vector tag_stack = null; // stack of tags that have been opened - private Hashtable counters = new Hashtable(); // the CountingRewriter instances - private Vector string_rewriters = new Vector(); // string rewriter instances - private Vector word_rewriters = new Vector(); // word rewriter instances - private Vector tag_rewriters = new Vector(); // tag rewriter instances - private Vector paren_rewriters = new Vector(); // paren rewriter instances - private Hashtable context_data = new Hashtable(); // context variables + private ArrayList tag_stack = null; // stack of tags that have been opened + private HashMap counters = new HashMap(); // the CountingRewriter instances + private ArrayList string_rewriters = new ArrayList(); // string rewriter instances + private ArrayList word_rewriters = new ArrayList(); // word rewriter instances + private ArrayList tag_rewriters = new ArrayList(); // tag rewriter instances + private ArrayList paren_rewriters = new ArrayList(); // paren rewriter instances + private HashMap context_data = new HashMap(); // context variables /*-------------------------------------------------------------------------------- * Constructor @@ -118,7 +126,6 @@ class HTMLCheckerImpl implements HTMLChecker, HTMLCheckerBackend, RewriterServic HTMLCheckerImpl(HTMLCheckerConfigImpl config) { - TagRepository.init(); this.config = config; copyRewriters(string_rewriters,config.getStringRewriters()); copyRewriters(word_rewriters,config.getWordRewriters()); @@ -160,7 +167,7 @@ class HTMLCheckerImpl implements HTMLChecker, HTMLCheckerBackend, RewriterServic } // end getRunLength - private void copyRewriters(Vector dest, List source) + private void copyRewriters(ArrayList dest, List source) { Iterator it = source.iterator(); while (it.hasNext()) @@ -202,7 +209,7 @@ class HTMLCheckerImpl implements HTMLChecker, HTMLCheckerBackend, RewriterServic { output_buffer = new StringBuffer(1024); temp_buffer = new StringBuffer(64); - tag_stack = new Vector(); + tag_stack = new ArrayList(); } // end initState @@ -210,7 +217,7 @@ class HTMLCheckerImpl implements HTMLChecker, HTMLCheckerBackend, RewriterServic { temp_buffer = null; if (tag_stack!=null) - tag_stack.removeAllElements(); + tag_stack.clear(); tag_stack = null; } // end killState @@ -520,6 +527,8 @@ class HTMLCheckerImpl implements HTMLChecker, HTMLCheckerBackend, RewriterServic private boolean handleAsHTML() { + if (logger.isDebugEnabled()) + logger.debug("handleAsHTML(): candidate buffer = [" + temp_buffer.toString() + "]"); trigger_WBR = false; // initialize // Figure out the place in the buffer where the command word starts. @@ -527,6 +536,8 @@ class HTMLCheckerImpl implements HTMLChecker, HTMLCheckerBackend, RewriterServic boolean closing_tag = false; if ((start_cmdTagRepository.getMaxTagLength())) - return false; // the command word is empty or is just too long to be an HTML tag + { // the command word is empty or is just too long to be an HTML tag + if (logger.isDebugEnabled()) + logger.debug("HTML tag rejected due to length (" + String.valueOf(end_cmd-start_cmd) + ")"); + return false; + + } // end if // Look up the tag name to get a tag index from the repository. - int tag_index = TagRepository.tagNameToIndex(temp_buffer.substring(start_cmd,end_cmd)); + String poss_tag_name = temp_buffer.substring(start_cmd,end_cmd); + int tag_index = TagRepository.tagNameToIndex(poss_tag_name); if (tag_index<0) - return false; // not a known HTML tag + { // not a known HTML tag + if (logger.isDebugEnabled()) + logger.debug("<" + poss_tag_name + "> is not valid HTML"); + return false; + + } // end if // Look up the tag object that corresponds to the tag index. SimpleTag tagobj = TagRepository.tagIndexToObject(tag_index); if (closing_tag && !(tagobj.allowClose())) - return false; // this is a closing tag, and this tag doesn't permit the "close" form + { // this is a closing tag, and this tag doesn't permit the "close" form + if (logger.isDebugEnabled()) + logger.debug(" is not a permitted tag form (no close)"); + return false; + + } // end if // Get the HTML tag set index for this tag, and see if we allow that set. int tag_set_id = TagRepository.tagIndexToSet(tag_index); if (!(config.isTagSetAllowed(tag_set_id)) && !(config.getDiscardHTMLTags())) - return false; // we're not allowing it, we're not discarding it, so punt! + { // we're not allowing it, we're not discarding it, so punt! + if (logger.isDebugEnabled()) + logger.debug("<" + poss_tag_name + "> is not allowed in this context"); + return false; + + } // end if - boolean valid = false; if (!(config.getDiscardHTMLTags()) && tagobj.balanceTags()) { // this tag needs to be balanced - here is where we manipulate the stack + boolean valid = false; + if (closing_tag) { // hunt through the list to find the most recently-opened tag of this type - int i = tag_stack.size() - 1; - while (i>=0) + int i = tag_stack.size(); + while ((--i)>=0) { // look through the stack... Integer foo = (Integer)(tag_stack.get(i)); if (foo.intValue()==tag_index) { // found it - remove it from the tag stack + if (logger.isDebugEnabled()) + logger.debug("balanced closure of <" + poss_tag_name + ">"); tag_stack.remove(i); valid = true; break; @@ -577,21 +612,36 @@ class HTMLCheckerImpl implements HTMLChecker, HTMLCheckerBackend, RewriterServic } // end if else { // push a new opening tag! + if (logger.isDebugEnabled()) + logger.debug("open form of <" + poss_tag_name + ">"); tag_stack.add(new Integer(tag_index)); valid = true; } // end else + if (!valid) + { // not validated by the stack code + if (logger.isDebugEnabled()) + logger.debug("stack checking code rejects <" + poss_tag_name + ">"); + return false; + + } // end if + } // end if // else tag doesn't need to be auto-balanced, or is being discarded - - if (!valid && !(config.getDiscardHTMLTags())) - return false; // not validated by the stack code, and not being discarded - + // Give the tag object one last chance to dictate what we do with the tag. String real_tag_data = tagobj.rewriteTagContents(temp_buffer.toString(),closing_tag,this); if ((real_tag_data==null) || config.getDiscardHTMLTags()) - return true; // tag is being erased by rewriter, or is being discarded anyway + { // tag is being erased by rewriter, or is being discarded anyway + if (logger.isDebugEnabled()) + logger.debug("rewriter erasure or discard of <" + poss_tag_name + ">"); + return true; + + } // end if + + if (logger.isDebugEnabled()) + logger.debug("real tag data = [" + real_tag_data + "]"); // Emit the tag to the output. emitChar('<',config.getRawOutputFilters(),false); @@ -601,12 +651,22 @@ class HTMLCheckerImpl implements HTMLChecker, HTMLCheckerBackend, RewriterServic // Determine whether this tag causes a "logical line break." boolean logical_line_break = false; if (trigger_WBR && !closing_tag && (nobreak_count>0)) + { // a word break is a logical line break (but only if within ...) + if (logger.isDebugEnabled()) + logger.debug("<" + poss_tag_name + "> WORD BREAKS"); logical_line_break = true; + + } // end if else logical_line_break = tagobj.causeLineBreak(closing_tag); if (logical_line_break) + { // logical line break is triggered + if (logger.isDebugEnabled()) + logger.debug("<" + poss_tag_name + "> triggers logical line break"); columns = 0; + } // end if + return true; // handled! } // end handleAsHTML() diff --git a/src/com/silverwrist/venice/htmlcheck/impl/SimpleTag.java b/src/com/silverwrist/venice/htmlcheck/impl/SimpleTag.java index b65cc28..ba7d5df 100644 --- a/src/com/silverwrist/venice/htmlcheck/impl/SimpleTag.java +++ b/src/com/silverwrist/venice/htmlcheck/impl/SimpleTag.java @@ -7,7 +7,7 @@ * WARRANTY OF ANY KIND, either express or implied. See the License for the specific * language governing rights and limitations under the License. * - * The Original Code is the Venice Web Community System. + * The Original Code is the Venice Web Communities System. * * The Initial Developer of the Original Code is Eric J. Bowersox , * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are @@ -100,4 +100,25 @@ class SimpleTag } // end rewriteTagContents + /*-------------------------------------------------------------------------------- + * Overrides from class Object + *-------------------------------------------------------------------------------- + */ + + public boolean equals(Object obj) + { + if (!(obj instanceof SimpleTag)) + return false; + SimpleTag other = (SimpleTag)obj; + return tagname.equals(other.tagname); + + } // end equals + + public int hashCode() + { + return tagname.hashCode(); + + } // end hashCode + } // end class SimpleTag + diff --git a/src/com/silverwrist/venice/htmlcheck/impl/TagRepository.java b/src/com/silverwrist/venice/htmlcheck/impl/TagRepository.java index dd40ad2..3497345 100644 --- a/src/com/silverwrist/venice/htmlcheck/impl/TagRepository.java +++ b/src/com/silverwrist/venice/htmlcheck/impl/TagRepository.java @@ -7,7 +7,7 @@ * WARRANTY OF ANY KIND, either express or implied. See the License for the specific * language governing rights and limitations under the License. * - * The Original Code is the Venice Web Community System. + * The Original Code is the Venice Web Communities System. * * The Initial Developer of the Original Code is Eric J. Bowersox , * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are @@ -23,15 +23,23 @@ import com.silverwrist.venice.htmlcheck.HTMLTagSets; class TagRepository implements HTMLTagSets { /*-------------------------------------------------------------------------------- - * Attributes + * Static data members *-------------------------------------------------------------------------------- */ - private static Hashtable tagname_to_index = new Hashtable(50,0.9F); - private static Vector index_to_object = new Vector(); - private static Vector index_to_setid = new Vector(); + private static HashMap tagname_to_index = new HashMap(50,0.9F); + private static ArrayList index_to_object = new ArrayList(); + private static ArrayList index_to_setid = new ArrayList(); private static int maxlength = 0; - private static boolean initialized = false; + + /*-------------------------------------------------------------------------------- + * Constructor + *-------------------------------------------------------------------------------- + */ + + private TagRepository() + { // do nothing + } // end constructor /*-------------------------------------------------------------------------------- * Internal functions @@ -44,7 +52,7 @@ class TagRepository implements HTMLTagSets index_to_object.add(tag); index_to_setid.add(new Integer(set)); tag.setIndex(ndx); - tagname_to_index.put(new String(tag.getTagName()),new Integer(ndx)); + tagname_to_index.put(tag.getTagName(),new Integer(ndx)); int newlen = tag.getTagName().length(); if (newlen>maxlength) maxlength = newlen; @@ -56,136 +64,6 @@ class TagRepository implements HTMLTagSets *-------------------------------------------------------------------------------- */ - public static void init() - { - if (!initialized) - { // set the flag so we don't do this again - initialized = true; - - // begin enshrining the tags! - enshrineTag(new SimpleTag("!DOCTYPE",false),DOC_FORMAT); - enshrineTag(new SimpleTag("%",false),SERVER_PAGE); - enshrineTag(new SimpleTag("%=",false),SERVER_PAGE); - enshrineTag(new SimpleTag("%@",false),SERVER_PAGE); - enshrineTag(new TagA(),ANCHOR); - enshrineTag(new BalancedTag("ABBR",false),INLINE_FORMAT); - enshrineTag(new BalancedTag("ACRONYM",false),INLINE_FORMAT); - enshrineTag(new BalancedTag("ADDRESS",true),BLOCK_FORMAT); - enshrineTag(new BalancedTag("APPLET",false),ACTIVE_CONTENT); - enshrineTag(new SimpleTag("AREA",false),IMAGE_MAPS); - enshrineTag(new BalancedTag("B",false),INLINE_FORMAT); - enshrineTag(new SimpleTag("BASE",false),DOC_FORMAT); - enshrineTag(new SimpleTag("BASEFONT",false),DOC_FORMAT); - enshrineTag(new BalancedTag("BDO",false),INLINE_FORMAT); - enshrineTag(new BalancedTag("BEAN",false),JAVA_SERVER); - enshrineTag(new SimpleTag("BGSOUND",false),MSFT_DOC_FORMAT); - enshrineTag(new BalancedTag("BIG",false),INLINE_FORMAT); - enshrineTag(new BalancedTag("BLINK",false),NSCP_INLINE_FORMAT); - enshrineTag(new BalancedTag("BLOCKQUOTE",true),BLOCK_FORMAT); - enshrineTag(new OpenCloseTag("BODY",false),DOC_FORMAT); - enshrineTag(new SimpleTag("BR",true),BLOCK_FORMAT); - enshrineTag(new OpenCloseTag("BUTTON",false),FORMS); - enshrineTag(new BalancedTag("CAPTION",true),TABLES); - enshrineTag(new BalancedTag("CENTER",true),BLOCK_FORMAT); - enshrineTag(new BalancedTag("CITE",false),INLINE_FORMAT); - enshrineTag(new BalancedTag("CODE",false),INLINE_FORMAT); - enshrineTag(new SimpleTag("COL",true),TABLES); - enshrineTag(new OpenCloseTag("COLGROUP",true),TABLES); - enshrineTag(new BalancedTag("COMMENT",false),MSFT_INLINE_FORMAT); - enshrineTag(new ListElementTag("DD"),BLOCK_FORMAT); - enshrineTag(new BalancedTag("DEL",false),CHANGE_MARKUP); - enshrineTag(new BalancedTag("DFN",false),INLINE_FORMAT); - enshrineTag(new BalancedTag("DIR",true),BLOCK_FORMAT); - enshrineTag(new BalancedTag("DIV",true),BLOCK_FORMAT); - enshrineTag(new BalancedTag("DL",true),BLOCK_FORMAT); - enshrineTag(new ListElementTag("DT"),BLOCK_FORMAT); - enshrineTag(new BalancedTag("EM",false),INLINE_FORMAT); - enshrineTag(new SimpleTag("EMBED",false),ACTIVE_CONTENT); - enshrineTag(new BalancedTag("FIELDSET",false),FORMS); - enshrineTag(new BalancedTag("FONT",false),FONT_FORMAT); - enshrineTag(new BalancedTag("FORM",false),FORMS); - enshrineTag(new SimpleTag("FRAME",true),FRAMES); - enshrineTag(new BalancedTag("FRAMESET",false),FRAMES); - enshrineTag(new BalancedTag("H1",true),FONT_FORMAT); - enshrineTag(new BalancedTag("H2",true),FONT_FORMAT); - enshrineTag(new BalancedTag("H3",true),FONT_FORMAT); - enshrineTag(new BalancedTag("H4",true),FONT_FORMAT); - enshrineTag(new BalancedTag("H5",true),FONT_FORMAT); - enshrineTag(new BalancedTag("H6",true),FONT_FORMAT); - enshrineTag(new OpenCloseTag("HEAD",false),DOC_FORMAT); - enshrineTag(new SimpleTag("HR",true),BLOCK_FORMAT); - enshrineTag(new OpenCloseTag("HTML",false),DOC_FORMAT); - enshrineTag(new BalancedTag("I",false),INLINE_FORMAT); - enshrineTag(new BalancedTag("IFRAME",true),FRAMES); - enshrineTag(new BalancedTag("ILAYER",true),NSCP_LAYERS); - enshrineTag(new SimpleTag("IMG",false),IMAGES); - enshrineTag(new SimpleTag("INPUT",false),FORMS); - enshrineTag(new BalancedTag("INS",false),CHANGE_MARKUP); - enshrineTag(new SimpleTag("ISINDEX",false),FORMS); - enshrineTag(new BalancedTag("KBD",false),INLINE_FORMAT); - enshrineTag(new SimpleTag("KEYGEN",false),NSCP_FORMS); - enshrineTag(new BalancedTag("LABEL",false),FORMS); - enshrineTag(new BalancedTag("LAYER",true),NSCP_LAYERS); - enshrineTag(new BalancedTag("LEGEND",false),FORMS); - enshrineTag(new ListElementTag("LI"),BLOCK_FORMAT); - enshrineTag(new SimpleTag("LINK",false),DOC_FORMAT); - enshrineTag(new BalancedTag("LISTING",false),MSFT_INLINE_FORMAT); - enshrineTag(new BalancedTag("MAP",false),IMAGE_MAPS); - enshrineTag(new BalancedTag("MARQUEE",true),MSFT_BLOCK_FORMAT); - enshrineTag(new BalancedTag("MENU",true),BLOCK_FORMAT); - enshrineTag(new SimpleTag("META",false),DOC_FORMAT); - enshrineTag(new BalancedTag("MULTICOL",true),NSCP_BLOCK_FORMAT); - enshrineTag(new TagNOBR(),BLOCK_FORMAT); - enshrineTag(new BalancedTag("NOEMBED",false),ACTIVE_CONTENT); - enshrineTag(new BalancedTag("NOFRAMES",false),FRAMES); - enshrineTag(new BalancedTag("NOLAYER",false),NSCP_LAYERS); - enshrineTag(new BalancedTag("NOSCRIPT",false),ACTIVE_CONTENT); - enshrineTag(new BalancedTag("OBJECT",false),ACTIVE_CONTENT); - enshrineTag(new BalancedTag("OL",true),BLOCK_FORMAT); - enshrineTag(new BalancedTag("OPTGROUP",false),FORMS); - enshrineTag(new ListElementTag("OPTION"),FORMS); - enshrineTag(new OpenCloseTag("P",true),BLOCK_FORMAT); - enshrineTag(new SimpleTag("PARAM",false),ACTIVE_CONTENT); - enshrineTag(new SimpleTag("PLAINTEXT",false),PREFORMAT); - enshrineTag(new BalancedTag("PRE",false),PREFORMAT); - enshrineTag(new BalancedTag("Q",false),INLINE_FORMAT); - enshrineTag(new SimpleTag("RT",false),MSFT_ACTIVE_CONTENT); - enshrineTag(new BalancedTag("RUBY",false),MSFT_ACTIVE_CONTENT); - enshrineTag(new BalancedTag("S",false),INLINE_FORMAT); - enshrineTag(new BalancedTag("SAMP",false),INLINE_FORMAT); - enshrineTag(new BalancedTag("SCRIPT",false),ACTIVE_CONTENT); - enshrineTag(new BalancedTag("SELECT",false),FORMS); - enshrineTag(new BalancedTag("SERVER",false),NSCP_SERVER); - enshrineTag(new BalancedTag("SERVLET",false),JAVA_SERVER); - enshrineTag(new BalancedTag("SMALL",false),INLINE_FORMAT); - enshrineTag(new SimpleTag("SPACER",false),NSCP_INLINE_FORMAT); - enshrineTag(new BalancedTag("SPAN",false),INLINE_FORMAT); - enshrineTag(new BalancedTag("STRIKE",false),INLINE_FORMAT); - enshrineTag(new BalancedTag("STRONG",false),INLINE_FORMAT); - enshrineTag(new BalancedTag("STYLE",false),DOC_FORMAT); - enshrineTag(new BalancedTag("SUB",false),INLINE_FORMAT); - enshrineTag(new BalancedTag("SUP",false),INLINE_FORMAT); - enshrineTag(new BalancedTag("TABLE",true),TABLES); - enshrineTag(new OpenCloseTag("TBODY",false),TABLES); - enshrineTag(new BalancedTag("TD",true),TABLES); - enshrineTag(new BalancedTag("TEXTAREA",true),FORMS); - enshrineTag(new OpenCloseTag("TFOOT",false),TABLES); - enshrineTag(new BalancedTag("TH",true),TABLES); - enshrineTag(new OpenCloseTag("THEAD",false),TABLES); - enshrineTag(new BalancedTag("TITLE",false),DOC_FORMAT); - enshrineTag(new BalancedTag("TR",true),TABLES); - enshrineTag(new BalancedTag("TT",false),INLINE_FORMAT); - enshrineTag(new BalancedTag("U",false),INLINE_FORMAT); - enshrineTag(new BalancedTag("UL",true),BLOCK_FORMAT); - enshrineTag(new BalancedTag("VAR",false),INLINE_FORMAT); - enshrineTag(new TagWBR(),BLOCK_FORMAT); - enshrineTag(new BalancedTag("XML",false),MSFT_ACTIVE_CONTENT); - enshrineTag(new BalancedTag("XMP",false),NSCP_INLINE_FORMAT); - - } // end if - - } // end init - public static int getMaxTagLength() { return maxlength; @@ -240,4 +118,133 @@ class TagRepository implements HTMLTagSets } // end configureRestrictedSet + /*-------------------------------------------------------------------------------- + * Static initializer + *-------------------------------------------------------------------------------- + */ + + static + { + // begin enshrining the tags! + enshrineTag(new SimpleTag("!DOCTYPE",false),DOC_FORMAT); + enshrineTag(new SimpleTag("%",false),SERVER_PAGE); + enshrineTag(new SimpleTag("%=",false),SERVER_PAGE); + enshrineTag(new SimpleTag("%@",false),SERVER_PAGE); + enshrineTag(new TagA(),ANCHOR); + enshrineTag(new BalancedTag("ABBR",false),INLINE_FORMAT); + enshrineTag(new BalancedTag("ACRONYM",false),INLINE_FORMAT); + enshrineTag(new BalancedTag("ADDRESS",true),BLOCK_FORMAT); + enshrineTag(new BalancedTag("APPLET",false),ACTIVE_CONTENT); + enshrineTag(new SimpleTag("AREA",false),IMAGE_MAPS); + enshrineTag(new BalancedTag("B",false),INLINE_FORMAT); + enshrineTag(new SimpleTag("BASE",false),DOC_FORMAT); + enshrineTag(new SimpleTag("BASEFONT",false),DOC_FORMAT); + enshrineTag(new BalancedTag("BDO",false),INLINE_FORMAT); + enshrineTag(new BalancedTag("BEAN",false),JAVA_SERVER); + enshrineTag(new SimpleTag("BGSOUND",false),MSFT_DOC_FORMAT); + enshrineTag(new BalancedTag("BIG",false),INLINE_FORMAT); + enshrineTag(new BalancedTag("BLINK",false),NSCP_INLINE_FORMAT); + enshrineTag(new BalancedTag("BLOCKQUOTE",true),BLOCK_FORMAT); + enshrineTag(new OpenCloseTag("BODY",false),DOC_FORMAT); + enshrineTag(new SimpleTag("BR",true),BLOCK_FORMAT); + enshrineTag(new OpenCloseTag("BUTTON",false),FORMS); + enshrineTag(new BalancedTag("CAPTION",true),TABLES); + enshrineTag(new BalancedTag("CENTER",true),BLOCK_FORMAT); + enshrineTag(new BalancedTag("CITE",false),INLINE_FORMAT); + enshrineTag(new BalancedTag("CODE",false),INLINE_FORMAT); + enshrineTag(new SimpleTag("COL",true),TABLES); + enshrineTag(new OpenCloseTag("COLGROUP",true),TABLES); + enshrineTag(new BalancedTag("COMMENT",false),MSFT_INLINE_FORMAT); + enshrineTag(new ListElementTag("DD"),BLOCK_FORMAT); + enshrineTag(new BalancedTag("DEL",false),CHANGE_MARKUP); + enshrineTag(new BalancedTag("DFN",false),INLINE_FORMAT); + enshrineTag(new BalancedTag("DIR",true),BLOCK_FORMAT); + enshrineTag(new BalancedTag("DIV",true),BLOCK_FORMAT); + enshrineTag(new BalancedTag("DL",true),BLOCK_FORMAT); + enshrineTag(new ListElementTag("DT"),BLOCK_FORMAT); + enshrineTag(new BalancedTag("EM",false),INLINE_FORMAT); + enshrineTag(new SimpleTag("EMBED",false),ACTIVE_CONTENT); + enshrineTag(new BalancedTag("FIELDSET",false),FORMS); + enshrineTag(new BalancedTag("FONT",false),FONT_FORMAT); + enshrineTag(new BalancedTag("FORM",false),FORMS); + enshrineTag(new SimpleTag("FRAME",true),FRAMES); + enshrineTag(new BalancedTag("FRAMESET",false),FRAMES); + enshrineTag(new BalancedTag("H1",true),FONT_FORMAT); + enshrineTag(new BalancedTag("H2",true),FONT_FORMAT); + enshrineTag(new BalancedTag("H3",true),FONT_FORMAT); + enshrineTag(new BalancedTag("H4",true),FONT_FORMAT); + enshrineTag(new BalancedTag("H5",true),FONT_FORMAT); + enshrineTag(new BalancedTag("H6",true),FONT_FORMAT); + enshrineTag(new OpenCloseTag("HEAD",false),DOC_FORMAT); + enshrineTag(new SimpleTag("HR",true),BLOCK_FORMAT); + enshrineTag(new OpenCloseTag("HTML",false),DOC_FORMAT); + enshrineTag(new BalancedTag("I",false),INLINE_FORMAT); + enshrineTag(new BalancedTag("IFRAME",true),FRAMES); + enshrineTag(new BalancedTag("ILAYER",true),NSCP_LAYERS); + enshrineTag(new SimpleTag("IMG",false),IMAGES); + enshrineTag(new SimpleTag("INPUT",false),FORMS); + enshrineTag(new BalancedTag("INS",false),CHANGE_MARKUP); + enshrineTag(new SimpleTag("ISINDEX",false),FORMS); + enshrineTag(new BalancedTag("KBD",false),INLINE_FORMAT); + enshrineTag(new SimpleTag("KEYGEN",false),NSCP_FORMS); + enshrineTag(new BalancedTag("LABEL",false),FORMS); + enshrineTag(new BalancedTag("LAYER",true),NSCP_LAYERS); + enshrineTag(new BalancedTag("LEGEND",false),FORMS); + enshrineTag(new ListElementTag("LI"),BLOCK_FORMAT); + enshrineTag(new SimpleTag("LINK",false),DOC_FORMAT); + enshrineTag(new BalancedTag("LISTING",false),MSFT_INLINE_FORMAT); + enshrineTag(new BalancedTag("MAP",false),IMAGE_MAPS); + enshrineTag(new BalancedTag("MARQUEE",true),MSFT_BLOCK_FORMAT); + enshrineTag(new BalancedTag("MENU",true),BLOCK_FORMAT); + enshrineTag(new SimpleTag("META",false),DOC_FORMAT); + enshrineTag(new BalancedTag("MULTICOL",true),NSCP_BLOCK_FORMAT); + enshrineTag(new TagNOBR(),BLOCK_FORMAT); + enshrineTag(new BalancedTag("NOEMBED",false),ACTIVE_CONTENT); + enshrineTag(new BalancedTag("NOFRAMES",false),FRAMES); + enshrineTag(new BalancedTag("NOLAYER",false),NSCP_LAYERS); + enshrineTag(new BalancedTag("NOSCRIPT",false),ACTIVE_CONTENT); + enshrineTag(new BalancedTag("OBJECT",false),ACTIVE_CONTENT); + enshrineTag(new BalancedTag("OL",true),BLOCK_FORMAT); + enshrineTag(new BalancedTag("OPTGROUP",false),FORMS); + enshrineTag(new ListElementTag("OPTION"),FORMS); + enshrineTag(new OpenCloseTag("P",true),BLOCK_FORMAT); + enshrineTag(new SimpleTag("PARAM",false),ACTIVE_CONTENT); + enshrineTag(new SimpleTag("PLAINTEXT",false),PREFORMAT); + enshrineTag(new BalancedTag("PRE",false),PREFORMAT); + enshrineTag(new BalancedTag("Q",false),INLINE_FORMAT); + enshrineTag(new SimpleTag("RT",false),MSFT_ACTIVE_CONTENT); + enshrineTag(new BalancedTag("RUBY",false),MSFT_ACTIVE_CONTENT); + enshrineTag(new BalancedTag("S",false),INLINE_FORMAT); + enshrineTag(new BalancedTag("SAMP",false),INLINE_FORMAT); + enshrineTag(new BalancedTag("SCRIPT",false),ACTIVE_CONTENT); + enshrineTag(new BalancedTag("SELECT",false),FORMS); + enshrineTag(new BalancedTag("SERVER",false),NSCP_SERVER); + enshrineTag(new BalancedTag("SERVLET",false),JAVA_SERVER); + enshrineTag(new BalancedTag("SMALL",false),INLINE_FORMAT); + enshrineTag(new SimpleTag("SPACER",false),NSCP_INLINE_FORMAT); + enshrineTag(new BalancedTag("SPAN",false),INLINE_FORMAT); + enshrineTag(new BalancedTag("STRIKE",false),INLINE_FORMAT); + enshrineTag(new BalancedTag("STRONG",false),INLINE_FORMAT); + enshrineTag(new BalancedTag("STYLE",false),DOC_FORMAT); + enshrineTag(new BalancedTag("SUB",false),INLINE_FORMAT); + enshrineTag(new BalancedTag("SUP",false),INLINE_FORMAT); + enshrineTag(new BalancedTag("TABLE",true),TABLES); + enshrineTag(new OpenCloseTag("TBODY",false),TABLES); + enshrineTag(new BalancedTag("TD",true),TABLES); + enshrineTag(new BalancedTag("TEXTAREA",true),FORMS); + enshrineTag(new OpenCloseTag("TFOOT",false),TABLES); + enshrineTag(new BalancedTag("TH",true),TABLES); + enshrineTag(new OpenCloseTag("THEAD",false),TABLES); + enshrineTag(new BalancedTag("TITLE",false),DOC_FORMAT); + enshrineTag(new BalancedTag("TR",true),TABLES); + enshrineTag(new BalancedTag("TT",false),INLINE_FORMAT); + enshrineTag(new BalancedTag("U",false),INLINE_FORMAT); + enshrineTag(new BalancedTag("UL",true),BLOCK_FORMAT); + enshrineTag(new BalancedTag("VAR",false),INLINE_FORMAT); + enshrineTag(new TagWBR(),BLOCK_FORMAT); + enshrineTag(new BalancedTag("XML",false),MSFT_ACTIVE_CONTENT); + enshrineTag(new BalancedTag("XMP",false),NSCP_INLINE_FORMAT); + + } // end static initializer + } // end class TagRepository diff --git a/src/com/silverwrist/venice/servlets/Attachment.java b/src/com/silverwrist/venice/servlets/Attachment.java index 8bfadc3..c7f1852 100644 --- a/src/com/silverwrist/venice/servlets/Attachment.java +++ b/src/com/silverwrist/venice/servlets/Attachment.java @@ -77,6 +77,8 @@ public class Attachment extends VeniceServlet type = msg.getAttachmentType(); filename = msg.getAttachmentFilename(); length = msg.getAttachmentLength(); + if (logger.isInfoEnabled()) + logger.info("Uploaded file: " + filename + "(type " + type + ", " + length + " bytes)"); data = msg.getAttachmentData(); } // end try diff --git a/src/com/silverwrist/venice/servlets/PostMessage.java b/src/com/silverwrist/venice/servlets/PostMessage.java index 4e53756..104bf4d 100644 --- a/src/com/silverwrist/venice/servlets/PostMessage.java +++ b/src/com/silverwrist/venice/servlets/PostMessage.java @@ -94,16 +94,21 @@ public class PostMessage extends VeniceServlet String on_error = "confdisp?sig=" + sig.getSIGID() + "&conf=" + conf.getConfID() + "&top=" + topic.getTopicNumber(); - // make sure we've got some post data - String raw_postdata = request.getParameter("pb"); - if (StringUtil.isStringEmpty(raw_postdata)) - return null; // don't allow zero-size posts - - final String yes = "Y"; - if (isImageButtonClicked(request,"cancel")) throw new RedirectResult(on_error); // canceled posting - take us back + // make sure we've got some post data + String raw_postdata = request.getParameter("pb"); + /* EJB 4/4/2001 - take this code out, FUTURE: maybe make it a global setting? + if (StringUtil.isStringEmpty(raw_postdata)) + return null; // don't allow zero-size posts + -- end removed code */ + + if (raw_postdata==null) + raw_postdata = ""; + + final String yes = "Y"; + if (isImageButtonClicked(request,"preview")) // generate a preview return new PostPreview(engine,sig,conf,topic,request.getParameter("pseud"),raw_postdata, request.getParameter("next"),getPostNumber(request,on_error), diff --git a/src/com/silverwrist/venice/servlets/PostOperations.java b/src/com/silverwrist/venice/servlets/PostOperations.java index 0702adb..5a2aba0 100644 --- a/src/com/silverwrist/venice/servlets/PostOperations.java +++ b/src/com/silverwrist/venice/servlets/PostOperations.java @@ -74,7 +74,7 @@ public class PostOperations extends VeniceServlet // get the topic TopicContext topic = getTopicParameter(request,conf,true,location); - locator += "&top=" + topic.getTopicID(); + locator += "&top=" + topic.getTopicNumber(); location = "confdisp?" + locator; // get the message diff --git a/src/com/silverwrist/venice/servlets/format/ConferenceListing.java b/src/com/silverwrist/venice/servlets/format/ConferenceListing.java index e4e8ab2..f01935f 100644 --- a/src/com/silverwrist/venice/servlets/format/ConferenceListing.java +++ b/src/com/silverwrist/venice/servlets/format/ConferenceListing.java @@ -141,6 +141,12 @@ public class ConferenceListing implements JSPRender } // end getLastUpdateDate + public boolean anyUnread(int ndx) + { + return ((ConferenceContext)(conferences.get(ndx))).anyUnread(); + + } // end anyUnread + public int getNumHosts(int ndx) { return hosts[ndx].size(); diff --git a/src/com/silverwrist/venice/servlets/format/RenderData.java b/src/com/silverwrist/venice/servlets/format/RenderData.java index f223964..044ec9d 100644 --- a/src/com/silverwrist/venice/servlets/format/RenderData.java +++ b/src/com/silverwrist/venice/servlets/format/RenderData.java @@ -52,6 +52,8 @@ public class RenderData private boolean can_gzip = false; private Locale my_locale; private TimeZone my_timezone; + private DateFormat activity_time = null; + private DateFormat display_date = null; /*-------------------------------------------------------------------------------- * Constructor @@ -250,9 +252,14 @@ public class RenderData public String formatDateForDisplay(Date date) { - DateFormat fmt = DateFormat.getDateTimeInstance(DateFormat.MEDIUM,DateFormat.MEDIUM,my_locale); - fmt.setTimeZone(my_timezone); - return fmt.format(date); + if (display_date==null) + { // create the display date formatter + display_date = DateFormat.getDateTimeInstance(DateFormat.MEDIUM,DateFormat.MEDIUM,my_locale); + display_date.setTimeZone(my_timezone); + + } // end if + + return display_date.format(date); } // end formatDateForDisplay @@ -338,10 +345,22 @@ public class RenderData switch (delta_days) { // now return a string based on the difference in days case 0: - return "Today"; + if (activity_time==null) + { // get the "activity" time formatter + activity_time = DateFormat.getTimeInstance(DateFormat.MEDIUM,my_locale); + activity_time.setTimeZone(my_timezone); + + } // end if + return "Today, " + activity_time.format(date); case 1: - return "Yesterday"; + if (activity_time==null) + { // get the "activity" time formatter + activity_time = DateFormat.getTimeInstance(DateFormat.MEDIUM,my_locale); + activity_time.setTimeZone(my_timezone); + + } // end if + return "Yesterday, " + activity_time.format(date); default: return String.valueOf(delta_days) + " days ago"; diff --git a/web/format/conferences.jsp b/web/format/conferences.jsp index 9db8cf6..e39bad0 100644 --- a/web/format/conferences.jsp +++ b/web/format/conferences.jsp @@ -37,7 +37,11 @@ <%= rdat.getStdFontTag(null,2) %> <% String path = "confdisp?sig=" + data.getSIGID() + "&conf=" + data.getConferenceID(i); %> <%= StringUtil.encodeHTML(data.getConferenceName(i)) %> - - Latest activity: <%= rdat.getActivityString(data.getLastUpdateDate(i)) %>
    + Latest activity: <%= rdat.getActivityString(data.getLastUpdateDate(i)) %> + <% if (data.anyUnread(i)) { %> + " ALT=\"New!\" BORDER=0 WIDTH=40 HEIGHT=20> + <% } // end if %> +
    <% int count = data.getNumHosts(i); %> <% if (count>0) { %> <% if (count>1) { %>Hosts<% } else { %>Host<% } %>: diff --git a/web/format/slippage.jsp b/web/format/slippage.jsp index 707fa02..865bcf7 100644 --- a/web/format/slippage.jsp +++ b/web/format/slippage.jsp @@ -30,7 +30,7 @@ <%= rdat.getStdFontTag(null,2) %> The following posts slipped in while you were typing. You may choose to edit your message and re-post, just post it as is, or cancel your posting altogether. - +

    <% if (rdat.useHTMLComments()) { %><% } %> <% Iterator it = data.getMessageIterator(); %> diff --git a/web/format/top_content.jsp b/web/format/top_content.jsp index 43daf65..f500125 100644 --- a/web/format/top_content.jsp +++ b/web/format/top_content.jsp @@ -28,7 +28,7 @@ <% if (rdat.useHTMLComments()) { %><% } %> <% if (data.displayWelcome()) { %> <% rdat.writeContentHeader(out,rdat.getStockMessage("welcome-top"),null); %> - <%= rdat.getStdFontTag(null,1) %><%= rdat.getStockMessage("welcome") %>

    + <%= rdat.getStdFontTag(null,2) %><%= rdat.getStockMessage("welcome") %>

    <% } // end if %> <% rdat.writeContentHeader(out,rdat.getStockMessage("currents-top"),null); %> <% int ntp = data.getNumTopPosts(); %> @@ -39,7 +39,7 @@ TopicMessageContext msg = data.getTopPost(i); String poster = data.getPosterName(msg); %> - <%= rdat.getStdFontTag(null,1) %> + <%= rdat.getStdFontTag(null,2) %> <%= msg.getPseud() %> ( " TARGET="_blank"><%= poster %>, @@ -50,5 +50,5 @@ <% } // end for %> <% } else { %> - <%= rdat.getStdFontTag(null,1) %>No front page postings found. + <%= rdat.getStdFontTag(null,2) %>No front page postings found. <% } // end if %> \ No newline at end of file