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 <IMG> and <LI>
  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.
This commit is contained in:
Eric J. Bowersox 2001-04-05 05:12:20 +00:00
parent 257537e869
commit f19aab70fe
15 changed files with 375 additions and 184 deletions

View File

@ -1,3 +1,5 @@
acmecity
advogato advogato
ain't ain't
anime anime
@ -8,10 +10,12 @@ boitano
boromax boromax
can't can't
cartman cartman
cdt
checkouts checkouts
couldn't couldn't
crewmember crewmember
crewmembers crewmembers
cst
deflector deflector
deflectors deflectors
delenn delenn
@ -20,10 +24,13 @@ dilithium
docking docking
doesn't doesn't
don't don't
edt
eminds eminds
entil'zha entil'zha
eps eps
erbo erbo
est
faux
fett fett
followup followup
franklin franklin
@ -47,19 +54,27 @@ lafou
ma'am ma'am
maddog maddog
marillion marillion
mdt
minbar minbar
minbari minbari
mp
mr mr
mst
mustn't mustn't
nacelle nacelle
nacelles nacelles
navigational navigational
ops ops
padd padd
paperclip
pdt
peachy peachy
pic
planitia planitia
planum planum
privs
psi psi
pst
refit refit
refitting refitting
replicator replicator
@ -70,9 +85,12 @@ runabout
salchow salchow
salchows salchows
sarcastically sarcastically
shouldn't
silverwrist silverwrist
snarf snarf
snarfage snarfage
snarfer
snarfing
snazzy snazzy
sourceforge sourceforge
spaceport spaceport
@ -92,6 +110,7 @@ turbolift
tuzanor tuzanor
umbilical umbilical
umbilicals umbilicals
unread
url url
utne utne
valen valen

View File

@ -9,7 +9,7 @@
WARRANTY OF ANY KIND, either express or implied. See the License for the specific WARRANTY OF ANY KIND, either express or implied. See the License for the specific
language governing rights and limitations under the License. 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 <erbo@silcom.com>, The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
for Silverwrist Design Studios. Portions created by Eric J. Bowersox are for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
@ -34,4 +34,16 @@
<appender-ref ref="STDLOG"/> <appender-ref ref="STDLOG"/>
</root> </root>
<!-- Turn down the standard detail in some areas -->
<category name="com.silverwrist.util.ServletMultipartHandler">
<priority value="fatal"/>
</category>
<category name="com.silverwrist.venice.htmlcheck">
<priority value="fatal"/>
</category>
</configuration> </configuration>

View File

@ -172,12 +172,49 @@ public class ServletMultipartHandler
// Parse the Content-Disposition header. // Parse the Content-Disposition header.
String[] cdstr = part.getHeader("Content-Disposition"); String[] cdstr = part.getHeader("Content-Disposition");
if (logger.isDebugEnabled())
logger.debug("Content-Disposition is " + cdstr[0]);
ContentDisposition cdisp = new ContentDisposition(cdstr[0]); ContentDisposition cdisp = new ContentDisposition(cdstr[0]);
name = cdisp.getParameter("name"); name = cdisp.getParameter("name");
filename = cdisp.getParameter("filename"); filename = cdisp.getParameter("filename");
if (filename!=null) 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('\\'); int sep = filename.lastIndexOf('\\');
if (sep>=0) if (sep>=0)
filename = filename.substring(sep+1); filename = filename.substring(sep+1);

View File

@ -7,7 +7,7 @@
* WARRANTY OF ANY KIND, either express or implied. See the License for the specific * WARRANTY OF ANY KIND, either express or implied. See the License for the specific
* language governing rights and limitations under the License. * 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 <erbo@silcom.com>, * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
@ -54,7 +54,6 @@ public class HTMLCheckerConfigImpl implements HTMLCheckerConfig
HTMLCheckerConfigImpl() HTMLCheckerConfigImpl()
{ {
TagRepository.init();
TagRepository.configureNormalSet(allowed_tagsets); TagRepository.configureNormalSet(allowed_tagsets);
} // end constructor } // end constructor

View File

@ -18,6 +18,7 @@
package com.silverwrist.venice.htmlcheck.impl; package com.silverwrist.venice.htmlcheck.impl;
import java.util.*; import java.util.*;
import org.apache.log4j.*;
import com.silverwrist.venice.htmlcheck.*; import com.silverwrist.venice.htmlcheck.*;
class HTMLCheckerImpl implements HTMLChecker, HTMLCheckerBackend, RewriterServices class HTMLCheckerImpl implements HTMLChecker, HTMLCheckerBackend, RewriterServices
@ -86,6 +87,13 @@ class HTMLCheckerImpl implements HTMLChecker, HTMLCheckerBackend, RewriterServic
private static final int MARGIN_SLOP = 5; private static final int MARGIN_SLOP = 5;
/*--------------------------------------------------------------------------------
* Static data members
*--------------------------------------------------------------------------------
*/
private static Category logger = Category.getInstance(HTMLCheckerImpl.class);
/*-------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------
* Attributes * Attributes
*-------------------------------------------------------------------------------- *--------------------------------------------------------------------------------
@ -103,13 +111,13 @@ class HTMLCheckerImpl implements HTMLChecker, HTMLCheckerBackend, RewriterServic
private boolean trigger_WBR = false; // word break trigger private boolean trigger_WBR = false; // word break trigger
private StringBuffer output_buffer = null; // output buffer for characters private StringBuffer output_buffer = null; // output buffer for characters
private StringBuffer temp_buffer = null; // temporary buffer used within one state private StringBuffer temp_buffer = null; // temporary buffer used within one state
private Vector tag_stack = null; // stack of tags that have been opened private ArrayList tag_stack = null; // stack of tags that have been opened
private Hashtable counters = new Hashtable(); // the CountingRewriter instances private HashMap counters = new HashMap(); // the CountingRewriter instances
private Vector string_rewriters = new Vector(); // string rewriter instances private ArrayList string_rewriters = new ArrayList(); // string rewriter instances
private Vector word_rewriters = new Vector(); // word rewriter instances private ArrayList word_rewriters = new ArrayList(); // word rewriter instances
private Vector tag_rewriters = new Vector(); // tag rewriter instances private ArrayList tag_rewriters = new ArrayList(); // tag rewriter instances
private Vector paren_rewriters = new Vector(); // paren rewriter instances private ArrayList paren_rewriters = new ArrayList(); // paren rewriter instances
private Hashtable context_data = new Hashtable(); // context variables private HashMap context_data = new HashMap(); // context variables
/*-------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------
* Constructor * Constructor
@ -118,7 +126,6 @@ class HTMLCheckerImpl implements HTMLChecker, HTMLCheckerBackend, RewriterServic
HTMLCheckerImpl(HTMLCheckerConfigImpl config) HTMLCheckerImpl(HTMLCheckerConfigImpl config)
{ {
TagRepository.init();
this.config = config; this.config = config;
copyRewriters(string_rewriters,config.getStringRewriters()); copyRewriters(string_rewriters,config.getStringRewriters());
copyRewriters(word_rewriters,config.getWordRewriters()); copyRewriters(word_rewriters,config.getWordRewriters());
@ -160,7 +167,7 @@ class HTMLCheckerImpl implements HTMLChecker, HTMLCheckerBackend, RewriterServic
} // end getRunLength } // end getRunLength
private void copyRewriters(Vector dest, List source) private void copyRewriters(ArrayList dest, List source)
{ {
Iterator it = source.iterator(); Iterator it = source.iterator();
while (it.hasNext()) while (it.hasNext())
@ -202,7 +209,7 @@ class HTMLCheckerImpl implements HTMLChecker, HTMLCheckerBackend, RewriterServic
{ {
output_buffer = new StringBuffer(1024); output_buffer = new StringBuffer(1024);
temp_buffer = new StringBuffer(64); temp_buffer = new StringBuffer(64);
tag_stack = new Vector(); tag_stack = new ArrayList();
} // end initState } // end initState
@ -210,7 +217,7 @@ class HTMLCheckerImpl implements HTMLChecker, HTMLCheckerBackend, RewriterServic
{ {
temp_buffer = null; temp_buffer = null;
if (tag_stack!=null) if (tag_stack!=null)
tag_stack.removeAllElements(); tag_stack.clear();
tag_stack = null; tag_stack = null;
} // end killState } // end killState
@ -520,6 +527,8 @@ class HTMLCheckerImpl implements HTMLChecker, HTMLCheckerBackend, RewriterServic
private boolean handleAsHTML() private boolean handleAsHTML()
{ {
if (logger.isDebugEnabled())
logger.debug("handleAsHTML(): candidate buffer = [" + temp_buffer.toString() + "]");
trigger_WBR = false; // initialize trigger_WBR = false; // initialize
// Figure out the place in the buffer where the command word starts. // 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; boolean closing_tag = false;
if ((start_cmd<temp_buffer.length()) && (temp_buffer.charAt(start_cmd)=='/')) if ((start_cmd<temp_buffer.length()) && (temp_buffer.charAt(start_cmd)=='/'))
{ // this is a closing tag - move the command start pointer... { // this is a closing tag - move the command start pointer...
if (logger.isDebugEnabled())
logger.debug("closing tag detected");
start_cmd++; start_cmd++;
closing_tag = true; closing_tag = true;
@ -538,34 +549,58 @@ class HTMLCheckerImpl implements HTMLChecker, HTMLCheckerBackend, RewriterServic
end_cmd++; end_cmd++;
if ((end_cmd==start_cmd) || ((end_cmd-start_cmd)>TagRepository.getMaxTagLength())) if ((end_cmd==start_cmd) || ((end_cmd-start_cmd)>TagRepository.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. // 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) 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. // Look up the tag object that corresponds to the tag index.
SimpleTag tagobj = TagRepository.tagIndexToObject(tag_index); SimpleTag tagobj = TagRepository.tagIndexToObject(tag_index);
if (closing_tag && !(tagobj.allowClose())) 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("</" + poss_tag_name + "> 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. // Get the HTML tag set index for this tag, and see if we allow that set.
int tag_set_id = TagRepository.tagIndexToSet(tag_index); int tag_set_id = TagRepository.tagIndexToSet(tag_index);
if (!(config.isTagSetAllowed(tag_set_id)) && !(config.getDiscardHTMLTags())) 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()) if (!(config.getDiscardHTMLTags()) && tagobj.balanceTags())
{ // this tag needs to be balanced - here is where we manipulate the stack { // this tag needs to be balanced - here is where we manipulate the stack
boolean valid = false;
if (closing_tag) if (closing_tag)
{ // hunt through the list to find the most recently-opened tag of this type { // hunt through the list to find the most recently-opened tag of this type
int i = tag_stack.size() - 1; int i = tag_stack.size();
while (i>=0) while ((--i)>=0)
{ // look through the stack... { // look through the stack...
Integer foo = (Integer)(tag_stack.get(i)); Integer foo = (Integer)(tag_stack.get(i));
if (foo.intValue()==tag_index) if (foo.intValue()==tag_index)
{ // found it - remove it from the tag stack { // found it - remove it from the tag stack
if (logger.isDebugEnabled())
logger.debug("balanced closure of <" + poss_tag_name + ">");
tag_stack.remove(i); tag_stack.remove(i);
valid = true; valid = true;
break; break;
@ -577,21 +612,36 @@ class HTMLCheckerImpl implements HTMLChecker, HTMLCheckerBackend, RewriterServic
} // end if } // end if
else else
{ // push a new opening tag! { // push a new opening tag!
if (logger.isDebugEnabled())
logger.debug("open form of <" + poss_tag_name + ">");
tag_stack.add(new Integer(tag_index)); tag_stack.add(new Integer(tag_index));
valid = true; valid = true;
} // end else } // 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 } // end if
// else tag doesn't need to be auto-balanced, or is being discarded // 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. // 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); String real_tag_data = tagobj.rewriteTagContents(temp_buffer.toString(),closing_tag,this);
if ((real_tag_data==null) || config.getDiscardHTMLTags()) 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. // Emit the tag to the output.
emitChar('<',config.getRawOutputFilters(),false); emitChar('<',config.getRawOutputFilters(),false);
@ -601,12 +651,22 @@ class HTMLCheckerImpl implements HTMLChecker, HTMLCheckerBackend, RewriterServic
// Determine whether this tag causes a "logical line break." // Determine whether this tag causes a "logical line break."
boolean logical_line_break = false; boolean logical_line_break = false;
if (trigger_WBR && !closing_tag && (nobreak_count>0)) if (trigger_WBR && !closing_tag && (nobreak_count>0))
{ // a word break is a logical line break (but only if within <NOBR>...</NOBR>)
if (logger.isDebugEnabled())
logger.debug("<" + poss_tag_name + "> WORD BREAKS");
logical_line_break = true; logical_line_break = true;
} // end if
else else
logical_line_break = tagobj.causeLineBreak(closing_tag); logical_line_break = tagobj.causeLineBreak(closing_tag);
if (logical_line_break) if (logical_line_break)
{ // logical line break is triggered
if (logger.isDebugEnabled())
logger.debug("<" + poss_tag_name + "> triggers logical line break");
columns = 0; columns = 0;
} // end if
return true; // handled! return true; // handled!
} // end handleAsHTML() } // end handleAsHTML()

View File

@ -7,7 +7,7 @@
* WARRANTY OF ANY KIND, either express or implied. See the License for the specific * WARRANTY OF ANY KIND, either express or implied. See the License for the specific
* language governing rights and limitations under the License. * 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 <erbo@silcom.com>, * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
@ -100,4 +100,25 @@ class SimpleTag
} // end rewriteTagContents } // 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 } // end class SimpleTag

View File

@ -7,7 +7,7 @@
* WARRANTY OF ANY KIND, either express or implied. See the License for the specific * WARRANTY OF ANY KIND, either express or implied. See the License for the specific
* language governing rights and limitations under the License. * 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 <erbo@silcom.com>, * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are * 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 class TagRepository implements HTMLTagSets
{ {
/*-------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------
* Attributes * Static data members
*-------------------------------------------------------------------------------- *--------------------------------------------------------------------------------
*/ */
private static Hashtable tagname_to_index = new Hashtable(50,0.9F); private static HashMap tagname_to_index = new HashMap(50,0.9F);
private static Vector index_to_object = new Vector(); private static ArrayList index_to_object = new ArrayList();
private static Vector index_to_setid = new Vector(); private static ArrayList index_to_setid = new ArrayList();
private static int maxlength = 0; private static int maxlength = 0;
private static boolean initialized = false;
/*--------------------------------------------------------------------------------
* Constructor
*--------------------------------------------------------------------------------
*/
private TagRepository()
{ // do nothing
} // end constructor
/*-------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------
* Internal functions * Internal functions
@ -44,7 +52,7 @@ class TagRepository implements HTMLTagSets
index_to_object.add(tag); index_to_object.add(tag);
index_to_setid.add(new Integer(set)); index_to_setid.add(new Integer(set));
tag.setIndex(ndx); 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(); int newlen = tag.getTagName().length();
if (newlen>maxlength) if (newlen>maxlength)
maxlength = newlen; maxlength = newlen;
@ -56,12 +64,67 @@ class TagRepository implements HTMLTagSets
*-------------------------------------------------------------------------------- *--------------------------------------------------------------------------------
*/ */
public static void init() public static int getMaxTagLength()
{ {
if (!initialized) return maxlength;
{ // set the flag so we don't do this again
initialized = true;
} // end getMaxTagLength
public static int tagNameToIndex(String tag)
{ // look up tag name and get index
Object obj = tagname_to_index.get(tag.toUpperCase());
if (obj==null)
return -1;
else
return ((Integer)obj).intValue();
} // end tagNameToIndex
public static SimpleTag tagIndexToObject(int ndx)
{
Object obj = index_to_object.get(ndx);
if (obj==null)
return null;
else
return (SimpleTag)obj;
} // end tagIndexToObject
public static int tagIndexToSet(int ndx)
{
Object obj = index_to_setid.get(ndx);
if (obj==null)
return -1;
else
return ((Integer)obj).intValue();
} // end tagIndexToSet
public static void configureNormalSet(BitSet bs)
{
bs.xor(bs); // clears all bits presently set in the bitset
bs.set(INLINE_FORMAT);
bs.set(ANCHOR);
bs.set(BLOCK_FORMAT);
bs.set(FONT_FORMAT);
bs.set(IMAGES);
} // end configureNormalSet
public static void configureRestrictedSet(BitSet bs)
{
bs.xor(bs); // clears all bits presently set in the bitset
bs.set(INLINE_FORMAT);
} // end configureRestrictedSet
/*--------------------------------------------------------------------------------
* Static initializer
*--------------------------------------------------------------------------------
*/
static
{
// begin enshrining the tags! // begin enshrining the tags!
enshrineTag(new SimpleTag("!DOCTYPE",false),DOC_FORMAT); enshrineTag(new SimpleTag("!DOCTYPE",false),DOC_FORMAT);
enshrineTag(new SimpleTag("%",false),SERVER_PAGE); enshrineTag(new SimpleTag("%",false),SERVER_PAGE);
@ -182,62 +245,6 @@ class TagRepository implements HTMLTagSets
enshrineTag(new BalancedTag("XML",false),MSFT_ACTIVE_CONTENT); enshrineTag(new BalancedTag("XML",false),MSFT_ACTIVE_CONTENT);
enshrineTag(new BalancedTag("XMP",false),NSCP_INLINE_FORMAT); enshrineTag(new BalancedTag("XMP",false),NSCP_INLINE_FORMAT);
} // end if } // end static initializer
} // end init
public static int getMaxTagLength()
{
return maxlength;
} // end getMaxTagLength
public static int tagNameToIndex(String tag)
{ // look up tag name and get index
Object obj = tagname_to_index.get(tag.toUpperCase());
if (obj==null)
return -1;
else
return ((Integer)obj).intValue();
} // end tagNameToIndex
public static SimpleTag tagIndexToObject(int ndx)
{
Object obj = index_to_object.get(ndx);
if (obj==null)
return null;
else
return (SimpleTag)obj;
} // end tagIndexToObject
public static int tagIndexToSet(int ndx)
{
Object obj = index_to_setid.get(ndx);
if (obj==null)
return -1;
else
return ((Integer)obj).intValue();
} // end tagIndexToSet
public static void configureNormalSet(BitSet bs)
{
bs.xor(bs); // clears all bits presently set in the bitset
bs.set(INLINE_FORMAT);
bs.set(ANCHOR);
bs.set(BLOCK_FORMAT);
bs.set(FONT_FORMAT);
bs.set(IMAGES);
} // end configureNormalSet
public static void configureRestrictedSet(BitSet bs)
{
bs.xor(bs); // clears all bits presently set in the bitset
bs.set(INLINE_FORMAT);
} // end configureRestrictedSet
} // end class TagRepository } // end class TagRepository

View File

@ -77,6 +77,8 @@ public class Attachment extends VeniceServlet
type = msg.getAttachmentType(); type = msg.getAttachmentType();
filename = msg.getAttachmentFilename(); filename = msg.getAttachmentFilename();
length = msg.getAttachmentLength(); length = msg.getAttachmentLength();
if (logger.isInfoEnabled())
logger.info("Uploaded file: " + filename + "(type " + type + ", " + length + " bytes)");
data = msg.getAttachmentData(); data = msg.getAttachmentData();
} // end try } // end try

View File

@ -94,16 +94,21 @@ public class PostMessage extends VeniceServlet
String on_error = "confdisp?sig=" + sig.getSIGID() + "&conf=" + conf.getConfID() + "&top=" String on_error = "confdisp?sig=" + sig.getSIGID() + "&conf=" + conf.getConfID() + "&top="
+ topic.getTopicNumber(); + 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")) if (isImageButtonClicked(request,"cancel"))
throw new RedirectResult(on_error); // canceled posting - take us back 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 if (isImageButtonClicked(request,"preview")) // generate a preview
return new PostPreview(engine,sig,conf,topic,request.getParameter("pseud"),raw_postdata, return new PostPreview(engine,sig,conf,topic,request.getParameter("pseud"),raw_postdata,
request.getParameter("next"),getPostNumber(request,on_error), request.getParameter("next"),getPostNumber(request,on_error),

View File

@ -74,7 +74,7 @@ public class PostOperations extends VeniceServlet
// get the topic // get the topic
TopicContext topic = getTopicParameter(request,conf,true,location); TopicContext topic = getTopicParameter(request,conf,true,location);
locator += "&top=" + topic.getTopicID(); locator += "&top=" + topic.getTopicNumber();
location = "confdisp?" + locator; location = "confdisp?" + locator;
// get the message // get the message

View File

@ -141,6 +141,12 @@ public class ConferenceListing implements JSPRender
} // end getLastUpdateDate } // end getLastUpdateDate
public boolean anyUnread(int ndx)
{
return ((ConferenceContext)(conferences.get(ndx))).anyUnread();
} // end anyUnread
public int getNumHosts(int ndx) public int getNumHosts(int ndx)
{ {
return hosts[ndx].size(); return hosts[ndx].size();

View File

@ -52,6 +52,8 @@ public class RenderData
private boolean can_gzip = false; private boolean can_gzip = false;
private Locale my_locale; private Locale my_locale;
private TimeZone my_timezone; private TimeZone my_timezone;
private DateFormat activity_time = null;
private DateFormat display_date = null;
/*-------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------
* Constructor * Constructor
@ -250,9 +252,14 @@ public class RenderData
public String formatDateForDisplay(Date date) public String formatDateForDisplay(Date date)
{ {
DateFormat fmt = DateFormat.getDateTimeInstance(DateFormat.MEDIUM,DateFormat.MEDIUM,my_locale); if (display_date==null)
fmt.setTimeZone(my_timezone); { // create the display date formatter
return fmt.format(date); display_date = DateFormat.getDateTimeInstance(DateFormat.MEDIUM,DateFormat.MEDIUM,my_locale);
display_date.setTimeZone(my_timezone);
} // end if
return display_date.format(date);
} // end formatDateForDisplay } // end formatDateForDisplay
@ -338,10 +345,22 @@ public class RenderData
switch (delta_days) switch (delta_days)
{ // now return a string based on the difference in days { // now return a string based on the difference in days
case 0: 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: 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: default:
return String.valueOf(delta_days) + " days ago"; return String.valueOf(delta_days) + " days ago";

View File

@ -37,7 +37,11 @@
<TD ALIGN=LEFT><%= rdat.getStdFontTag(null,2) %> <TD ALIGN=LEFT><%= rdat.getStdFontTag(null,2) %>
<% String path = "confdisp?sig=" + data.getSIGID() + "&conf=" + data.getConferenceID(i); %> <% String path = "confdisp?sig=" + data.getSIGID() + "&conf=" + data.getConferenceID(i); %>
<A HREF="<%= rdat.getEncodedServletPath(path) %>"><%= StringUtil.encodeHTML(data.getConferenceName(i)) %></A> - <A HREF="<%= rdat.getEncodedServletPath(path) %>"><%= StringUtil.encodeHTML(data.getConferenceName(i)) %></A> -
Latest activity: <%= rdat.getActivityString(data.getLastUpdateDate(i)) %><BR> Latest activity: <%= rdat.getActivityString(data.getLastUpdateDate(i)) %>
<% if (data.anyUnread(i)) { %>
<IMG SRC="<%= rdat.getFullImagePath("tag_new.gif") %>" ALT=\"New!\" BORDER=0 WIDTH=40 HEIGHT=20>
<% } // end if %>
<BR>
<% int count = data.getNumHosts(i); %> <% int count = data.getNumHosts(i); %>
<% if (count>0) { %> <% if (count>0) { %>
<% if (count>1) { %>Hosts<% } else { %>Host<% } %>: <% if (count>1) { %>Hosts<% } else { %>Host<% } %>:

View File

@ -30,7 +30,7 @@
<%= rdat.getStdFontTag(null,2) %> <%= rdat.getStdFontTag(null,2) %>
The following posts slipped in while you were typing. You may choose to edit your message and 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. re-post, just post it as is, or cancel your posting altogether.
</FONT> </FONT><P>
<% if (rdat.useHTMLComments()) { %><!-- Begin Slipped Messages --><% } %> <% if (rdat.useHTMLComments()) { %><!-- Begin Slipped Messages --><% } %>
<% Iterator it = data.getMessageIterator(); %> <% Iterator it = data.getMessageIterator(); %>

View File

@ -28,7 +28,7 @@
<% if (rdat.useHTMLComments()) { %><!-- Top content panel --><% } %> <% if (rdat.useHTMLComments()) { %><!-- Top content panel --><% } %>
<% if (data.displayWelcome()) { %> <% if (data.displayWelcome()) { %>
<% rdat.writeContentHeader(out,rdat.getStockMessage("welcome-top"),null); %> <% rdat.writeContentHeader(out,rdat.getStockMessage("welcome-top"),null); %>
<%= rdat.getStdFontTag(null,1) %><%= rdat.getStockMessage("welcome") %></FONT><P> <%= rdat.getStdFontTag(null,2) %><%= rdat.getStockMessage("welcome") %></FONT><P>
<% } // end if %> <% } // end if %>
<% rdat.writeContentHeader(out,rdat.getStockMessage("currents-top"),null); %> <% rdat.writeContentHeader(out,rdat.getStockMessage("currents-top"),null); %>
<% int ntp = data.getNumTopPosts(); %> <% int ntp = data.getNumTopPosts(); %>
@ -39,7 +39,7 @@
TopicMessageContext msg = data.getTopPost(i); TopicMessageContext msg = data.getTopPost(i);
String poster = data.getPosterName(msg); String poster = data.getPosterName(msg);
%> %>
<%= rdat.getStdFontTag(null,1) %> <%= rdat.getStdFontTag(null,2) %>
<B><%= msg.getPseud() %></B> <B><%= msg.getPseud() %></B>
(<EM> (<EM>
<A HREF="<%= rdat.getEncodedServletPath("user/" + poster) %>" TARGET="_blank"><%= poster %></A>, <A HREF="<%= rdat.getEncodedServletPath("user/" + poster) %>" TARGET="_blank"><%= poster %></A>,
@ -50,5 +50,5 @@
</FONT> </FONT>
<% } // end for %> <% } // end for %>
<% } else { %> <% } else { %>
<%= rdat.getStdFontTag(null,1) %><EM>No front page postings found.</EM></FONT> <%= rdat.getStdFontTag(null,2) %><EM>No front page postings found.</EM></FONT>
<% } // end if %> <% } // end if %>