some serious new feature implementation:

- cookie-based persistent logins
- expanded activity reporting
- "top" and "fixed" left menus are now dynamically generated from XML config,
  not hard coded
- error reporting enhanced and protection increased
- "About Venice" page first draft
- new means of "framing" static content within the Venice "frame"
- base page now includes the "footer" itself, "content" pages don't anymore
- general cleanup of some heavyweight old containers, replaced with faster
  Collections framework containers
- probably more, there's a LOT of stuff in here
This commit is contained in:
Eric J. Bowersox 2001-04-09 03:20:58 +00:00
parent 3d32fe95c5
commit 63fedc9db6
77 changed files with 2817 additions and 558 deletions

View File

@ -8,7 +8,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
@ -86,4 +86,38 @@ Text of this agreement is TBD.
</messages> </messages>
<!-- Menu definitions for the base page -->
<menu-definitions>
<!-- Definition for the "top" menu (when not in a SIG) -->
<menudef id="top">
<header>Front Page</header>
<menuitem>
<text>Calendar</text>
<absolute>TODO</absolute>
<disabled/>
</menuitem>
<menuitem>
<text>Chat</text>
<absolute>TODO</absolute>
<disabled/>
</menuitem>
</menudef>
<!-- Definition for the "fixed" menu (always displayed under the "top" or "SIG" menus) -->
<menudef id="fixed">
<header>About This Site</header>
<menuitem>
<text>Documentation</text>
<absolute>TODO</absolute>
<disabled/>
</menuitem>
<menuitem>
<text>About Venice</text>
<frame>about-venice.html</frame>
</menuitem>
</menudef>
</menu-definitions>
</render-config> </render-config>

View File

@ -69,6 +69,14 @@
<load-on-startup>3</load-on-startup> <load-on-startup>3</load-on-startup>
</servlet> </servlet>
<servlet>
<servlet-name>framestatic</servlet-name>
<description>
Displays static content inside the Venice frame.
</description>
<servlet-class>com.silverwrist.venice.servlets.FrameStatic</servlet-class>
</servlet>
<servlet> <servlet>
<servlet-name>account</servlet-name> <servlet-name>account</servlet-name>
<description> <description>
@ -216,6 +224,11 @@
<url-pattern>/top</url-pattern> <url-pattern>/top</url-pattern>
</servlet-mapping> </servlet-mapping>
<servlet-mapping>
<servlet-name>framestatic</servlet-name>
<url-pattern>/frame/*</url-pattern>
</servlet-mapping>
<servlet-mapping> <servlet-mapping>
<servlet-name>account</servlet-name> <servlet-name>account</servlet-name>
<url-pattern>/account</url-pattern> <url-pattern>/account</url-pattern>

View File

@ -71,6 +71,7 @@ CREATE TABLE users (
uid INT NOT NULL PRIMARY KEY AUTO_INCREMENT, uid INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
username VARCHAR(64) NOT NULL, username VARCHAR(64) NOT NULL,
passhash VARCHAR(64) NOT NULL, passhash VARCHAR(64) NOT NULL,
tokenauth VARCHAR(64),
contactid INT DEFAULT -1, contactid INT DEFAULT -1,
is_anon TINYINT DEFAULT 0, is_anon TINYINT DEFAULT 0,
verify_email TINYINT DEFAULT 0, verify_email TINYINT DEFAULT 0,
@ -345,6 +346,8 @@ CREATE TABLE topicsettings (
uid INT NOT NULL, uid INT NOT NULL,
hidden TINYINT DEFAULT 0, hidden TINYINT DEFAULT 0,
last_message INT DEFAULT -1, last_message INT DEFAULT -1,
last_read DATETIME,
last_post DATETIME,
PRIMARY KEY (topicid, uid) PRIMARY KEY (topicid, uid)
); );

View File

@ -0,0 +1,400 @@
/*
* The contents of this file are subject to the Mozilla Public License Version 1.1
* (the "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at <http://www.mozilla.org/MPL/>.
*
* Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
* 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 Communities System.
*
* 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
* Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
package com.silverwrist.util.cachemap;
import java.util.*;
public class CacheMap implements Map
{
/*--------------------------------------------------------------------------------
* Internal class used to do comparisons for cache shrinkage
*--------------------------------------------------------------------------------
*/
static class CacheOrdering implements Comparator
{
private CacheMapStrategy strategy; // CacheMap's strategy object
private long tick; // when the sort operation started
CacheOrdering(CacheMapStrategy strategy)
{
this.strategy = strategy;
this.tick = System.currentTimeMillis();
} // end constructor
public int compare(Object o1, Object o2)
{
long figm1 = strategy.getEntryValue((CacheMapEntry)o1,tick);
long figm2 = strategy.getEntryValue((CacheMapEntry)o2,tick);
return (int)(figm1 - figm2); // we want the largest figures of merit to go first
} // end compare
public boolean equals(Object o)
{
return (o instanceof CacheOrdering);
} // end equals
} // end class CacheOrdering
/*--------------------------------------------------------------------------------
* Internal class implementing a default cache ordering strategy
*--------------------------------------------------------------------------------
*/
static class DefaultStrategy implements CacheMapStrategy
{
private static final long SCALING_FACTOR = 5000;
DefaultStrategy()
{ // do nothing
} // end constructor
public long getEntryValue(CacheMapEntry entry, long tick)
{
return (entry.getHits() * SCALING_FACTOR) - entry.getAge(tick);
} // end getEntryValue
} // end class DefaultStrategy
/*--------------------------------------------------------------------------------
* Static data members
*--------------------------------------------------------------------------------
*/
private static final DefaultStrategy default_strategy_singleton = new DefaultStrategy();
/*--------------------------------------------------------------------------------
* Attributes
*--------------------------------------------------------------------------------
*/
private int capacity; // capacity of the CacheMap
private int shrink_percentage; // what percentage we shrink by when full
private CacheMapStrategy strategy; // strategy routine to use to purge entries
private HashMap base_map; // maps keys to CacheMapEntry values
private ArrayList element_list; // the actual elements
/*--------------------------------------------------------------------------------
* Constructors
*--------------------------------------------------------------------------------
*/
public CacheMap(int capacity, int shrink_percentage, CacheMapStrategy strategy)
{
if (capacity<=0)
throw new IllegalArgumentException("capacity must be greater than 0");
if ((shrink_percentage<=0) || (shrink_percentage>100))
throw new IllegalArgumentException("shrink_percentage must be in [1, 100]");
if (strategy==null)
throw new NullPointerException("no strategy passed to CacheMap");
this.capacity = capacity;
this.shrink_percentage = shrink_percentage;
this.strategy = strategy;
this.base_map = new HashMap(10);
this.element_list = new ArrayList(10);
} // end constructor
public CacheMap(int capacity, int shrink_percentage)
{
this(capacity,shrink_percentage,default_strategy_singleton);
} // end constructor
public CacheMap(int capacity)
{
this(capacity,10,default_strategy_singleton);
} // end constructor
/*--------------------------------------------------------------------------------
* Implementations from interface Map
*--------------------------------------------------------------------------------
*/
public int size()
{
return base_map.size();
} // end size
public boolean isEmpty()
{
return base_map.isEmpty();
} // end isEmpty
public boolean containsKey(Object key)
{
return base_map.containsKey(key);
} // end containsKey
public boolean containsValue(Object value)
{
Iterator it = element_list.iterator();
while (it.hasNext())
{ // look at all the CacheMapEntry values we have
CacheMapEntry cme = (CacheMapEntry)(it.next());
Object my_val = cme.getValue();
if (my_val==null)
{ // test for also null
if (value==null)
return true;
} // end if
else
{ // make sure the other value is non-null before we test equality
if ((value!=null) && my_val.equals(value))
return true;
} // end else
} // end while
return false; // nope, sorry
} // end containsValue
public Object get(Object key)
{
CacheMapEntry cme = (CacheMapEntry)(base_map.get(key));
if (cme==null)
return null;
cme.touch();
return cme.getValue();
} // end get
public Object put(Object key, Object value)
{
Object rc = null;
CacheMapEntry cme = (CacheMapEntry)(base_map.get(key));
if (cme==null)
{ // create a new CacheMapEntry for this key
cme = new CacheMapEntry(key,value);
synchronized (this)
{ // insert it into the basic object
if (base_map.size()==capacity)
shrink();
element_list.add(cme);
base_map.put(cme.getKey(),cme);
} // end synchronized block
} // end if
else
{ // we have an old value - replace it and touch the entry
cme.touch();
rc = cme.setValue(value);
} // end else
return rc;
} // end put
public Object remove(Object key)
{
Object rc = null;
CacheMapEntry cme = (CacheMapEntry)(base_map.get(key));
if (cme!=null)
{ // save the mapped value before we remove it
rc = cme.getValue();
synchronized (this)
{ // remove the values
base_map.remove(key);
element_list.remove(cme);
} // end synchronized block
} // end if
return rc;
} // end remove
public void putAll(Map map)
{
synchronized (this)
{ // make sure we have enough space in the CacheMap for all the new elements!
while ((map.size() + base_map.size()) > capacity)
shrink();
} // end synchronized block
Iterator it = map.entrySet().iterator();
while (it.hasNext())
{ // add each element in turn
Map.Entry me = (Map.Entry)(it.next());
put(me.getKey(),me.getValue());
} // end while
} // end putAll
public synchronized void clear()
{
base_map.clear();
element_list.clear();
} // end clear
public Set keySet()
{
return base_map.keySet();
} // end keySet
public Collection values()
{
return null; // not implemented
} // end values
public Set entrySet()
{
return null; // not implemented
} // end entrySet
public boolean equals(Object o)
{
if ((o==null) || !(o instanceof Map))
return false; // not a map
Map other = (Map)o;
if (other.size()!=base_map.size())
return false; // size does matter!
Iterator it = base_map.values().iterator();
while (it.hasNext())
{ // get each of the entries out and use that to do a key-value comparison
CacheMapEntry cme = (CacheMapEntry)(it.next());
Object o1 = cme.getValue();
Object o2 = other.get(cme.getKey());
if (o1==null)
{ // must have a matching null
if (o2!=null)
return false;
} // end if
else
{ // make sure we have a matching object (not null)
if ((o2==null) || !(o2.equals(o1)))
return false;
} // end else
} // end while
return true; // all OK!
} // end equals
public int hashCode()
{
int rc = 0;
Iterator it = base_map.values().iterator();
while (it.hasNext())
{ // add up the hash codes and return them
CacheMapEntry cme = (CacheMapEntry)(it.next());
rc += cme.hashCode();
} // end while
return rc;
} // end hashCode
/*--------------------------------------------------------------------------------
* External getters/setters
*--------------------------------------------------------------------------------
*/
public int getCapacity()
{
return capacity;
} // end getCapacity
public void setCapacity(int c)
{
if (c<=0)
throw new IllegalArgumentException("capacity must be greater than 0");
capacity = c;
} // end setCapacity
public int getShrinkPercentage()
{
return shrink_percentage;
} // end getShrinkPercentage
public void setShrinkPercentage(int p)
{
if ((p<=0) || (p>100))
throw new IllegalArgumentException("shrink_percentage must be in [1, 100]");
shrink_percentage = p;
} // end setShrinkPercentage
public CacheMapStrategy getStrategy()
{
return strategy;
} // end getStrategy
public void setStrategy(CacheMapStrategy s)
{
if (s==null)
throw new NullPointerException("no strategy passed to CacheMap");
strategy = s;
} // end setStrategy
/*--------------------------------------------------------------------------------
* External operations
*--------------------------------------------------------------------------------
*/
public synchronized void shrink()
{
// Figure out how many elements to remove.
int num_remove = (element_list.size() * shrink_percentage) / 100;
// Sort the element list to figure out which elements to remove.
Collections.sort(element_list,new CacheOrdering(strategy));
// The elements we want to remove are at the end of the array, so start from there.
for (int i=0; i<num_remove; i++)
{ // remove the "removed" entries from the hash map
CacheMapEntry cme = (CacheMapEntry)(element_list.remove(element_list.size() - 1));
base_map.remove(cme.getKey());
} // end for
} // end shrink
} // end class CacheMap

View File

@ -0,0 +1,154 @@
/*
* The contents of this file are subject to the Mozilla Public License Version 1.1
* (the "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at <http://www.mozilla.org/MPL/>.
*
* Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
* 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 Communities System.
*
* 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
* Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
package com.silverwrist.util.cachemap;
import java.util.*;
class CacheMapEntry implements Map.Entry
{
/*--------------------------------------------------------------------------------
* Attributes
*--------------------------------------------------------------------------------
*/
private Object key;
private Object value;
private int hits = 0;
private long timestamp;
/*--------------------------------------------------------------------------------
* Constructor
*--------------------------------------------------------------------------------
*/
CacheMapEntry(Object key, Object value)
{
this.key = key;
this.value = value;
this.timestamp = System.currentTimeMillis();
} // end constructor
/*--------------------------------------------------------------------------------
* finalize() function
*--------------------------------------------------------------------------------
*/
protected void finalize()
{
key = null;
value = null;
} // end finalize
/*--------------------------------------------------------------------------------
* Implementations from interface MapEntry
*--------------------------------------------------------------------------------
*/
public final Object getKey()
{
return key;
} // end getKey
public final Object getValue()
{
return value;
} // end getValue
public final Object setValue(Object o)
{
Object rc = value;
value = o;
return rc;
} // end setValue
public final boolean equals(Object o)
{
// make sure the other element is a Map.Entry
if ((o==null) || !(o instanceof Map.Entry))
return false;
Map.Entry other = (Map.Entry)o;
// compare the keys
if (key==null)
{ // the other key must be null
if (other.getKey()!=null)
return false;
} // end if
else
{ // the other key must be equal to us
if ((other.getKey()==null) || (!(key.equals(other.getKey()))))
return false;
} // end else
// compare the values
if (value==null)
return (other.getValue()==null);
else
return ((other.getValue()!=null) && value.equals(other.getValue()));
} // end equals
public final int hashCode()
{
int rc = 0;
if (key!=null)
rc ^= key.hashCode();
if (value!=null)
rc ^= value.hashCode();
return rc;
} // end hashCode
/*--------------------------------------------------------------------------------
* External operations
*--------------------------------------------------------------------------------
*/
final int getHits()
{
return hits;
} // end getHits
final long getTimestamp()
{
return timestamp;
} // end getTimestamp
final long getAge(long tick)
{
return (tick - timestamp);
} // end getAge
final void touch()
{
hits++;
timestamp = System.currentTimeMillis();
} // end touch
} // end class CacheMapEntry

View File

@ -15,23 +15,10 @@
* *
* Contributor(s): * Contributor(s):
*/ */
package com.silverwrist.venice.servlets.format; package com.silverwrist.util.cachemap;
import java.io.Writer; public interface CacheMapStrategy
import java.io.IOException;
public class MenuTop implements ComponentRender
{ {
public MenuTop() public abstract long getEntryValue(CacheMapEntry entry, long tick);
{ // constructor does nothing
} // end constructor
public void renderHere(Writer out, RenderData rdat) throws IOException } // end interface CacheMapStrategy
{
out.write("<B>Front Page</B><BR>\n");
out.write("<A HREF=\"\">Calendar</A><BR>\n"); // TODO: fill this link in
out.write("<A HREF=\"\">Chat</A>\n"); // TODO: fill this link in
} // end renderHere
} // end class MenuTop

View File

@ -18,7 +18,6 @@
package com.silverwrist.util.rcache; package com.silverwrist.util.rcache;
import java.util.*; import java.util.*;
import com.silverwrist.util.collections.*;
public class ReferenceCache public class ReferenceCache
{ {
@ -124,7 +123,7 @@ public class ReferenceCache
public List sweepReturn() public List sweepReturn()
{ {
Vector rc = new Vector(); ArrayList rc = new ArrayList();
int count = 0; int count = 0;
synchronized (this) synchronized (this)
@ -155,7 +154,7 @@ public class ReferenceCache
} // end synchronized block } // end synchronized block
return new ReadOnlyVector(rc); return Collections.unmodifiableList(rc);
} // end sweepReturn } // end sweepReturn

View File

@ -78,5 +78,17 @@ public interface TopicContext
public abstract void delete() throws DataException, AccessError; public abstract void delete() throws DataException, AccessError;
public abstract List getActivePosters(int skip, int limit) throws DataException, AccessError;
public abstract List getActivePosters(int limit) throws DataException, AccessError;
public abstract List getActivePosters() throws DataException, AccessError;
public abstract List getActiveReaders(int skip, int limit) throws DataException, AccessError;
public abstract List getActiveReaders(int limit) throws DataException, AccessError;
public abstract List getActiveReaders() throws DataException, AccessError;
} // end interface TopicContext } // end interface TopicContext

View File

@ -103,4 +103,8 @@ public interface UserContext extends SearchMode
public abstract void setTimeZone(TimeZone timezone) throws DataException; public abstract void setTimeZone(TimeZone timezone) throws DataException;
public abstract String getAuthenticationToken() throws AccessError, DataException;
public abstract boolean authenticateWithToken(String token) throws DataException;
} // end interface UserContext } // end interface UserContext

View File

@ -20,7 +20,6 @@ package com.silverwrist.venice.core.impl;
import java.sql.*; import java.sql.*;
import java.util.*; import java.util.*;
import org.apache.log4j.*; import org.apache.log4j.*;
import com.silverwrist.util.collections.*;
import com.silverwrist.venice.db.*; import com.silverwrist.venice.db.*;
import com.silverwrist.venice.core.*; import com.silverwrist.venice.core.*;
@ -70,7 +69,7 @@ class CategoryDescriptorImpl implements CategoryDescriptor, Cloneable
*/ */
private DataPool datapool; // used for doing database lookups private DataPool datapool; // used for doing database lookups
private Vector cats; // the actual category segments private LinkedList cats; // the actual category segments
private int symlink = -1; // if our category is actually a symlink private int symlink = -1; // if our category is actually a symlink
private boolean do_hide = true; // do we hide subcategories marked hide_dir? private boolean do_hide = true; // do we hide subcategories marked hide_dir?
@ -82,7 +81,7 @@ class CategoryDescriptorImpl implements CategoryDescriptor, Cloneable
CategoryDescriptorImpl(DataPool datapool, int catid, boolean do_hide) throws DataException CategoryDescriptorImpl(DataPool datapool, int catid, boolean do_hide) throws DataException
{ {
this.datapool = datapool; this.datapool = datapool;
cats = new Vector(); cats = new LinkedList();
this.do_hide = do_hide; this.do_hide = do_hide;
if (catid<0) if (catid<0)
@ -114,7 +113,7 @@ class CategoryDescriptorImpl implements CategoryDescriptor, Cloneable
throws SQLException, DataException throws SQLException, DataException
{ {
this.datapool = datapool; this.datapool = datapool;
cats = new Vector(); cats = new LinkedList();
this.do_hide = do_hide; this.do_hide = do_hide;
if (catid<0) if (catid<0)
@ -127,19 +126,18 @@ class CategoryDescriptorImpl implements CategoryDescriptor, Cloneable
protected CategoryDescriptorImpl(DataPool datapool, int id, int symlink, String name, boolean do_hide) protected CategoryDescriptorImpl(DataPool datapool, int id, int symlink, String name, boolean do_hide)
{ {
this.datapool = datapool; this.datapool = datapool;
this.cats = new Vector(); this.cats = new LinkedList();
this.symlink = symlink; this.symlink = symlink;
this.do_hide = do_hide; this.do_hide = do_hide;
this.cats.add(new CatSegment(id,name)); this.cats.add(new CatSegment(id,name));
this.cats.trimToSize();
} // end constructor } // end constructor
protected CategoryDescriptorImpl(CategoryDescriptorImpl other, int copy_levels) protected CategoryDescriptorImpl(CategoryDescriptorImpl other, int copy_levels)
{ {
this.datapool = other.datapool; this.datapool = other.datapool;
this.cats = new Vector(); this.cats = new LinkedList();
this.symlink = ((copy_levels==other.cats.size()) ? other.symlink : -1); this.symlink = ((copy_levels==other.cats.size()) ? other.symlink : -1);
this.do_hide = other.do_hide; this.do_hide = other.do_hide;
@ -147,7 +145,6 @@ class CategoryDescriptorImpl implements CategoryDescriptor, Cloneable
{ // copy the references to the objects directly { // copy the references to the objects directly
for (int i=0; i<copy_levels; i++) for (int i=0; i<copy_levels; i++)
this.cats.add(other.cats.get(i)); this.cats.add(other.cats.get(i));
this.cats.trimToSize();
} // end if } // end if
@ -156,7 +153,7 @@ class CategoryDescriptorImpl implements CategoryDescriptor, Cloneable
protected CategoryDescriptorImpl(CategoryDescriptorImpl other, int id, int symlink, String name) protected CategoryDescriptorImpl(CategoryDescriptorImpl other, int id, int symlink, String name)
{ {
this.datapool = other.datapool; this.datapool = other.datapool;
this.cats = new Vector(); this.cats = new LinkedList();
this.symlink = symlink; this.symlink = symlink;
this.do_hide = other.do_hide; this.do_hide = other.do_hide;
@ -164,7 +161,6 @@ class CategoryDescriptorImpl implements CategoryDescriptor, Cloneable
for (int i=0; i<other.cats.size(); i++) for (int i=0; i<other.cats.size(); i++)
this.cats.add(other.cats.get(i)); this.cats.add(other.cats.get(i));
this.cats.add(new CatSegment(id,name)); this.cats.add(new CatSegment(id,name));
this.cats.trimToSize();
} // end constructor } // end constructor
@ -209,13 +205,11 @@ class CategoryDescriptorImpl implements CategoryDescriptor, Cloneable
} // end if } // end if
cats.add(0,new CatSegment(curr_catid,rs.getString("name"))); cats.addFirst(new CatSegment(curr_catid,rs.getString("name")));
curr_catid = rs.getInt("parent"); curr_catid = rs.getInt("parent");
} // end while } // end while
cats.trimToSize(); // shrink vector down to size
} // end doFillFromTop } // end doFillFromTop
/*-------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------
@ -226,7 +220,7 @@ class CategoryDescriptorImpl implements CategoryDescriptor, Cloneable
public int getCategoryID() public int getCategoryID()
{ {
if (cats.size()>0) if (cats.size()>0)
return ((CatSegment)(cats.lastElement())).getID(); return ((CatSegment)(cats.getLast())).getID();
else else
return -1; return -1;
@ -260,7 +254,7 @@ class CategoryDescriptorImpl implements CategoryDescriptor, Cloneable
} // end if } // end if
Connection conn = null; Connection conn = null;
Vector rc = new Vector(); ArrayList rc = new ArrayList();
try try
{ // get a connection and create a statement { // get a connection and create a statement
conn = datapool.getConnection(); conn = datapool.getConnection();
@ -294,8 +288,7 @@ class CategoryDescriptorImpl implements CategoryDescriptor, Cloneable
} // end finally } // end finally
// wrap the vector in a ReadOnlyVector object return Collections.unmodifiableList(rc);
return new ReadOnlyVector(rc);
} // end getSubCategories } // end getSubCategories
@ -393,7 +386,7 @@ class CategoryDescriptorImpl implements CategoryDescriptor, Cloneable
static List getTopLevelCategoryList(DataPool datapool, boolean do_hide) throws DataException static List getTopLevelCategoryList(DataPool datapool, boolean do_hide) throws DataException
{ {
Connection conn = null; Connection conn = null;
Vector rc = new Vector(); ArrayList rc = new ArrayList();
try try
{ // get a connection and create a statement { // get a connection and create a statement
conn = datapool.getConnection(); conn = datapool.getConnection();
@ -426,8 +419,7 @@ class CategoryDescriptorImpl implements CategoryDescriptor, Cloneable
} // end finally } // end finally
// wrap the vector in a ReadOnlyVector object return Collections.unmodifiableList(rc);
return new ReadOnlyVector(rc);
} // end getTopLevelCategoryList } // end getTopLevelCategoryList
@ -438,7 +430,7 @@ class CategoryDescriptorImpl implements CategoryDescriptor, Cloneable
logger.debug("Category search: mode = " + String.valueOf(mode) + ", term '" + term + "', offset = " logger.debug("Category search: mode = " + String.valueOf(mode) + ", term '" + term + "', offset = "
+ String.valueOf(offset) + ", count = " + String.valueOf(count)); + String.valueOf(offset) + ", count = " + String.valueOf(count));
Vector rc = new Vector(); ArrayList rc = new ArrayList();
Connection conn = null; // pooled database connection Connection conn = null; // pooled database connection
try try
@ -505,7 +497,7 @@ class CategoryDescriptorImpl implements CategoryDescriptor, Cloneable
} // end finally } // end finally
return new ReadOnlyVector(rc); return Collections.unmodifiableList(rc);
} // end searchForCategories } // end searchForCategories

View File

@ -20,7 +20,6 @@ package com.silverwrist.venice.core.impl;
import java.sql.*; import java.sql.*;
import java.util.*; import java.util.*;
import org.apache.log4j.*; import org.apache.log4j.*;
import com.silverwrist.util.collections.*;
import com.silverwrist.venice.db.*; import com.silverwrist.venice.db.*;
import com.silverwrist.venice.security.AuditRecord; import com.silverwrist.venice.security.AuditRecord;
import com.silverwrist.venice.security.DefaultLevels; import com.silverwrist.venice.security.DefaultLevels;
@ -233,7 +232,7 @@ class ConferenceCoreData implements ConferenceData
throw new DataException("This conference has been deleted."); throw new DataException("This conference has been deleted.");
Connection conn = null; Connection conn = null;
Vector rc = new Vector(); ArrayList rc = new ArrayList();
try try
{ // get a database connection from this object { // get a database connection from this object
@ -263,7 +262,7 @@ class ConferenceCoreData implements ConferenceData
} // end finally } // end finally
return new ReadOnlyVector(rc); return Collections.unmodifiableList(rc);
} // end getAlias } // end getAlias
@ -273,7 +272,7 @@ class ConferenceCoreData implements ConferenceData
throw new DataException("This conference has been deleted."); throw new DataException("This conference has been deleted.");
Connection conn = null; Connection conn = null;
Vector rc = new Vector(); ArrayList rc = new ArrayList();
try try
{ // get a database connection from this object { // get a database connection from this object
@ -312,7 +311,7 @@ class ConferenceCoreData implements ConferenceData
} // end finally } // end finally
return new ReadOnlyVector(rc); return Collections.unmodifiableList(rc);
} // end getHosts } // end getHosts
@ -1059,7 +1058,7 @@ class ConferenceCoreData implements ConferenceData
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
logger.debug("Member list: conference = " + confid); logger.debug("Member list: conference = " + confid);
Vector rc = new Vector(); // return from this function ArrayList rc = new ArrayList(); // return from this function
Connection conn = null; // pooled database connection Connection conn = null; // pooled database connection
try try
@ -1104,7 +1103,7 @@ class ConferenceCoreData implements ConferenceData
} // end finally } // end finally
return new ReadOnlyVector(rc); return Collections.unmodifiableList(rc);
} // end getMemberList } // end getMemberList

View File

@ -20,7 +20,6 @@ package com.silverwrist.venice.core.impl;
import java.sql.*; import java.sql.*;
import java.util.*; import java.util.*;
import org.apache.log4j.*; import org.apache.log4j.*;
import com.silverwrist.util.collections.*;
import com.silverwrist.util.rcache.ReferencedData; import com.silverwrist.util.rcache.ReferencedData;
import com.silverwrist.venice.db.*; import com.silverwrist.venice.db.*;
import com.silverwrist.venice.htmlcheck.*; import com.silverwrist.venice.htmlcheck.*;
@ -95,19 +94,21 @@ class ConferenceUserContextImpl implements ConferenceContext, ConferenceBackend
} // end constructor } // end constructor
public void doFix(Statement stmt, int uid) throws SQLException public void doFix(Statement stmt, int uid, java.util.Date date) throws SQLException
{ {
StringBuffer sql = new StringBuffer(); StringBuffer sql = new StringBuffer();
if (do_insert) if (do_insert)
{ // construct an SQL INSERT statement { // construct an SQL INSERT statement
sql.append("INSERT INTO topicsettings (topicid, uid, last_message) VALUES (").append(topicid); sql.append("INSERT INTO topicsettings (topicid, uid, last_message, last_read) VALUES (");
sql.append(", ").append(uid).append(", ").append(top_message).append(");"); sql.append(topicid).append(", ").append(uid).append(", ").append(top_message).append(", '");
sql.append(SQLUtil.encodeDate(date)).append("');");
} // end if } // end if
else else
{ // construct an SQL UPDATE statement { // construct an SQL UPDATE statement
sql.append("UPDATE topicsettings SET last_message = ").append(top_message).append(" WHERE topicid = "); sql.append("UPDATE topicsettings SET last_message = ").append(top_message).append(", last_read = '");
sql.append(topicid).append(" AND uid = ").append(uid).append(';'); sql.append(SQLUtil.encodeDate(date)).append("' WHERE topicid = ").append(topicid);
sql.append(" AND uid = ").append(uid).append(';');
} // end else } // end else
@ -941,8 +942,17 @@ class ConferenceUserContextImpl implements ConferenceContext, ConferenceBackend
// now we need to reset our last post date // now we need to reset our last post date
Connection conn = null; Connection conn = null;
try try
{ // get a connection and feed it to the touchPost function { // get a connection
conn = datapool.getConnection(); conn = datapool.getConnection();
// create a new record in topicsettings (we WERE the first to post in the topic after all!)
Statement stmt = conn.createStatement();
StringBuffer sql = new StringBuffer("INSERT INTO topicsettings (topicid, uid, last_post) VALUES (");
sql.append(new_topic_inf.getTopicID()).append(", ").append(sig.realUID()).append(", '");
sql.append(SQLUtil.encodeDate(new_topic_inf.getCreateDate())).append("');");
stmt.executeUpdate(sql.toString());
// update the conference last-post information
touchPost(conn,new_topic_inf.getCreateDate()); touchPost(conn,new_topic_inf.getCreateDate());
} // end try } // end try
@ -1024,16 +1034,17 @@ class ConferenceUserContextImpl implements ConferenceContext, ConferenceBackend
ResultSet rs = stmt.executeQuery(sql.toString()); ResultSet rs = stmt.executeQuery(sql.toString());
// use the results to build up a list of FixSeenHelpers // use the results to build up a list of FixSeenHelpers
Vector tmp = new Vector(); ArrayList tmp = new ArrayList();
while (rs.next()) while (rs.next())
tmp.add(new FixSeenHelper(rs.getInt(1),rs.getInt(2),rs.getBoolean(3))); tmp.add(new FixSeenHelper(rs.getInt(1),rs.getInt(2),rs.getBoolean(3)));
// now iterate over the list and call doFix on each one // now iterate over the list and call doFix on each one
Iterator it = tmp.iterator(); Iterator it = tmp.iterator();
java.util.Date now = new java.util.Date();
while (it.hasNext()) while (it.hasNext())
{ // just hit each one in turn { // just hit each one in turn
FixSeenHelper fsh = (FixSeenHelper)(it.next()); FixSeenHelper fsh = (FixSeenHelper)(it.next());
fsh.doFix(stmt,sig.realUID()); fsh.doFix(stmt,sig.realUID(),now);
} // end while } // end while
@ -1074,7 +1085,7 @@ class ConferenceUserContextImpl implements ConferenceContext, ConferenceBackend
} // end if } // end if
Connection conn = null; Connection conn = null;
Vector rc = new Vector(); ArrayList rc = new ArrayList();
try try
{ // retrieve a connection from the datapool { // retrieve a connection from the datapool
@ -1115,7 +1126,7 @@ class ConferenceUserContextImpl implements ConferenceContext, ConferenceBackend
} // end finally } // end finally
return new ReadOnlyVector(rc); return Collections.unmodifiableList(rc);
} // end getActivePosters } // end getActivePosters
@ -1141,7 +1152,7 @@ class ConferenceUserContextImpl implements ConferenceContext, ConferenceBackend
} // end if } // end if
Connection conn = null; Connection conn = null;
Vector rc = new Vector(); ArrayList rc = new ArrayList();
try try
{ // retrieve a connection from the datapool { // retrieve a connection from the datapool
@ -1182,7 +1193,7 @@ class ConferenceUserContextImpl implements ConferenceContext, ConferenceBackend
} // end finally } // end finally
return new ReadOnlyVector(rc); return Collections.unmodifiableList(rc);
} // end getActiveReaders } // end getActiveReaders
@ -1700,7 +1711,7 @@ class ConferenceUserContextImpl implements ConferenceContext, ConferenceBackend
{ {
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
logger.debug("getSIGConferences for SIG # " + sig.realSIGID() + ", user #" + sig.realUID()); logger.debug("getSIGConferences for SIG # " + sig.realSIGID() + ", user #" + sig.realUID());
Vector rc = new Vector(); // return from this function ArrayList rc = new ArrayList(); // return from this function
Connection conn = null; // pooled database connection Connection conn = null; // pooled database connection
try try
@ -1751,7 +1762,7 @@ class ConferenceUserContextImpl implements ConferenceContext, ConferenceBackend
} // end finally } // end finally
return new ReadOnlyVector(rc); return Collections.unmodifiableList(rc);
} // end getSIGConferences } // end getSIGConferences
@ -1863,7 +1874,7 @@ class ConferenceUserContextImpl implements ConferenceContext, ConferenceBackend
logger.debug("getUserHotlist for user #" + user.realUID()); logger.debug("getUserHotlist for user #" + user.realUID());
Connection conn = null; // pooled database connection Connection conn = null; // pooled database connection
Vector rc = new Vector(); // return from this function ArrayList rc = new ArrayList(); // return from this function
try try
{ // get a database connection { // get a database connection
@ -1926,7 +1937,7 @@ class ConferenceUserContextImpl implements ConferenceContext, ConferenceBackend
} // end finally } // end finally
return new ReadOnlyVector(rc); return Collections.unmodifiableList(rc);
} // end getUserHotlist } // end getUserHotlist

View File

@ -93,4 +93,8 @@ public interface EngineBackend
public abstract void unpublish(long postid); public abstract void unpublish(long postid);
public abstract String generateRandomAuthString();
public abstract boolean isValidRandomAuthString(String s);
} // end interface EngineBackend } // end interface EngineBackend

View File

@ -21,7 +21,6 @@ import java.sql.*;
import java.util.*; import java.util.*;
import org.apache.log4j.*; import org.apache.log4j.*;
import com.silverwrist.util.StringUtil; import com.silverwrist.util.StringUtil;
import com.silverwrist.util.collections.*;
import com.silverwrist.util.rcache.*; import com.silverwrist.util.rcache.*;
import com.silverwrist.venice.db.*; import com.silverwrist.venice.db.*;
import com.silverwrist.venice.core.*; import com.silverwrist.venice.core.*;
@ -1493,7 +1492,7 @@ class SIGCoreData implements SIGData, SIGDataBackend
logger.debug("Member search: SIG = " + sigid + ", field = " + field + ", mode = " + mode + ", term '" logger.debug("Member search: SIG = " + sigid + ", field = " + field + ", mode = " + mode + ", term '"
+ term + "', offset = " + offset + ", count = " + count); + term + "', offset = " + offset + ", count = " + count);
Vector rc = new Vector(); // return from this function ArrayList rc = new ArrayList(); // return from this function
Connection conn = null; // pooled database connection Connection conn = null; // pooled database connection
try try
@ -1584,7 +1583,7 @@ class SIGCoreData implements SIGData, SIGDataBackend
} // end finally } // end finally
return new ReadOnlyVector(rc); return Collections.unmodifiableList(rc);
} // end searchForMembers } // end searchForMembers
@ -1689,7 +1688,7 @@ class SIGCoreData implements SIGData, SIGDataBackend
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
logger.debug("Member list: SIG = " + sigid); logger.debug("Member list: SIG = " + sigid);
Vector rc = new Vector(); // return from this function ArrayList rc = new ArrayList(); // return from this function
Connection conn = null; // pooled database connection Connection conn = null; // pooled database connection
try try
@ -1737,7 +1736,7 @@ class SIGCoreData implements SIGData, SIGDataBackend
} // end finally } // end finally
return new ReadOnlyVector(rc); return Collections.unmodifiableList(rc);
} // end getMemberList } // end getMemberList

View File

@ -21,7 +21,6 @@ import java.sql.*;
import java.util.*; import java.util.*;
import org.apache.log4j.*; import org.apache.log4j.*;
import com.silverwrist.util.StringUtil; import com.silverwrist.util.StringUtil;
import com.silverwrist.util.collections.*;
import com.silverwrist.util.rcache.ReferencedData; import com.silverwrist.util.rcache.ReferencedData;
import com.silverwrist.venice.db.*; import com.silverwrist.venice.db.*;
import com.silverwrist.venice.security.AuditRecord; import com.silverwrist.venice.security.AuditRecord;
@ -163,7 +162,7 @@ class SIGUserContextImpl implements SIGContext, SIGBackend
{ {
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
logger.debug("setMemberValues(" + String.valueOf(granted_level) + ", " + String.valueOf(member) logger.debug("setMemberValues(" + String.valueOf(granted_level) + ", " + String.valueOf(member)
+ ", " + String.valueOf(locked)); + ", " + String.valueOf(locked) + ")");
if (user.realBaseLevel()>granted_level) if (user.realBaseLevel()>granted_level)
this.level = user.realBaseLevel(); this.level = user.realBaseLevel();
@ -1484,7 +1483,7 @@ class SIGUserContextImpl implements SIGContext, SIGBackend
{ {
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
logger.debug("getMemberSIGEntries for user #" + String.valueOf(user.realUID())); logger.debug("getMemberSIGEntries for user #" + String.valueOf(user.realUID()));
Vector rc = new Vector(); // return from this function ArrayList rc = new ArrayList(); // return from this function
Connection conn = null; // pooled database connection Connection conn = null; // pooled database connection
try try
@ -1521,7 +1520,7 @@ class SIGUserContextImpl implements SIGContext, SIGBackend
} // end finally } // end finally
return new ReadOnlyVector(rc); return Collections.unmodifiableList(rc);
} // end getMemberSIGEntries } // end getMemberSIGEntries
@ -1611,7 +1610,7 @@ class SIGUserContextImpl implements SIGContext, SIGBackend
+ ", term '" + term + "', offset = " + String.valueOf(offset) + ", count = " + ", term '" + term + "', offset = " + String.valueOf(offset) + ", count = "
+ String.valueOf(count)); + String.valueOf(count));
Vector rc = new Vector(); // return from this function ArrayList rc = new ArrayList(); // return from this function
Connection conn = null; // pooled database connection Connection conn = null; // pooled database connection
try try
@ -1688,7 +1687,7 @@ class SIGUserContextImpl implements SIGContext, SIGBackend
} // end finally } // end finally
return new ReadOnlyVector(rc); return Collections.unmodifiableList(rc);
} // end searchForSIGs } // end searchForSIGs
@ -1780,7 +1779,7 @@ class SIGUserContextImpl implements SIGContext, SIGBackend
logger.debug("reading SIGs in category " + String.valueOf(catid) + ", offset = " logger.debug("reading SIGs in category " + String.valueOf(catid) + ", offset = "
+ String.valueOf(offset) + ", count = " + String.valueOf(count)); + String.valueOf(offset) + ", count = " + String.valueOf(count));
Vector rc = new Vector(); // return from this function ArrayList rc = new ArrayList(); // return from this function
Connection conn = null; // pooled database connection Connection conn = null; // pooled database connection
try try
@ -1823,7 +1822,7 @@ class SIGUserContextImpl implements SIGContext, SIGBackend
} // end finally } // end finally
return new ReadOnlyVector(rc); return Collections.unmodifiableList(rc);
} // end getSIGsInCategory } // end getSIGsInCategory

View File

@ -23,7 +23,6 @@ import java.util.*;
import java.util.zip.*; import java.util.zip.*;
import org.apache.log4j.*; import org.apache.log4j.*;
import com.silverwrist.util.StringUtil; import com.silverwrist.util.StringUtil;
import com.silverwrist.util.collections.*;
import com.silverwrist.venice.db.*; import com.silverwrist.venice.db.*;
import com.silverwrist.venice.security.AuditRecord; import com.silverwrist.venice.security.AuditRecord;
import com.silverwrist.venice.security.Capability; import com.silverwrist.venice.security.Capability;
@ -1092,7 +1091,7 @@ class TopicMessageUserContextImpl implements TopicMessageContext
logger.debug("loadMessageRange for conf # " + conf.realConfID() + ", topic #" + topicid + ", range [" logger.debug("loadMessageRange for conf # " + conf.realConfID() + ", topic #" + topicid + ", range ["
+ post_low + ", " + post_high + "]"); + post_low + ", " + post_high + "]");
Vector rc = new Vector(); ArrayList rc = new ArrayList();
Connection conn = null; // pooled database connection Connection conn = null; // pooled database connection
try try
@ -1138,7 +1137,7 @@ class TopicMessageUserContextImpl implements TopicMessageContext
} // end finally } // end finally
return new ReadOnlyVector(rc); // wrap the return vector return Collections.unmodifiableList(rc); // wrap the return vector
} // end loadMessageRange } // end loadMessageRange

View File

@ -20,7 +20,6 @@ package com.silverwrist.venice.core.impl;
import java.sql.*; import java.sql.*;
import java.util.*; import java.util.*;
import org.apache.log4j.*; import org.apache.log4j.*;
import com.silverwrist.util.collections.*;
import com.silverwrist.venice.db.*; import com.silverwrist.venice.db.*;
import com.silverwrist.venice.htmlcheck.*; import com.silverwrist.venice.htmlcheck.*;
import com.silverwrist.venice.security.AuditRecord; import com.silverwrist.venice.security.AuditRecord;
@ -511,7 +510,9 @@ class TopicUserContextImpl implements TopicContext
try try
{ // start by trying to see if we can update topicsettings directly { // start by trying to see if we can update topicsettings directly
StringBuffer sql = new StringBuffer("UPDATE topicsettings SET last_message = "); StringBuffer sql = new StringBuffer("UPDATE topicsettings SET last_message = ");
sql.append(last_msg).append(" WHERE topicid = ").append(topicid).append(" AND uid = "); sql.append(last_msg).append(", last_read = '");
java.util.Date now = new java.util.Date();
sql.append(SQLUtil.encodeDate(now)).append("' WHERE topicid = ").append(topicid).append(" AND uid = ");
sql.append(conf.realUID()).append(';'); sql.append(conf.realUID()).append(';');
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
logger.debug("SQL: " + sql.toString()); logger.debug("SQL: " + sql.toString());
@ -540,8 +541,9 @@ class TopicUserContextImpl implements TopicContext
// OK, just insert a new row into topicsettings, why dontcha... // OK, just insert a new row into topicsettings, why dontcha...
sql.setLength(0); sql.setLength(0);
sql.append("INSERT INTO topicsettings (topicid, uid, last_message) VALUES (").append(topicid); sql.append("INSERT INTO topicsettings (topicid, uid, last_message, last_read) VALUES (");
sql.append(", ").append(conf.realUID()).append(", ").append(last_msg).append(");"); sql.append(topicid).append(", ").append(conf.realUID()).append(", ").append(last_msg).append(", '");
sql.append(SQLUtil.encodeDate(now)).append("');");
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
logger.debug("SQL: " + sql.toString()); logger.debug("SQL: " + sql.toString());
stmt.executeUpdate(sql.toString()); stmt.executeUpdate(sql.toString());
@ -691,7 +693,7 @@ class TopicUserContextImpl implements TopicContext
// slap a lock on all the tables we need to touch // slap a lock on all the tables we need to touch
stmt.executeUpdate("LOCK TABLES confs WRITE, topics WRITE, posts WRITE, postdata WRITE, " stmt.executeUpdate("LOCK TABLES confs WRITE, topics WRITE, posts WRITE, postdata WRITE, "
+ "confsettings WRITE, topicsettings READ;"); + "confsettings WRITE, topicsettings WRITE;");
try try
{ // refresh our current status and recheck allowed status { // refresh our current status and recheck allowed status
@ -755,6 +757,25 @@ class TopicUserContextImpl implements TopicContext
sql.append(real_text).append("');"); sql.append(real_text).append("');");
stmt.executeUpdate(sql.toString()); stmt.executeUpdate(sql.toString());
// mark that we posted to the topic
sql.setLength(0);
sql.append("UPDATE topicsettings SET last_post = '").append(SQLUtil.encodeDate(posted_date));
sql.append("' WHERE topicid = ").append(topicid).append(" AND uid = ").append(conf.realUID());
sql.append(';');
if (logger.isDebugEnabled())
logger.debug("SQL: " + sql.toString());
if (stmt.executeUpdate(sql.toString())<1)
{ // we had no topicsettings record, add one
sql.setLength(0);
sql.append("INSERT INTO topicsettings (topicid, uid, last_post) VALUES (").append(topicid);
sql.append(", ").append(conf.realUID()).append(", '").append(SQLUtil.encodeDate(posted_date));
sql.append("');");
if (logger.isDebugEnabled())
logger.debug("SQL: " + sql.toString());
stmt.executeUpdate(sql.toString());
} // end if
// mark that we posted to the conference // mark that we posted to the conference
conf.touchUpdate(conn,posted_date); conf.touchUpdate(conn,posted_date);
conf.touchPost(conn,posted_date); conf.touchPost(conn,posted_date);
@ -925,6 +946,126 @@ class TopicUserContextImpl implements TopicContext
} // end delete } // end delete
public List getActivePosters(int skip, int limit) throws DataException
{
Connection conn = null;
ArrayList rc = new ArrayList();
try
{ // retrieve a connection from the datapool
conn = datapool.getConnection();
Statement stmt = conn.createStatement();
// create the SQL statement to retrieve all posters
StringBuffer sql =
new StringBuffer("SELECT s.uid, u.username, s.last_read, s.last_post FROM topicsettings s, "
+ "users u WHERE u.uid = s.uid AND s.topicid = ");
sql.append(topicid).append(" AND u.is_anon = 0 AND ISNULL(s.last_post) = 0 ORDER BY s.last_post DESC");
if ((skip>=0) && (limit>0))
sql.append(" LIMIT ").append(skip).append(", ").append(limit);
sql.append(';');
// execute the statement
ResultSet rs = stmt.executeQuery(sql.toString());
while (rs.next())
{ // return all the records as ActiveUser data elements
ActiveUser usr = new ActiveUserImpl(rs.getInt(1),rs.getString(2),SQLUtil.getFullDateTime(rs,3),
SQLUtil.getFullDateTime(rs,4));
rc.add(usr);
} // end while
} // end try
catch (SQLException e)
{ // this becomes a DataException
logger.error("DB error getting active poster list: " + e.getMessage(),e);
throw new DataException("unable to get active poster listing: " + e.getMessage(),e);
} // end catch
finally
{ // make sure we release the connection before we go
if (conn!=null)
datapool.releaseConnection(conn);
} // end finally
return Collections.unmodifiableList(rc);
} // end getActivePosters
public List getActivePosters(int limit) throws DataException, AccessError
{
return getActivePosters(0,limit);
} // end getActivePosters
public List getActivePosters() throws DataException, AccessError
{
return getActivePosters(-1,-1);
} // end getActivePosters
public List getActiveReaders(int skip, int limit) throws DataException, AccessError
{
Connection conn = null;
ArrayList rc = new ArrayList();
try
{ // retrieve a connection from the datapool
conn = datapool.getConnection();
Statement stmt = conn.createStatement();
// create the SQL statement to retrieve all readers
StringBuffer sql =
new StringBuffer("SELECT s.uid, u.username, s.last_read, s.last_post FROM topicsettings s, "
+ "users u WHERE u.uid = s.uid AND s.topicid = ");
sql.append(topicid).append(" AND u.is_anon = 0 AND ISNULL(s.last_read) = 0 ORDER BY s.last_read DESC");
if ((skip>=0) && (limit>0))
sql.append(" LIMIT ").append(skip).append(", ").append(limit);
sql.append(';');
// execute the statement
ResultSet rs = stmt.executeQuery(sql.toString());
while (rs.next())
{ // return all the records as ActiveUser data elements
ActiveUser usr = new ActiveUserImpl(rs.getInt(1),rs.getString(2),SQLUtil.getFullDateTime(rs,3),
SQLUtil.getFullDateTime(rs,4));
rc.add(usr);
} // end while
} // end try
catch (SQLException e)
{ // this becomes a DataException
logger.error("DB error getting active reader list: " + e.getMessage(),e);
throw new DataException("unable to get active reader listing: " + e.getMessage(),e);
} // end catch
finally
{ // make sure we release the connection before we go
if (conn!=null)
datapool.releaseConnection(conn);
} // end finally
return Collections.unmodifiableList(rc);
} // end getActiveReaders
public List getActiveReaders(int limit) throws DataException, AccessError
{
return getActiveReaders(0,limit);
} // end getActiveReaders
public List getActiveReaders() throws DataException, AccessError
{
return getActiveReaders(-1,-1);
} // end getActiveReaders
/*-------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------
* External operations usable only from within the package * External operations usable only from within the package
*-------------------------------------------------------------------------------- *--------------------------------------------------------------------------------
@ -936,7 +1077,7 @@ class TopicUserContextImpl implements TopicContext
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
logger.debug("getTopicList for conf # " + String.valueOf(conf.realConfID()) + ", user #" logger.debug("getTopicList for conf # " + String.valueOf(conf.realConfID()) + ", user #"
+ String.valueOf(conf.realUID())); + String.valueOf(conf.realUID()));
Vector rc = new Vector(); // return from this function ArrayList rc = new ArrayList(); // return from this function
Connection conn = null; // pooled database connection Connection conn = null; // pooled database connection
try try
@ -1088,7 +1229,7 @@ class TopicUserContextImpl implements TopicContext
} // end finally } // end finally
return new ReadOnlyVector(rc); return Collections.unmodifiableList(rc);
} // end getTopicList } // end getTopicList

View File

@ -22,7 +22,6 @@ import java.sql.*;
import org.apache.log4j.*; import org.apache.log4j.*;
import com.silverwrist.util.LocaleFactory; import com.silverwrist.util.LocaleFactory;
import com.silverwrist.util.StringUtil; import com.silverwrist.util.StringUtil;
import com.silverwrist.util.collections.*;
import com.silverwrist.util.rcache.ReferencedData; import com.silverwrist.util.rcache.ReferencedData;
import com.silverwrist.venice.*; import com.silverwrist.venice.*;
import com.silverwrist.venice.core.*; import com.silverwrist.venice.core.*;
@ -41,6 +40,9 @@ class UserContextImpl implements UserContext, UserBackend
private static Category logger = Category.getInstance(UserContextImpl.class.getName()); private static Category logger = Category.getInstance(UserContextImpl.class.getName());
private static final String AUTH_TOKEN_PREFIX = "VQAT:";
private static final char AUTH_TOKEN_SEP = '|';
/*-------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------
* Attributes * Attributes
*-------------------------------------------------------------------------------- *--------------------------------------------------------------------------------
@ -902,7 +904,7 @@ class UserContextImpl implements UserContext, UserBackend
public List getSideBoxList() throws DataException public List getSideBoxList() throws DataException
{ {
Connection conn = null; Connection conn = null;
Vector rc = new Vector(); ArrayList rc = new ArrayList();
try try
{ // retrieve a connection from the data pool { // retrieve a connection from the data pool
@ -934,7 +936,7 @@ class UserContextImpl implements UserContext, UserBackend
} // end finally } // end finally
return new ReadOnlyVector(rc); return Collections.unmodifiableList(rc);
} // end getSideBoxList } // end getSideBoxList
@ -1052,6 +1054,235 @@ class UserContextImpl implements UserContext, UserBackend
} // end setTimeZone } // end setTimeZone
public String getAuthenticationToken() throws AccessError, DataException
{
if (!isLoggedIn())
{ // can't generate an authentication token if we're not authenticated!
logger.error("UserContext not authenticated, cannot generate auth token");
throw new AccessError("You cannot generate an authentication token without logging in.");
} // end if
// Generate a random authentication string and poke it into the database for this user.
String tokenauth = engine.generateRandomAuthString();
Connection conn = null;
try
{ // retrieve a connection from the data pool
conn = datapool.getConnection();
Statement stmt = conn.createStatement();
StringBuffer sql = new StringBuffer("UPDATE users SET tokenauth = '");
sql.append(tokenauth).append("' WHERE uid = ").append(uid).append(';');
stmt.executeUpdate(sql.toString());
} // end try
catch (SQLException e)
{ // turn SQLException into data exception
logger.error("DB error setting token authentication string: " + e.getMessage(),e);
throw new DataException("Unable to set authentication token: " + e.getMessage(),e);
} // end catch
finally
{ // make sure the connection is released before we go
if (conn!=null)
datapool.releaseConnection(conn);
} // end finally
// Build the full authentication token string value.
int checkvalue = uid ^ tokenauth.hashCode();
StringBuffer buf = new StringBuffer(AUTH_TOKEN_PREFIX);
buf.append(uid).append(AUTH_TOKEN_SEP).append(tokenauth).append(AUTH_TOKEN_SEP).append(checkvalue);
buf.append(AUTH_TOKEN_SEP);
return buf.toString();
} // end getAuthenticationToken
public boolean authenticateWithToken(String token) throws DataException
{
if (isLoggedIn())
{ // already authenticated, can't authenticate again
logger.error("UserContext already authenticated (with uid " + uid + ")");
throw new InternalStateError("context already authenticated");
} // end if
if (logger.isDebugEnabled())
logger.debug("decoding authtoken: " + token);
// Pick apart the authentication token value.
if (!(token.startsWith(AUTH_TOKEN_PREFIX)))
{ // token parse error
logger.error("Token parse error: prefix not valid");
return false;
} // end if
int xstart = AUTH_TOKEN_PREFIX.length();
int xend = token.indexOf(AUTH_TOKEN_SEP,xstart);
if (xend<0)
{ // could not find the UID separator
logger.error("Token parse error: UID sep not found");
return false;
} // end if
int pending_uid;
try
{ // get the user ID
pending_uid = Integer.parseInt(token.substring(xstart,xend));
} // end try
catch (NumberFormatException nfe)
{ // we couldn't parse the UID
logger.error("Token parse error: invalid UID value");
return false;
} // end catch
xstart = xend + 1;
xend = token.indexOf(AUTH_TOKEN_SEP,xstart);
if (xend<0)
{ // could not find the auth string separator
logger.error("Token parse error: auth string sep not found");
return false;
} // end if
String pending_auth = token.substring(xstart,xend);
if (!(engine.isValidRandomAuthString(pending_auth)))
{ // the auth string is not valid by the rules under which it was generated
logger.error("Token parse error: invalid auth string value");
return false;
} // end if
xstart = xend + 1;
xend = token.indexOf(AUTH_TOKEN_SEP,xstart);
if (xend<0)
{ // could not find the checkvalue separator
logger.error("Token parse error: checkvalue sep not found");
return false;
} // end if
int checkvalue;
try
{ // get the check value
checkvalue = Integer.parseInt(token.substring(xstart,xend));
} // end try
catch (NumberFormatException nfe)
{ // we couldn't parse the checkvalue
logger.error("Token parse error: invalid checkvalue");
return false;
} // end catch
if (checkvalue!=(pending_uid ^ pending_auth.hashCode()))
{ // the checkvalue does not match what it should - possible corrupted token
logger.error("Token parse error: checkvalue does not match");
return false;
} // end if
// At this point, we now have a UID and authentication string extracted from the token.
// Proceed to authenticate.
if (logger.isDebugEnabled())
logger.debug("Authenticating user ID#" + pending_uid);
Connection conn = null;
AuditRecord ar = null;
try
{ // look for a user record matching this user ID
conn = datapool.getConnection();
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("SELECT * FROM users WHERE uid = " + pending_uid + ";");
if (!(rs.next()))
{ // user not found
logger.error("...user not found");
ar = new AuditRecord(AuditRecord.LOGIN_FAIL,0,remote_addr,"Bad token UID: " + pending_uid);
return false;
} // end if
if (rs.getBoolean("is_anon"))
{ // can't log in as Anonymous Honyak
logger.error("...user is the Anonymous Honyak, can't explicitly login");
ar = new AuditRecord(AuditRecord.LOGIN_FAIL,pending_uid,remote_addr,"Anonymous user");
return false;
} // end if
if (rs.getBoolean("lockout"))
{ // account locked out
logger.error("...user is locked out by the Admin");
ar = new AuditRecord(AuditRecord.LOGIN_FAIL,pending_uid,remote_addr,"Account locked out");
return false;
} // end if
// compare the stored token auth value to what we have
if (!(pending_auth.equals(rs.getString("tokenauth"))))
{ // the auth string is bad - we can't log in
logger.warn("...invalid authentication string");
ar = new AuditRecord(AuditRecord.LOGIN_FAIL,pending_uid,remote_addr,"Bad auth-string");
return false;
} // end if
if (logger.isDebugEnabled())
logger.debug("...authenticated");
// we're authenticated - load the user data into the context
loadUserData(rs);
// update the "last access" time in the database
java.util.Date mydate = new java.util.Date();
stmt.executeUpdate("UPDATE users SET lastaccess = '" + SQLUtil.encodeDate(mydate)
+ "' WHERE uid = " + uid + ";");
// update the "last access" time in this object
last_access = mydate;
// an audit record indicating we logged in OK
ar = new AuditRecord(AuditRecord.LOGIN_OK,uid,remote_addr);
if (logger.isDebugEnabled())
logger.debug("...context loaded, we're ready :-)");
} // end try
catch (SQLException e)
{ // database error - this is a DataException
logger.error("DB error reading user data: " + e.getMessage(),e);
throw new DataException("unable to access user data: " + e.getMessage(),e);
} // end catch
finally
{ // make sure the connection is released before we go
try
{ // save off the audit record before we go, though
if ((ar!=null) && (conn!=null))
ar.store(conn);
} // end try
catch (SQLException e)
{ // we couldn't store the audit record!
logger.error("DB error saving audit record: " + e.getMessage(),e);
} // end catch
if (conn!=null)
datapool.releaseConnection(conn);
} // end if
return true; // token authentication worked!
} // end authenticateWithToken
/*-------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------
* Implementations from interface UserBackend * Implementations from interface UserBackend
*-------------------------------------------------------------------------------- *--------------------------------------------------------------------------------

View File

@ -23,7 +23,6 @@ import org.apache.log4j.*;
import org.w3c.dom.*; import org.w3c.dom.*;
import com.silverwrist.util.StringUtil; import com.silverwrist.util.StringUtil;
import com.silverwrist.util.DOMElementHelper; import com.silverwrist.util.DOMElementHelper;
import com.silverwrist.util.collections.*;
import com.silverwrist.util.rcache.*; import com.silverwrist.util.rcache.*;
import com.silverwrist.venice.core.*; import com.silverwrist.venice.core.*;
import com.silverwrist.venice.db.*; import com.silverwrist.venice.db.*;
@ -385,6 +384,10 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
private static Category logger = Category.getInstance(VeniceEngineImpl.class.getName()); private static Category logger = Category.getInstance(VeniceEngineImpl.class.getName());
private static final String AUTH_ALPHABET =
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz./";
private static final int AUTH_STRING_LEN = 32;
/*-------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------
* Attributes * Attributes
*-------------------------------------------------------------------------------- *--------------------------------------------------------------------------------
@ -406,7 +409,7 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
private int[] gp_ints; // global integer parameters private int[] gp_ints; // global integer parameters
private MasterSideBox[] sideboxes; // master sidebox table private MasterSideBox[] sideboxes; // master sidebox table
private Hashtable sidebox_ids = new Hashtable(); // maps sidebox IDs to MasterSideBox objects private Hashtable sidebox_ids = new Hashtable(); // maps sidebox IDs to MasterSideBox objects
private Vector cache_fp_posts = new Vector(); // all posts that have been published to front page private LinkedList cache_fp_posts = new LinkedList(); // all posts that have been published to front page
private boolean cache_fp_posts_busy = false; // busy flag for above vector private boolean cache_fp_posts_busy = false; // busy flag for above vector
/*-------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------
@ -482,7 +485,7 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
this.config = config; this.config = config;
Vector dictionary_tmp; ArrayList dictionary_tmp;
try try
{ // first, verify that this is a valid configuration { // first, verify that this is a valid configuration
Element root = config.getDocumentElement(); Element root = config.getDocumentElement();
@ -542,7 +545,7 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
} // end if } // end if
// Retrieve the list of dictionary files to load into the spellchecker. // Retrieve the list of dictionary files to load into the spellchecker.
dictionary_tmp = new Vector(); dictionary_tmp = new ArrayList();
NodeList dict_nodes = dict_sect.getChildNodes(); NodeList dict_nodes = dict_sect.getChildNodes();
for (i=0; i<dict_nodes.getLength(); i++) for (i=0; i<dict_nodes.getLength(); i++)
{ // scan the <dictionary> element looking for <file> elements { // scan the <dictionary> element looking for <file> elements
@ -625,15 +628,13 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
logger.debug(max_value + " features loaded from database"); logger.debug(max_value + " features loaded from database");
// load the master sidebox table // load the master sidebox table
Vector sidebox_tmp = new Vector(); ArrayList sidebox_tmp = new ArrayList();
rs = stmt.executeQuery("SELECT * FROM refsidebox ORDER BY boxid;"); rs = stmt.executeQuery("SELECT * FROM refsidebox ORDER BY boxid;");
while (rs.next()) while (rs.next())
sidebox_tmp.add(new MasterSideBox(rs)); sidebox_tmp.add(new MasterSideBox(rs));
// store the real master sidebox table as an array // store the real master sidebox table as an array
sideboxes = new MasterSideBox[sidebox_tmp.size()]; sideboxes = (MasterSideBox[])(sidebox_tmp.toArray(new MasterSideBox[0]));
for (i=0; i<sidebox_tmp.size(); i++)
sideboxes[i] = (MasterSideBox)(sidebox_tmp.get(i));
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
logger.debug(sideboxes.length + " sidebox definitions loaded from database"); logger.debug(sideboxes.length + " sidebox definitions loaded from database");
@ -671,10 +672,7 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
UserNameRewriter username_rewriter = new UserNameRewriter(datapool); UserNameRewriter username_rewriter = new UserNameRewriter(datapool);
// Create the LazyLexicon that holds our dictionary files, and add it to the SpellingRewriter. // Create the LazyLexicon that holds our dictionary files, and add it to the SpellingRewriter.
String[] dictfiles = new String[dictionary_tmp.size()]; LazyTreeLexicon lex = new LazyTreeLexicon((String[])(dictionary_tmp.toArray(new String[0])));
for (i=0; i<dictionary_tmp.size(); i++)
dictfiles[i] = (String)(dictionary_tmp.get(i));
LazyTreeLexicon lex = new LazyTreeLexicon(dictfiles);
spell_rewriter.addDictionary(lex); spell_rewriter.addDictionary(lex);
html_configs = new HTMLCheckerConfig[4]; // create the array html_configs = new HTMLCheckerConfig[4]; // create the array
@ -771,7 +769,7 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
{ {
checkInitialized(); checkInitialized();
Connection conn = null; Connection conn = null;
Vector rc = new Vector(); ArrayList rc = new ArrayList();
try try
{ // do a SELECT on the refcountry table to load the master country list { // do a SELECT on the refcountry table to load the master country list
@ -803,7 +801,7 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
} // end finally } // end finally
return new ReadOnlyVector(rc); return Collections.unmodifiableList(rc);
} // end getCountryList } // end getCountryList
@ -811,7 +809,7 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
{ {
checkInitialized(); checkInitialized();
Connection conn = null; Connection conn = null;
Vector rc = new Vector(); ArrayList rc = new ArrayList();
try try
{ // do a SELECT on the refcountry table to load the master country list { // do a SELECT on the refcountry table to load the master country list
@ -843,7 +841,7 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
} // end finally } // end finally
return new ReadOnlyVector(rc); return Collections.unmodifiableList(rc);
} // end getLanguageList } // end getLanguageList
@ -1225,8 +1223,8 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
logger.debug("User search: field = " + field + ", mode = " + mode + ", term '" + term + "', offset = " logger.debug("User search: field = " + field + ", mode = " + mode + ", term '" + term + "', offset = "
+ offset + ", count = " + count); + offset + ", count = " + count);
Vector rc = new Vector(); // return from this function ArrayList rc = new ArrayList(); // return from this function
Connection conn = null; // pooled database connection Connection conn = null; // pooled database connection
try try
{ // get a database connection { // get a database connection
@ -1309,7 +1307,7 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
} // end finally } // end finally
return new ReadOnlyVector(rc); return Collections.unmodifiableList(rc);
} // end searchForUsers } // end searchForUsers
@ -1506,7 +1504,7 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
public List getPublishedMessages(boolean all) throws DataException public List getPublishedMessages(boolean all) throws DataException
{ {
Vector rc = new Vector(); ArrayList rc = new ArrayList();
synchronized (this) synchronized (this)
{ // Make sure the cache is in condition. { // Make sure the cache is in condition.
@ -1542,7 +1540,7 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
if (all) // add the extra postings to the list if (all) // add the extra postings to the list
PublishedMessageImpl.backfillReturn(rc,datapool); PublishedMessageImpl.backfillReturn(rc,datapool);
return new ReadOnlyVector(rc); return Collections.unmodifiableList(rc);
} // end getPublishedMessages } // end getPublishedMessages
@ -1713,7 +1711,7 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
public List getSIGFeatureSet(BitSet enabled_features, int level, boolean read_privs) public List getSIGFeatureSet(BitSet enabled_features, int level, boolean read_privs)
{ {
checkInitialized(); checkInitialized();
Vector rc = new Vector(); ArrayList rc = new ArrayList();
for (int i=0; i<features.length; i++) for (int i=0; i<features.length; i++)
if (enabled_features.get(i) && features[i].featureAllowed(level,read_privs)) if (enabled_features.get(i) && features[i].featureAllowed(level,read_privs))
{ // this feature must be included in the eventual output set { // this feature must be included in the eventual output set
@ -1728,14 +1726,14 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
} // end if and for } // end if and for
if (insert_me) // insert at end by default if (insert_me) // insert at end by default
rc.addElement(elt); rc.add(elt);
} // end if and for } // end if and for
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
logger.debug("getSIGFeatureSet() loaded " + rc.size() + " elements"); logger.debug("getSIGFeatureSet() loaded " + rc.size() + " elements");
return new ReadOnlyVector(rc); // wrap the vector for return return Collections.unmodifiableList(rc); // wrap the vector for return
} // end getSIGFeatureSet } // end getSIGFeatureSet
@ -1934,9 +1932,9 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
{ {
if (pubmsg!=null) if (pubmsg!=null)
{ // add the new message { // add the new message
cache_fp_posts.add(0,pubmsg); cache_fp_posts.addFirst(pubmsg);
while (cache_fp_posts.size()>gp_ints[IP_NUMFRONTPAGEPOSTS]) while (cache_fp_posts.size()>gp_ints[IP_NUMFRONTPAGEPOSTS])
cache_fp_posts.remove(cache_fp_posts.size()-1); cache_fp_posts.removeLast();
} // end pubmsg } // end pubmsg
@ -1962,4 +1960,28 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
} // end unpublish } // end unpublish
public String generateRandomAuthString()
{
StringBuffer buf = new StringBuffer(AUTH_STRING_LEN);
for (int i=0; i<AUTH_STRING_LEN; i++)
buf.append(AUTH_ALPHABET.charAt(rng.nextInt(AUTH_ALPHABET.length())));
return buf.toString();
} // end generateRandomAuthString
public boolean isValidRandomAuthString(String s)
{
if (s.length()!=AUTH_STRING_LEN)
return false;
for (int i=0; i<AUTH_STRING_LEN; i++)
{ // verify each authentication character in turn
if (AUTH_ALPHABET.indexOf(s.charAt(i))<0)
return false;
} // end for
return true; // all tests passed - ship it!
} // end isValidRandomAuthString
} // end class VeniceEngineImpl } // end class VeniceEngineImpl

View File

@ -19,7 +19,6 @@ package com.silverwrist.venice.security;
import java.sql.*; import java.sql.*;
import java.util.*; import java.util.*;
import com.silverwrist.util.collections.*;
import com.silverwrist.venice.db.SQLUtil; import com.silverwrist.venice.db.SQLUtil;
import com.silverwrist.venice.core.AuditData; import com.silverwrist.venice.core.AuditData;
import com.silverwrist.venice.core.DataException; import com.silverwrist.venice.core.DataException;
@ -34,9 +33,9 @@ public class AuditRecord implements AuditData
static class DescrStringCache static class DescrStringCache
{ {
private Hashtable descr_cache = new Hashtable(); private HashMap descr_cache = new HashMap();
private Hashtable uname_cache = new Hashtable(); private HashMap uname_cache = new HashMap();
private Hashtable signame_cache = new Hashtable(); private HashMap signame_cache = new HashMap();
private Statement stmt; private Statement stmt;
DescrStringCache(Connection conn) throws SQLException DescrStringCache(Connection conn) throws SQLException
@ -363,7 +362,7 @@ public class AuditRecord implements AuditData
public static List getAuditRecords(Connection conn, int sigid, int offset, int count) public static List getAuditRecords(Connection conn, int sigid, int offset, int count)
throws SQLException, DataException throws SQLException, DataException
{ {
Vector rc = new Vector(); ArrayList rc = new ArrayList();
DescrStringCache cache = new DescrStringCache(conn); DescrStringCache cache = new DescrStringCache(conn);
Statement stmt = conn.createStatement(); Statement stmt = conn.createStatement();
@ -380,7 +379,7 @@ public class AuditRecord implements AuditData
} // end while } // end while
return new ReadOnlyVector(rc); return Collections.unmodifiableList(rc);
} // end getAuditRecords } // end getAuditRecords

View File

@ -18,7 +18,6 @@
package com.silverwrist.venice.security; package com.silverwrist.venice.security;
import java.util.*; import java.util.*;
import com.silverwrist.util.collections.*;
public class Role implements Comparable, SecLevels public class Role implements Comparable, SecLevels
{ {
@ -31,12 +30,24 @@ public class Role implements Comparable, SecLevels
private static Role no_access = null; private static Role no_access = null;
private static Role unrestricted_user = null; private static Role unrestricted_user = null;
private static Role sig_host = null; private static Role sig_host = null;
private static Vector global_low = null; private static ArrayList global_low = null;
private static Vector global_high = null; private static ArrayList global_high = null;
private static Vector sig_low = null; private static ArrayList sig_low = null;
private static Vector sig_high = null; private static ArrayList sig_high = null;
private static Vector conf_low = null; private static ArrayList conf_low = null;
private static Vector conf_high = null; private static ArrayList conf_high = null;
private static List sigreadlist_rc = null;
private static List sigwritelist_rc = null;
private static List sigcreatelist_rc = null;
private static List sigdeletelist_rc = null;
private static List sigjoinlist_rc = null;
private static List sig_member_levels = null;
private static List confreadlist_rc = null;
private static List confpostlist_rc = null;
private static List confhidelist_rc = null;
private static List confdeletelist_rc = null;
private static List conf_member_levels = null;
/*-------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------
* Attributes * Attributes
@ -58,80 +69,6 @@ public class Role implements Comparable, SecLevels
} // end constructor } // end constructor
/*--------------------------------------------------------------------------------
* Internal functions
*--------------------------------------------------------------------------------
*/
private static void initAllSets()
{
if (not_in_list==null)
not_in_list = new Role(0,"(not in list)");
if (no_access==null)
no_access = new Role(NO_ACCESS,"No Access");
if (unrestricted_user==null)
unrestricted_user = new Role(UNRESTRICTED_USER,"'Unrestricted' User");
if (global_low==null)
{ // initialize the "global lowband" vector
global_low = new Vector(3);
global_low.addElement(new Role(GLOBAL_ANONYMOUS,"Anonymous User"));
global_low.addElement(new Role(GLOBAL_UNVERIFIED,"Unauthenticated User"));
global_low.addElement(new Role(GLOBAL_NORMAL,"Normal User"));
global_low.trimToSize();
} // end if
if (global_high==null)
{ // initialize the "global highband" vector
global_high = new Vector(3);
global_high.addElement(new Role(GLOBAL_ANYADMIN,"Any System Administrator"));
global_high.addElement(new Role(GLOBAL_PFY,"System Assistant Administrator"));
global_high.addElement(new Role(GLOBAL_BOFH,"Global System Administrator"));
global_high.trimToSize();
} // end if
if (sig_low==null)
{ // initialize the "SIG lowband" vector
sig_low = new Vector(1);
sig_low.addElement(new Role(SIG_MEMBER,"SIG Member"));
sig_low.trimToSize();
} // end if
if (sig_high==null)
{ // initialize the "SIG highband" vector
sig_high = new Vector(3);
sig_high.addElement(new Role(SIG_ANYADMIN,"Any SIG Administrator"));
sig_high.addElement(new Role(SIG_COHOST,"SIG Co-Host"));
sig_host = new Role(SIG_HOST,"SIG Host");
sig_high.addElement(sig_host);
sig_high.trimToSize();
} // end if
if (conf_low==null)
{ // initialize the "conference lowband" vector
conf_low = new Vector(1);
conf_low.addElement(new Role(CONFERENCE_MEMBER,"Conference Member"));
conf_low.trimToSize();
} // end if
if (conf_high==null)
{ // initialize the "conference highband" vector
conf_high = new Vector(2);
conf_high.addElement(new Role(CONFERENCE_ANYADMIN,"Any Conference Administrator"));
conf_high.addElement(new Role(CONFERENCE_HOST,"Conference Host"));
conf_high.trimToSize();
} // end if
} // end initAllSets
/*-------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------
* External operations * External operations
*-------------------------------------------------------------------------------- *--------------------------------------------------------------------------------
@ -196,69 +133,95 @@ public class Role implements Comparable, SecLevels
public static List getSIGReadList() public static List getSIGReadList()
{ {
initAllSets(); if (sigreadlist_rc==null)
Vector rc = new Vector(); { // create the returned list
rc.addAll(global_low); ArrayList rc = new ArrayList();
rc.addAll(sig_low); rc.addAll(global_low);
rc.add(unrestricted_user); rc.addAll(sig_low);
rc.addAll(sig_high); rc.add(unrestricted_user);
rc.add(global_high.firstElement()); rc.addAll(sig_high);
return new ReadOnlyVector(rc); rc.add(global_high.get(0));
sigreadlist_rc = Collections.unmodifiableList(rc);
} // end if
return sigreadlist_rc;
} // end getSIGReadList } // end getSIGReadList
public static List getSIGWriteList() public static List getSIGWriteList()
{ {
initAllSets(); if (sigwritelist_rc==null)
Vector rc = new Vector(); { // build the return value
rc.addAll(sig_high); ArrayList rc = new ArrayList();
rc.addAll(global_high); rc.addAll(sig_high);
return new ReadOnlyVector(rc); rc.addAll(global_high);
sigwritelist_rc = Collections.unmodifiableList(rc);
} // end if
return sigwritelist_rc;
} // end getSIGWriteList } // end getSIGWriteList
public static List getSIGCreateList() public static List getSIGCreateList()
{ {
initAllSets(); if (sigcreatelist_rc==null)
Vector rc = new Vector(); { // create the return list
rc.add(global_low.lastElement()); ArrayList rc = new ArrayList();
rc.addAll(sig_low); rc.add(global_low.get(global_low.size()-1));
rc.add(unrestricted_user); rc.addAll(sig_low);
rc.addAll(sig_high); rc.add(unrestricted_user);
rc.add(global_high.firstElement()); rc.addAll(sig_high);
return new ReadOnlyVector(rc); rc.add(global_high.get(0));
sigcreatelist_rc = Collections.unmodifiableList(rc);
} // end if
return sigcreatelist_rc;
} // end getSIGCreateList } // end getSIGCreateList
public static List getSIGDeleteList() public static List getSIGDeleteList()
{ {
initAllSets(); if (sigdeletelist_rc==null)
Vector rc = new Vector(); { // create the return list
rc.addAll(sig_high); ArrayList rc = new ArrayList();
rc.addAll(global_high); rc.addAll(sig_high);
rc.add(no_access); rc.addAll(global_high);
return new ReadOnlyVector(rc); rc.add(no_access);
sigdeletelist_rc = Collections.unmodifiableList(rc);
} // end if
return sigdeletelist_rc;
} // end getSIGDeleteList } // end getSIGDeleteList
public static List getSIGJoinList() public static List getSIGJoinList()
{ {
initAllSets(); if (sigjoinlist_rc==null)
return new ReadOnlyVector(global_low); sigjoinlist_rc = Collections.unmodifiableList(global_low);
return sigjoinlist_rc;
} // end getSIGJoinList } // end getSIGJoinList
public static List getSIGMemberLevelChoices() public static List getSIGMemberLevelChoices()
{ {
initAllSets(); if (sig_member_levels==null)
Vector rc = new Vector(); { // figure out the member levels list
rc.add(not_in_list); ArrayList rc = new ArrayList();
rc.addAll(global_low); rc.add(not_in_list);
rc.addAll(sig_low); rc.addAll(global_low);
rc.add(unrestricted_user); rc.addAll(sig_low);
rc.addAll(sig_high); rc.add(unrestricted_user);
rc.remove(rc.size()-1); rc.addAll(sig_high);
return new ReadOnlyVector(rc); rc.remove(rc.size()-1);
sig_member_levels = Collections.unmodifiableList(rc);
} // end if
return sig_member_levels;
} // end getSIGMemberLevelChoices } // end getSIGMemberLevelChoices
@ -270,26 +233,36 @@ public class Role implements Comparable, SecLevels
public static List getConferenceReadList() public static List getConferenceReadList()
{ {
initAllSets(); if (confreadlist_rc==null)
Vector rc = new Vector(); { // precalculate the conference read list
rc.addAll(global_low); ArrayList rc = new ArrayList();
rc.addAll(sig_low); rc.addAll(global_low);
rc.addAll(conf_low); rc.addAll(sig_low);
rc.add(unrestricted_user); rc.addAll(conf_low);
return new ReadOnlyVector(rc); rc.add(unrestricted_user);
confreadlist_rc = Collections.unmodifiableList(rc);
} // end if
return confreadlist_rc;
} // end getConferenceReadList } // end getConferenceReadList
public static List getConferencePostList() public static List getConferencePostList()
{ {
initAllSets(); if (confpostlist_rc==null)
Vector rc = new Vector(); { // precalculate the post list
rc.addAll(global_low); ArrayList rc = new ArrayList();
rc.addAll(sig_low); rc.addAll(global_low);
rc.addAll(conf_low); rc.addAll(sig_low);
rc.add(unrestricted_user); rc.addAll(conf_low);
rc.addAll(conf_high); rc.add(unrestricted_user);
return new ReadOnlyVector(rc); rc.addAll(conf_high);
confpostlist_rc = Collections.unmodifiableList(rc);
} // end if
return confpostlist_rc;
} // return getConferencePostList } // return getConferencePostList
@ -301,12 +274,17 @@ public class Role implements Comparable, SecLevels
public static List getConferenceHideList() public static List getConferenceHideList()
{ {
initAllSets(); if (confhidelist_rc==null)
Vector rc = new Vector(); { // precalculate the hide list
rc.addAll(conf_high); ArrayList rc = new ArrayList();
rc.addAll(sig_high); rc.addAll(conf_high);
rc.add(global_high.firstElement()); rc.addAll(sig_high);
return new ReadOnlyVector(rc); rc.add(global_high.get(0));
confhidelist_rc = Collections.unmodifiableList(rc);
} // end if
return confhidelist_rc;
} // end getConferenceHideList } // end getConferenceHideList
@ -324,27 +302,88 @@ public class Role implements Comparable, SecLevels
public static List getConferenceDeleteList() public static List getConferenceDeleteList()
{ {
initAllSets(); if (confdeletelist_rc==null)
Vector rc = new Vector(); { // precalculate the delete list
rc.addAll(sig_high); ArrayList rc = new ArrayList();
rc.addAll(global_high); rc.addAll(sig_high);
rc.add(no_access); rc.addAll(global_high);
return new ReadOnlyVector(rc); rc.add(no_access);
confdeletelist_rc = Collections.unmodifiableList(rc);
} // end if
return confdeletelist_rc;
} // end getConferenceDeleteList } // end getConferenceDeleteList
public static List getConferenceMemberLevelChoices() public static List getConferenceMemberLevelChoices()
{ {
initAllSets(); if (conf_member_levels==null)
Vector rc = new Vector(); { // precalculate the list
rc.add(not_in_list); ArrayList rc = new ArrayList();
rc.addAll(global_low); rc.add(not_in_list);
rc.addAll(sig_low); rc.addAll(global_low);
rc.addAll(conf_low); rc.addAll(sig_low);
rc.add(unrestricted_user); rc.addAll(conf_low);
rc.add(conf_high.lastElement()); rc.add(unrestricted_user);
return new ReadOnlyVector(rc); rc.add(conf_high.get(conf_high.size()-1));
conf_member_levels = Collections.unmodifiableList(rc);
} // end if
return conf_member_levels;
} // end getConferenceMemberLevelChoices } // end getConferenceMemberLevelChoices
/*--------------------------------------------------------------------------------
* Static initializer
*--------------------------------------------------------------------------------
*/
static
{
not_in_list = new Role(0,"(not in list)");
no_access = new Role(NO_ACCESS,"No Access");
unrestricted_user = new Role(UNRESTRICTED_USER,"'Unrestricted' User");
// initialize the "global lowband" vector
global_low = new ArrayList(3);
global_low.add(new Role(GLOBAL_ANONYMOUS,"Anonymous User"));
global_low.add(new Role(GLOBAL_UNVERIFIED,"Unauthenticated User"));
global_low.add(new Role(GLOBAL_NORMAL,"Normal User"));
global_low.trimToSize();
// initialize the "global highband" vector
global_high = new ArrayList(3);
global_high.add(new Role(GLOBAL_ANYADMIN,"Any System Administrator"));
global_high.add(new Role(GLOBAL_PFY,"System Assistant Administrator"));
global_high.add(new Role(GLOBAL_BOFH,"Global System Administrator"));
global_high.trimToSize();
// initialize the "SIG lowband" vector
sig_low = new ArrayList(1);
sig_low.add(new Role(SIG_MEMBER,"SIG Member"));
sig_low.trimToSize();
// initialize the "SIG highband" vector
sig_high = new ArrayList(3);
sig_high.add(new Role(SIG_ANYADMIN,"Any SIG Administrator"));
sig_high.add(new Role(SIG_COHOST,"SIG Co-Host"));
sig_host = new Role(SIG_HOST,"SIG Host");
sig_high.add(sig_host);
sig_high.trimToSize();
// initialize the "conference lowband" vector
conf_low = new ArrayList(1);
conf_low.add(new Role(CONFERENCE_MEMBER,"Conference Member"));
conf_low.trimToSize();
// initialize the "conference highband" vector
conf_high = new ArrayList(2);
conf_high.add(new Role(CONFERENCE_ANYADMIN,"Any Conference Administrator"));
conf_high.add(new Role(CONFERENCE_HOST,"Conference Host"));
conf_high.trimToSize();
} // end static initializer
} // end class Role } // end class Role

View File

@ -36,6 +36,8 @@ public class Account extends VeniceServlet
private static final String DISPLAY_LOGIN_ATTR = "com.silverwrist.venice.servlets.internal.DisplayLogin"; private static final String DISPLAY_LOGIN_ATTR = "com.silverwrist.venice.servlets.internal.DisplayLogin";
private static final int COOKIE_LIFETIME = 60*60*24*365; // one year
private static Category logger = Category.getInstance(Account.class.getName()); private static Category logger = Category.getInstance(Account.class.getName());
/*-------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------
@ -159,6 +161,11 @@ public class Account extends VeniceServlet
if (user.isLoggedIn()) if (user.isLoggedIn())
{ // this is a Logout command { // this is a Logout command
clearUserContext(request); clearUserContext(request);
// delete the "login" cookie
Cookie del_login_info = rdat.createCookie(Variables.LOGIN_COOKIE,"",0);
Variables.saveCookie(request,del_login_info);
throw new RedirectResult("top"); // take 'em back to the "top" page throw new RedirectResult("top"); // take 'em back to the "top" page
} // end if } // end if
@ -299,7 +306,15 @@ public class Account extends VeniceServlet
{ // use the user context to authenticate { // use the user context to authenticate
user.authenticate(dlg.getFieldValue("user"),dlg.getFieldValue("pass")); user.authenticate(dlg.getFieldValue("user"),dlg.getFieldValue("pass"));
// TODO: here is where the persistent cookie gets sent, if it does... // If they want a cookie, give it to them!
final String yes = "Y";
if (yes.equals(dlg.getFieldValue("saveme")))
{ // create the authentication cookie and save it
Cookie auth_cookie = rdat.createCookie(Variables.LOGIN_COOKIE,user.getAuthenticationToken(),
COOKIE_LIFETIME);
Variables.saveCookie(request,auth_cookie);
} // end if
// assuming it worked OK, redirect them back where they came from // assuming it worked OK, redirect them back where they came from
// (or to the verification page if they need to go there) // (or to the verification page if they need to go there)

View File

@ -486,15 +486,43 @@ public class ConfOperations extends VeniceServlet
} // end if ("A" command) } // end if ("A" command)
if (cmd.equals("RP") || cmd.equals("RR")) if (cmd.equals("QR"))
{ // "RP" = "Report Posters," "RR" = "Report Readers" (requires conference parameter) { // "QR" = "Reports Menu" (requires conference parameter)
ConferenceContext conf = getConferenceParameter(request,sig,true,on_error); ConferenceContext conf = getConferenceParameter(request,sig,true,on_error);
on_error = "confops?sig=" + sig.getSIGID() + "&conf=" + conf.getConfID() + "&cmd=Q"; on_error = "confops?sig=" + sig.getSIGID() + "&conf=" + conf.getConfID() + "&cmd=Q";
try
{ // display the "Conference Reports" display
setMyLocation(request,"confops?sig=" + sig.getSIGID() + "&conf=" + conf.getConfID() + "&cmd=QR");
return new ReportConferenceMenu(sig,conf);
} // end try
catch (DataException de)
{ // unable to get the data for the list
return new ErrorBox("Database Error","Database error getting topic list: " + de.getMessage(),on_error);
} // end catch
catch (AccessError ae)
{ // some sort of access error - display an error dialog
return new ErrorBox("Access Error",ae.getMessage(),on_error);
} // end catch
} // end if ("QR" command)
if (cmd.equals("RP") || cmd.equals("RR"))
{ // "RP" = "Report Posters," "RR" = "Report Readers" (requires conference parameter, optional topic)
ConferenceContext conf = getConferenceParameter(request,sig,true,on_error);
TopicContext topic = getTopicParameter(request,conf,false,on_error);
on_error = "confops?sig=" + sig.getSIGID() + "&conf=" + conf.getConfID() + "&cmd=QR";
try try
{ // generate the listing on this page { // generate the listing on this page
setMyLocation(request,"confops?sig=" + sig.getSIGID() + "&conf=" + conf.getConfID() + "&cmd=" + cmd); String my_loc = "confops?sig=" + sig.getSIGID() + "&conf=" + conf.getConfID();
return new ConferenceActivity(sig,conf,cmd.equals("RP")); if (topic!=null)
my_loc += ("&top=" + topic.getTopicNumber());
setMyLocation(request,my_loc + "&cmd=" + cmd);
return new ConferenceActivity(sig,conf,topic,cmd.equals("RP"));
} // end try } // end try
catch (DataException de) catch (DataException de)

View File

@ -0,0 +1,63 @@
/*
* The contents of this file are subject to the Mozilla Public License Version 1.1
* (the "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at <http://www.mozilla.org/MPL/>.
*
* Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
* 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 Communities System.
*
* 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
* Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
package com.silverwrist.venice.servlets;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import org.apache.log4j.*;
import com.silverwrist.venice.core.*;
import com.silverwrist.venice.servlets.format.*;
public class FrameStatic extends VeniceServlet
{
/*--------------------------------------------------------------------------------
* Static data members
*--------------------------------------------------------------------------------
*/
private static Category logger = Category.getInstance(FrameStatic.class);
/*--------------------------------------------------------------------------------
* Overrides from class HttpServlet
*--------------------------------------------------------------------------------
*/
public String getServletInfo()
{
String rc = "FrameStatic servlet - Displays a static page inside the Venice \"frame\"\n"
+ "Part of the Venice Web Communities System\n";
return rc;
} // end getServletInfo
/*--------------------------------------------------------------------------------
* Overrides from class VeniceServlet
*--------------------------------------------------------------------------------
*/
protected VeniceContent doVeniceGet(HttpServletRequest request, VeniceEngine engine,
UserContext user, RenderData rdat)
throws ServletException, IOException, VeniceServletResult
{
setMyLocation(request,"frame" + request.getPathInfo());
return StaticRender.getStaticRender(request.getPathInfo().substring(1));
} // end doVeniceGet
} // end class FrameStatic

View File

@ -31,7 +31,7 @@ public class UserDisplay extends VeniceServlet
*-------------------------------------------------------------------------------- *--------------------------------------------------------------------------------
*/ */
private static Category logger = Category.getInstance(UserDisplay.class.getName()); private static Category logger = Category.getInstance(UserDisplay.class);
/*-------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------
* Overrides from class HttpServlet * Overrides from class HttpServlet

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,6 +23,7 @@ import javax.servlet.http.*;
import org.apache.log4j.*; import org.apache.log4j.*;
import com.silverwrist.venice.core.*; import com.silverwrist.venice.core.*;
import com.silverwrist.venice.servlets.format.*; import com.silverwrist.venice.servlets.format.*;
import com.silverwrist.venice.servlets.format.menus.LeftMenu;
public class Variables public class Variables
{ {
@ -35,19 +36,21 @@ public class Variables
protected static final String ENGINE_ATTRIBUTE = "com.silverwrist.venice.core.Engine"; protected static final String ENGINE_ATTRIBUTE = "com.silverwrist.venice.core.Engine";
protected static final String COUNTRYLIST_ATTRIBUTE = "com.silverwrist.venice.db.CountryList"; protected static final String COUNTRYLIST_ATTRIBUTE = "com.silverwrist.venice.db.CountryList";
protected static final String LANGUAGELIST_ATTRIBUTE = "com.silverwrist.venice.db.LanguageList"; protected static final String LANGUAGELIST_ATTRIBUTE = "com.silverwrist.venice.db.LanguageList";
protected static final String TOPMENU_ATTRIBUTE = "com.silverwrist.venice.servlets.MenuTop";
// HttpSession ("session") attributes // HttpSession ("session") attributes
protected static final String USERCTXT_ATTRIBUTE = "user.context"; protected static final String USERCTXT_ATTRIBUTE = "user.context";
protected static final String MENU_ATTRIBUTE = "current.menu"; protected static final String MENU_ATTRIBUTE = "current.menu";
// ServletRequest ("request" attributes)
protected static final String COOKIEJAR_ATTRIBUTE = "com.silverwrist.venice.servlets.CookieJar";
// Servlet initialization parameters // Servlet initialization parameters
protected static final String ENGINE_INIT_PARAM = "venice.config"; protected static final String ENGINE_INIT_PARAM = "venice.config";
// Cookie name // Cookie name
public static final String LOGIN_COOKIE = "VeniceLogin"; public static final String LOGIN_COOKIE = "VeniceAuth";
private static Category logger = Category.getInstance(Variables.class.getName()); private static Category logger = Category.getInstance(Variables.class);
private static Integer engine_gate = new Integer(0); private static Integer engine_gate = new Integer(0);
/*-------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------
@ -90,7 +93,8 @@ public class Variables
} // end getVeniceEngine } // end getVeniceEngine
public static UserContext getUserContext(ServletContext ctxt, ServletRequest request, HttpSession session) public static UserContext getUserContext(ServletContext ctxt, HttpServletRequest request,
HttpSession session)
throws ServletException throws ServletException
{ {
Object uctmp = session.getAttribute(USERCTXT_ATTRIBUTE); Object uctmp = session.getAttribute(USERCTXT_ATTRIBUTE);
@ -101,6 +105,33 @@ public class Variables
{ // use the Venice engine to create a new user context and save it off { // use the Venice engine to create a new user context and save it off
VeniceEngine engine = getVeniceEngine(ctxt); VeniceEngine engine = getVeniceEngine(ctxt);
UserContext user = engine.createUserContext(request.getRemoteAddr()); UserContext user = engine.createUserContext(request.getRemoteAddr());
// Did the user send a Venice authentication cookie? If so, try to use it.
Cookie[] cookies = request.getCookies();
Cookie venice_cookie = null;
for (int i=0; (venice_cookie==null) && (i<cookies.length); i++)
{ // look for a Venice authentication cookie
if (LOGIN_COOKIE.equals(cookies[i].getName()))
venice_cookie = cookies[i];
} // end for
if (venice_cookie!=null)
{ // we've found the cookie - now attempt to authenticate with it
if (!(user.authenticateWithToken(venice_cookie.getValue())))
{ // the authentication failed - this cookie MUST be bogus, delete it!
Cookie zapper = new Cookie(LOGIN_COOKIE,"");
zapper.setMaxAge(0);
zapper.setPath(request.getContextPath());
saveCookie(request,zapper);
} // end if
// else we're authenticated - let the cookie stay!
} // end if
// else don't bother trying to authenticate
// save the user context off as usual and return it
session.setAttribute(USERCTXT_ATTRIBUTE,user); session.setAttribute(USERCTXT_ATTRIBUTE,user);
return user; return user;
@ -185,18 +216,31 @@ public class Variables
public static void setMenuTop(ServletContext ctxt, HttpSession session) public static void setMenuTop(ServletContext ctxt, HttpSession session)
{ {
Object obj = session.getAttribute(MENU_ATTRIBUTE); Object obj = session.getAttribute(MENU_ATTRIBUTE);
if ((obj==null) || !(obj instanceof MenuTop)) boolean do_change;
{ // look for the common MenuTop object and set it to the session context if ((obj==null) || !(obj instanceof LeftMenu))
obj = ctxt.getAttribute(TOPMENU_ATTRIBUTE); do_change = true;
if (obj==null) else
{ // we don't have a common MenuTop yet...make one { // look to see if this is the "top" menu
MenuTop mt = new MenuTop(); LeftMenu mnu = (LeftMenu)obj;
ctxt.setAttribute(TOPMENU_ATTRIBUTE,mt); do_change = !(mnu.getIdentifier().equals("top"));
obj = mt;
} // end if } // end else
session.setAttribute(MENU_ATTRIBUTE,obj); if (do_change)
{ // get the new menu from the RenderConfig object and save it
try
{ // but note that getting the rendering configuration can throw a ServletException
RenderConfig cfg = RenderConfig.getRenderConfig(ctxt);
LeftMenu new_mnu = cfg.getLeftMenu("top");
session.setAttribute(MENU_ATTRIBUTE,new_mnu);
} // end try
catch (ServletException e)
{ // if we fail, just clear it out
logger.warn("caught ServletException in setMenuTop",e);
session.removeAttribute(MENU_ATTRIBUTE);
} // end catch
} // end if } // end if
@ -237,4 +281,41 @@ public class Variables
} // end failIfNull } // end failIfNull
public static void saveCookie(ServletRequest request, Cookie cookie)
{
ArrayList cookiejar = null;
Object o = request.getAttribute(COOKIEJAR_ATTRIBUTE);
if ((o==null) || !(o instanceof ArrayList))
{ // create a new cookie jar and save it
cookiejar = new ArrayList();
request.setAttribute(COOKIEJAR_ATTRIBUTE,cookiejar);
} // end if
else // found our cookie jar
cookiejar = (ArrayList)o;
// save the cookie in the cookie jar (to be flushed later)
cookiejar.add(cookie);
} // end saveCookie
public static void flushCookies(ServletRequest request, HttpServletResponse response)
{
Object o = request.getAttribute(COOKIEJAR_ATTRIBUTE);
request.removeAttribute(COOKIEJAR_ATTRIBUTE);
if (o instanceof ArrayList)
{ // found the cookie jar - now take the cookies out and add them to the response
ArrayList cookiejar = (ArrayList)o;
Iterator it = cookiejar.iterator();
while (it.hasNext())
{ // add each cookie in turn
Cookie cookie = (Cookie)(it.next());
response.addCookie(cookie);
} // end while
} // end if
} // end flushCookies
} // end class Variables } // end class Variables

View File

@ -67,8 +67,7 @@ public abstract class VeniceServlet extends HttpServlet
} // end if } // end if
else else
{ // a null SIGContext is permitted { // a null SIGContext is permitted
if (logger.isDebugEnabled()) logger.debug("no SIG specified");
logger.debug("no SIG specified");
return null; return null;
} // end else } // end else
@ -78,7 +77,15 @@ public abstract class VeniceServlet extends HttpServlet
SIGContext rc = null; SIGContext rc = null;
try try
{ // turn the string into a SIGID, and thence to a SIGContext { // turn the string into a SIGID, and thence to a SIGContext
rc = user.getSIGContext(Integer.parseInt(str)); int tmp_id = Integer.parseInt(str);
rc = user.getSIGContext(tmp_id);
if (rc==null)
{ // trap any null results (may not be possible with SIGs, but you never know)
logger.error("SIG #" + tmp_id + " was not found!");
throw new ErrorBox(null,"The specified SIG (#" + tmp_id + ") was not found in the database.",on_error);
} // end if
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
logger.debug("found SIG #" + rc.getSIGID()); logger.debug("found SIG #" + rc.getSIGID());
@ -112,8 +119,7 @@ public abstract class VeniceServlet extends HttpServlet
} // end if } // end if
else else
{ // a null TopicContext is permitted { // a null TopicContext is permitted
if (logger.isDebugEnabled()) logger.debug("no topic specified");
logger.debug("no topic specified");
return null; return null;
} // end else } // end else
@ -122,8 +128,17 @@ public abstract class VeniceServlet extends HttpServlet
TopicContext rc = null; TopicContext rc = null;
try try
{ // turn the string into a TopicID, and thence to a TopicContext { // turn the string into a topic number, and thence to a TopicContext
rc = conf.getTopic(Short.parseShort(str)); short tmp_id = Short.parseShort(str);
rc = conf.getTopic(tmp_id);
if (rc==null)
{ // the topic was not found!
logger.error("ConfID #" + conf.getConfID() + " did not have topic #" + tmp_id);
throw new ErrorBox(null,"Topic #" + tmp_id + " was not found in the '" + conf.getName()
+ "' conference.",on_error);
} // end if
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
logger.debug("found topic #" + rc.getTopicID()); logger.debug("found topic #" + rc.getTopicID());
@ -162,8 +177,7 @@ public abstract class VeniceServlet extends HttpServlet
} // end if } // end if
else else
{ // a null TopicMessageContext is permitted { // a null TopicMessageContext is permitted
if (logger.isDebugEnabled()) logger.debug("no message specified");
logger.debug("no message specified");
return null; return null;
} // end else } // end else
@ -173,7 +187,16 @@ public abstract class VeniceServlet extends HttpServlet
TopicMessageContext rc = null; TopicMessageContext rc = null;
try try
{ // turn the string into a postid, and thence to a TopicMessageContext { // turn the string into a postid, and thence to a TopicMessageContext
rc = conf.getMessageByPostID(Long.parseLong(str)); long tmp_id = Long.parseLong(str);
rc = conf.getMessageByPostID(tmp_id);
if (rc==null)
{ // the message was not found
logger.error("ConfID #" + conf.getConfID() + " does not contain postid " + tmp_id);
throw new ErrorBox(null,"The post with ID number " + tmp_id + " was not found in the '"
+ conf.getName() + "' conference.",on_error);
} // end if
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
logger.debug("found post #" + rc.getPostID()); logger.debug("found post #" + rc.getPostID());
@ -212,8 +235,7 @@ public abstract class VeniceServlet extends HttpServlet
} // end if } // end if
else else
{ // a null TopicMessageContext is permitted { // a null TopicMessageContext is permitted
if (logger.isDebugEnabled()) logger.debug("no message specified");
logger.debug("no message specified");
return null; return null;
} // end else } // end else
@ -223,7 +245,16 @@ public abstract class VeniceServlet extends HttpServlet
TopicMessageContext rc = null; TopicMessageContext rc = null;
try try
{ // turn the string into a post number, and thence to a TopicMessageContext { // turn the string into a post number, and thence to a TopicMessageContext
rc = topic.getMessage(Integer.parseInt(str)); int tmp_id = Integer.parseInt(str);
rc = topic.getMessage(tmp_id);
if (rc==null)
{ // could not find the message
logger.error("TopicID " + topic.getTopicID() + " does not contain message #" + tmp_id);
throw new ErrorBox(null,"There is no message #" + tmp_id + " in the '" + topic.getName() + "' topic.",
on_error);
} // end if
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
logger.debug("found post #" + rc.getPostID()); logger.debug("found post #" + rc.getPostID());
@ -360,8 +391,7 @@ public abstract class VeniceServlet extends HttpServlet
} // end if } // end if
else else
{ // a null ConferenceContext is permitted { // a null ConferenceContext is permitted
if (logger.isDebugEnabled()) logger.debug("no conference specified");
logger.debug("no conference specified");
return null; return null;
} // end else } // end else
@ -371,7 +401,16 @@ public abstract class VeniceServlet extends HttpServlet
ConferenceContext rc = null; ConferenceContext rc = null;
try try
{ // turn the string into a ConfID, and thence to a ConferenceContext { // turn the string into a ConfID, and thence to a ConferenceContext
rc = sig.getConferenceContext(Integer.parseInt(str)); int tmp_id = Integer.parseInt(str);
rc = sig.getConferenceContext(tmp_id);
if (rc==null)
{ // couldn't find the conference
logger.error("SIG #" + sig.getSIGID() + " does not contain conference #" + tmp_id);
throw new ErrorBox(null,"The conference #" + tmp_id + " could not be found in the '" + sig.getName()
+ "' SIG.",on_error);
} // end if
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
logger.debug("found conf #" + rc.getConfID()); logger.debug("found conf #" + rc.getConfID());
@ -517,45 +556,79 @@ public abstract class VeniceServlet extends HttpServlet
{ {
ServletContext ctxt = getServletContext(); ServletContext ctxt = getServletContext();
VeniceEngine engine = Variables.getVeniceEngine(ctxt); VeniceEngine engine = Variables.getVeniceEngine(ctxt);
UserContext user = Variables.getUserContext(ctxt,request,request.getSession(true));
RenderData rdat = RenderConfig.createRenderData(ctxt,request,response);
VeniceContent content = null; VeniceContent content = null;
// Make all log messages for the request carry the remote address.
NDC.push(request.getRemoteAddr());
try try
{ // run the actual "get" in the servlet { // get the user context
content = doVeniceGet(request,engine,user,rdat); UserContext user = Variables.getUserContext(ctxt,request,request.getSession(true));
boolean record_uname = user.isLoggedIn();
if (record_uname)
NDC.push(user.getUserName());
try
{ // and now we proceed!
RenderData rdat = RenderConfig.createRenderData(ctxt,user,request,response);
try
{ // run the actual "get" in the servlet
content = doVeniceGet(request,engine,user,rdat);
} // end try
catch (VeniceServletResult res)
{ // special VeniceServletResult catch here - figure out what result it is
if (res instanceof VeniceContent)
content = (VeniceContent)res; // this is content
else if (res instanceof ContentResult)
{ // this contains content
ContentResult cres = (ContentResult)res;
content = cres.getContent();
} // end else if
else if (res instanceof ExecuteResult)
{ // direct-execution result
ExecuteResult xres = (ExecuteResult)res;
Variables.flushCookies(request,response);
xres.execute(rdat);
return;
} // end else if
else // unrecognized VeniceServletResult
content = null;
} // end catch
catch (RuntimeException re)
{ // record that we caught a runtime exception in here!
logger.error("VeniceServlet.doGet caught " + re.getClass().getName() + " in doVeniceGet",re);
throw re;
} // end catch
Variables.flushCookies(request,response);
if (content!=null)
{ // display the content!
BaseJSPData base = new BaseJSPData(getMyLocation(request,engine,user,rdat),content);
base.transfer(ctxt,rdat);
} // end if
else // there is no content - display the null response
rdat.nullResponse();
} // end try
finally
{ // pop the username from the NDC if we used it
if (record_uname)
NDC.pop();
} // end finally
} // end try } // end try
catch (VeniceServletResult res) finally
{ // special VeniceServletResult catch here - figure out what result it is { // pop the nested diagnostic context
if (res instanceof VeniceContent) NDC.pop();
content = (VeniceContent)res; // this is content
else if (res instanceof ContentResult)
{ // this contains content
ContentResult cres = (ContentResult)res;
content = cres.getContent();
} // end else if } // end finally
else if (res instanceof ExecuteResult)
{ // direct-execution result
ExecuteResult xres = (ExecuteResult)res;
xres.execute(rdat);
return;
} // end else if
else // unrecognized VeniceServletResult
content = null;
} // end catch
if (content!=null)
{ // display the content!
BaseJSPData base = new BaseJSPData(getMyLocation(request,engine,user,rdat),content);
base.transfer(ctxt,rdat);
} // end if
else // there is no content - display the null response
rdat.nullResponse();
} // end doGet } // end doGet
@ -564,67 +637,102 @@ public abstract class VeniceServlet extends HttpServlet
{ {
ServletContext ctxt = getServletContext(); ServletContext ctxt = getServletContext();
VeniceEngine engine = Variables.getVeniceEngine(ctxt); VeniceEngine engine = Variables.getVeniceEngine(ctxt);
UserContext user = Variables.getUserContext(ctxt,request,request.getSession(true));
RenderData rdat = RenderConfig.createRenderData(ctxt,user,request,response);
ServletMultipartHandler mphandler = null; ServletMultipartHandler mphandler = null;
VeniceContent content = null; VeniceContent content = null;
if (ServletMultipartHandler.canHandle(request)) // Make all log messages for the request carry the remote address.
{ // if this is a multipart/form-data request, invoke our special handler code NDC.push(request.getRemoteAddr());
try
{ // get the user context
UserContext user = Variables.getUserContext(ctxt,request,request.getSession(true));
boolean record_uname = user.isLoggedIn();
if (record_uname)
NDC.push(user.getUserName());
try try
{ // create the multipart handler { // and now we proceed!
mphandler = new ServletMultipartHandler(request); RenderData rdat = RenderConfig.createRenderData(ctxt,user,request,response);
if (ServletMultipartHandler.canHandle(request))
{ // if this is a multipart/form-data request, invoke our special handler code
try
{ // create the multipart handler
mphandler = new ServletMultipartHandler(request);
} // end try
catch (ServletMultipartException e)
{ // this is an error message we need to generate and just bail out on
logger.error("ServletMultipartException caught in doVenicePost!",e);
BaseJSPData base = new BaseJSPData(getMyLocation(request,engine,user,rdat),
new ErrorBox(null,"Internal Error: " + e.getMessage(),null));
base.transfer(ctxt,rdat);
return;
} // end if
} // end if
try
{ // call the appropriate doVenicePost method
if (mphandler!=null)
content = doVenicePost(request,mphandler,engine,user,rdat);
else
content = doVenicePost(request,engine,user,rdat);
} // end try
catch (VeniceServletResult res)
{ // special VeniceServletResult catch here - figure out what result it is
if (res instanceof VeniceContent)
content = (VeniceContent)res; // this is content
else if (res instanceof ContentResult)
{ // this contains content
ContentResult cres = (ContentResult)res;
content = cres.getContent();
} // end else if
else if (res instanceof ExecuteResult)
{ // direct-execution result
ExecuteResult xres = (ExecuteResult)res;
Variables.flushCookies(request,response);
xres.execute(rdat);
return;
} // end else if
else // unrecognized VeniceServletResult
content = null;
} // end catch
catch (RuntimeException re)
{ // record that we caught a runtime exception in here!
logger.error("VeniceServlet.doPost caught " + re.getClass().getName() + " in doVenicePost",re);
throw re;
} // end catch
Variables.flushCookies(request,response);
if (content!=null)
{ // display the content!
BaseJSPData base = new BaseJSPData(getMyLocation(request,engine,user,rdat),content);
base.transfer(ctxt,rdat);
} // end if
else // there is no content - display the null response
rdat.nullResponse();
} // end try } // end try
catch (ServletMultipartException e) finally
{ // this is an error message we need to generate and just bail out on { // pop the username from the NDC if we used it
BaseJSPData base = new BaseJSPData(getMyLocation(request,engine,user,rdat), if (record_uname)
new ErrorBox(null,"Internal Error: " + e.getMessage(),null)); NDC.pop();
base.transfer(ctxt,rdat);
return;
} // end if } // end finally
} // end if
try
{ // call the appropriate doVenicePost method
if (mphandler!=null)
content = doVenicePost(request,mphandler,engine,user,rdat);
else
content = doVenicePost(request,engine,user,rdat);
} // end try } // end try
catch (VeniceServletResult res) finally
{ // special VeniceServletResult catch here - figure out what result it is { // pop the nested diagnostic context
if (res instanceof VeniceContent) NDC.pop();
content = (VeniceContent)res; // this is content
else if (res instanceof ContentResult)
{ // this contains content
ContentResult cres = (ContentResult)res;
content = cres.getContent();
} // end else if } // end finally
else if (res instanceof ExecuteResult)
{ // direct-execution result
ExecuteResult xres = (ExecuteResult)res;
xres.execute(rdat);
return;
} // end else if
else // unrecognized VeniceServletResult
content = null;
} // end catch
if (content!=null)
{ // display the content!
BaseJSPData base = new BaseJSPData(getMyLocation(request,engine,user,rdat),content);
base.transfer(ctxt,rdat);
} // end if
else // there is no content - display the null response
rdat.nullResponse();
} // end doPost } // end doPost

View File

@ -145,7 +145,6 @@ public class AuditDataViewer implements ContentRender
} // end while } // end while
out.write("</TABLE>\n"); out.write("</TABLE>\n");
rdat.writeFooter(out);
} // end renderHere } // end renderHere

View File

@ -22,6 +22,8 @@ import java.io.IOException;
import javax.servlet.*; import javax.servlet.*;
import javax.servlet.http.*; import javax.servlet.http.*;
import org.apache.log4j.*; import org.apache.log4j.*;
import com.silverwrist.venice.servlets.Variables;
import com.silverwrist.venice.servlets.format.menus.LeftMenu;
public class BaseJSPData public class BaseJSPData
{ {
@ -114,6 +116,22 @@ public class BaseJSPData
} // end transfer } // end transfer
public void renderMenu(HttpSession session, Writer out, RenderData rdat) throws IOException
{
ComponentRender menu = Variables.getMenu(session);
if (menu==null)
menu = (ComponentRender)(rdat.getLeftMenu("top"));
menu.renderHere(out,rdat);
} // end renderMenu
public void renderFixedMenu(Writer out, RenderData rdat) throws IOException
{
ComponentRender menu = (ComponentRender)(rdat.getLeftMenu("fixed"));
menu.renderHere(out,rdat);
} // end renderFixedMenu
public void renderContent(ServletContext ctxt, Writer out, RenderData rdat) public void renderContent(ServletContext ctxt, Writer out, RenderData rdat)
throws IOException, ServletException throws IOException, ServletException
{ {
@ -142,7 +160,7 @@ public class BaseJSPData
rdat.flushOutput(); // now make sure the included page is properly flushed rdat.flushOutput(); // now make sure the included page is properly flushed
return; return;
} // end if } // end else if
else // this is the fallback if we don't recognize the content else // this is the fallback if we don't recognize the content
new ErrorBox(null,"Internal Error: Content of invalid type",null).renderHere(out,rdat); new ErrorBox(null,"Internal Error: Content of invalid type",null).renderHere(out,rdat);

View File

@ -39,24 +39,39 @@ public class ConferenceActivity implements JSPRender
private SIGContext sig; // the SIG we're in private SIGContext sig; // the SIG we're in
private ConferenceContext conf; // the conference being listed private ConferenceContext conf; // the conference being listed
private TopicContext topic; // the topic being listed
private boolean posters; // is this a list of posters? private boolean posters; // is this a list of posters?
private List records; // the actual data records private List records; // the actual data records
private String locator = null; // our locator
/*-------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------
* Constructor * Constructor
*-------------------------------------------------------------------------------- *--------------------------------------------------------------------------------
*/ */
public ConferenceActivity(SIGContext sig, ConferenceContext conf, boolean posters) public ConferenceActivity(SIGContext sig, ConferenceContext conf, TopicContext topic, boolean posters)
throws DataException, AccessError throws DataException, AccessError
{ {
this.sig = sig; this.sig = sig;
this.conf = conf; this.conf = conf;
this.topic = topic;
this.posters = posters; this.posters = posters;
if (posters) if (topic!=null)
this.records = conf.getActivePosters(); { // do the report on the topic
if (posters)
this.records = topic.getActivePosters();
else
this.records = topic.getActiveReaders();
} // end if
else else
this.records = conf.getActiveReaders(); { // do the report on the conference
if (posters)
this.records = conf.getActivePosters();
else
this.records = conf.getActiveReaders();
} // end else
} // end constructor } // end constructor
@ -78,10 +93,22 @@ public class ConferenceActivity implements JSPRender
public String getPageTitle(RenderData rdat) public String getPageTitle(RenderData rdat)
{ {
if (posters) if (topic!=null)
return "Users Posting in Conference " + conf.getName(); { // it's a topic report
if (posters)
return "Users Posting in Topic " + topic.getName();
else
return "Users Reading Topic " + topic.getName();
} // end if
else else
return "Users Reading Conference " + conf.getName(); { // it's a conference report
if (posters)
return "Users Posting in Conference " + conf.getName();
else
return "Users Reading Conference " + conf.getName();
} // end else
} // end getPageTitle } // end getPageTitle
@ -113,12 +140,29 @@ public class ConferenceActivity implements JSPRender
} // end getConfName } // end getConfName
public String getTopicName()
{
if (topic==null)
return null;
else
return topic.getName();
} // end getTopicName
public String getLocator() public String getLocator()
{ {
return "sig=" + sig.getSIGID() + "&conf=" + conf.getConfID(); if (locator==null)
locator = "sig=" + sig.getSIGID() + "&conf=" + conf.getConfID();
return locator;
} // end getLocator } // end getLocator
public boolean isTopicReport()
{
return (topic!=null);
} // end isTopicReport
public boolean isPosterReport() public boolean isPosterReport()
{ {
return posters; return posters;

View File

@ -122,7 +122,6 @@ public class ConfirmBox implements ContentRender
out.write("<IMG SRC=\"" + rdat.getFullImagePath("bn_no.gif") out.write("<IMG SRC=\"" + rdat.getFullImagePath("bn_no.gif")
+ "\" ALT=\"No\" WIDTH=80 HEIGHT=24 BORDER=0></A>\n"); + "\" ALT=\"No\" WIDTH=80 HEIGHT=24 BORDER=0></A>\n");
out.write("</FONT></TD></TR></TABLE><P>\n"); out.write("</FONT></TD></TR></TABLE><P>\n");
rdat.writeFooter(out);
} // end renderHere } // end renderHere

View File

@ -216,7 +216,6 @@ public class ContentDialog implements Cloneable, ContentRender
} // end if } // end if
out.write("</FONT></FORM>\n"); out.write("</FONT></FORM>\n");
rdat.writeFooter(out);
} // end renderHere } // end renderHere

View File

@ -135,7 +135,6 @@ public class ContentMenuPanel implements Cloneable, ContentRender
} // end while } // end while
out.write("</TABLE>\n"); out.write("</TABLE>\n");
rdat.writeFooter(out);
} // end renderHere } // end renderHere

View File

@ -78,7 +78,6 @@ public class ErrorBox extends VeniceServletResult implements ContentRender
else else
out.write("<A HREF=\"" + rdat.getEncodedServletPath(back) + "\">Go back.</A>\n"); out.write("<A HREF=\"" + rdat.getEncodedServletPath(back) + "\">Go back.</A>\n");
out.write("<P></FONT></TD></TR></TABLE><P>\n"); out.write("<P></FONT></TD></TR></TABLE><P>\n");
rdat.writeFooter(out);
} // end renderHere } // end renderHere

View File

@ -37,8 +37,8 @@ public class LoginDialog extends ContentDialog
addFormField(new CDPasswordFormFieldCommand("pass","Password",null,false,32,128, addFormField(new CDPasswordFormFieldCommand("pass","Password",null,false,32,128,
new CDImageButton("remind","bn_reminder.gif","Reminder", new CDImageButton("remind","bn_reminder.gif","Reminder",
80,24))); 80,24)));
//addFormField(new CDCheckBoxFormField("saveme","Save my user name and password for automatic logins", addFormField(new CDCheckBoxFormField("saveme","Remember me for next time so I can log in automatically",
// null,"Y")); null,"Y"));
addCommandButton(new CDImageButton("login","bn_log_in.gif","Log In",80,24)); addCommandButton(new CDImageButton("login","bn_log_in.gif","Log In",80,24));
addCommandButton(new CDImageButton("cancel","bn_cancel.gif","Cancel",80,24)); addCommandButton(new CDImageButton("cancel","bn_cancel.gif","Cancel",80,24));

View File

@ -39,6 +39,7 @@ public class ManageConference implements JSPRender
private SIGContext sig; // the SIG we're in private SIGContext sig; // the SIG we're in
private ConferenceContext conf; // the conference being listed private ConferenceContext conf; // the conference being listed
private String locator = null; // the locator we use
/*-------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------
* Constructor * Constructor
@ -116,7 +117,9 @@ public class ManageConference implements JSPRender
public String getLocator() public String getLocator()
{ {
return "sig=" + sig.getSIGID() + "&conf=" + conf.getConfID(); if (locator==null)
locator = "sig=" + sig.getSIGID() + "&conf=" + conf.getConfID();
return locator;
} // end getLocator } // end getLocator
@ -128,8 +131,7 @@ public class ManageConference implements JSPRender
public boolean displayAdminSection() public boolean displayAdminSection()
{ {
return conf.canChangeConference(); return conf.canChangeConference() || conf.canDeleteConference();
// TODO: needs to have "delete" permission OR'ed in
} // end displayAdminSection } // end displayAdminSection

View File

@ -31,6 +31,7 @@ import com.silverwrist.util.StringUtil;
import com.silverwrist.venice.core.ConfigException; import com.silverwrist.venice.core.ConfigException;
import com.silverwrist.venice.core.UserContext; import com.silverwrist.venice.core.UserContext;
import com.silverwrist.venice.servlets.Variables; import com.silverwrist.venice.servlets.Variables;
import com.silverwrist.venice.servlets.format.menus.LeftMenu;
public class RenderConfig public class RenderConfig
{ {
@ -57,7 +58,8 @@ public class RenderConfig
private String image_url; private String image_url;
private String static_url; private String static_url;
private String site_logo; private String site_logo;
private Hashtable stock_messages; private HashMap stock_messages;
private HashMap menus;
/*-------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------
* Constructor * Constructor
@ -171,9 +173,10 @@ public class RenderConfig
} // end if } // end if
// Initialize the stock messages list. // Initialize the stock messages list.
stock_messages = new Hashtable(); stock_messages = new HashMap();
NodeList msg_nodes = msg_sect.getChildNodes(); NodeList msg_nodes = msg_sect.getChildNodes();
for (int i=0; i<msg_nodes.getLength(); i++) int i;
for (i=0; i<msg_nodes.getLength(); i++)
{ // examine all subnodes to add them to the message text { // examine all subnodes to add them to the message text
Node msgn = msg_nodes.item(i); Node msgn = msg_nodes.item(i);
if (msgn.getNodeType()==Node.ELEMENT_NODE) if (msgn.getNodeType()==Node.ELEMENT_NODE)
@ -191,6 +194,56 @@ public class RenderConfig
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
logger.debug(stock_messages.size() + " stock messages loaded from config"); logger.debug(stock_messages.size() + " stock messages loaded from config");
Element menu_sect = root_h.getSubElement("menu-definitions");
if (menu_sect==null)
{ // no <menu-definitions/> section - bail out now!
logger.fatal("config document has no <menu-definitions/> section");
throw new ConfigException("no <menu-definitions/> section found in config file",root);
} // end if
// Initialize the menus list.
menus = new HashMap();
NodeList menu_nodes = menu_sect.getChildNodes();
for (i=0; i<menu_nodes.getLength(); i++)
{ // look for <menudef> subnodes and use them to initialize menus
Node mn = menu_nodes.item(i);
if (mn.getNodeType()==Node.ELEMENT_NODE)
{ // found an element - now check it's name
if (mn.getNodeName().equals("menudef"))
{ // root of a menu definition - get its ID, build it, and save it
Element mel = (Element)mn;
String menuid = mel.getAttribute("id");
if (menuid==null)
{ // no menu ID attribute
logger.fatal("<menudef/> seen with no \"id\" attribute");
throw new ConfigException("<menudef/> seen with no \"id\" attribute",mel);
} // end if
// create the menu and add it to the mapping
LeftMenu menu = new LeftMenu(mel,menuid);
menus.put(menuid,menu);
if (logger.isDebugEnabled())
logger.debug("menu \"" + menuid + "\" defined");
} // end if (found the root of a menu definition)
else
{ // unknown element - bail out!
logger.fatal("config document has unknown node <" + mn.getNodeName() +
"/> inside <menu-definitions/>");
throw new ConfigException("unknown node name <" + mn.getNodeName() + "/> in <menu-definitions/>",
menu_sect);
} // end else
} // end if
} // end for
if (logger.isDebugEnabled())
logger.debug(menus.size() + " menu definitions loaded from config");
} // end constructor } // end constructor
/*-------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------
@ -337,20 +390,6 @@ public class RenderConfig
} // end getRequiredBullet } // end getRequiredBullet
void writeFooter(Writer out) throws IOException
{
out.write("<HR WIDTH=\"80%\">\n<TABLE ALIGN=CENTER BORDER=0 CELLPADDING=0 CELLSPACING=6><TR VALIGN=TOP>"
+ "\n<TD ALIGN=RIGHT>\n");
out.write(getStdFontTag(null,1));
out.write(getStockMessage("footer-text"));
out.write("</FONT>\n</TD>\n<TD ALIGN=LEFT>\n<A HREF=\"http://venice.sourceforge.net\" TARGET=\"_blank\">"
+ "<IMG SRC=\"");
out.write(getFullImagePath("powered-by-venice.gif"));
out.write("\" ALT=\"Powered by Venice\" WIDTH=140 HEIGHT=80 BORDER=0 HSPACE=0 VSPACE=0></A>\n</TD>\n"
+ "</TR></TABLE>\n");
} // end writeFooter
void writeContentHeader(Writer out, String primary, String secondary) throws IOException void writeContentHeader(Writer out, String primary, String secondary) throws IOException
{ {
out.write(getStdFontTag("#3333AA",5) + "<B>" + StringUtil.encodeHTML(primary) + "</B></FONT>"); out.write(getStdFontTag("#3333AA",5) + "<B>" + StringUtil.encodeHTML(primary) + "</B></FONT>");
@ -374,6 +413,12 @@ public class RenderConfig
} // end writeStockMessage } // end writeStockMessage
public LeftMenu getLeftMenu(String identifier)
{
return (LeftMenu)(menus.get(identifier));
} // end getLeftMenu
/*-------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------
* Static operations for use by VeniceServlet * Static operations for use by VeniceServlet
*-------------------------------------------------------------------------------- *--------------------------------------------------------------------------------
@ -410,14 +455,14 @@ public class RenderConfig
HttpServletResponse response) throws ServletException HttpServletResponse response) throws ServletException
{ {
UserContext uc = Variables.getUserContext(ctxt,request,request.getSession(true)); UserContext uc = Variables.getUserContext(ctxt,request,request.getSession(true));
return new RenderData(getRenderConfig(ctxt),uc,request,response); return new RenderData(getRenderConfig(ctxt),uc,ctxt,request,response);
} // end createRenderData } // end createRenderData
public static RenderData createRenderData(ServletContext ctxt, UserContext uc, HttpServletRequest request, public static RenderData createRenderData(ServletContext ctxt, UserContext uc, HttpServletRequest request,
HttpServletResponse response) throws ServletException HttpServletResponse response) throws ServletException
{ {
return new RenderData(getRenderConfig(ctxt),uc,request,response); return new RenderData(getRenderConfig(ctxt),uc,ctxt,request,response);
} // end createRenderData } // end createRenderData

View File

@ -29,6 +29,7 @@ import com.silverwrist.venice.core.IDUtils;
import com.silverwrist.venice.core.UserContext; import com.silverwrist.venice.core.UserContext;
import com.silverwrist.venice.db.PostLinkRewriter; import com.silverwrist.venice.db.PostLinkRewriter;
import com.silverwrist.venice.db.UserNameRewriter; import com.silverwrist.venice.db.UserNameRewriter;
import com.silverwrist.venice.servlets.format.menus.LeftMenu;
public class RenderData public class RenderData
{ {
@ -47,6 +48,7 @@ public class RenderData
*/ */
private RenderConfig rconf; private RenderConfig rconf;
private ServletContext ctxt;
private HttpServletRequest request; private HttpServletRequest request;
private HttpServletResponse response; private HttpServletResponse response;
private boolean can_gzip = false; private boolean can_gzip = false;
@ -60,9 +62,11 @@ public class RenderData
*-------------------------------------------------------------------------------- *--------------------------------------------------------------------------------
*/ */
RenderData(RenderConfig rconf, UserContext uc, HttpServletRequest request, HttpServletResponse response) RenderData(RenderConfig rconf, UserContext uc, ServletContext ctxt, HttpServletRequest request,
HttpServletResponse response)
{ {
this.rconf = rconf; this.rconf = rconf;
this.ctxt = ctxt;
this.request = request; this.request = request;
this.response = response; this.response = response;
@ -167,7 +171,13 @@ public class RenderData
{ {
return "/format/" + name; return "/format/" + name;
} // end getFullFormatJSPPath } // end getFormatJSPPath
public String getStaticIncludePath(String name)
{
return "/static/" + name;
} // end getStaticIncludePath
public String getStdFontTag(String color, int size) public String getStdFontTag(String color, int size)
{ {
@ -193,12 +203,6 @@ public class RenderData
} // end getRequiredBullet } // end getRequiredBullet
public void writeFooter(Writer out) throws IOException
{
rconf.writeFooter(out);
} // end writeFooter
public void writeContentHeader(Writer out, String primary, String secondary) throws IOException public void writeContentHeader(Writer out, String primary, String secondary) throws IOException
{ {
rconf.writeContentHeader(out,primary,secondary); rconf.writeContentHeader(out,primary,secondary);
@ -250,6 +254,12 @@ public class RenderData
} // end writeStockMessage } // end writeStockMessage
public LeftMenu getLeftMenu(String identifier)
{
return rconf.getLeftMenu(identifier);
} // end getLeftMenu
public String formatDateForDisplay(Date date) public String formatDateForDisplay(Date date)
{ {
if (display_date==null) if (display_date==null)
@ -491,4 +501,19 @@ public class RenderData
} // end rewritePostData } // end rewritePostData
public String mapToPath(String path)
{
return ctxt.getRealPath(path);
} // end mapToPath
public Cookie createCookie(String name, String value, int age)
{
Cookie rc = new Cookie(name,value);
rc.setMaxAge(age);
rc.setPath(request.getContextPath());
return rc;
} // end createCookie
} // end class RenderData } // end class RenderData

View File

@ -0,0 +1,128 @@
/*
* The contents of this file are subject to the Mozilla Public License Version 1.1
* (the "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at <http://www.mozilla.org/MPL/>.
*
* Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
* 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 Communities System.
*
* 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
* Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
package com.silverwrist.venice.servlets.format;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import com.silverwrist.venice.core.*;
public class ReportConferenceMenu implements JSPRender
{
/*--------------------------------------------------------------------------------
* Static data members
*--------------------------------------------------------------------------------
*/
// Attribute name for request attribute
protected static final String ATTR_NAME = "com.silverwrist.venice.content.ReportConferenceMenu";
/*--------------------------------------------------------------------------------
* Attributes
*--------------------------------------------------------------------------------
*/
private SIGContext sig; // the SIG we're in
private ConferenceContext conf; // the conference being listed
private List topics; // the topics in this conference
private String locator = null; // the locator
/*--------------------------------------------------------------------------------
* Constructor
*--------------------------------------------------------------------------------
*/
public ReportConferenceMenu(SIGContext sig, ConferenceContext conf) throws DataException, AccessError
{
this.sig = sig;
this.conf = conf;
this.topics = conf.getTopicList(ConferenceContext.GET_ALL,ConferenceContext.SORT_NUMBER);
} // end constructor
/*--------------------------------------------------------------------------------
* External static functions
*--------------------------------------------------------------------------------
*/
public static ReportConferenceMenu retrieve(ServletRequest request)
{
return (ReportConferenceMenu)(request.getAttribute(ATTR_NAME));
} // end retrieve
/*--------------------------------------------------------------------------------
* Implementations from interface VeniceContent
*--------------------------------------------------------------------------------
*/
public String getPageTitle(RenderData rdat)
{
return "Conference Reports: " + conf.getName();
} // end getPageTitle
/*--------------------------------------------------------------------------------
* Implementations from interface JSPRender
*--------------------------------------------------------------------------------
*/
public void store(ServletRequest request)
{
request.setAttribute(ATTR_NAME,this);
} // end store
public String getTargetJSPName()
{
return "report_conf.jsp";
} // end getTargetJSPName
/*--------------------------------------------------------------------------------
* External operations
*--------------------------------------------------------------------------------
*/
public int getConfID()
{
return conf.getConfID();
} // end getConfID
public String getConfName()
{
return conf.getName();
} // end getConfName
public String getLocator()
{
if (locator==null)
locator = "sig=" + sig.getSIGID() + "&conf=" + conf.getConfID();
return locator;
} // end getLocator
public Iterator getTopics()
{
return topics.iterator();
} // end getTopics
} // end class ReportConferenceMenu

View File

@ -0,0 +1,184 @@
/*
* The contents of this file are subject to the Mozilla Public License Version 1.1
* (the "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at <http://www.mozilla.org/MPL/>.
*
* Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
* 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 Communities System.
*
* 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
* Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
package com.silverwrist.venice.servlets.format;
import java.io.*;
import com.silverwrist.util.cachemap.CacheMap;
public class StaticRender implements ContentRender
{
/*--------------------------------------------------------------------------------
* Static data values
*--------------------------------------------------------------------------------
*/
private static CacheMap cache = new CacheMap(15,25);
/*--------------------------------------------------------------------------------
* Attributes
*--------------------------------------------------------------------------------
*/
private String name;
private boolean processed = false;
private String title = null;
private String content = null;
/*--------------------------------------------------------------------------------
* Static data values
*--------------------------------------------------------------------------------
*/
protected StaticRender(String name)
{
this.name = name;
} // end constructor
/*--------------------------------------------------------------------------------
* Internal functions
*--------------------------------------------------------------------------------
*/
private static String searchBetweenTags(StringBuffer data, String search, String tagname)
{
tagname = tagname.toUpperCase();
String start = "<" + tagname;
String end = "</" + tagname + ">";
int startpos = search.indexOf(start);
if (startpos<0)
return null;
startpos += start.length();
int bkt_pos = search.indexOf('>',startpos);
if (bkt_pos<0)
return null;
int end_pos = search.indexOf(end,++bkt_pos);
if (end_pos<0)
return data.substring(bkt_pos);
else
return data.substring(bkt_pos,end_pos);
} // end searchBetweenTags
private synchronized void process(RenderData rdat)
{
if (processed)
return; // check and set flag
// Map the content path to a real filename.
String real_path = rdat.mapToPath(rdat.getStaticIncludePath(name));
if (real_path==null)
{ // not found!
title = name;
content = "File not mappable: " + name;
return;
} // end if
// Read in the whole thing.
StringBuffer raw_file = new StringBuffer();
try
{ // read in from the file
FileReader rdr = new FileReader(real_path);
char[] buffer = new char[4096];
int rd = rdr.read(buffer);
while (rd>=0)
{ // read in the raw characters
if (rd>0)
raw_file.append(buffer,0,rd);
rd = rdr.read(buffer);
} // end while
rdr.close();
} // end try
catch (IOException ioe)
{ // I/O exception - just discard
title = name;
content = "I/O error reading " + name + ": " + ioe.getMessage();
return;
} // end catch
// make the upper-case search page and use that to locate the page title and body
String search_page = raw_file.toString().toUpperCase();
title = searchBetweenTags(raw_file,search_page,"TITLE");
content = searchBetweenTags(raw_file,search_page,"BODY");
if (content==null)
{ // no content?
content = "No content seen on " + name;
processed = false;
} // end if
processed = true; // set the flag to indicate we've got everything
} // end process
/*--------------------------------------------------------------------------------
* Implementations from interface VeniceContent
*--------------------------------------------------------------------------------
*/
public String getPageTitle(RenderData rdat)
{
process(rdat);
if (title==null)
return name;
else
return title;
} // end getPageTitle
/*--------------------------------------------------------------------------------
* Implementations from interface ContentRender
*--------------------------------------------------------------------------------
*/
public void renderHere(Writer out, RenderData rdat) throws IOException
{
process(rdat);
if (content!=null)
out.write(content);
} // end renderHere
/*--------------------------------------------------------------------------------
* External static operations
*--------------------------------------------------------------------------------
*/
public static StaticRender getStaticRender(String name)
{
StaticRender rc = (StaticRender)(cache.get(name));
if (rc==null)
{ // create a new object and cache it
rc = new StaticRender(name);
cache.put(name,rc);
} // end if
return rc;
} // end getStaticRender
} // end class StaticRender

View File

@ -149,7 +149,6 @@ public class TextMessageDialog implements ContentRender
} // end for } // end for
out.write("</DIV>\n"); out.write("</DIV>\n");
rdat.writeFooter(out);
} // end renderHere } // end renderHere

View File

@ -243,7 +243,6 @@ public class TopDisplay implements ContentRender
// Finish up. // Finish up.
out.write("</TD>\n</TR></TABLE>"); out.write("</TD>\n</TR></TABLE>");
rdat.writeFooter(out);
} // end renderHere } // end renderHere

View File

@ -15,58 +15,43 @@
* *
* Contributor(s): * Contributor(s):
*/ */
package com.silverwrist.util.collections; package com.silverwrist.venice.servlets.format.menus;
import java.util.*; import org.w3c.dom.*;
import com.silverwrist.util.*;
import com.silverwrist.venice.servlets.format.RenderData;
public class ReadOnlyVector extends AbstractList class AbsoluteLeftMenuItem extends LeftMenuItem
{ {
/*-------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------
* Attributes * Attributes
*-------------------------------------------------------------------------------- *--------------------------------------------------------------------------------
*/ */
private Vector my_vec; // local vector String url;
/*-------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------
* Constructor * Constructor
*-------------------------------------------------------------------------------- *--------------------------------------------------------------------------------
*/ */
public ReadOnlyVector(Vector vec) AbsoluteLeftMenuItem(Element elt)
{ {
my_vec = vec; super(elt);
my_vec.trimToSize(); DOMElementHelper h = new DOMElementHelper(elt);
url = h.getSubElementText("absolute");
} // end constructor } // end constructor
/*-------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------
* finalize() method * Overrides from class LeftMenuItem
*-------------------------------------------------------------------------------- *--------------------------------------------------------------------------------
*/ */
protected void finalize() throws Throwable protected void appendURL(StringBuffer sbuf, RenderData rdat)
{ {
my_vec = null; sbuf.append(url);
super.finalize();
} // end finalize } // end appendURL
/*-------------------------------------------------------------------------------- } // end class AbsoluteLeftMenuItem
* Implementations from superclass AbstractList
*--------------------------------------------------------------------------------
*/
public Object get(int index)
{
return my_vec.elementAt(index);
} // end get
public int size()
{
return my_vec.size();
} // end size
} // end class ReadOnlyVector

View File

@ -0,0 +1,57 @@
/*
* The contents of this file are subject to the Mozilla Public License Version 1.1
* (the "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at <http://www.mozilla.org/MPL/>.
*
* Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
* 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 Communities System.
*
* 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
* Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
package com.silverwrist.venice.servlets.format.menus;
import org.w3c.dom.*;
import com.silverwrist.util.*;
import com.silverwrist.venice.servlets.format.RenderData;
class FrameLeftMenuItem extends LeftMenuItem
{
/*--------------------------------------------------------------------------------
* Attributes
*--------------------------------------------------------------------------------
*/
String url;
/*--------------------------------------------------------------------------------
* Constructor
*--------------------------------------------------------------------------------
*/
FrameLeftMenuItem(Element elt)
{
super(elt);
DOMElementHelper h = new DOMElementHelper(elt);
url = h.getSubElementText("frame");
} // end constructor
/*--------------------------------------------------------------------------------
* Overrides from class LeftMenuItem
*--------------------------------------------------------------------------------
*/
protected void appendURL(StringBuffer sbuf, RenderData rdat)
{
sbuf.append(rdat.getEncodedServletPath("frame/" + url));
} // end appendURL
} // end class FrameLeftMenuItem

View File

@ -0,0 +1,188 @@
/*
* The contents of this file are subject to the Mozilla Public License Version 1.1
* (the "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at <http://www.mozilla.org/MPL/>.
*
* Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
* 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 Communities System.
*
* 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
* Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
package com.silverwrist.venice.servlets.format.menus;
import java.io.Writer;
import java.io.IOException;
import java.util.*;
import org.apache.log4j.*;
import org.w3c.dom.*;
import com.silverwrist.util.*;
import com.silverwrist.venice.core.ConfigException;
import com.silverwrist.venice.servlets.format.ComponentRender;
import com.silverwrist.venice.servlets.format.RenderData;
public class LeftMenu implements ComponentRender
{
/*--------------------------------------------------------------------------------
* Internal class representing a header component
*--------------------------------------------------------------------------------
*/
static class Header implements ComponentRender
{
private String txt; // the actual stored text
Header(Element elt)
{
DOMElementHelper h = new DOMElementHelper(elt);
StringBuffer buf = new StringBuffer("<B>");
buf.append(StringUtil.encodeHTML(h.getElementText())).append("</B><BR>\n");
txt = buf.toString();
} // end constructor
public void renderHere(Writer out, RenderData rdat) throws IOException
{
out.write(txt);
} // end renderHere
} // end class Header
/*--------------------------------------------------------------------------------
* Internal class representing a separator component
*--------------------------------------------------------------------------------
*/
static class Separator implements ComponentRender
{
Separator()
{ // do nothing
} // end constructor
public void renderHere(Writer out, RenderData rdat) throws IOException
{
out.write("<BR>\n");
} // end renderHere
} // end class Separator
/*--------------------------------------------------------------------------------
* Static data members
*--------------------------------------------------------------------------------
*/
private static Category logger = Category.getInstance(LeftMenu.class);
private static final Separator separator_singleton = new Separator();
/*--------------------------------------------------------------------------------
* Attributes
*--------------------------------------------------------------------------------
*/
private String identifier;
private ArrayList menu_items = new ArrayList();
/*--------------------------------------------------------------------------------
* Constructor
*--------------------------------------------------------------------------------
*/
public LeftMenu(Element elt, String identifier) throws ConfigException
{
if (!(elt.getNodeName().equals("menudef")))
{ // just some shorts-checking here to make sure the element is OK
logger.fatal("huh?!? this should have been a <menudef/> if it got here!");
throw new ConfigException("not a <menudef/> element");
} // end if
NodeList items = elt.getChildNodes();
for (int i=0; i<items.getLength(); i++)
{ // examine each of the child elements closely
Node n = items.item(i);
if (n.getNodeType()==Node.ELEMENT_NODE)
{ // we've found a child element - what type is it?
if (n.getNodeName().equals("menuitem"))
{ // investigate the contents of the subelement
DOMElementHelper h = new DOMElementHelper((Element)n);
if (!(h.hasChildElement("text")))
{ // no menu item text!
logger.fatal("<menuitem/> element has no <text/> subelement");
throw new ConfigException("<menuitem/> element has no <text/> subelement",h.getElement());
} // end if
LeftMenuItem mitem = null;
if (h.hasChildElement("servlet"))
mitem = new ServletLeftMenuItem(h.getElement());
else if (h.hasChildElement("absolute"))
mitem = new AbsoluteLeftMenuItem(h.getElement());
else if (h.hasChildElement("frame"))
mitem = new FrameLeftMenuItem(h.getElement());
else
{ // we don't know what type of menu this is!
logger.fatal("unknown <menuitem/> type seen in menu");
throw new ConfigException("unknown <menuitem/> type seen in menu",h.getElement());
} // end else
menu_items.add(mitem);
} // end if
else if (n.getNodeName().equals("header"))
menu_items.add(new Header((Element)n)); // add a new header
else if (n.getNodeName().equals("separator"))
menu_items.add(separator_singleton); // all separators are exactly the same
else
{ // menu definition has an unknown item
logger.fatal("unknown element <" + n.getNodeName() + "/> inside <menudef/>");
throw new ConfigException("unknown element <" + n.getNodeName() + "/> inside <menudef/>",n);
} // end else
} // end if (an element node)
} // end for (each child node)
this.identifier = identifier;
} // end constructor
/*--------------------------------------------------------------------------------
* Implementations from interface ComponentRender
*--------------------------------------------------------------------------------
*/
public void renderHere(Writer out, RenderData rdat) throws IOException
{
Iterator it = menu_items.iterator();
while (it.hasNext())
{ // render each menu item in turn
ComponentRender cr = (ComponentRender)(it.next());
cr.renderHere(out,rdat);
} // end while
} // end renderHere
/*--------------------------------------------------------------------------------
* External operations
*--------------------------------------------------------------------------------
*/
public String getIdentifier()
{
return identifier;
} // end getIdentifier
} // end class LeftMenu

View File

@ -0,0 +1,93 @@
/*
* The contents of this file are subject to the Mozilla Public License Version 1.1
* (the "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at <http://www.mozilla.org/MPL/>.
*
* Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
* 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 Communities System.
*
* 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
* Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
package com.silverwrist.venice.servlets.format.menus;
import java.io.Writer;
import java.io.IOException;
import org.w3c.dom.*;
import com.silverwrist.util.*;
import com.silverwrist.venice.servlets.format.ComponentRender;
import com.silverwrist.venice.servlets.format.RenderData;
abstract class LeftMenuItem implements ComponentRender
{
/*--------------------------------------------------------------------------------
* Attributes
*--------------------------------------------------------------------------------
*/
private String text;
private boolean disabled = false;
private boolean new_window = false;
/*--------------------------------------------------------------------------------
* Constructor
*--------------------------------------------------------------------------------
*/
protected LeftMenuItem(Element elt)
{
DOMElementHelper h = new DOMElementHelper(elt);
text = StringUtil.encodeHTML(h.getSubElementText("text"));
if (h.hasChildElement("disabled"))
disabled = true;
if (h.hasChildElement("new-window"))
new_window = true;
} // end constructor
/*--------------------------------------------------------------------------------
* Abstract functions which MUST be overridden
*--------------------------------------------------------------------------------
*/
protected abstract void appendURL(StringBuffer sbuf, RenderData rdat);
/*--------------------------------------------------------------------------------
* Implementations from interface ComponentRender
*--------------------------------------------------------------------------------
*/
public void renderHere(Writer out, RenderData rdat) throws IOException
{
StringBuffer buf = new StringBuffer();
if (disabled)
buf.append("<FONT COLOR=\"#CCCCCC\">");
else
{ // write the <A> tag
buf.append("<A HREF=\"");
appendURL(buf,rdat);
buf.append('"');
if (new_window)
buf.append(" TARGET=\"_blank\"");
buf.append('>');
} // end else (writing <A> tag)
buf.append(text);
if (disabled)
buf.append("</FONT>");
else
buf.append("</A>");
buf.append("<BR>\n");
out.write(buf.toString());
} // end renderHere
} // end class LeftMenuItem

View File

@ -0,0 +1,57 @@
/*
* The contents of this file are subject to the Mozilla Public License Version 1.1
* (the "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at <http://www.mozilla.org/MPL/>.
*
* Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
* 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 Communities System.
*
* 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
* Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
package com.silverwrist.venice.servlets.format.menus;
import org.w3c.dom.*;
import com.silverwrist.util.*;
import com.silverwrist.venice.servlets.format.RenderData;
class ServletLeftMenuItem extends LeftMenuItem
{
/*--------------------------------------------------------------------------------
* Attributes
*--------------------------------------------------------------------------------
*/
String url;
/*--------------------------------------------------------------------------------
* Constructor
*--------------------------------------------------------------------------------
*/
ServletLeftMenuItem(Element elt)
{
super(elt);
DOMElementHelper h = new DOMElementHelper(elt);
url = h.getSubElementText("servlet");
} // end constructor
/*--------------------------------------------------------------------------------
* Overrides from class LeftMenuItem
*--------------------------------------------------------------------------------
*/
protected void appendURL(StringBuffer sbuf, RenderData rdat)
{
sbuf.append(rdat.getEncodedServletPath(url));
} // end appendURL
} // end class ServletLeftMenuItem

View File

@ -38,4 +38,3 @@
WIDTH=80 HEIGHT=24 BORDER=0> WIDTH=80 HEIGHT=24 BORDER=0>
</FORM><P> </FORM><P>
</FONT> </FONT>
<% rdat.writeFooter(out); %>

View File

@ -20,19 +20,6 @@
<%@ page import = "com.silverwrist.venice.core.*" %> <%@ page import = "com.silverwrist.venice.core.*" %>
<%@ page import = "com.silverwrist.venice.servlets.Variables" %> <%@ page import = "com.silverwrist.venice.servlets.Variables" %>
<%@ page import = "com.silverwrist.venice.servlets.format.*" %> <%@ page import = "com.silverwrist.venice.servlets.format.*" %>
<%!
private static void renderMenu(HttpSession session, java.io.Writer out, RenderData rdat)
throws java.io.IOException
{
ComponentRender menu = Variables.getMenu(session);
if (menu==null)
menu = new MenuTop();
menu.renderHere(out,rdat);
} // end renderMenu
%>
<% <%
BaseJSPData basedat = BaseJSPData.retrieve(request); BaseJSPData basedat = BaseJSPData.retrieve(request);
Variables.failIfNull(basedat); Variables.failIfNull(basedat);
@ -97,36 +84,51 @@ private static void renderMenu(HttpSession session, java.io.Writer out, RenderDa
<% if (rdat.useHTMLComments()) { %><!-- END PAGE HEADER --><% } %> <% if (rdat.useHTMLComments()) { %><!-- END PAGE HEADER --><% } %>
<TR VALIGN=TOP><TD ALIGN=CENTER> <TR VALIGN=TOP><TD ALIGN=CENTER>
<TABLE ALIGN=CENTER WIDTH="100%" BORDER=0 CELLPADDING=2 CELLSPACING=0><TR VALIGN=TOP> <TABLE ALIGN=CENTER WIDTH="100%" BORDER=0 CELLPADDING=2 CELLSPACING=0>
<TD ALIGN=LEFT WIDTH=120 BGCOLOR="#9999FF"> <TR VALIGN=TOP>
<TABLE ALIGN=LEFT WIDTH=120 CELPADDING=0 CELLSPACING=0> <TD ALIGN=LEFT WIDTH=120 BGCOLOR="#9999FF">
<% if (rdat.useHTMLComments()) { %><!-- BEGIN LEFT SIDEBAR --><% } %> <TABLE ALIGN=LEFT WIDTH=120 CELPADDING=0 CELLSPACING=0>
<TR VALIGN=TOP><TD VALIGN=LEFT><%= rdat.getStdFontTag(null,2) %> <% if (rdat.useHTMLComments()) { %><!-- BEGIN LEFT SIDEBAR --><% } %>
<% if (rdat.useHTMLComments()) { %><!-- variable menu --><% } %> <TR VALIGN=TOP><TD VALIGN=LEFT><%= rdat.getStdFontTag(null,2) %>
<% renderMenu(session,out,rdat); %> <% if (rdat.useHTMLComments()) { %><!-- variable menu --><% } %>
</FONT></TD></TR> <% basedat.renderMenu(session,out,rdat); %>
</FONT></TD></TR>
<TR VALIGN=TOP><TD VALIGN=LEFT>&nbsp;</TD></TR> <TR VALIGN=TOP><TD VALIGN=LEFT>&nbsp;</TD></TR>
<TR VALIGN=TOP><TD VALIGN=LEFT><%= rdat.getStdFontTag(null,2) %> <TR VALIGN=TOP><TD VALIGN=LEFT><%= rdat.getStdFontTag(null,2) %>
<% if (rdat.useHTMLComments()) { %><!-- fixed menu --><% } %> <% if (rdat.useHTMLComments()) { %><!-- fixed menu --><% } %>
<B>About This Site</B><BR> <% basedat.renderFixedMenu(out,rdat); %>
<A HREF="/TODO">Documentation</A><BR> </FONT></TD></TR>
<A HREF="/TODO">About Venice</A>
</FONT></TD></TR>
<% if (rdat.useHTMLComments()) { %><!-- END LEFT SIDEBAR --><% } %> <% if (rdat.useHTMLComments()) { %><!-- END LEFT SIDEBAR --><% } %>
</TABLE> </TABLE>
</TD> </TD>
<TD ALIGN=LEFT WIDTH="100%" BGCOLOR="white"> <TD ALIGN=LEFT WIDTH="100%" BGCOLOR="white">
<TABLE WIDTH="100%" BORDER=0 CELLPADDING=2 CELLSPACING=0><TR VALIGN=TOP><TD ALIGN=LEFT>
<% if (rdat.useHTMLComments()) { %><!-- BEGIN PAGE CONTENT --><% } %> <% if (rdat.useHTMLComments()) { %><!-- BEGIN PAGE CONTENT --><% } %>
<% basedat.renderContent(application,out,rdat); %> <% basedat.renderContent(application,out,rdat); %>
<% if (rdat.useHTMLComments()) { %><!-- END PAGE CONTENT --><% } %> <% if (rdat.useHTMLComments()) { %><!-- END PAGE CONTENT --><% } %>
</TD></TR></TABLE> </TD>
</TD> </TR>
</TR></TABLE> <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> </TD></TR>
</TABLE> </TABLE>
</BODY> </BODY>

View File

@ -25,11 +25,18 @@
Variables.failIfNull(data); Variables.failIfNull(data);
RenderData rdat = RenderConfig.createRenderData(application,request,response); RenderData rdat = RenderConfig.createRenderData(application,request,response);
%> %>
<% rdat.writeContentHeader(out,(data.isPosterReport() ? "Posters in Conference:" <%
: "Readers in Conference:"),data.getConfName()); %> if (data.isTopicReport())
rdat.writeContentHeader(out,(data.isPosterReport() ? "Posters in Topic:"
: "Readers in Topic:"),
data.getTopicName() + " in " + data.getConfName());
else
rdat.writeContentHeader(out,(data.isPosterReport() ? "Posters in Conference:"
: "Readers in Conference:"),data.getConfName());
%>
<%= rdat.getStdFontTag(null,2) %> <%= rdat.getStdFontTag(null,2) %>
<A HREF="<%= rdat.getEncodedServletPath("confops?" + data.getLocator() + "&cmd=Q") %>">Return to <A HREF="<%= rdat.getEncodedServletPath("confops?" + data.getLocator() + "&cmd=QR") %>">Return to
Manage Conference Menu</A> Conference Reports Menu</A>
</FONT><P> </FONT><P>
<% if (data.anyElements()) { %> <% if (data.anyElements()) { %>
@ -79,11 +86,18 @@
</TABLE> </TABLE>
<% } else { %> <% } else { %>
<%= rdat.getStdFontTag(null,2) %><EM> <%= rdat.getStdFontTag(null,2) %><EM>
<% if (data.isPosterReport()) { %> <% if (data.isTopicReport()) { %>
No posters to conference "<%= StringUtil.encodeHTML(data.getConfName()) %>" found. <% if (data.isPosterReport()) { %>
No posters to topic "<%= data.getTopicName() %>" found.
<% } else { %>
No readers of topic "<%= data.getTopicName() %>" found.
<% } // end if %>
<% } else { %> <% } else { %>
No readers of conference "<%= StringUtil.encodeHTML(data.getConfName()) %>" found. <% if (data.isPosterReport()) { %>
No posters to conference "<%= StringUtil.encodeHTML(data.getConfName()) %>" found.
<% } else { %>
No readers of conference "<%= StringUtil.encodeHTML(data.getConfName()) %>" found.
<% } // end if %>
<% } // end if %> <% } // end if %>
</EM></FONT> </EM></FONT>
<% } // end if %> <% } // end if %>
<P><% rdat.writeFooter(out); %>

View File

@ -151,4 +151,3 @@
WIDTH=80 HEIGHT=24 BORDER=0> WIDTH=80 HEIGHT=24 BORDER=0>
</FORM><BR> </FORM><BR>
<% } // end if %> <% } // end if %>
<% rdat.writeFooter(out); %>

View File

@ -137,4 +137,3 @@
<% } else { %> <% } else { %>
<%= rdat.getStdFontTag(null,2) %><EM>There are no conferences in this SIG.</EM></FONT> <%= rdat.getStdFontTag(null,2) %><EM>There are no conferences in this SIG.</EM></FONT>
<% } // end if %> <% } // end if %>
<% rdat.writeFooter(out); %>

View File

@ -72,4 +72,3 @@
BORDER=0></A>&nbsp; BORDER=0></A>&nbsp;
<% } // end if %> <% } // end if %>
</DIV> </DIV>
<% rdat.writeFooter(out); %>

View File

@ -286,4 +286,3 @@ private static String getActivityString(SIGContext sig, RenderData rdat)
</TABLE><BR CLEAR=LEFT> </TABLE><BR CLEAR=LEFT>
<% } // end if (results found) %> <% } // end if (results found) %>
<% rdat.writeFooter(out); %>

View File

@ -96,4 +96,3 @@
by visiting the conferences and pressing the "Add to Hotlist" button. by visiting the conferences and pressing the "Add to Hotlist" button.
</EM></FONT> </EM></FONT>
<% } // end if %> <% } // end if %>
<% rdat.writeFooter(out); %>

View File

@ -49,4 +49,3 @@
</TD></TR> </TD></TR>
</TABLE> </TABLE>
</FORM> </FORM>
<% rdat.writeFooter(out); %>

View File

@ -68,4 +68,3 @@
</FORM> </FORM>
</FONT> </FONT>
<% rdat.writeFooter(out); %>

View File

@ -61,13 +61,9 @@
Conference Aliases</A><P> Conference Aliases</A><P>
<A HREF="<%= rdat.getEncodedServletPath("confops?" + data.getLocator() + "&cmd=M") %>">Manage <A HREF="<%= rdat.getEncodedServletPath("confops?" + data.getLocator() + "&cmd=M") %>">Manage
Conference Members</A><P> Conference Members</A><P>
<A HREF="<%= rdat.getEncodedServletPath("confops?" + data.getLocator() + "&cmd=RP") %>">Conference <A HREF="<%= rdat.getEncodedServletPath("confops?" + data.getLocator() + "&cmd=QR") %>">Conference
Posters Report</A><P> Activity Reports</A><P>
<A HREF="<%= rdat.getEncodedServletPath("confops?" + data.getLocator() + "&cmd=RR") %>">Conference
Readers/Lurkers Report</A><P>
<A HREF="<%= rdat.getEncodedServletPath("confops?" + data.getLocator() + "&cmd=DEL") %>">Delete <A HREF="<%= rdat.getEncodedServletPath("confops?" + data.getLocator() + "&cmd=DEL") %>">Delete
Conference</A><P> Conference</A><P>
</B></FONT> </B></FONT>
<% } // end if (displaying admin section) %> <% } // end if (displaying admin section) %>
<% rdat.writeFooter(out); %>

View File

@ -40,5 +40,3 @@
<A HREF="/TODO">Invite Users</A> <A HREF="/TODO">Invite Users</A>
</DIV> </DIV>
</FONT> </FONT>
<% rdat.writeFooter(out); %>

View File

@ -48,7 +48,7 @@
<TABLE BORDER=0 CELLPADDING=0> <TABLE BORDER=0 CELLPADDING=0>
<TR><TD ALIGN=LEFT COLSPAN=2> <TR><TD ALIGN=LEFT COLSPAN=2>
<%= rdat.getStdFontTag(null,2) %>New topic name:</FONT><BR> <%= rdat.getStdFontTag(null,2) %>New topic name:</FONT><BR>
<INPUT TYPE="TEXT" NAME="title" SIZE=37 MAXLENGTH=255 VALUE="<%= data.getTopicName() %>"> <INPUT TYPE="TEXT" NAME="title" SIZE=37 MAXLENGTH=128 VALUE="<%= data.getTopicName() %>">
</TD></TR> </TD></TR>
<TR><TD ALIGN=LEFT COLSPAN=2> <TR><TD ALIGN=LEFT COLSPAN=2>
<%= rdat.getStdFontTag(null,2) %>Your name/header:</FONT><BR> <%= rdat.getStdFontTag(null,2) %>Your name/header:</FONT><BR>
@ -77,4 +77,3 @@
</TD></TR> </TD></TR>
</TABLE> </TABLE>
</FORM> </FORM>
<% rdat.writeFooter(out); %>

View File

@ -176,7 +176,7 @@
</EM>) </EM>)
<% if (msg.hasAttachment()) { %> <% if (msg.hasAttachment()) { %>
<A HREF="<%= rdat.getEncodedServletPath("attachment?" + data.getConfLocator() + "&msg=" <A HREF="<%= rdat.getEncodedServletPath("attachment?" + data.getConfLocator() + "&msg="
+ msg.getPostID()) %>"><IMG + msg.getPostID()) %>" TARGET="_blank"><IMG
SRC="<%= rdat.getFullImagePath("attachment.gif") %>" SRC="<%= rdat.getFullImagePath("attachment.gif") %>"
ALT="(Attachment <%= msg.getAttachmentFilename() %> - <%= msg.getAttachmentLength() %> bytes)" ALT="(Attachment <%= msg.getAttachmentFilename() %> - <%= msg.getAttachmentLength() %> bytes)"
WIDTH=16 HEIGHT=16 BORDER=0></A> WIDTH=16 HEIGHT=16 BORDER=0></A>
@ -341,4 +341,3 @@
<% } else if (data.isTopicFrozen()) { %> <% } else if (data.isTopicFrozen()) { %>
<DIV ALIGN=CENTER><%= rdat.getStdFontTag(null,2) %><B>This is a <EM>Frozen</EM> Topic</B></DIV> <DIV ALIGN=CENTER><%= rdat.getStdFontTag(null,2) %><B>This is a <EM>Frozen</EM> Topic</B></DIV>
<% } // end if %> <% } // end if %>
<% rdat.writeFooter(out); %>

View File

@ -84,4 +84,3 @@
</TD></TR> </TD></TR>
</TABLE> </TABLE>
</FORM> </FORM>
<% rdat.writeFooter(out); %>

View File

@ -0,0 +1,73 @@
<%--
The contents of this file are subject to the Mozilla Public License Version 1.1
(the "License"); you may not use this file except in compliance with the License.
You may obtain a copy of the License at <http://www.mozilla.org/MPL/>.
Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
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 Communities System.
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
Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
Contributor(s):
--%>
<%@ page import = "java.util.*" %>
<%@ page import = "com.silverwrist.util.StringUtil" %>
<%@ page import = "com.silverwrist.venice.core.*" %>
<%@ page import = "com.silverwrist.venice.servlets.Variables" %>
<%@ page import = "com.silverwrist.venice.servlets.format.*" %>
<%
ReportConferenceMenu data = ReportConferenceMenu.retrieve(request);
Variables.failIfNull(data);
RenderData rdat = RenderConfig.createRenderData(application,request,response);
String stdfont = rdat.getStdFontTag(null,2);
String partial;
%>
<% if (rdat.useHTMLComments()) { %><!-- Reports for conference #<%= data.getConfID() %> --><% } %>
<% rdat.writeContentHeader(out,"Conference Reports:",data.getConfName()); %>
<%= stdfont %>
<A HREF="<%= rdat.getEncodedServletPath("confops?" + data.getLocator() + "&cmd=Q") %>">Return to Manage
Conference Menu</A>
</FONT><P>
<TABLE ALIGN=CENTER BORDER=0 CELLPADDING=0 CELLSPACING=6>
<TR VALIGN=MIDDLE>
<TH ALIGN=LEFT><%= stdfont %><B><U>#</U></B></FONT></TH>
<TH ALIGN=LEFT><%= stdfont %><B><U>Topic Name</U></B></FONT></TH>
<TH ALIGN=LEFT COLSPAN=2><%= stdfont %><B><U>Reports</U></B></FONT></TH>
</TR>
<TR VALIGN=MIDDLE>
<TD ALIGN=LEFT>&nbsp;</TD>
<TD ALIGN=LEFT><%= stdfont %>(Entire conference)</FONT></TD>
<% partial = "confops?" + data.getLocator() + "&cmd="; %>
<TD ALIGN=LEFT><%= stdfont %>
<A HREF="<%= rdat.getEncodedServletPath(partial + "RP") %>">Posters</A>
</FONT></TD>
<TD ALIGN=LEFT><%= stdfont %>
<A HREF="<%= rdat.getEncodedServletPath(partial + "RR") %>">Readers/Lurkers</A>
</FONT></TD>
</TR>
<% Iterator it = data.getTopics(); %>
<% while (it.hasNext()) { %>
<%
TopicContext topic = (TopicContext)(it.next());
partial = "confops?" + data.getLocator() + "&top=" + topic.getTopicNumber() + "&cmd=";
%>
<TR VALIGN=MIDDLE>
<TD ALIGN=LEFT><%= stdfont %><%= topic.getTopicNumber() %></FONT></TD>
<TD ALIGN=LEFT><%= stdfont %><%= topic.getName() %></FONT></TD>
<TD ALIGN=LEFT><%= stdfont %>
<A HREF="<%= rdat.getEncodedServletPath(partial + "RP") %>">Posters</A>
</FONT></TD>
<TD ALIGN=LEFT><%= stdfont %>
<A HREF="<%= rdat.getEncodedServletPath(partial + "RR") %>">Readers/Lurkers</A>
</FONT></TD>
</TR>
<% } // end while %>
</TABLE><P>

View File

@ -148,4 +148,3 @@
WIDTH=80 HEIGHT=24 BORDER=0> WIDTH=80 HEIGHT=24 BORDER=0>
</FORM><BR> </FORM><BR>
<% } // end if %> <% } // end if %>
<% rdat.writeFooter(out); %>

View File

@ -69,4 +69,3 @@
<B>SIG Administration</B> menu.<P> <B>SIG Administration</B> menu.<P>
</FONT> </FONT>
<% rdat.writeFooter(out); %>

View File

@ -62,4 +62,3 @@
<% } else { %> <% } else { %>
<%= rdat.getStdFontTag(null,2) %><EM>You are not a member of any SIGs.</EM></FONT> <%= rdat.getStdFontTag(null,2) %><EM>You are not a member of any SIGs.</EM></FONT>
<% } // end if %> <% } // end if %>
<% rdat.writeFooter(out); %>

View File

@ -100,4 +100,3 @@
</FONT></TD> </FONT></TD>
</TR></TABLE> </TR></TABLE>
<% rdat.writeFooter(out); %>

View File

@ -33,4 +33,3 @@
has elected to provide. Enjoy your membership!<P> has elected to provide. Enjoy your membership!<P>
<DIV ALIGN=CENTER><A HREF="<%= data.getEntryURL(rdat) %>">Enter SIG</A></DIV> <DIV ALIGN=CENTER><A HREF="<%= data.getEntryURL(rdat) %>">Enter SIG</A></DIV>
</FONT> </FONT>
<% rdat.writeFooter(out); %>

View File

@ -106,6 +106,3 @@
</TD></TR> </TD></TR>
</TABLE> </TABLE>
</FORM> </FORM>
<% rdat.writeFooter(out); %>

View File

@ -190,4 +190,3 @@
<B>]</B> <B>]</B>
</DIV> </DIV>
</FONT> </FONT>
<% rdat.writeFooter(out); %>

View File

@ -109,5 +109,3 @@
</TABLE> </TABLE>
</FORM> </FORM>
<% } // end if %> <% } // end if %>
<% rdat.writeFooter(out); %>

BIN
web/images/sw-main.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

BIN
web/images/venicelogo.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

View File

@ -0,0 +1,43 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>About Venice</title>
</head>
<body bgcolor="white">
<DIV ALIGN="CENTER"><IMG SRC="/venice/images/venicelogo.jpg" ALT="Venice Web Communities System"
WIDTH=420 HEIGHT=80 BORDER=0></DIV><BR>
<H3>Venice Web Communities System Release 0.01PR</H3>
<FONT FACE="Arial, Helvetica" SIZE=2>
Copyright &copy; 2001 Silverwrist Design Studios, All Rights Reserved.<P>
This software is subject to the
<A HREF="http://www.mozilla.org/MPL/MPL-1.1.html" TARGET="_blank">Mozilla Public License Version 1.1</A>.
It is distributed on an "AS IS" basis, <B>without warranty of any kind</B>, either express or implied.
See the License for the specific language governing rights and limitations under the License.
</FONT><P>
<H3>The Venice Project Team</H3>
<FONT FACE="Arial, Helvetica" SIZE=2><DL>
<DT><B>Eric Bowersox</B> &lt;erbo&gt;</DT>
<DD>Code wrangler, system guru, and administrator in general</DD>
<DT><B>Harry Pike</B> &lt;maddog&gt;</DT>
<DD>EMinds host and domain expert in virtual community hosting</DD>
<DT><B>Finnegan</B> &lt;finnegan&gt;</DT>
<DD>Designer of the Venice web site</DD>
<DT><B>Catherine Dodson</B> &lt;cait&gt;</DT>
<DD>Technical documentation</DD>
<DT><B>Pamela Boulais</B> &lt;silverwrist&gt;</DT>
<DD>Administrative support, liaison, and den mother</DD>
<DT><B>The Entire Electric Minds Community</B></DT>
<DD>Beta testing, bug hunting, and encouragement</DD>
</DL></FONT>
<DIV ALIGN="CENTER"><FONT FACE="Arial, Helvetica" SIZE=2><EM>
Thanks to: Howard, who thought it up; Andre, who rescued it the first time; and the community, who
kept it together no matter what.
</EM></FONT></DIV><P>
<DIV ALIGN="CENTER"><A HREF="http://www.silverwrist.com"><IMG SRC="/venice/images/sw-main.gif"
ALT="Silverwrist Design Studios" WIDTH=294 HEIGHT=208 BORDER=0</A></DIV>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB