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:
parent
3d32fe95c5
commit
63fedc9db6
|
@ -8,7 +8,7 @@
|
|||
WARRANTY OF ANY KIND, either express or implied. See the License for the specific
|
||||
language governing rights and limitations under the License.
|
||||
|
||||
The Original Code is the Venice Web Community System.
|
||||
The Original Code is the Venice Web Communities System.
|
||||
|
||||
The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
|
||||
for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
|
||||
|
@ -86,4 +86,38 @@ Text of this agreement is TBD.
|
|||
|
||||
</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>
|
||||
|
|
13
etc/web.xml
13
etc/web.xml
|
@ -69,6 +69,14 @@
|
|||
<load-on-startup>3</load-on-startup>
|
||||
</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-name>account</servlet-name>
|
||||
<description>
|
||||
|
@ -216,6 +224,11 @@
|
|||
<url-pattern>/top</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<servlet-mapping>
|
||||
<servlet-name>framestatic</servlet-name>
|
||||
<url-pattern>/frame/*</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<servlet-mapping>
|
||||
<servlet-name>account</servlet-name>
|
||||
<url-pattern>/account</url-pattern>
|
||||
|
|
|
@ -71,6 +71,7 @@ CREATE TABLE users (
|
|||
uid INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||
username VARCHAR(64) NOT NULL,
|
||||
passhash VARCHAR(64) NOT NULL,
|
||||
tokenauth VARCHAR(64),
|
||||
contactid INT DEFAULT -1,
|
||||
is_anon TINYINT DEFAULT 0,
|
||||
verify_email TINYINT DEFAULT 0,
|
||||
|
@ -345,6 +346,8 @@ CREATE TABLE topicsettings (
|
|||
uid INT NOT NULL,
|
||||
hidden TINYINT DEFAULT 0,
|
||||
last_message INT DEFAULT -1,
|
||||
last_read DATETIME,
|
||||
last_post DATETIME,
|
||||
PRIMARY KEY (topicid, uid)
|
||||
);
|
||||
|
||||
|
|
400
src/com/silverwrist/util/cachemap/CacheMap.java
Normal file
400
src/com/silverwrist/util/cachemap/CacheMap.java
Normal 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
|
154
src/com/silverwrist/util/cachemap/CacheMapEntry.java
Normal file
154
src/com/silverwrist/util/cachemap/CacheMapEntry.java
Normal 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
|
|
@ -15,23 +15,10 @@
|
|||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
package com.silverwrist.venice.servlets.format;
|
||||
package com.silverwrist.util.cachemap;
|
||||
|
||||
import java.io.Writer;
|
||||
import java.io.IOException;
|
||||
|
||||
public class MenuTop implements ComponentRender
|
||||
public interface CacheMapStrategy
|
||||
{
|
||||
public MenuTop()
|
||||
{ // constructor does nothing
|
||||
} // end constructor
|
||||
public abstract long getEntryValue(CacheMapEntry entry, long tick);
|
||||
|
||||
public void renderHere(Writer out, RenderData rdat) throws IOException
|
||||
{
|
||||
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
|
||||
} // end interface CacheMapStrategy
|
|
@ -18,7 +18,6 @@
|
|||
package com.silverwrist.util.rcache;
|
||||
|
||||
import java.util.*;
|
||||
import com.silverwrist.util.collections.*;
|
||||
|
||||
public class ReferenceCache
|
||||
{
|
||||
|
@ -124,7 +123,7 @@ public class ReferenceCache
|
|||
|
||||
public List sweepReturn()
|
||||
{
|
||||
Vector rc = new Vector();
|
||||
ArrayList rc = new ArrayList();
|
||||
int count = 0;
|
||||
|
||||
synchronized (this)
|
||||
|
@ -155,7 +154,7 @@ public class ReferenceCache
|
|||
|
||||
} // end synchronized block
|
||||
|
||||
return new ReadOnlyVector(rc);
|
||||
return Collections.unmodifiableList(rc);
|
||||
|
||||
} // end sweepReturn
|
||||
|
||||
|
|
|
@ -78,5 +78,17 @@ public interface TopicContext
|
|||
|
||||
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
|
||||
|
||||
|
|
|
@ -103,4 +103,8 @@ public interface UserContext extends SearchMode
|
|||
|
||||
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
|
||||
|
|
|
@ -20,7 +20,6 @@ package com.silverwrist.venice.core.impl;
|
|||
import java.sql.*;
|
||||
import java.util.*;
|
||||
import org.apache.log4j.*;
|
||||
import com.silverwrist.util.collections.*;
|
||||
import com.silverwrist.venice.db.*;
|
||||
import com.silverwrist.venice.core.*;
|
||||
|
||||
|
@ -70,7 +69,7 @@ class CategoryDescriptorImpl implements CategoryDescriptor, Cloneable
|
|||
*/
|
||||
|
||||
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 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
|
||||
{
|
||||
this.datapool = datapool;
|
||||
cats = new Vector();
|
||||
cats = new LinkedList();
|
||||
this.do_hide = do_hide;
|
||||
|
||||
if (catid<0)
|
||||
|
@ -114,7 +113,7 @@ class CategoryDescriptorImpl implements CategoryDescriptor, Cloneable
|
|||
throws SQLException, DataException
|
||||
{
|
||||
this.datapool = datapool;
|
||||
cats = new Vector();
|
||||
cats = new LinkedList();
|
||||
this.do_hide = do_hide;
|
||||
|
||||
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)
|
||||
{
|
||||
this.datapool = datapool;
|
||||
this.cats = new Vector();
|
||||
this.cats = new LinkedList();
|
||||
this.symlink = symlink;
|
||||
this.do_hide = do_hide;
|
||||
|
||||
this.cats.add(new CatSegment(id,name));
|
||||
this.cats.trimToSize();
|
||||
|
||||
} // end constructor
|
||||
|
||||
protected CategoryDescriptorImpl(CategoryDescriptorImpl other, int copy_levels)
|
||||
{
|
||||
this.datapool = other.datapool;
|
||||
this.cats = new Vector();
|
||||
this.cats = new LinkedList();
|
||||
this.symlink = ((copy_levels==other.cats.size()) ? other.symlink : -1);
|
||||
this.do_hide = other.do_hide;
|
||||
|
||||
|
@ -147,7 +145,6 @@ class CategoryDescriptorImpl implements CategoryDescriptor, Cloneable
|
|||
{ // copy the references to the objects directly
|
||||
for (int i=0; i<copy_levels; i++)
|
||||
this.cats.add(other.cats.get(i));
|
||||
this.cats.trimToSize();
|
||||
|
||||
} // end if
|
||||
|
||||
|
@ -156,7 +153,7 @@ class CategoryDescriptorImpl implements CategoryDescriptor, Cloneable
|
|||
protected CategoryDescriptorImpl(CategoryDescriptorImpl other, int id, int symlink, String name)
|
||||
{
|
||||
this.datapool = other.datapool;
|
||||
this.cats = new Vector();
|
||||
this.cats = new LinkedList();
|
||||
this.symlink = symlink;
|
||||
this.do_hide = other.do_hide;
|
||||
|
||||
|
@ -164,7 +161,6 @@ class CategoryDescriptorImpl implements CategoryDescriptor, Cloneable
|
|||
for (int i=0; i<other.cats.size(); i++)
|
||||
this.cats.add(other.cats.get(i));
|
||||
this.cats.add(new CatSegment(id,name));
|
||||
this.cats.trimToSize();
|
||||
|
||||
} // end constructor
|
||||
|
||||
|
@ -209,13 +205,11 @@ class CategoryDescriptorImpl implements CategoryDescriptor, Cloneable
|
|||
|
||||
} // 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");
|
||||
|
||||
} // end while
|
||||
|
||||
cats.trimToSize(); // shrink vector down to size
|
||||
|
||||
} // end doFillFromTop
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
|
@ -226,7 +220,7 @@ class CategoryDescriptorImpl implements CategoryDescriptor, Cloneable
|
|||
public int getCategoryID()
|
||||
{
|
||||
if (cats.size()>0)
|
||||
return ((CatSegment)(cats.lastElement())).getID();
|
||||
return ((CatSegment)(cats.getLast())).getID();
|
||||
else
|
||||
return -1;
|
||||
|
||||
|
@ -260,7 +254,7 @@ class CategoryDescriptorImpl implements CategoryDescriptor, Cloneable
|
|||
} // end if
|
||||
|
||||
Connection conn = null;
|
||||
Vector rc = new Vector();
|
||||
ArrayList rc = new ArrayList();
|
||||
try
|
||||
{ // get a connection and create a statement
|
||||
conn = datapool.getConnection();
|
||||
|
@ -294,8 +288,7 @@ class CategoryDescriptorImpl implements CategoryDescriptor, Cloneable
|
|||
|
||||
} // end finally
|
||||
|
||||
// wrap the vector in a ReadOnlyVector object
|
||||
return new ReadOnlyVector(rc);
|
||||
return Collections.unmodifiableList(rc);
|
||||
|
||||
} // end getSubCategories
|
||||
|
||||
|
@ -393,7 +386,7 @@ class CategoryDescriptorImpl implements CategoryDescriptor, Cloneable
|
|||
static List getTopLevelCategoryList(DataPool datapool, boolean do_hide) throws DataException
|
||||
{
|
||||
Connection conn = null;
|
||||
Vector rc = new Vector();
|
||||
ArrayList rc = new ArrayList();
|
||||
try
|
||||
{ // get a connection and create a statement
|
||||
conn = datapool.getConnection();
|
||||
|
@ -426,8 +419,7 @@ class CategoryDescriptorImpl implements CategoryDescriptor, Cloneable
|
|||
|
||||
} // end finally
|
||||
|
||||
// wrap the vector in a ReadOnlyVector object
|
||||
return new ReadOnlyVector(rc);
|
||||
return Collections.unmodifiableList(rc);
|
||||
|
||||
} // end getTopLevelCategoryList
|
||||
|
||||
|
@ -438,7 +430,7 @@ class CategoryDescriptorImpl implements CategoryDescriptor, Cloneable
|
|||
logger.debug("Category search: mode = " + String.valueOf(mode) + ", term '" + term + "', offset = "
|
||||
+ String.valueOf(offset) + ", count = " + String.valueOf(count));
|
||||
|
||||
Vector rc = new Vector();
|
||||
ArrayList rc = new ArrayList();
|
||||
Connection conn = null; // pooled database connection
|
||||
|
||||
try
|
||||
|
@ -505,7 +497,7 @@ class CategoryDescriptorImpl implements CategoryDescriptor, Cloneable
|
|||
|
||||
} // end finally
|
||||
|
||||
return new ReadOnlyVector(rc);
|
||||
return Collections.unmodifiableList(rc);
|
||||
|
||||
} // end searchForCategories
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@ package com.silverwrist.venice.core.impl;
|
|||
import java.sql.*;
|
||||
import java.util.*;
|
||||
import org.apache.log4j.*;
|
||||
import com.silverwrist.util.collections.*;
|
||||
import com.silverwrist.venice.db.*;
|
||||
import com.silverwrist.venice.security.AuditRecord;
|
||||
import com.silverwrist.venice.security.DefaultLevels;
|
||||
|
@ -233,7 +232,7 @@ class ConferenceCoreData implements ConferenceData
|
|||
throw new DataException("This conference has been deleted.");
|
||||
|
||||
Connection conn = null;
|
||||
Vector rc = new Vector();
|
||||
ArrayList rc = new ArrayList();
|
||||
|
||||
try
|
||||
{ // get a database connection from this object
|
||||
|
@ -263,7 +262,7 @@ class ConferenceCoreData implements ConferenceData
|
|||
|
||||
} // end finally
|
||||
|
||||
return new ReadOnlyVector(rc);
|
||||
return Collections.unmodifiableList(rc);
|
||||
|
||||
} // end getAlias
|
||||
|
||||
|
@ -273,7 +272,7 @@ class ConferenceCoreData implements ConferenceData
|
|||
throw new DataException("This conference has been deleted.");
|
||||
|
||||
Connection conn = null;
|
||||
Vector rc = new Vector();
|
||||
ArrayList rc = new ArrayList();
|
||||
|
||||
try
|
||||
{ // get a database connection from this object
|
||||
|
@ -312,7 +311,7 @@ class ConferenceCoreData implements ConferenceData
|
|||
|
||||
} // end finally
|
||||
|
||||
return new ReadOnlyVector(rc);
|
||||
return Collections.unmodifiableList(rc);
|
||||
|
||||
} // end getHosts
|
||||
|
||||
|
@ -1059,7 +1058,7 @@ class ConferenceCoreData implements ConferenceData
|
|||
if (logger.isDebugEnabled())
|
||||
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
|
||||
|
||||
try
|
||||
|
@ -1104,7 +1103,7 @@ class ConferenceCoreData implements ConferenceData
|
|||
|
||||
} // end finally
|
||||
|
||||
return new ReadOnlyVector(rc);
|
||||
return Collections.unmodifiableList(rc);
|
||||
|
||||
} // end getMemberList
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@ package com.silverwrist.venice.core.impl;
|
|||
import java.sql.*;
|
||||
import java.util.*;
|
||||
import org.apache.log4j.*;
|
||||
import com.silverwrist.util.collections.*;
|
||||
import com.silverwrist.util.rcache.ReferencedData;
|
||||
import com.silverwrist.venice.db.*;
|
||||
import com.silverwrist.venice.htmlcheck.*;
|
||||
|
@ -95,19 +94,21 @@ class ConferenceUserContextImpl implements ConferenceContext, ConferenceBackend
|
|||
|
||||
} // 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();
|
||||
if (do_insert)
|
||||
{ // construct an SQL INSERT statement
|
||||
sql.append("INSERT INTO topicsettings (topicid, uid, last_message) VALUES (").append(topicid);
|
||||
sql.append(", ").append(uid).append(", ").append(top_message).append(");");
|
||||
sql.append("INSERT INTO topicsettings (topicid, uid, last_message, last_read) VALUES (");
|
||||
sql.append(topicid).append(", ").append(uid).append(", ").append(top_message).append(", '");
|
||||
sql.append(SQLUtil.encodeDate(date)).append("');");
|
||||
|
||||
} // end if
|
||||
else
|
||||
{ // construct an SQL UPDATE statement
|
||||
sql.append("UPDATE topicsettings SET last_message = ").append(top_message).append(" WHERE topicid = ");
|
||||
sql.append(topicid).append(" AND uid = ").append(uid).append(';');
|
||||
sql.append("UPDATE topicsettings SET last_message = ").append(top_message).append(", last_read = '");
|
||||
sql.append(SQLUtil.encodeDate(date)).append("' WHERE topicid = ").append(topicid);
|
||||
sql.append(" AND uid = ").append(uid).append(';');
|
||||
|
||||
} // end else
|
||||
|
||||
|
@ -941,8 +942,17 @@ class ConferenceUserContextImpl implements ConferenceContext, ConferenceBackend
|
|||
// now we need to reset our last post date
|
||||
Connection conn = null;
|
||||
try
|
||||
{ // get a connection and feed it to the touchPost function
|
||||
{ // get a connection
|
||||
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());
|
||||
|
||||
} // end try
|
||||
|
@ -1024,16 +1034,17 @@ class ConferenceUserContextImpl implements ConferenceContext, ConferenceBackend
|
|||
ResultSet rs = stmt.executeQuery(sql.toString());
|
||||
|
||||
// use the results to build up a list of FixSeenHelpers
|
||||
Vector tmp = new Vector();
|
||||
ArrayList tmp = new ArrayList();
|
||||
while (rs.next())
|
||||
tmp.add(new FixSeenHelper(rs.getInt(1),rs.getInt(2),rs.getBoolean(3)));
|
||||
|
||||
// now iterate over the list and call doFix on each one
|
||||
Iterator it = tmp.iterator();
|
||||
java.util.Date now = new java.util.Date();
|
||||
while (it.hasNext())
|
||||
{ // just hit each one in turn
|
||||
FixSeenHelper fsh = (FixSeenHelper)(it.next());
|
||||
fsh.doFix(stmt,sig.realUID());
|
||||
fsh.doFix(stmt,sig.realUID(),now);
|
||||
|
||||
} // end while
|
||||
|
||||
|
@ -1074,7 +1085,7 @@ class ConferenceUserContextImpl implements ConferenceContext, ConferenceBackend
|
|||
} // end if
|
||||
|
||||
Connection conn = null;
|
||||
Vector rc = new Vector();
|
||||
ArrayList rc = new ArrayList();
|
||||
|
||||
try
|
||||
{ // retrieve a connection from the datapool
|
||||
|
@ -1115,7 +1126,7 @@ class ConferenceUserContextImpl implements ConferenceContext, ConferenceBackend
|
|||
|
||||
} // end finally
|
||||
|
||||
return new ReadOnlyVector(rc);
|
||||
return Collections.unmodifiableList(rc);
|
||||
|
||||
} // end getActivePosters
|
||||
|
||||
|
@ -1141,7 +1152,7 @@ class ConferenceUserContextImpl implements ConferenceContext, ConferenceBackend
|
|||
} // end if
|
||||
|
||||
Connection conn = null;
|
||||
Vector rc = new Vector();
|
||||
ArrayList rc = new ArrayList();
|
||||
|
||||
try
|
||||
{ // retrieve a connection from the datapool
|
||||
|
@ -1182,7 +1193,7 @@ class ConferenceUserContextImpl implements ConferenceContext, ConferenceBackend
|
|||
|
||||
} // end finally
|
||||
|
||||
return new ReadOnlyVector(rc);
|
||||
return Collections.unmodifiableList(rc);
|
||||
|
||||
} // end getActiveReaders
|
||||
|
||||
|
@ -1700,7 +1711,7 @@ class ConferenceUserContextImpl implements ConferenceContext, ConferenceBackend
|
|||
{
|
||||
if (logger.isDebugEnabled())
|
||||
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
|
||||
|
||||
try
|
||||
|
@ -1751,7 +1762,7 @@ class ConferenceUserContextImpl implements ConferenceContext, ConferenceBackend
|
|||
|
||||
} // end finally
|
||||
|
||||
return new ReadOnlyVector(rc);
|
||||
return Collections.unmodifiableList(rc);
|
||||
|
||||
} // end getSIGConferences
|
||||
|
||||
|
@ -1863,7 +1874,7 @@ class ConferenceUserContextImpl implements ConferenceContext, ConferenceBackend
|
|||
logger.debug("getUserHotlist for user #" + user.realUID());
|
||||
|
||||
Connection conn = null; // pooled database connection
|
||||
Vector rc = new Vector(); // return from this function
|
||||
ArrayList rc = new ArrayList(); // return from this function
|
||||
|
||||
try
|
||||
{ // get a database connection
|
||||
|
@ -1926,7 +1937,7 @@ class ConferenceUserContextImpl implements ConferenceContext, ConferenceBackend
|
|||
|
||||
} // end finally
|
||||
|
||||
return new ReadOnlyVector(rc);
|
||||
return Collections.unmodifiableList(rc);
|
||||
|
||||
} // end getUserHotlist
|
||||
|
||||
|
|
|
@ -93,4 +93,8 @@ public interface EngineBackend
|
|||
|
||||
public abstract void unpublish(long postid);
|
||||
|
||||
public abstract String generateRandomAuthString();
|
||||
|
||||
public abstract boolean isValidRandomAuthString(String s);
|
||||
|
||||
} // end interface EngineBackend
|
||||
|
|
|
@ -21,7 +21,6 @@ import java.sql.*;
|
|||
import java.util.*;
|
||||
import org.apache.log4j.*;
|
||||
import com.silverwrist.util.StringUtil;
|
||||
import com.silverwrist.util.collections.*;
|
||||
import com.silverwrist.util.rcache.*;
|
||||
import com.silverwrist.venice.db.*;
|
||||
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 '"
|
||||
+ 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
|
||||
|
||||
try
|
||||
|
@ -1584,7 +1583,7 @@ class SIGCoreData implements SIGData, SIGDataBackend
|
|||
|
||||
} // end finally
|
||||
|
||||
return new ReadOnlyVector(rc);
|
||||
return Collections.unmodifiableList(rc);
|
||||
|
||||
} // end searchForMembers
|
||||
|
||||
|
@ -1689,7 +1688,7 @@ class SIGCoreData implements SIGData, SIGDataBackend
|
|||
if (logger.isDebugEnabled())
|
||||
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
|
||||
|
||||
try
|
||||
|
@ -1737,7 +1736,7 @@ class SIGCoreData implements SIGData, SIGDataBackend
|
|||
|
||||
} // end finally
|
||||
|
||||
return new ReadOnlyVector(rc);
|
||||
return Collections.unmodifiableList(rc);
|
||||
|
||||
} // end getMemberList
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@ import java.sql.*;
|
|||
import java.util.*;
|
||||
import org.apache.log4j.*;
|
||||
import com.silverwrist.util.StringUtil;
|
||||
import com.silverwrist.util.collections.*;
|
||||
import com.silverwrist.util.rcache.ReferencedData;
|
||||
import com.silverwrist.venice.db.*;
|
||||
import com.silverwrist.venice.security.AuditRecord;
|
||||
|
@ -163,7 +162,7 @@ class SIGUserContextImpl implements SIGContext, SIGBackend
|
|||
{
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("setMemberValues(" + String.valueOf(granted_level) + ", " + String.valueOf(member)
|
||||
+ ", " + String.valueOf(locked));
|
||||
+ ", " + String.valueOf(locked) + ")");
|
||||
|
||||
if (user.realBaseLevel()>granted_level)
|
||||
this.level = user.realBaseLevel();
|
||||
|
@ -1484,7 +1483,7 @@ class SIGUserContextImpl implements SIGContext, SIGBackend
|
|||
{
|
||||
if (logger.isDebugEnabled())
|
||||
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
|
||||
|
||||
try
|
||||
|
@ -1521,7 +1520,7 @@ class SIGUserContextImpl implements SIGContext, SIGBackend
|
|||
|
||||
} // end finally
|
||||
|
||||
return new ReadOnlyVector(rc);
|
||||
return Collections.unmodifiableList(rc);
|
||||
|
||||
} // end getMemberSIGEntries
|
||||
|
||||
|
@ -1611,7 +1610,7 @@ class SIGUserContextImpl implements SIGContext, SIGBackend
|
|||
+ ", term '" + term + "', offset = " + 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
|
||||
|
||||
try
|
||||
|
@ -1688,7 +1687,7 @@ class SIGUserContextImpl implements SIGContext, SIGBackend
|
|||
|
||||
} // end finally
|
||||
|
||||
return new ReadOnlyVector(rc);
|
||||
return Collections.unmodifiableList(rc);
|
||||
|
||||
} // end searchForSIGs
|
||||
|
||||
|
@ -1780,7 +1779,7 @@ class SIGUserContextImpl implements SIGContext, SIGBackend
|
|||
logger.debug("reading SIGs in category " + String.valueOf(catid) + ", offset = "
|
||||
+ 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
|
||||
|
||||
try
|
||||
|
@ -1823,7 +1822,7 @@ class SIGUserContextImpl implements SIGContext, SIGBackend
|
|||
|
||||
} // end finally
|
||||
|
||||
return new ReadOnlyVector(rc);
|
||||
return Collections.unmodifiableList(rc);
|
||||
|
||||
} // end getSIGsInCategory
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@ import java.util.*;
|
|||
import java.util.zip.*;
|
||||
import org.apache.log4j.*;
|
||||
import com.silverwrist.util.StringUtil;
|
||||
import com.silverwrist.util.collections.*;
|
||||
import com.silverwrist.venice.db.*;
|
||||
import com.silverwrist.venice.security.AuditRecord;
|
||||
import com.silverwrist.venice.security.Capability;
|
||||
|
@ -1092,7 +1091,7 @@ class TopicMessageUserContextImpl implements TopicMessageContext
|
|||
logger.debug("loadMessageRange for conf # " + conf.realConfID() + ", topic #" + topicid + ", range ["
|
||||
+ post_low + ", " + post_high + "]");
|
||||
|
||||
Vector rc = new Vector();
|
||||
ArrayList rc = new ArrayList();
|
||||
Connection conn = null; // pooled database connection
|
||||
|
||||
try
|
||||
|
@ -1138,7 +1137,7 @@ class TopicMessageUserContextImpl implements TopicMessageContext
|
|||
|
||||
} // end finally
|
||||
|
||||
return new ReadOnlyVector(rc); // wrap the return vector
|
||||
return Collections.unmodifiableList(rc); // wrap the return vector
|
||||
|
||||
} // end loadMessageRange
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@ package com.silverwrist.venice.core.impl;
|
|||
import java.sql.*;
|
||||
import java.util.*;
|
||||
import org.apache.log4j.*;
|
||||
import com.silverwrist.util.collections.*;
|
||||
import com.silverwrist.venice.db.*;
|
||||
import com.silverwrist.venice.htmlcheck.*;
|
||||
import com.silverwrist.venice.security.AuditRecord;
|
||||
|
@ -511,7 +510,9 @@ class TopicUserContextImpl implements TopicContext
|
|||
try
|
||||
{ // start by trying to see if we can update topicsettings directly
|
||||
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(';');
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("SQL: " + sql.toString());
|
||||
|
@ -540,8 +541,9 @@ class TopicUserContextImpl implements TopicContext
|
|||
|
||||
// OK, just insert a new row into topicsettings, why dontcha...
|
||||
sql.setLength(0);
|
||||
sql.append("INSERT INTO topicsettings (topicid, uid, last_message) VALUES (").append(topicid);
|
||||
sql.append(", ").append(conf.realUID()).append(", ").append(last_msg).append(");");
|
||||
sql.append("INSERT INTO topicsettings (topicid, uid, last_message, last_read) VALUES (");
|
||||
sql.append(topicid).append(", ").append(conf.realUID()).append(", ").append(last_msg).append(", '");
|
||||
sql.append(SQLUtil.encodeDate(now)).append("');");
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("SQL: " + 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
|
||||
stmt.executeUpdate("LOCK TABLES confs WRITE, topics WRITE, posts WRITE, postdata WRITE, "
|
||||
+ "confsettings WRITE, topicsettings READ;");
|
||||
+ "confsettings WRITE, topicsettings WRITE;");
|
||||
|
||||
try
|
||||
{ // refresh our current status and recheck allowed status
|
||||
|
@ -755,6 +757,25 @@ class TopicUserContextImpl implements TopicContext
|
|||
sql.append(real_text).append("');");
|
||||
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
|
||||
conf.touchUpdate(conn,posted_date);
|
||||
conf.touchPost(conn,posted_date);
|
||||
|
@ -925,6 +946,126 @@ class TopicUserContextImpl implements TopicContext
|
|||
|
||||
} // 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
|
||||
*--------------------------------------------------------------------------------
|
||||
|
@ -936,7 +1077,7 @@ class TopicUserContextImpl implements TopicContext
|
|||
if (logger.isDebugEnabled())
|
||||
logger.debug("getTopicList for conf # " + String.valueOf(conf.realConfID()) + ", user #"
|
||||
+ 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
|
||||
|
||||
try
|
||||
|
@ -1088,7 +1229,7 @@ class TopicUserContextImpl implements TopicContext
|
|||
|
||||
} // end finally
|
||||
|
||||
return new ReadOnlyVector(rc);
|
||||
return Collections.unmodifiableList(rc);
|
||||
|
||||
} // end getTopicList
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@ import java.sql.*;
|
|||
import org.apache.log4j.*;
|
||||
import com.silverwrist.util.LocaleFactory;
|
||||
import com.silverwrist.util.StringUtil;
|
||||
import com.silverwrist.util.collections.*;
|
||||
import com.silverwrist.util.rcache.ReferencedData;
|
||||
import com.silverwrist.venice.*;
|
||||
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 final String AUTH_TOKEN_PREFIX = "VQAT:";
|
||||
private static final char AUTH_TOKEN_SEP = '|';
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Attributes
|
||||
*--------------------------------------------------------------------------------
|
||||
|
@ -902,7 +904,7 @@ class UserContextImpl implements UserContext, UserBackend
|
|||
public List getSideBoxList() throws DataException
|
||||
{
|
||||
Connection conn = null;
|
||||
Vector rc = new Vector();
|
||||
ArrayList rc = new ArrayList();
|
||||
|
||||
try
|
||||
{ // retrieve a connection from the data pool
|
||||
|
@ -934,7 +936,7 @@ class UserContextImpl implements UserContext, UserBackend
|
|||
|
||||
} // end finally
|
||||
|
||||
return new ReadOnlyVector(rc);
|
||||
return Collections.unmodifiableList(rc);
|
||||
|
||||
} // end getSideBoxList
|
||||
|
||||
|
@ -1052,6 +1054,235 @@ class UserContextImpl implements UserContext, UserBackend
|
|||
|
||||
} // 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
|
||||
*--------------------------------------------------------------------------------
|
||||
|
|
|
@ -23,7 +23,6 @@ import org.apache.log4j.*;
|
|||
import org.w3c.dom.*;
|
||||
import com.silverwrist.util.StringUtil;
|
||||
import com.silverwrist.util.DOMElementHelper;
|
||||
import com.silverwrist.util.collections.*;
|
||||
import com.silverwrist.util.rcache.*;
|
||||
import com.silverwrist.venice.core.*;
|
||||
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 final String AUTH_ALPHABET =
|
||||
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz./";
|
||||
private static final int AUTH_STRING_LEN = 32;
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Attributes
|
||||
*--------------------------------------------------------------------------------
|
||||
|
@ -406,7 +409,7 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
|
|||
private int[] gp_ints; // global integer parameters
|
||||
private MasterSideBox[] sideboxes; // master sidebox table
|
||||
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
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
|
@ -482,7 +485,7 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
|
|||
|
||||
this.config = config;
|
||||
|
||||
Vector dictionary_tmp;
|
||||
ArrayList dictionary_tmp;
|
||||
try
|
||||
{ // first, verify that this is a valid configuration
|
||||
Element root = config.getDocumentElement();
|
||||
|
@ -542,7 +545,7 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
|
|||
} // end if
|
||||
|
||||
// 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();
|
||||
for (i=0; i<dict_nodes.getLength(); i++)
|
||||
{ // 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");
|
||||
|
||||
// load the master sidebox table
|
||||
Vector sidebox_tmp = new Vector();
|
||||
ArrayList sidebox_tmp = new ArrayList();
|
||||
rs = stmt.executeQuery("SELECT * FROM refsidebox ORDER BY boxid;");
|
||||
while (rs.next())
|
||||
sidebox_tmp.add(new MasterSideBox(rs));
|
||||
|
||||
// store the real master sidebox table as an array
|
||||
sideboxes = new MasterSideBox[sidebox_tmp.size()];
|
||||
for (i=0; i<sidebox_tmp.size(); i++)
|
||||
sideboxes[i] = (MasterSideBox)(sidebox_tmp.get(i));
|
||||
sideboxes = (MasterSideBox[])(sidebox_tmp.toArray(new MasterSideBox[0]));
|
||||
if (logger.isDebugEnabled())
|
||||
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);
|
||||
|
||||
// Create the LazyLexicon that holds our dictionary files, and add it to the SpellingRewriter.
|
||||
String[] dictfiles = new String[dictionary_tmp.size()];
|
||||
for (i=0; i<dictionary_tmp.size(); i++)
|
||||
dictfiles[i] = (String)(dictionary_tmp.get(i));
|
||||
LazyTreeLexicon lex = new LazyTreeLexicon(dictfiles);
|
||||
LazyTreeLexicon lex = new LazyTreeLexicon((String[])(dictionary_tmp.toArray(new String[0])));
|
||||
spell_rewriter.addDictionary(lex);
|
||||
|
||||
html_configs = new HTMLCheckerConfig[4]; // create the array
|
||||
|
@ -771,7 +769,7 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
|
|||
{
|
||||
checkInitialized();
|
||||
Connection conn = null;
|
||||
Vector rc = new Vector();
|
||||
ArrayList rc = new ArrayList();
|
||||
|
||||
try
|
||||
{ // 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
|
||||
|
||||
return new ReadOnlyVector(rc);
|
||||
return Collections.unmodifiableList(rc);
|
||||
|
||||
} // end getCountryList
|
||||
|
||||
|
@ -811,7 +809,7 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
|
|||
{
|
||||
checkInitialized();
|
||||
Connection conn = null;
|
||||
Vector rc = new Vector();
|
||||
ArrayList rc = new ArrayList();
|
||||
|
||||
try
|
||||
{ // 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
|
||||
|
||||
return new ReadOnlyVector(rc);
|
||||
return Collections.unmodifiableList(rc);
|
||||
|
||||
} // end getLanguageList
|
||||
|
||||
|
@ -1225,8 +1223,8 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
|
|||
logger.debug("User search: field = " + field + ", mode = " + mode + ", term '" + term + "', offset = "
|
||||
+ offset + ", count = " + count);
|
||||
|
||||
Vector rc = new Vector(); // return from this function
|
||||
Connection conn = null; // pooled database connection
|
||||
ArrayList rc = new ArrayList(); // return from this function
|
||||
Connection conn = null; // pooled database connection
|
||||
|
||||
try
|
||||
{ // get a database connection
|
||||
|
@ -1309,7 +1307,7 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
|
|||
|
||||
} // end finally
|
||||
|
||||
return new ReadOnlyVector(rc);
|
||||
return Collections.unmodifiableList(rc);
|
||||
|
||||
} // end searchForUsers
|
||||
|
||||
|
@ -1506,7 +1504,7 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
|
|||
|
||||
public List getPublishedMessages(boolean all) throws DataException
|
||||
{
|
||||
Vector rc = new Vector();
|
||||
ArrayList rc = new ArrayList();
|
||||
|
||||
synchronized (this)
|
||||
{ // 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
|
||||
PublishedMessageImpl.backfillReturn(rc,datapool);
|
||||
|
||||
return new ReadOnlyVector(rc);
|
||||
return Collections.unmodifiableList(rc);
|
||||
|
||||
} // end getPublishedMessages
|
||||
|
||||
|
@ -1713,7 +1711,7 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
|
|||
public List getSIGFeatureSet(BitSet enabled_features, int level, boolean read_privs)
|
||||
{
|
||||
checkInitialized();
|
||||
Vector rc = new Vector();
|
||||
ArrayList rc = new ArrayList();
|
||||
for (int i=0; i<features.length; i++)
|
||||
if (enabled_features.get(i) && features[i].featureAllowed(level,read_privs))
|
||||
{ // this feature must be included in the eventual output set
|
||||
|
@ -1728,14 +1726,14 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
|
|||
} // end if and for
|
||||
|
||||
if (insert_me) // insert at end by default
|
||||
rc.addElement(elt);
|
||||
rc.add(elt);
|
||||
|
||||
} // end if and for
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
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
|
||||
|
||||
|
@ -1934,9 +1932,9 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
|
|||
{
|
||||
if (pubmsg!=null)
|
||||
{ // add the new message
|
||||
cache_fp_posts.add(0,pubmsg);
|
||||
cache_fp_posts.addFirst(pubmsg);
|
||||
while (cache_fp_posts.size()>gp_ints[IP_NUMFRONTPAGEPOSTS])
|
||||
cache_fp_posts.remove(cache_fp_posts.size()-1);
|
||||
cache_fp_posts.removeLast();
|
||||
|
||||
} // end pubmsg
|
||||
|
||||
|
@ -1962,4 +1960,28 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
|
|||
|
||||
} // 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
|
||||
|
|
|
@ -19,7 +19,6 @@ package com.silverwrist.venice.security;
|
|||
|
||||
import java.sql.*;
|
||||
import java.util.*;
|
||||
import com.silverwrist.util.collections.*;
|
||||
import com.silverwrist.venice.db.SQLUtil;
|
||||
import com.silverwrist.venice.core.AuditData;
|
||||
import com.silverwrist.venice.core.DataException;
|
||||
|
@ -34,9 +33,9 @@ public class AuditRecord implements AuditData
|
|||
|
||||
static class DescrStringCache
|
||||
{
|
||||
private Hashtable descr_cache = new Hashtable();
|
||||
private Hashtable uname_cache = new Hashtable();
|
||||
private Hashtable signame_cache = new Hashtable();
|
||||
private HashMap descr_cache = new HashMap();
|
||||
private HashMap uname_cache = new HashMap();
|
||||
private HashMap signame_cache = new HashMap();
|
||||
private Statement stmt;
|
||||
|
||||
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)
|
||||
throws SQLException, DataException
|
||||
{
|
||||
Vector rc = new Vector();
|
||||
ArrayList rc = new ArrayList();
|
||||
DescrStringCache cache = new DescrStringCache(conn);
|
||||
|
||||
Statement stmt = conn.createStatement();
|
||||
|
@ -380,7 +379,7 @@ public class AuditRecord implements AuditData
|
|||
|
||||
} // end while
|
||||
|
||||
return new ReadOnlyVector(rc);
|
||||
return Collections.unmodifiableList(rc);
|
||||
|
||||
} // end getAuditRecords
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
package com.silverwrist.venice.security;
|
||||
|
||||
import java.util.*;
|
||||
import com.silverwrist.util.collections.*;
|
||||
|
||||
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 unrestricted_user = null;
|
||||
private static Role sig_host = null;
|
||||
private static Vector global_low = null;
|
||||
private static Vector global_high = null;
|
||||
private static Vector sig_low = null;
|
||||
private static Vector sig_high = null;
|
||||
private static Vector conf_low = null;
|
||||
private static Vector conf_high = null;
|
||||
private static ArrayList global_low = null;
|
||||
private static ArrayList global_high = null;
|
||||
private static ArrayList sig_low = null;
|
||||
private static ArrayList sig_high = null;
|
||||
private static ArrayList conf_low = 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
|
||||
|
@ -58,80 +69,6 @@ public class Role implements Comparable, SecLevels
|
|||
|
||||
} // 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
|
||||
*--------------------------------------------------------------------------------
|
||||
|
@ -196,69 +133,95 @@ public class Role implements Comparable, SecLevels
|
|||
|
||||
public static List getSIGReadList()
|
||||
{
|
||||
initAllSets();
|
||||
Vector rc = new Vector();
|
||||
rc.addAll(global_low);
|
||||
rc.addAll(sig_low);
|
||||
rc.add(unrestricted_user);
|
||||
rc.addAll(sig_high);
|
||||
rc.add(global_high.firstElement());
|
||||
return new ReadOnlyVector(rc);
|
||||
if (sigreadlist_rc==null)
|
||||
{ // create the returned list
|
||||
ArrayList rc = new ArrayList();
|
||||
rc.addAll(global_low);
|
||||
rc.addAll(sig_low);
|
||||
rc.add(unrestricted_user);
|
||||
rc.addAll(sig_high);
|
||||
rc.add(global_high.get(0));
|
||||
sigreadlist_rc = Collections.unmodifiableList(rc);
|
||||
|
||||
} // end if
|
||||
|
||||
return sigreadlist_rc;
|
||||
|
||||
} // end getSIGReadList
|
||||
|
||||
public static List getSIGWriteList()
|
||||
{
|
||||
initAllSets();
|
||||
Vector rc = new Vector();
|
||||
rc.addAll(sig_high);
|
||||
rc.addAll(global_high);
|
||||
return new ReadOnlyVector(rc);
|
||||
if (sigwritelist_rc==null)
|
||||
{ // build the return value
|
||||
ArrayList rc = new ArrayList();
|
||||
rc.addAll(sig_high);
|
||||
rc.addAll(global_high);
|
||||
sigwritelist_rc = Collections.unmodifiableList(rc);
|
||||
|
||||
} // end if
|
||||
|
||||
return sigwritelist_rc;
|
||||
|
||||
} // end getSIGWriteList
|
||||
|
||||
public static List getSIGCreateList()
|
||||
{
|
||||
initAllSets();
|
||||
Vector rc = new Vector();
|
||||
rc.add(global_low.lastElement());
|
||||
rc.addAll(sig_low);
|
||||
rc.add(unrestricted_user);
|
||||
rc.addAll(sig_high);
|
||||
rc.add(global_high.firstElement());
|
||||
return new ReadOnlyVector(rc);
|
||||
if (sigcreatelist_rc==null)
|
||||
{ // create the return list
|
||||
ArrayList rc = new ArrayList();
|
||||
rc.add(global_low.get(global_low.size()-1));
|
||||
rc.addAll(sig_low);
|
||||
rc.add(unrestricted_user);
|
||||
rc.addAll(sig_high);
|
||||
rc.add(global_high.get(0));
|
||||
sigcreatelist_rc = Collections.unmodifiableList(rc);
|
||||
|
||||
} // end if
|
||||
|
||||
return sigcreatelist_rc;
|
||||
|
||||
} // end getSIGCreateList
|
||||
|
||||
public static List getSIGDeleteList()
|
||||
{
|
||||
initAllSets();
|
||||
Vector rc = new Vector();
|
||||
rc.addAll(sig_high);
|
||||
rc.addAll(global_high);
|
||||
rc.add(no_access);
|
||||
return new ReadOnlyVector(rc);
|
||||
if (sigdeletelist_rc==null)
|
||||
{ // create the return list
|
||||
ArrayList rc = new ArrayList();
|
||||
rc.addAll(sig_high);
|
||||
rc.addAll(global_high);
|
||||
rc.add(no_access);
|
||||
sigdeletelist_rc = Collections.unmodifiableList(rc);
|
||||
|
||||
} // end if
|
||||
|
||||
return sigdeletelist_rc;
|
||||
|
||||
} // end getSIGDeleteList
|
||||
|
||||
public static List getSIGJoinList()
|
||||
{
|
||||
initAllSets();
|
||||
return new ReadOnlyVector(global_low);
|
||||
if (sigjoinlist_rc==null)
|
||||
sigjoinlist_rc = Collections.unmodifiableList(global_low);
|
||||
return sigjoinlist_rc;
|
||||
|
||||
} // end getSIGJoinList
|
||||
|
||||
public static List getSIGMemberLevelChoices()
|
||||
{
|
||||
initAllSets();
|
||||
Vector rc = new Vector();
|
||||
rc.add(not_in_list);
|
||||
rc.addAll(global_low);
|
||||
rc.addAll(sig_low);
|
||||
rc.add(unrestricted_user);
|
||||
rc.addAll(sig_high);
|
||||
rc.remove(rc.size()-1);
|
||||
return new ReadOnlyVector(rc);
|
||||
if (sig_member_levels==null)
|
||||
{ // figure out the member levels list
|
||||
ArrayList rc = new ArrayList();
|
||||
rc.add(not_in_list);
|
||||
rc.addAll(global_low);
|
||||
rc.addAll(sig_low);
|
||||
rc.add(unrestricted_user);
|
||||
rc.addAll(sig_high);
|
||||
rc.remove(rc.size()-1);
|
||||
sig_member_levels = Collections.unmodifiableList(rc);
|
||||
|
||||
} // end if
|
||||
|
||||
return sig_member_levels;
|
||||
|
||||
} // end getSIGMemberLevelChoices
|
||||
|
||||
|
@ -270,26 +233,36 @@ public class Role implements Comparable, SecLevels
|
|||
|
||||
public static List getConferenceReadList()
|
||||
{
|
||||
initAllSets();
|
||||
Vector rc = new Vector();
|
||||
rc.addAll(global_low);
|
||||
rc.addAll(sig_low);
|
||||
rc.addAll(conf_low);
|
||||
rc.add(unrestricted_user);
|
||||
return new ReadOnlyVector(rc);
|
||||
if (confreadlist_rc==null)
|
||||
{ // precalculate the conference read list
|
||||
ArrayList rc = new ArrayList();
|
||||
rc.addAll(global_low);
|
||||
rc.addAll(sig_low);
|
||||
rc.addAll(conf_low);
|
||||
rc.add(unrestricted_user);
|
||||
confreadlist_rc = Collections.unmodifiableList(rc);
|
||||
|
||||
} // end if
|
||||
|
||||
return confreadlist_rc;
|
||||
|
||||
} // end getConferenceReadList
|
||||
|
||||
public static List getConferencePostList()
|
||||
{
|
||||
initAllSets();
|
||||
Vector rc = new Vector();
|
||||
rc.addAll(global_low);
|
||||
rc.addAll(sig_low);
|
||||
rc.addAll(conf_low);
|
||||
rc.add(unrestricted_user);
|
||||
rc.addAll(conf_high);
|
||||
return new ReadOnlyVector(rc);
|
||||
if (confpostlist_rc==null)
|
||||
{ // precalculate the post list
|
||||
ArrayList rc = new ArrayList();
|
||||
rc.addAll(global_low);
|
||||
rc.addAll(sig_low);
|
||||
rc.addAll(conf_low);
|
||||
rc.add(unrestricted_user);
|
||||
rc.addAll(conf_high);
|
||||
confpostlist_rc = Collections.unmodifiableList(rc);
|
||||
|
||||
} // end if
|
||||
|
||||
return confpostlist_rc;
|
||||
|
||||
} // return getConferencePostList
|
||||
|
||||
|
@ -301,12 +274,17 @@ public class Role implements Comparable, SecLevels
|
|||
|
||||
public static List getConferenceHideList()
|
||||
{
|
||||
initAllSets();
|
||||
Vector rc = new Vector();
|
||||
rc.addAll(conf_high);
|
||||
rc.addAll(sig_high);
|
||||
rc.add(global_high.firstElement());
|
||||
return new ReadOnlyVector(rc);
|
||||
if (confhidelist_rc==null)
|
||||
{ // precalculate the hide list
|
||||
ArrayList rc = new ArrayList();
|
||||
rc.addAll(conf_high);
|
||||
rc.addAll(sig_high);
|
||||
rc.add(global_high.get(0));
|
||||
confhidelist_rc = Collections.unmodifiableList(rc);
|
||||
|
||||
} // end if
|
||||
|
||||
return confhidelist_rc;
|
||||
|
||||
} // end getConferenceHideList
|
||||
|
||||
|
@ -324,27 +302,88 @@ public class Role implements Comparable, SecLevels
|
|||
|
||||
public static List getConferenceDeleteList()
|
||||
{
|
||||
initAllSets();
|
||||
Vector rc = new Vector();
|
||||
rc.addAll(sig_high);
|
||||
rc.addAll(global_high);
|
||||
rc.add(no_access);
|
||||
return new ReadOnlyVector(rc);
|
||||
if (confdeletelist_rc==null)
|
||||
{ // precalculate the delete list
|
||||
ArrayList rc = new ArrayList();
|
||||
rc.addAll(sig_high);
|
||||
rc.addAll(global_high);
|
||||
rc.add(no_access);
|
||||
confdeletelist_rc = Collections.unmodifiableList(rc);
|
||||
|
||||
} // end if
|
||||
|
||||
return confdeletelist_rc;
|
||||
|
||||
} // end getConferenceDeleteList
|
||||
|
||||
public static List getConferenceMemberLevelChoices()
|
||||
{
|
||||
initAllSets();
|
||||
Vector rc = new Vector();
|
||||
rc.add(not_in_list);
|
||||
rc.addAll(global_low);
|
||||
rc.addAll(sig_low);
|
||||
rc.addAll(conf_low);
|
||||
rc.add(unrestricted_user);
|
||||
rc.add(conf_high.lastElement());
|
||||
return new ReadOnlyVector(rc);
|
||||
if (conf_member_levels==null)
|
||||
{ // precalculate the list
|
||||
ArrayList rc = new ArrayList();
|
||||
rc.add(not_in_list);
|
||||
rc.addAll(global_low);
|
||||
rc.addAll(sig_low);
|
||||
rc.addAll(conf_low);
|
||||
rc.add(unrestricted_user);
|
||||
rc.add(conf_high.get(conf_high.size()-1));
|
||||
conf_member_levels = Collections.unmodifiableList(rc);
|
||||
|
||||
} // end if
|
||||
|
||||
return conf_member_levels;
|
||||
|
||||
} // 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
|
||||
|
|
|
@ -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 int COOKIE_LIFETIME = 60*60*24*365; // one year
|
||||
|
||||
private static Category logger = Category.getInstance(Account.class.getName());
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
|
@ -159,6 +161,11 @@ public class Account extends VeniceServlet
|
|||
if (user.isLoggedIn())
|
||||
{ // this is a Logout command
|
||||
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
|
||||
|
||||
} // end if
|
||||
|
@ -299,7 +306,15 @@ public class Account extends VeniceServlet
|
|||
{ // use the user context to authenticate
|
||||
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
|
||||
// (or to the verification page if they need to go there)
|
||||
|
|
|
@ -486,15 +486,43 @@ public class ConfOperations extends VeniceServlet
|
|||
|
||||
} // end if ("A" command)
|
||||
|
||||
if (cmd.equals("RP") || cmd.equals("RR"))
|
||||
{ // "RP" = "Report Posters," "RR" = "Report Readers" (requires conference parameter)
|
||||
if (cmd.equals("QR"))
|
||||
{ // "QR" = "Reports Menu" (requires conference parameter)
|
||||
ConferenceContext conf = getConferenceParameter(request,sig,true,on_error);
|
||||
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
|
||||
{ // generate the listing on this page
|
||||
setMyLocation(request,"confops?sig=" + sig.getSIGID() + "&conf=" + conf.getConfID() + "&cmd=" + cmd);
|
||||
return new ConferenceActivity(sig,conf,cmd.equals("RP"));
|
||||
String my_loc = "confops?sig=" + sig.getSIGID() + "&conf=" + conf.getConfID();
|
||||
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
|
||||
catch (DataException de)
|
||||
|
|
63
src/com/silverwrist/venice/servlets/FrameStatic.java
Normal file
63
src/com/silverwrist/venice/servlets/FrameStatic.java
Normal 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
|
|
@ -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
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
* WARRANTY OF ANY KIND, either express or implied. See the License for the specific
|
||||
* language governing rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is the Venice Web Community System.
|
||||
* The Original Code is the Venice Web Communities System.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
|
||||
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
|
||||
|
@ -23,6 +23,7 @@ import javax.servlet.http.*;
|
|||
import org.apache.log4j.*;
|
||||
import com.silverwrist.venice.core.*;
|
||||
import com.silverwrist.venice.servlets.format.*;
|
||||
import com.silverwrist.venice.servlets.format.menus.LeftMenu;
|
||||
|
||||
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 COUNTRYLIST_ATTRIBUTE = "com.silverwrist.venice.db.CountryList";
|
||||
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
|
||||
protected static final String USERCTXT_ATTRIBUTE = "user.context";
|
||||
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
|
||||
protected static final String ENGINE_INIT_PARAM = "venice.config";
|
||||
|
||||
// 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);
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
|
@ -90,7 +93,8 @@ public class Variables
|
|||
|
||||
} // end getVeniceEngine
|
||||
|
||||
public static UserContext getUserContext(ServletContext ctxt, ServletRequest request, HttpSession session)
|
||||
public static UserContext getUserContext(ServletContext ctxt, HttpServletRequest request,
|
||||
HttpSession session)
|
||||
throws ServletException
|
||||
{
|
||||
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
|
||||
VeniceEngine engine = getVeniceEngine(ctxt);
|
||||
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);
|
||||
return user;
|
||||
|
||||
|
@ -185,18 +216,31 @@ public class Variables
|
|||
public static void setMenuTop(ServletContext ctxt, HttpSession session)
|
||||
{
|
||||
Object obj = session.getAttribute(MENU_ATTRIBUTE);
|
||||
if ((obj==null) || !(obj instanceof MenuTop))
|
||||
{ // look for the common MenuTop object and set it to the session context
|
||||
obj = ctxt.getAttribute(TOPMENU_ATTRIBUTE);
|
||||
if (obj==null)
|
||||
{ // we don't have a common MenuTop yet...make one
|
||||
MenuTop mt = new MenuTop();
|
||||
ctxt.setAttribute(TOPMENU_ATTRIBUTE,mt);
|
||||
obj = mt;
|
||||
boolean do_change;
|
||||
if ((obj==null) || !(obj instanceof LeftMenu))
|
||||
do_change = true;
|
||||
else
|
||||
{ // look to see if this is the "top" menu
|
||||
LeftMenu mnu = (LeftMenu)obj;
|
||||
do_change = !(mnu.getIdentifier().equals("top"));
|
||||
|
||||
} // 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
|
||||
|
||||
|
@ -237,4 +281,41 @@ public class Variables
|
|||
|
||||
} // 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
|
||||
|
|
|
@ -67,8 +67,7 @@ public abstract class VeniceServlet extends HttpServlet
|
|||
} // end if
|
||||
else
|
||||
{ // a null SIGContext is permitted
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("no SIG specified");
|
||||
logger.debug("no SIG specified");
|
||||
return null;
|
||||
|
||||
} // end else
|
||||
|
@ -78,7 +77,15 @@ public abstract class VeniceServlet extends HttpServlet
|
|||
SIGContext rc = null;
|
||||
try
|
||||
{ // 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())
|
||||
logger.debug("found SIG #" + rc.getSIGID());
|
||||
|
||||
|
@ -112,8 +119,7 @@ public abstract class VeniceServlet extends HttpServlet
|
|||
} // end if
|
||||
else
|
||||
{ // a null TopicContext is permitted
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("no topic specified");
|
||||
logger.debug("no topic specified");
|
||||
return null;
|
||||
|
||||
} // end else
|
||||
|
@ -122,8 +128,17 @@ public abstract class VeniceServlet extends HttpServlet
|
|||
|
||||
TopicContext rc = null;
|
||||
try
|
||||
{ // turn the string into a TopicID, and thence to a TopicContext
|
||||
rc = conf.getTopic(Short.parseShort(str));
|
||||
{ // turn the string into a topic number, and thence to a TopicContext
|
||||
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())
|
||||
logger.debug("found topic #" + rc.getTopicID());
|
||||
|
||||
|
@ -162,8 +177,7 @@ public abstract class VeniceServlet extends HttpServlet
|
|||
} // end if
|
||||
else
|
||||
{ // a null TopicMessageContext is permitted
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("no message specified");
|
||||
logger.debug("no message specified");
|
||||
return null;
|
||||
|
||||
} // end else
|
||||
|
@ -173,7 +187,16 @@ public abstract class VeniceServlet extends HttpServlet
|
|||
TopicMessageContext rc = null;
|
||||
try
|
||||
{ // 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())
|
||||
logger.debug("found post #" + rc.getPostID());
|
||||
|
||||
|
@ -212,8 +235,7 @@ public abstract class VeniceServlet extends HttpServlet
|
|||
} // end if
|
||||
else
|
||||
{ // a null TopicMessageContext is permitted
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("no message specified");
|
||||
logger.debug("no message specified");
|
||||
return null;
|
||||
|
||||
} // end else
|
||||
|
@ -223,7 +245,16 @@ public abstract class VeniceServlet extends HttpServlet
|
|||
TopicMessageContext rc = null;
|
||||
try
|
||||
{ // 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())
|
||||
logger.debug("found post #" + rc.getPostID());
|
||||
|
||||
|
@ -360,8 +391,7 @@ public abstract class VeniceServlet extends HttpServlet
|
|||
} // end if
|
||||
else
|
||||
{ // a null ConferenceContext is permitted
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("no conference specified");
|
||||
logger.debug("no conference specified");
|
||||
return null;
|
||||
|
||||
} // end else
|
||||
|
@ -371,7 +401,16 @@ public abstract class VeniceServlet extends HttpServlet
|
|||
ConferenceContext rc = null;
|
||||
try
|
||||
{ // 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())
|
||||
logger.debug("found conf #" + rc.getConfID());
|
||||
|
||||
|
@ -517,45 +556,79 @@ public abstract class VeniceServlet extends HttpServlet
|
|||
{
|
||||
ServletContext ctxt = getServletContext();
|
||||
VeniceEngine engine = Variables.getVeniceEngine(ctxt);
|
||||
UserContext user = Variables.getUserContext(ctxt,request,request.getSession(true));
|
||||
RenderData rdat = RenderConfig.createRenderData(ctxt,request,response);
|
||||
VeniceContent content = null;
|
||||
|
||||
// Make all log messages for the request carry the remote address.
|
||||
NDC.push(request.getRemoteAddr());
|
||||
try
|
||||
{ // run the actual "get" in the servlet
|
||||
content = doVeniceGet(request,engine,user,rdat);
|
||||
{ // 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
|
||||
{ // 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
|
||||
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();
|
||||
finally
|
||||
{ // pop the nested diagnostic context
|
||||
NDC.pop();
|
||||
|
||||
} // end else if
|
||||
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 finally
|
||||
|
||||
} // end doGet
|
||||
|
||||
|
@ -564,68 +637,103 @@ public abstract class VeniceServlet extends HttpServlet
|
|||
{
|
||||
ServletContext ctxt = getServletContext();
|
||||
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;
|
||||
VeniceContent content = null;
|
||||
|
||||
if (ServletMultipartHandler.canHandle(request))
|
||||
{ // if this is a multipart/form-data request, invoke our special handler code
|
||||
// Make all log messages for the request carry the remote address.
|
||||
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
|
||||
{ // create the multipart handler
|
||||
mphandler = new ServletMultipartHandler(request);
|
||||
{ // and now we proceed!
|
||||
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
|
||||
catch (ServletMultipartException e)
|
||||
{ // this is an error message we need to generate and just bail out on
|
||||
BaseJSPData base = new BaseJSPData(getMyLocation(request,engine,user,rdat),
|
||||
new ErrorBox(null,"Internal Error: " + e.getMessage(),null));
|
||||
base.transfer(ctxt,rdat);
|
||||
return;
|
||||
finally
|
||||
{ // pop the username from the NDC if we used it
|
||||
if (record_uname)
|
||||
NDC.pop();
|
||||
|
||||
} // 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 finally
|
||||
|
||||
} // 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;
|
||||
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();
|
||||
finally
|
||||
{ // pop the nested diagnostic context
|
||||
NDC.pop();
|
||||
|
||||
} // end finally
|
||||
|
||||
} // end doPost
|
||||
|
||||
} // end class VeniceServlet
|
||||
|
|
|
@ -145,7 +145,6 @@ public class AuditDataViewer implements ContentRender
|
|||
} // end while
|
||||
|
||||
out.write("</TABLE>\n");
|
||||
rdat.writeFooter(out);
|
||||
|
||||
} // end renderHere
|
||||
|
||||
|
|
|
@ -22,6 +22,8 @@ import java.io.IOException;
|
|||
import javax.servlet.*;
|
||||
import javax.servlet.http.*;
|
||||
import org.apache.log4j.*;
|
||||
import com.silverwrist.venice.servlets.Variables;
|
||||
import com.silverwrist.venice.servlets.format.menus.LeftMenu;
|
||||
|
||||
public class BaseJSPData
|
||||
{
|
||||
|
@ -114,6 +116,22 @@ public class BaseJSPData
|
|||
|
||||
} // 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)
|
||||
throws IOException, ServletException
|
||||
{
|
||||
|
@ -142,7 +160,7 @@ public class BaseJSPData
|
|||
rdat.flushOutput(); // now make sure the included page is properly flushed
|
||||
return;
|
||||
|
||||
} // end if
|
||||
} // end else if
|
||||
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);
|
||||
|
||||
|
|
|
@ -39,24 +39,39 @@ public class ConferenceActivity implements JSPRender
|
|||
|
||||
private SIGContext sig; // the SIG we're in
|
||||
private ConferenceContext conf; // the conference being listed
|
||||
private TopicContext topic; // the topic being listed
|
||||
private boolean posters; // is this a list of posters?
|
||||
private List records; // the actual data records
|
||||
private String locator = null; // our locator
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Constructor
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public ConferenceActivity(SIGContext sig, ConferenceContext conf, boolean posters)
|
||||
public ConferenceActivity(SIGContext sig, ConferenceContext conf, TopicContext topic, boolean posters)
|
||||
throws DataException, AccessError
|
||||
{
|
||||
this.sig = sig;
|
||||
this.conf = conf;
|
||||
this.topic = topic;
|
||||
this.posters = posters;
|
||||
if (posters)
|
||||
this.records = conf.getActivePosters();
|
||||
if (topic!=null)
|
||||
{ // do the report on the topic
|
||||
if (posters)
|
||||
this.records = topic.getActivePosters();
|
||||
else
|
||||
this.records = topic.getActiveReaders();
|
||||
|
||||
} // end if
|
||||
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
|
||||
|
||||
|
@ -78,10 +93,22 @@ public class ConferenceActivity implements JSPRender
|
|||
|
||||
public String getPageTitle(RenderData rdat)
|
||||
{
|
||||
if (posters)
|
||||
return "Users Posting in Conference " + conf.getName();
|
||||
if (topic!=null)
|
||||
{ // it's a topic report
|
||||
if (posters)
|
||||
return "Users Posting in Topic " + topic.getName();
|
||||
else
|
||||
return "Users Reading Topic " + topic.getName();
|
||||
|
||||
} // end if
|
||||
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
|
||||
|
||||
|
@ -113,12 +140,29 @@ public class ConferenceActivity implements JSPRender
|
|||
|
||||
} // end getConfName
|
||||
|
||||
public String getTopicName()
|
||||
{
|
||||
if (topic==null)
|
||||
return null;
|
||||
else
|
||||
return topic.getName();
|
||||
|
||||
} // end getTopicName
|
||||
|
||||
public String getLocator()
|
||||
{
|
||||
return "sig=" + sig.getSIGID() + "&conf=" + conf.getConfID();
|
||||
if (locator==null)
|
||||
locator = "sig=" + sig.getSIGID() + "&conf=" + conf.getConfID();
|
||||
return locator;
|
||||
|
||||
} // end getLocator
|
||||
|
||||
public boolean isTopicReport()
|
||||
{
|
||||
return (topic!=null);
|
||||
|
||||
} // end isTopicReport
|
||||
|
||||
public boolean isPosterReport()
|
||||
{
|
||||
return posters;
|
||||
|
|
|
@ -122,7 +122,6 @@ public class ConfirmBox implements ContentRender
|
|||
out.write("<IMG SRC=\"" + rdat.getFullImagePath("bn_no.gif")
|
||||
+ "\" ALT=\"No\" WIDTH=80 HEIGHT=24 BORDER=0></A>\n");
|
||||
out.write("</FONT></TD></TR></TABLE><P>\n");
|
||||
rdat.writeFooter(out);
|
||||
|
||||
} // end renderHere
|
||||
|
||||
|
|
|
@ -216,7 +216,6 @@ public class ContentDialog implements Cloneable, ContentRender
|
|||
} // end if
|
||||
|
||||
out.write("</FONT></FORM>\n");
|
||||
rdat.writeFooter(out);
|
||||
|
||||
} // end renderHere
|
||||
|
||||
|
|
|
@ -135,7 +135,6 @@ public class ContentMenuPanel implements Cloneable, ContentRender
|
|||
} // end while
|
||||
|
||||
out.write("</TABLE>\n");
|
||||
rdat.writeFooter(out);
|
||||
|
||||
} // end renderHere
|
||||
|
||||
|
|
|
@ -78,7 +78,6 @@ public class ErrorBox extends VeniceServletResult implements ContentRender
|
|||
else
|
||||
out.write("<A HREF=\"" + rdat.getEncodedServletPath(back) + "\">Go back.</A>\n");
|
||||
out.write("<P></FONT></TD></TR></TABLE><P>\n");
|
||||
rdat.writeFooter(out);
|
||||
|
||||
} // end renderHere
|
||||
|
||||
|
|
|
@ -37,8 +37,8 @@ public class LoginDialog extends ContentDialog
|
|||
addFormField(new CDPasswordFormFieldCommand("pass","Password",null,false,32,128,
|
||||
new CDImageButton("remind","bn_reminder.gif","Reminder",
|
||||
80,24)));
|
||||
//addFormField(new CDCheckBoxFormField("saveme","Save my user name and password for automatic logins",
|
||||
// null,"Y"));
|
||||
addFormField(new CDCheckBoxFormField("saveme","Remember me for next time so I can log in automatically",
|
||||
null,"Y"));
|
||||
addCommandButton(new CDImageButton("login","bn_log_in.gif","Log In",80,24));
|
||||
addCommandButton(new CDImageButton("cancel","bn_cancel.gif","Cancel",80,24));
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@ public class ManageConference implements JSPRender
|
|||
|
||||
private SIGContext sig; // the SIG we're in
|
||||
private ConferenceContext conf; // the conference being listed
|
||||
private String locator = null; // the locator we use
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Constructor
|
||||
|
@ -116,7 +117,9 @@ public class ManageConference implements JSPRender
|
|||
|
||||
public String getLocator()
|
||||
{
|
||||
return "sig=" + sig.getSIGID() + "&conf=" + conf.getConfID();
|
||||
if (locator==null)
|
||||
locator = "sig=" + sig.getSIGID() + "&conf=" + conf.getConfID();
|
||||
return locator;
|
||||
|
||||
} // end getLocator
|
||||
|
||||
|
@ -128,8 +131,7 @@ public class ManageConference implements JSPRender
|
|||
|
||||
public boolean displayAdminSection()
|
||||
{
|
||||
return conf.canChangeConference();
|
||||
// TODO: needs to have "delete" permission OR'ed in
|
||||
return conf.canChangeConference() || conf.canDeleteConference();
|
||||
|
||||
} // end displayAdminSection
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ import com.silverwrist.util.StringUtil;
|
|||
import com.silverwrist.venice.core.ConfigException;
|
||||
import com.silverwrist.venice.core.UserContext;
|
||||
import com.silverwrist.venice.servlets.Variables;
|
||||
import com.silverwrist.venice.servlets.format.menus.LeftMenu;
|
||||
|
||||
public class RenderConfig
|
||||
{
|
||||
|
@ -57,7 +58,8 @@ public class RenderConfig
|
|||
private String image_url;
|
||||
private String static_url;
|
||||
private String site_logo;
|
||||
private Hashtable stock_messages;
|
||||
private HashMap stock_messages;
|
||||
private HashMap menus;
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Constructor
|
||||
|
@ -171,9 +173,10 @@ public class RenderConfig
|
|||
} // end if
|
||||
|
||||
// Initialize the stock messages list.
|
||||
stock_messages = new Hashtable();
|
||||
stock_messages = new HashMap();
|
||||
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
|
||||
Node msgn = msg_nodes.item(i);
|
||||
if (msgn.getNodeType()==Node.ELEMENT_NODE)
|
||||
|
@ -191,6 +194,56 @@ public class RenderConfig
|
|||
if (logger.isDebugEnabled())
|
||||
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
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
|
@ -337,20 +390,6 @@ public class RenderConfig
|
|||
|
||||
} // 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
|
||||
{
|
||||
out.write(getStdFontTag("#3333AA",5) + "<B>" + StringUtil.encodeHTML(primary) + "</B></FONT>");
|
||||
|
@ -374,6 +413,12 @@ public class RenderConfig
|
|||
|
||||
} // end writeStockMessage
|
||||
|
||||
public LeftMenu getLeftMenu(String identifier)
|
||||
{
|
||||
return (LeftMenu)(menus.get(identifier));
|
||||
|
||||
} // end getLeftMenu
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Static operations for use by VeniceServlet
|
||||
*--------------------------------------------------------------------------------
|
||||
|
@ -410,14 +455,14 @@ public class RenderConfig
|
|||
HttpServletResponse response) throws ServletException
|
||||
{
|
||||
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
|
||||
|
||||
public static RenderData createRenderData(ServletContext ctxt, UserContext uc, HttpServletRequest request,
|
||||
HttpServletResponse response) throws ServletException
|
||||
{
|
||||
return new RenderData(getRenderConfig(ctxt),uc,request,response);
|
||||
return new RenderData(getRenderConfig(ctxt),uc,ctxt,request,response);
|
||||
|
||||
} // end createRenderData
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ import com.silverwrist.venice.core.IDUtils;
|
|||
import com.silverwrist.venice.core.UserContext;
|
||||
import com.silverwrist.venice.db.PostLinkRewriter;
|
||||
import com.silverwrist.venice.db.UserNameRewriter;
|
||||
import com.silverwrist.venice.servlets.format.menus.LeftMenu;
|
||||
|
||||
public class RenderData
|
||||
{
|
||||
|
@ -47,6 +48,7 @@ public class RenderData
|
|||
*/
|
||||
|
||||
private RenderConfig rconf;
|
||||
private ServletContext ctxt;
|
||||
private HttpServletRequest request;
|
||||
private HttpServletResponse response;
|
||||
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.ctxt = ctxt;
|
||||
this.request = request;
|
||||
this.response = response;
|
||||
|
||||
|
@ -167,7 +171,13 @@ public class RenderData
|
|||
{
|
||||
return "/format/" + name;
|
||||
|
||||
} // end getFullFormatJSPPath
|
||||
} // end getFormatJSPPath
|
||||
|
||||
public String getStaticIncludePath(String name)
|
||||
{
|
||||
return "/static/" + name;
|
||||
|
||||
} // end getStaticIncludePath
|
||||
|
||||
public String getStdFontTag(String color, int size)
|
||||
{
|
||||
|
@ -193,12 +203,6 @@ public class RenderData
|
|||
|
||||
} // 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
|
||||
{
|
||||
rconf.writeContentHeader(out,primary,secondary);
|
||||
|
@ -250,6 +254,12 @@ public class RenderData
|
|||
|
||||
} // end writeStockMessage
|
||||
|
||||
public LeftMenu getLeftMenu(String identifier)
|
||||
{
|
||||
return rconf.getLeftMenu(identifier);
|
||||
|
||||
} // end getLeftMenu
|
||||
|
||||
public String formatDateForDisplay(Date date)
|
||||
{
|
||||
if (display_date==null)
|
||||
|
@ -491,4 +501,19 @@ public class RenderData
|
|||
|
||||
} // 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
|
||||
|
|
|
@ -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
|
184
src/com/silverwrist/venice/servlets/format/StaticRender.java
Normal file
184
src/com/silverwrist/venice/servlets/format/StaticRender.java
Normal 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
|
|
@ -149,7 +149,6 @@ public class TextMessageDialog implements ContentRender
|
|||
} // end for
|
||||
|
||||
out.write("</DIV>\n");
|
||||
rdat.writeFooter(out);
|
||||
|
||||
} // end renderHere
|
||||
|
||||
|
|
|
@ -243,7 +243,6 @@ public class TopDisplay implements ContentRender
|
|||
|
||||
// Finish up.
|
||||
out.write("</TD>\n</TR></TABLE>");
|
||||
rdat.writeFooter(out);
|
||||
|
||||
} // end renderHere
|
||||
|
||||
|
|
|
@ -15,58 +15,43 @@
|
|||
*
|
||||
* 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
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
private Vector my_vec; // local vector
|
||||
String url;
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Constructor
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public ReadOnlyVector(Vector vec)
|
||||
AbsoluteLeftMenuItem(Element elt)
|
||||
{
|
||||
my_vec = vec;
|
||||
my_vec.trimToSize();
|
||||
super(elt);
|
||||
DOMElementHelper h = new DOMElementHelper(elt);
|
||||
url = h.getSubElementText("absolute");
|
||||
|
||||
} // end constructor
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* finalize() method
|
||||
* Overrides from class LeftMenuItem
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
protected void finalize() throws Throwable
|
||||
protected void appendURL(StringBuffer sbuf, RenderData rdat)
|
||||
{
|
||||
my_vec = null;
|
||||
super.finalize();
|
||||
sbuf.append(url);
|
||||
|
||||
} // end finalize
|
||||
} // end appendURL
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* 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
|
||||
} // end class AbsoluteLeftMenuItem
|
|
@ -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
|
188
src/com/silverwrist/venice/servlets/format/menus/LeftMenu.java
Normal file
188
src/com/silverwrist/venice/servlets/format/menus/LeftMenu.java
Normal 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
|
||||
|
|
@ -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
|
|
@ -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
|
|
@ -38,4 +38,3 @@
|
|||
WIDTH=80 HEIGHT=24 BORDER=0>
|
||||
</FORM><P>
|
||||
</FONT>
|
||||
<% rdat.writeFooter(out); %>
|
||||
|
|
|
@ -20,19 +20,6 @@
|
|||
<%@ page import = "com.silverwrist.venice.core.*" %>
|
||||
<%@ page import = "com.silverwrist.venice.servlets.Variables" %>
|
||||
<%@ 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);
|
||||
Variables.failIfNull(basedat);
|
||||
|
@ -97,36 +84,51 @@ private static void renderMenu(HttpSession session, java.io.Writer out, RenderDa
|
|||
<% if (rdat.useHTMLComments()) { %><!-- END PAGE HEADER --><% } %>
|
||||
|
||||
<TR VALIGN=TOP><TD ALIGN=CENTER>
|
||||
<TABLE ALIGN=CENTER WIDTH="100%" BORDER=0 CELLPADDING=2 CELLSPACING=0><TR VALIGN=TOP>
|
||||
<TD ALIGN=LEFT WIDTH=120 BGCOLOR="#9999FF">
|
||||
<TABLE ALIGN=LEFT WIDTH=120 CELPADDING=0 CELLSPACING=0>
|
||||
<% if (rdat.useHTMLComments()) { %><!-- BEGIN LEFT SIDEBAR --><% } %>
|
||||
<TR VALIGN=TOP><TD VALIGN=LEFT><%= rdat.getStdFontTag(null,2) %>
|
||||
<% if (rdat.useHTMLComments()) { %><!-- variable menu --><% } %>
|
||||
<% renderMenu(session,out,rdat); %>
|
||||
</FONT></TD></TR>
|
||||
<TABLE ALIGN=CENTER WIDTH="100%" BORDER=0 CELLPADDING=2 CELLSPACING=0>
|
||||
<TR VALIGN=TOP>
|
||||
<TD ALIGN=LEFT WIDTH=120 BGCOLOR="#9999FF">
|
||||
<TABLE ALIGN=LEFT WIDTH=120 CELPADDING=0 CELLSPACING=0>
|
||||
<% if (rdat.useHTMLComments()) { %><!-- BEGIN LEFT SIDEBAR --><% } %>
|
||||
<TR VALIGN=TOP><TD VALIGN=LEFT><%= rdat.getStdFontTag(null,2) %>
|
||||
<% if (rdat.useHTMLComments()) { %><!-- variable menu --><% } %>
|
||||
<% basedat.renderMenu(session,out,rdat); %>
|
||||
</FONT></TD></TR>
|
||||
|
||||
<TR VALIGN=TOP><TD VALIGN=LEFT> </TD></TR>
|
||||
<TR VALIGN=TOP><TD VALIGN=LEFT><%= rdat.getStdFontTag(null,2) %>
|
||||
<% if (rdat.useHTMLComments()) { %><!-- fixed menu --><% } %>
|
||||
<B>About This Site</B><BR>
|
||||
<A HREF="/TODO">Documentation</A><BR>
|
||||
<A HREF="/TODO">About Venice</A>
|
||||
</FONT></TD></TR>
|
||||
<TR VALIGN=TOP><TD VALIGN=LEFT> </TD></TR>
|
||||
<TR VALIGN=TOP><TD VALIGN=LEFT><%= rdat.getStdFontTag(null,2) %>
|
||||
<% if (rdat.useHTMLComments()) { %><!-- fixed menu --><% } %>
|
||||
<% basedat.renderFixedMenu(out,rdat); %>
|
||||
</FONT></TD></TR>
|
||||
|
||||
<% if (rdat.useHTMLComments()) { %><!-- END LEFT SIDEBAR --><% } %>
|
||||
<% if (rdat.useHTMLComments()) { %><!-- END LEFT SIDEBAR --><% } %>
|
||||
|
||||
</TABLE>
|
||||
</TD>
|
||||
</TABLE>
|
||||
</TD>
|
||||
|
||||
<TD ALIGN=LEFT WIDTH="100%" BGCOLOR="white">
|
||||
<TABLE WIDTH="100%" BORDER=0 CELLPADDING=2 CELLSPACING=0><TR VALIGN=TOP><TD ALIGN=LEFT>
|
||||
<TD ALIGN=LEFT WIDTH="100%" BGCOLOR="white">
|
||||
<% if (rdat.useHTMLComments()) { %><!-- BEGIN PAGE CONTENT --><% } %>
|
||||
<% basedat.renderContent(application,out,rdat); %>
|
||||
<% if (rdat.useHTMLComments()) { %><!-- END PAGE CONTENT --><% } %>
|
||||
</TD></TR></TABLE>
|
||||
</TD>
|
||||
</TR></TABLE>
|
||||
<% if (rdat.useHTMLComments()) { %><!-- END PAGE CONTENT --><% } %>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR VALIGN=TOP>
|
||||
<TD ALIGN=LEFT WIDTH=120 BGCOLOR="#9999FF"> </TD>
|
||||
<TD ALIGN=LEFT WIDTH="100%" BGCOLOR="white">
|
||||
<% if (rdat.useHTMLComments()) { %><!-- PAGE FOOTER --><% } %>
|
||||
<HR WIDTH="80%">
|
||||
<TABLE ALIGN=CENTER BORDER=0 CELLPADDING=0 CELLSPACING=6><TR VALIGN=TOP>
|
||||
<TD ALIGN=RIGHT><%= rdat.getStdFontTag(null,1) %>
|
||||
<%= rdat.getStockMessage("footer-text") %>
|
||||
</FONT></TD>
|
||||
<TD ALIGN=LEFT>
|
||||
<A HREF="http://venice.sourceforge.net" TARGET="_blank"><IMG
|
||||
SRC="<%= rdat.getFullImagePath("powered-by-venice.gif") %>" ALT="Powered by Venice"
|
||||
WIDTH=140 HEIGHT=80 BORDER=0 HSPACE=0 VSPACE=0></A>
|
||||
</TD>
|
||||
</TR></TABLE>
|
||||
</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</TD></TR>
|
||||
</TABLE>
|
||||
</BODY>
|
||||
|
|
|
@ -25,11 +25,18 @@
|
|||
Variables.failIfNull(data);
|
||||
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) %>
|
||||
<A HREF="<%= rdat.getEncodedServletPath("confops?" + data.getLocator() + "&cmd=Q") %>">Return to
|
||||
Manage Conference Menu</A>
|
||||
<A HREF="<%= rdat.getEncodedServletPath("confops?" + data.getLocator() + "&cmd=QR") %>">Return to
|
||||
Conference Reports Menu</A>
|
||||
</FONT><P>
|
||||
|
||||
<% if (data.anyElements()) { %>
|
||||
|
@ -79,11 +86,18 @@
|
|||
</TABLE>
|
||||
<% } else { %>
|
||||
<%= rdat.getStdFontTag(null,2) %><EM>
|
||||
<% if (data.isPosterReport()) { %>
|
||||
No posters to conference "<%= StringUtil.encodeHTML(data.getConfName()) %>" found.
|
||||
<% if (data.isTopicReport()) { %>
|
||||
<% if (data.isPosterReport()) { %>
|
||||
No posters to topic "<%= data.getTopicName() %>" found.
|
||||
<% } else { %>
|
||||
No readers of topic "<%= data.getTopicName() %>" found.
|
||||
<% } // end if %>
|
||||
<% } 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 %>
|
||||
</EM></FONT>
|
||||
<% } // end if %>
|
||||
<P><% rdat.writeFooter(out); %>
|
||||
|
|
|
@ -151,4 +151,3 @@
|
|||
WIDTH=80 HEIGHT=24 BORDER=0>
|
||||
</FORM><BR>
|
||||
<% } // end if %>
|
||||
<% rdat.writeFooter(out); %>
|
||||
|
|
|
@ -137,4 +137,3 @@
|
|||
<% } else { %>
|
||||
<%= rdat.getStdFontTag(null,2) %><EM>There are no conferences in this SIG.</EM></FONT>
|
||||
<% } // end if %>
|
||||
<% rdat.writeFooter(out); %>
|
||||
|
|
|
@ -72,4 +72,3 @@
|
|||
BORDER=0></A>
|
||||
<% } // end if %>
|
||||
</DIV>
|
||||
<% rdat.writeFooter(out); %>
|
||||
|
|
|
@ -286,4 +286,3 @@ private static String getActivityString(SIGContext sig, RenderData rdat)
|
|||
|
||||
</TABLE><BR CLEAR=LEFT>
|
||||
<% } // end if (results found) %>
|
||||
<% rdat.writeFooter(out); %>
|
||||
|
|
|
@ -96,4 +96,3 @@
|
|||
by visiting the conferences and pressing the "Add to Hotlist" button.
|
||||
</EM></FONT>
|
||||
<% } // end if %>
|
||||
<% rdat.writeFooter(out); %>
|
||||
|
|
|
@ -49,4 +49,3 @@
|
|||
</TD></TR>
|
||||
</TABLE>
|
||||
</FORM>
|
||||
<% rdat.writeFooter(out); %>
|
|
@ -68,4 +68,3 @@
|
|||
</FORM>
|
||||
|
||||
</FONT>
|
||||
<% rdat.writeFooter(out); %>
|
||||
|
|
|
@ -61,13 +61,9 @@
|
|||
Conference Aliases</A><P>
|
||||
<A HREF="<%= rdat.getEncodedServletPath("confops?" + data.getLocator() + "&cmd=M") %>">Manage
|
||||
Conference Members</A><P>
|
||||
<A HREF="<%= rdat.getEncodedServletPath("confops?" + data.getLocator() + "&cmd=RP") %>">Conference
|
||||
Posters Report</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=QR") %>">Conference
|
||||
Activity Reports</A><P>
|
||||
<A HREF="<%= rdat.getEncodedServletPath("confops?" + data.getLocator() + "&cmd=DEL") %>">Delete
|
||||
Conference</A><P>
|
||||
</B></FONT>
|
||||
<% } // end if (displaying admin section) %>
|
||||
|
||||
<% rdat.writeFooter(out); %>
|
||||
|
|
|
@ -40,5 +40,3 @@
|
|||
<A HREF="/TODO">Invite Users</A>
|
||||
</DIV>
|
||||
</FONT>
|
||||
<% rdat.writeFooter(out); %>
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
<TABLE BORDER=0 CELLPADDING=0>
|
||||
<TR><TD ALIGN=LEFT COLSPAN=2>
|
||||
<%= 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>
|
||||
<TR><TD ALIGN=LEFT COLSPAN=2>
|
||||
<%= rdat.getStdFontTag(null,2) %>Your name/header:</FONT><BR>
|
||||
|
@ -77,4 +77,3 @@
|
|||
</TD></TR>
|
||||
</TABLE>
|
||||
</FORM>
|
||||
<% rdat.writeFooter(out); %>
|
||||
|
|
|
@ -176,7 +176,7 @@
|
|||
</EM>)
|
||||
<% if (msg.hasAttachment()) { %>
|
||||
<A HREF="<%= rdat.getEncodedServletPath("attachment?" + data.getConfLocator() + "&msg="
|
||||
+ msg.getPostID()) %>"><IMG
|
||||
+ msg.getPostID()) %>" TARGET="_blank"><IMG
|
||||
SRC="<%= rdat.getFullImagePath("attachment.gif") %>"
|
||||
ALT="(Attachment <%= msg.getAttachmentFilename() %> - <%= msg.getAttachmentLength() %> bytes)"
|
||||
WIDTH=16 HEIGHT=16 BORDER=0></A>
|
||||
|
@ -341,4 +341,3 @@
|
|||
<% } else if (data.isTopicFrozen()) { %>
|
||||
<DIV ALIGN=CENTER><%= rdat.getStdFontTag(null,2) %><B>This is a <EM>Frozen</EM> Topic</B></DIV>
|
||||
<% } // end if %>
|
||||
<% rdat.writeFooter(out); %>
|
||||
|
|
|
@ -84,4 +84,3 @@
|
|||
</TD></TR>
|
||||
</TABLE>
|
||||
</FORM>
|
||||
<% rdat.writeFooter(out); %>
|
||||
|
|
73
web/format/report_conf.jsp
Normal file
73
web/format/report_conf.jsp
Normal 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> </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>
|
|
@ -148,4 +148,3 @@
|
|||
WIDTH=80 HEIGHT=24 BORDER=0>
|
||||
</FORM><BR>
|
||||
<% } // end if %>
|
||||
<% rdat.writeFooter(out); %>
|
||||
|
|
|
@ -69,4 +69,3 @@
|
|||
<B>SIG Administration</B> menu.<P>
|
||||
|
||||
</FONT>
|
||||
<% rdat.writeFooter(out); %>
|
||||
|
|
|
@ -62,4 +62,3 @@
|
|||
<% } else { %>
|
||||
<%= rdat.getStdFontTag(null,2) %><EM>You are not a member of any SIGs.</EM></FONT>
|
||||
<% } // end if %>
|
||||
<% rdat.writeFooter(out); %>
|
||||
|
|
|
@ -100,4 +100,3 @@
|
|||
|
||||
</FONT></TD>
|
||||
</TR></TABLE>
|
||||
<% rdat.writeFooter(out); %>
|
||||
|
|
|
@ -33,4 +33,3 @@
|
|||
has elected to provide. Enjoy your membership!<P>
|
||||
<DIV ALIGN=CENTER><A HREF="<%= data.getEntryURL(rdat) %>">Enter SIG</A></DIV>
|
||||
</FONT>
|
||||
<% rdat.writeFooter(out); %>
|
||||
|
|
|
@ -106,6 +106,3 @@
|
|||
</TD></TR>
|
||||
</TABLE>
|
||||
</FORM>
|
||||
<% rdat.writeFooter(out); %>
|
||||
|
||||
|
||||
|
|
|
@ -51,4 +51,4 @@
|
|||
<% } // end for %>
|
||||
<% } else { %>
|
||||
<%= rdat.getStdFontTag(null,2) %><EM>No front page postings found.</EM></FONT>
|
||||
<% } // end if %>
|
||||
<% } // end if %>
|
||||
|
|
|
@ -190,4 +190,3 @@
|
|||
<B>]</B>
|
||||
</DIV>
|
||||
</FONT>
|
||||
<% rdat.writeFooter(out); %>
|
||||
|
|
|
@ -109,5 +109,3 @@
|
|||
</TABLE>
|
||||
</FORM>
|
||||
<% } // end if %>
|
||||
|
||||
<% rdat.writeFooter(out); %>
|
||||
|
|
BIN
web/images/sw-main.gif
Normal file
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
BIN
web/images/venicelogo.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.1 KiB |
43
web/static/about-venice.html
Normal file
43
web/static/about-venice.html
Normal 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 © 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> <erbo></DT>
|
||||
<DD>Code wrangler, system guru, and administrator in general</DD>
|
||||
<DT><B>Harry Pike</B> <maddog></DT>
|
||||
<DD>EMinds host and domain expert in virtual community hosting</DD>
|
||||
<DT><B>Finnegan</B> <finnegan></DT>
|
||||
<DD>Designer of the Venice web site</DD>
|
||||
<DT><B>Catherine Dodson</B> <cait></DT>
|
||||
<DD>Technical documentation</DD>
|
||||
<DT><B>Pamela Boulais</B> <silverwrist></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>
|
||||
|
BIN
web/static/images/sw-main.gif
Normal file
BIN
web/static/images/sw-main.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.4 KiB |
BIN
web/static/images/venicelogo.jpg
Normal file
BIN
web/static/images/venicelogo.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.1 KiB |
Loading…
Reference in New Issue
Block a user