gave the "top" page the makeover it so richly deserved - now, instead of an

array of content panels, we have a big content panel (use to come later)
plus a set of configurable "sideboxes" that look kind of like Slashboxes...
This commit is contained in:
Eric J. Bowersox 2001-02-16 05:51:20 +00:00
parent 36f7c7f10f
commit bda25d9aa2
23 changed files with 776 additions and 963 deletions

5
TODO
View File

@ -15,11 +15,6 @@ Lots!
- Implement quick e-mail from the user profile display (engine support and - Implement quick e-mail from the user profile display (engine support and
UI). UI).
- The whole "top" display thing needs a serious realignment. The present
system is a bit klunky and will be tough to implement Customize. We need
the capability to support JSP-based rendering in the individual "top" content
panes as well.
- More SELECT queries that specify discrete columns need to start using - More SELECT queries that specify discrete columns need to start using
numeric indexes to retrieve the column data, instead of names. This will numeric indexes to retrieve the column data, instead of names. This will
make the retrieval process more efficient, and make for shorter SQL make the retrieval process more efficient, and make for shorter SQL

View File

@ -89,14 +89,22 @@ CREATE TABLE userprefs (
localeid VARCHAR(64) DEFAULT 'en-US-' localeid VARCHAR(64) DEFAULT 'en-US-'
); );
# Indicates what the "top" page configuration is for any given user. # Indicates what the top-level "sidebox" configuration is for any given user.
CREATE TABLE topconfig ( CREATE TABLE sideboxes (
uid INT NOT NULL, uid INT NOT NULL,
row SMALLINT NOT NULL, boxid INT NOT NULL,
col SMALLINT NOT NULL, sequence INT NOT NULL,
partid CHAR(4) NOT NULL,
param VARCHAR(255), param VARCHAR(255),
PRIMARY KEY (uid, row, col) UNIQUE INDEX userboxes (uid, boxid),
INDEX inorder (uid, sequence)
);
# A reference to the available sideboxes.
CREATE TABLE refsidebox (
boxid INT NOT NULL PRIMARY KEY,
classname VARCHAR(255),
description VARCHAR(255),
param_descr VARCHAR(255)
); );
# The contact information table. This is used for both users and SIGs. # The contact information table. This is used for both users and SIGs.
@ -435,6 +443,12 @@ INSERT INTO refaudit (type, descr) VALUES
(315, 'Delete Conference'), (315, 'Delete Conference'),
(9999999, 'DUMMY'); (9999999, 'DUMMY');
# Which side boxes are defined. The class names MUST match implementations in the
# com.silverwrist.venice.servlets.format package!!!
INSERT INTO refsidebox (boxid, classname, description, param_descr) VALUES
(1, 'SideBoxSIGs', 'Your SIGs', NULL),
(2, 'SideBoxConferences', 'Your Conference Hotlist', NULL);
# The ISO 3166 two-letter country codes. Source is # The ISO 3166 two-letter country codes. Source is
# <http://www.din.de/gremien/nas/nabd/iso3166ma/>. # <http://www.din.de/gremien/nas/nabd/iso3166ma/>.
INSERT INTO refcountry (code, name) VALUES INSERT INTO refcountry (code, name) VALUES
@ -1309,8 +1323,8 @@ INSERT INTO contacts (contactid, given_name, family_name, locality, region, pcod
# Provide the default view for Anonymous Honyak. This view will be copied to all # Provide the default view for Anonymous Honyak. This view will be copied to all
# new users. # new users.
INSERT INTO topconfig (uid, row, col, partid, param) INSERT INTO sideboxes (uid, boxid, sequence, param)
VALUES (1, 0, 0, 'SIGS', NULL), (1, 0, 1, 'CONF', NULL); VALUES (1, 1, 100, NULL), (1, 2, 200, NULL);
# Add the 'Administrator' user to the users table. # Add the 'Administrator' user to the users table.
# (UID = 2, CONTACTID = 2) # (UID = 2, CONTACTID = 2)
@ -1321,8 +1335,8 @@ INSERT INTO contacts (contactid, given_name, family_name, locality, region, pcod
VALUES (2, 'System', 'Administrator', 'Anywhere', '', '', 'US', 'root@your.box.com', 2); VALUES (2, 'System', 'Administrator', 'Anywhere', '', '', 'US', 'root@your.box.com', 2);
# Create the default view for Administrator. # Create the default view for Administrator.
INSERT INTO topconfig (uid, row, col, partid, param) INSERT INTO sideboxes (uid, boxid, sequence, param)
VALUES (2, 0, 0, 'SIGS', NULL), (2, 0, 1, 'CONF', NULL); VALUES (2, 1, 100, NULL), (2, 2, 200, NULL);
# Add the administration SIG to the SIGs table. # Add the administration SIG to the SIGs table.
# (SIGID = 1, CONTACTID = 3) # (SIGID = 1, CONTACTID = 3)
@ -1416,8 +1430,8 @@ INSERT INTO users (uid, username, passhash, contactid, verify_email, base_lvl, c
INSERT INTO userprefs (uid) VALUES (3); INSERT INTO userprefs (uid) VALUES (3);
INSERT INTO contacts (contactid, given_name, family_name, locality, region, pcode, country, email, owner_uid) INSERT INTO contacts (contactid, given_name, family_name, locality, region, pcode, country, email, owner_uid)
VALUES (5, 'Test', 'User', 'Denver', 'CO', '80231', 'US', 'testuser@example.com', 3); VALUES (5, 'Test', 'User', 'Denver', 'CO', '80231', 'US', 'testuser@example.com', 3);
INSERT INTO topconfig (uid, row, col, partid, param) INSERT INTO sideboxes (uid, boxid, sequence, param)
VALUES (3, 0, 0, 'SIGS', NULL), (3, 0, 1, 'CONF', NULL); VALUES (3, 1, 100, NULL), (3, 2, 200, NULL);
INSERT INTO sigmember (sigid, uid, granted_lvl, locked) INSERT INTO sigmember (sigid, uid, granted_lvl, locked)
VALUES (2, 3, 6500, 1); VALUES (2, 3, 6500, 1);

View File

@ -7,7 +7,7 @@
* WARRANTY OF ANY KIND, either express or implied. See the License for the specific * WARRANTY OF ANY KIND, either express or implied. See the License for the specific
* language governing rights and limitations under the License. * language governing rights and limitations under the License.
* *
* The Original Code is the Venice Web Community System. * The Original Code is the Venice Web Communities System.
* *
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are

View File

@ -7,7 +7,7 @@
* WARRANTY OF ANY KIND, either express or implied. See the License for the specific * WARRANTY OF ANY KIND, either express or implied. See the License for the specific
* language governing rights and limitations under the License. * language governing rights and limitations under the License.
* *
* The Original Code is the Venice Web Community System. * The Original Code is the Venice Web Communities System.
* *
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
@ -17,20 +17,18 @@
*/ */
package com.silverwrist.venice.core; package com.silverwrist.venice.core;
public interface FrontPageViewConfig public interface SideBoxDescriptor
{ {
public abstract int getNumRows(); public abstract int getID();
public abstract int getNumColumns(); public abstract int getSequence();
public abstract String getPartID(int row, int column); public abstract String getParameter();
public abstract void setPartID(int row, int column, String partid); public abstract String getDescription();
public abstract String getParameter(int row, int column); public abstract String getParamDescription();
public abstract void setParameter(int row, int column, String param); public abstract String getClassname();
public abstract boolean getModified(); } // end interface SideBoxDescriptor
} // end interface FrontPageViewConfig

View File

@ -7,7 +7,7 @@
* WARRANTY OF ANY KIND, either express or implied. See the License for the specific * WARRANTY OF ANY KIND, either express or implied. See the License for the specific
* language governing rights and limitations under the License. * language governing rights and limitations under the License.
* *
* The Original Code is the Venice Web Community System. * The Original Code is the Venice Web Communities System.
* *
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
@ -52,10 +52,6 @@ public interface UserContext extends SearchMode
public abstract void setDescription(String new_descr) throws DataException; public abstract void setDescription(String new_descr) throws DataException;
public abstract FrontPageViewConfig getFrontPageViewConfig(int max_cols) throws DataException;
public abstract void putFrontPageViewConfig(FrontPageViewConfig cfg) throws DataException;
public abstract List getMemberSIGs() throws DataException; public abstract List getMemberSIGs() throws DataException;
public abstract SIGContext getSIGContext(int sigid) throws DataException; public abstract SIGContext getSIGContext(int sigid) throws DataException;
@ -89,4 +85,6 @@ public interface UserContext extends SearchMode
public abstract boolean canCreateSIG(); public abstract boolean canCreateSIG();
public abstract List getSideBoxList() throws DataException;
} // end interface UserContext } // end interface UserContext

View File

@ -7,7 +7,7 @@
* WARRANTY OF ANY KIND, either express or implied. See the License for the specific * WARRANTY OF ANY KIND, either express or implied. See the License for the specific
* language governing rights and limitations under the License. * language governing rights and limitations under the License.
* *
* The Original Code is the Venice Web Community System. * The Original Code is the Venice Web Communities System.
* *
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
@ -71,4 +71,6 @@ public interface VeniceEngine extends SearchMode
public abstract int getMaxNumSIGMembersDisplay(); public abstract int getMaxNumSIGMembersDisplay();
public abstract List getMasterSideBoxList();
} // end interface VeniceEngine } // end interface VeniceEngine

View File

@ -22,6 +22,7 @@ import java.util.List;
import com.silverwrist.venice.security.AuditRecord; import com.silverwrist.venice.security.AuditRecord;
import com.silverwrist.venice.htmlcheck.HTMLChecker; import com.silverwrist.venice.htmlcheck.HTMLChecker;
import com.silverwrist.venice.core.DataException; import com.silverwrist.venice.core.DataException;
import com.silverwrist.venice.core.SideBoxDescriptor;
public interface EngineBackend public interface EngineBackend
{ {
@ -80,4 +81,6 @@ public interface EngineBackend
public abstract void forceParamReload() throws DataException; public abstract void forceParamReload() throws DataException;
public abstract SideBoxDescriptor getMasterSideBoxDescriptor(int id);
} // end interface EngineBackend } // end interface EngineBackend

View File

@ -1,273 +0,0 @@
/*
* 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 Community 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.core.impl;
import java.sql.*;
import java.util.*;
import com.silverwrist.venice.core.*;
import com.silverwrist.venice.db.*;
class FrontPageViewConfigImpl implements FrontPageViewConfig, Stashable
{
private int my_uid;
private int num_cols;
private Vector v_parts = new Vector();
private Vector v_params = new Vector();
private boolean is_modified = false;
FrontPageViewConfigImpl(Connection conn, int uid, int max_cols) throws DataException, SQLException
{
my_uid = uid;
num_cols = max_cols;
StringBuffer sql = new StringBuffer("SELECT row, col, partid, param FROM topconfig WHERE uid = ");
sql.append(uid).append(';');
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(sql.toString());
while (rs.next())
{ // make sure the column is in range first
int col = rs.getInt("col");
if ((col>=0) && (col<num_cols))
{ // get the row and find out how far down we have to go in the vector
int row = rs.getInt("row");
if (row>=0)
{ // now look for the right arrays to store into
String[] a_part = null;
String[] a_param = null;
if (row>=v_parts.size())
{ // need to extend the vector contents
while (row>=v_parts.size())
{ // append new arrays onto the config
a_part = new String[num_cols];
a_param = new String[num_cols];
for (int i=0; i<num_cols; i++)
{ // nuke the new arrays
a_part[i] = null;
a_param[i] = null;
} // end for
v_parts.addElement(a_part);
v_params.addElement(a_param);
} // end while
} // end if
else
{ // just fetch the existing arrays
a_part = (String[])(v_parts.elementAt(row));
a_param = (String[])(v_params.elementAt(row));
} // end else
// and now save off the recordset data
a_part[col] = rs.getString("partid");
a_param[col] = rs.getString("param");
} // end if
} // end if
} // end while
} // end constructor
public int getNumRows()
{
return v_parts.size();
} // end getNumRows
public int getNumColumns()
{
return num_cols;
} // end getNumCols
public String getPartID(int row, int column)
{
if ((row<0) || (row>=v_parts.size()))
throw new IndexOutOfBoundsException("invalid row specified to FrontPageViewConfig.getPartID");
if ((column<0) || (column>=num_cols))
throw new IndexOutOfBoundsException("invalid column specified to FrontPageViewConfig.getPartID");
String[] array = (String[])(v_parts.elementAt(row));
return array[column];
} // end getPartID
public void setPartID(int row, int column, String partid)
{
if (row<0)
throw new IndexOutOfBoundsException("invalid row specified to FrontPageViewConfig.setPartID");
if ((column<0) || (column>=num_cols))
throw new IndexOutOfBoundsException("invalid column specified to FrontPageViewConfig.setPartID");
String[] a_part = null;
String[] a_param = null;
if (row>=v_parts.size())
{ // need to extend the vector contents
while (row>=v_parts.size())
{ // append new arrays onto the config
a_part = new String[num_cols];
a_param = new String[num_cols];
for (int i=0; i<num_cols; i++)
{ // nuke the new arrays
a_part[i] = null;
a_param[i] = null;
} // end for
v_parts.addElement(a_part);
v_params.addElement(a_param);
} // end while
} // end if
else // just fetch the existing array
a_part = (String[])(v_parts.elementAt(row));
a_part[column] = partid;
is_modified = true;
} // end setPartID
public String getParameter(int row, int column)
{
if ((row<0) || (row>=v_params.size()))
throw new IndexOutOfBoundsException("invalid row specified to FrontPageViewConfig.getParameter");
if ((column<0) || (column>=num_cols))
throw new IndexOutOfBoundsException("invalid column specified to FrontPageViewConfig.getParameter");
String[] array = (String[])(v_params.elementAt(row));
return array[column];
} // end getParameter
public void setParameter(int row, int column, String param)
{
if (row<0)
throw new IndexOutOfBoundsException("invalid row specified to FrontPageViewConfig.setParameter");
if ((column<0) || (column>=num_cols))
throw new IndexOutOfBoundsException("invalid column specified to FrontPageViewConfig.setParameter");
String[] a_part = null;
String[] a_param = null;
if (row>=v_parts.size())
{ // need to extend the vector contents
while (row>=v_parts.size())
{ // append new arrays onto the config
a_part = new String[num_cols];
a_param = new String[num_cols];
for (int i=0; i<num_cols; i++)
{ // nuke the new arrays
a_part[i] = null;
a_param[i] = null;
} // end for
v_parts.addElement(a_part);
v_params.addElement(a_param);
} // end while
} // end if
else // just fetch the existing array
a_param = (String[])(v_params.elementAt(row));
a_param[column] = param;
is_modified = true;
} // end setParameter
public boolean getModified()
{
return is_modified;
} // end getModified
public int getStashableUID()
{
return my_uid;
} // end getStashableUID
public void stash(Connection conn) throws SQLException
{
StringBuffer buf = new StringBuffer();
for (int row=0; row<v_parts.size(); row++)
{ // retrieve the row arrays first
String[] a_part = (String[])(v_parts.elementAt(row));
String[] a_param = (String[])(v_params.elementAt(row));
for (int col=0; col<num_cols; col++)
{ // add to the list as long as the part isn't NULL
if (a_part[col]!=null)
{ // append this set of values to the INSERT we're going to make later
if (buf.length()==0)
buf.append("INSERT INTO topconfig (uid, row, col, partid, param) VALUES ");
else
buf.append(", ");
buf.append('(').append(my_uid).append(", ").append(row).append(", ").append(col).append(", ");
buf.append(SQLUtil.encodeStringArg(a_part[col])).append(", ");
buf.append(SQLUtil.encodeStringArg(a_param[col])).append(')');
} // end if
} // end for (each column)
} // end for (each row)
String insert_cmd = null;
if (buf.length()>0)
{ // we've got the insert command
buf.append(';');
insert_cmd = buf.toString();
buf.setLength(0);
} // end if
// now create the DELETE command
buf.append("DELETE FROM topconfig WHERE uid = ").append(my_uid).append(';');
// we need to lock the topconfig table while we do this
Statement stmt = conn.createStatement();
stmt.executeUpdate("LOCK TABLES topconfig WRITE;");
try
{ // delete all existing records
stmt.executeUpdate(buf.toString());
// now insert the new records
if (insert_cmd!=null)
stmt.executeUpdate(insert_cmd);
} // end try
finally
{ // make sure to unlock the tables when we're done
Statement ulk_stmt = conn.createStatement();
ulk_stmt.executeUpdate("UNLOCK TABLES;");
} // end finally
} // end stash
} // end class FrontPageViewConfigImpl

View File

@ -0,0 +1,87 @@
/*
* 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.core.impl;
import com.silverwrist.venice.core.SideBoxDescriptor;
class SideBoxDescriptorImpl implements SideBoxDescriptor
{
/*--------------------------------------------------------------------------------
* Attributes
*--------------------------------------------------------------------------------
*/
private SideBoxDescriptor parent;
private int sequence;
private String param;
/*--------------------------------------------------------------------------------
* Constructor
*--------------------------------------------------------------------------------
*/
SideBoxDescriptorImpl(SideBoxDescriptor parent, int sequence, String param)
{
this.parent = parent;
this.sequence = sequence;
this.param = param;
} // end constructor
/*--------------------------------------------------------------------------------
* Implementations from interface SideBoxDescriptor
*--------------------------------------------------------------------------------
*/
public int getID()
{
return parent.getID();
} // end getID
public int getSequence()
{
return sequence;
} // end getSequence
public String getParameter()
{
return param;
} // end getParameter
public String getDescription()
{
return parent.getDescription();
} // end getDescription
public String getParamDescription()
{
return parent.getParamDescription();
} // end getParamDescription
public String getClassname()
{
return parent.getClassname();
} // end getClassname
} // end class SideBoxDescriptorImpl

View File

@ -7,7 +7,7 @@
* WARRANTY OF ANY KIND, either express or implied. See the License for the specific * WARRANTY OF ANY KIND, either express or implied. See the License for the specific
* language governing rights and limitations under the License. * language governing rights and limitations under the License.
* *
* The Original Code is the Venice Web Community System. * The Original Code is the Venice Web Communities System.
* *
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>, * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
@ -710,76 +710,6 @@ class UserContextImpl implements UserContext, UserBackend
} // end setDescription } // end setDescription
public FrontPageViewConfig getFrontPageViewConfig(int max_cols) throws DataException
{
Connection conn = null;
try
{ // retrieve a connection from the data pool
conn = datapool.getConnection();
// create new object
return new FrontPageViewConfigImpl(conn,uid,max_cols);
} // end try
catch (SQLException e)
{ // turn SQLException into data exception
logger.error("DB error getting front page view config: " + e.getMessage(),e);
throw new DataException("unable to retrieve front page view config: " + e.getMessage(),e);
} // end catch
finally
{ // make sure the connection is released before we go
if (conn!=null)
datapool.releaseConnection(conn);
} // end finally
} // end getFrontPageViewConfig
public void putFrontPageViewConfig(FrontPageViewConfig cfg) throws DataException
{
Connection conn = null;
try
{ // coerce the value to a Stashable first
Stashable obj = (Stashable)cfg;
if (obj.getStashableUID()!=uid)
{ // wrong UID for configuration - this is bogus
logger.error("invalid ownership of FrontPageViewConfig (was "
+ String.valueOf(obj.getStashableUID()) + ", should be " + String.valueOf(uid) + ")");
throw new DataException("invalid front page view config record");
} // end if
// retrieve a connection from the data pool
conn = datapool.getConnection();
// stash the object
obj.stash(conn);
} // end try
catch (ClassCastException cce)
{ // we need to be able to coerce the FrontPageViewConfig to a Stashable
logger.error("FrontPageViewConfig was not a Stashable");
throw new DataException("improper front page view config record");
} // end catch
catch (SQLException e)
{ // turn SQLException into data exception
logger.error("DB error saving front page view config: " + e.getMessage(),e);
throw new DataException("unable to save front page view config: " + e.getMessage(),e);
} // end catch
finally
{ // make sure the connection is released before we go
if (conn!=null)
datapool.releaseConnection(conn);
} // end finally
} // end putFrontPageViewConfig
public List getMemberSIGs() throws DataException public List getMemberSIGs() throws DataException
{ {
return SIGUserContextImpl.getMemberSIGEntries(engine,this,datapool); return SIGUserContextImpl.getMemberSIGEntries(engine,this,datapool);
@ -893,6 +823,45 @@ class UserContextImpl implements UserContext, UserBackend
} // end canCreateSIG } // end canCreateSIG
public List getSideBoxList() throws DataException
{
Connection conn = null;
Vector rc = new Vector();
try
{ // retrieve a connection from the data pool
conn = datapool.getConnection();
Statement stmt = conn.createStatement();
// retrieve the necessary rows from the sideboxes table
ResultSet rs = stmt.executeQuery("SELECT boxid, sequence, param FROM sideboxes WHERE uid = " + uid
+ " ORDER BY sequence;");
while (rs.next())
{ // create the implementation objects and return them all
SideBoxDescriptor sbd = new SideBoxDescriptorImpl(engine.getMasterSideBoxDescriptor(rs.getInt(1)),
rs.getInt(2),rs.getString(3));
rc.add(sbd);
} // end while
} // end try
catch (SQLException e)
{ // turn SQLException into data exception
logger.error("DB error getting side box config: " + e.getMessage(),e);
throw new DataException("unable to retrieve side box config: " + e.getMessage(),e);
} // end catch
finally
{ // make sure the connection is released before we go
if (conn!=null)
datapool.releaseConnection(conn);
} // end finally
return new ReadOnlyVector(rc);
} // end getSideBoxList
/*-------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------
* Implementations from interface UserBackend * Implementations from interface UserBackend
*-------------------------------------------------------------------------------- *--------------------------------------------------------------------------------

View File

@ -190,6 +190,94 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
} // end class VeniceFeatureDef } // end class VeniceFeatureDef
/*--------------------------------------------------------------------------------
* Internal class storing side box information.
*--------------------------------------------------------------------------------
*/
class MasterSideBox implements SideBoxDescriptor
{
private int id;
private String description;
private String param_descr;
private String classname;
MasterSideBox(ResultSet rs) throws SQLException
{
this.id = rs.getInt("boxid");
this.description = rs.getString("description");
this.param_descr = rs.getString("param_descr");
this.classname = rs.getString("classname");
} // end constructor
public int getID()
{
return id;
} // end getID
public int getSequence()
{
return -1;
} // end getSequence
public String getParameter()
{
return null;
} // end getParameter
public String getDescription()
{
return description;
} // end getDescription
public String getParamDescription()
{
return param_descr;
} // end getParamDescription
public String getClassname()
{
return classname;
} // end getClassname
} // end class MasterSideBox
/*--------------------------------------------------------------------------------
* Internal class for returning side box information.
*--------------------------------------------------------------------------------
*/
static class MasterSideBoxList extends AbstractList
{
private MasterSideBox[] array;
MasterSideBoxList(MasterSideBox[] array)
{
this.array = array;
} // end constructor
public Object get(int index)
{
return array[index];
} // end get
public int size()
{
return array.length;
} // end size
} // end class MasterSideBoxList
/*-------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------
* Static data values * Static data values
*-------------------------------------------------------------------------------- *--------------------------------------------------------------------------------
@ -214,6 +302,8 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
private Hashtable conf_objects = new Hashtable(); // holder for ConferenceCoreData objects private Hashtable conf_objects = new Hashtable(); // holder for ConferenceCoreData objects
private HTMLCheckerConfig[] html_configs; // holder for HTML checker configurations private HTMLCheckerConfig[] html_configs; // holder for HTML checker configurations
private int[] gp_ints; // global integer parameters 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
/*-------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------
* Constructor * Constructor
@ -274,6 +364,8 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
*/ */
public void initialize(Document config) throws ConfigException, DataException public void initialize(Document config) throws ConfigException, DataException
{ {
int i; // loop counter
if (this.config!=null) if (this.config!=null)
{ // already configured! { // already configured!
logger.error("Venice engine already initialized"); logger.error("Venice engine already initialized");
@ -345,10 +437,9 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
// Retrieve the list of dictionary files to load into the spellchecker. // Retrieve the list of dictionary files to load into the spellchecker.
dictionary_tmp = new Vector(); dictionary_tmp = new Vector();
NodeList dict_nodes = dict_sect.getChildNodes(); NodeList dict_nodes = dict_sect.getChildNodes();
int j; for (i=0; i<dict_nodes.getLength(); i++)
for (j=0; j<dict_nodes.getLength(); j++)
{ // scan the <dictionary> element looking for <file> elements { // scan the <dictionary> element looking for <file> elements
Node dn = dict_nodes.item(j); Node dn = dict_nodes.item(i);
if ((dn.getNodeType()==Node.ELEMENT_NODE) && (dn.getNodeName().equals("file"))) if ((dn.getNodeType()==Node.ELEMENT_NODE) && (dn.getNodeName().equals("file")))
{ // store the file name as a vector element { // store the file name as a vector element
Element del = (Element)dn; Element del = (Element)dn;
@ -370,9 +461,9 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
// Initialize the stock messages list. // Initialize the stock messages list.
stock_messages = new Hashtable(); stock_messages = new Hashtable();
NodeList msg_nodes = msg_sect.getChildNodes(); NodeList msg_nodes = msg_sect.getChildNodes();
for (j=0; j<msg_nodes.getLength(); j++) for (i=0; i<msg_nodes.getLength(); i++)
{ // examine all subnodes to add them to the message text { // examine all subnodes to add them to the message text
Node msgn = msg_nodes.item(j); Node msgn = msg_nodes.item(i);
if (msgn.getNodeType()==Node.ELEMENT_NODE) if (msgn.getNodeType()==Node.ELEMENT_NODE)
{ // add it to the hash table by its tag name { // add it to the hash table by its tag name
Element msgel = (Element)msgn; Element msgel = (Element)msgn;
@ -426,6 +517,19 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
logger.debug(max_value + " features loaded from database"); logger.debug(max_value + " features loaded from database");
// load the master sidebox table
Vector sidebox_tmp = new Vector();
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));
if (logger.isDebugEnabled())
logger.debug(sideboxes.length + " sidebox definitions loaded from database");
// load the global defaults // load the global defaults
loadDefaults(stmt); loadDefaults(stmt);
@ -443,9 +547,12 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
} // end finally } // end finally
for (int i=0; i<features.length; i++) // insert feature symbols into hashtable for (i=0; i<features.length; i++) // insert feature symbols into hashtable
feature_syms.put(features[i].getSymbol(),features[i]); feature_syms.put(features[i].getSymbol(),features[i]);
for (i=0; i<sideboxes.length; i++) // insert sideboxes into hashtable
sidebox_ids.put(new Integer(sideboxes[i].getID()),sideboxes[i]);
// Here is where we create the HTML Checker and all the goodies it relies on. // Here is where we create the HTML Checker and all the goodies it relies on.
// Start by creating some of the subsidiary objects that get added to HTML Checker configs. // Start by creating some of the subsidiary objects that get added to HTML Checker configs.
EmailRewriter email_rewriter = new EmailRewriter(); EmailRewriter email_rewriter = new EmailRewriter();
@ -458,7 +565,7 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
// Create the LazyLexicon that holds our dictionary files, and add it to the SpellingRewriter. // Create the LazyLexicon that holds our dictionary files, and add it to the SpellingRewriter.
String[] dictfiles = new String[dictionary_tmp.size()]; String[] dictfiles = new String[dictionary_tmp.size()];
for (int i=0; i<dictionary_tmp.size(); i++) for (i=0; i<dictionary_tmp.size(); i++)
dictfiles[i] = (String)(dictionary_tmp.get(i)); dictfiles[i] = (String)(dictionary_tmp.get(i));
LazyTreeLexicon lex = new LazyTreeLexicon(dictfiles); LazyTreeLexicon lex = new LazyTreeLexicon(dictfiles);
spell_rewriter.addDictionary(lex); spell_rewriter.addDictionary(lex);
@ -767,7 +874,7 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
{ // look to see if the user name is already present { // look to see if the user name is already present
conn = datapool.getConnection(); conn = datapool.getConnection();
Statement stmt = conn.createStatement(); Statement stmt = conn.createStatement();
stmt.executeUpdate("LOCK TABLES users WRITE, userprefs WRITE, sigmember WRITE, topconfig WRITE;"); stmt.executeUpdate("LOCK TABLES users WRITE, userprefs WRITE, sigmember WRITE, sideboxes WRITE;");
try try
{ // make sure the user name isn't there already { // make sure the user name isn't there already
ResultSet rs = stmt.executeQuery("SELECT uid FROM users WHERE username = '" + encode_username + "';"); ResultSet rs = stmt.executeQuery("SELECT uid FROM users WHERE username = '" + encode_username + "';");
@ -835,20 +942,18 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
logger.debug("...loaded default SIG memberships"); logger.debug("...loaded default SIG memberships");
// get the "top" configuration for this user // get the sidebox configuration for this user
rs = stmt.executeQuery("SELECT topconfig.row, topconfig.col, topconfig.partid, topconfig.param " rs = stmt.executeQuery("SELECT sideboxes.boxid, sideboxes.sequence, sideboxes.param FROM sideboxes, "
+ "FROM topconfig, users WHERE topconfig.uid = users.uid AND " + "users WHERE sideboxes.uid = users.uid AND users.is_anon = 1;");
+ "users.is_anon = 1;");
sql.setLength(0); sql.setLength(0);
while (rs.next()) while (rs.next())
{ // set up to insert into the topconfig table { // set up to insert into the sideboxes table
if (sql.length()==0) if (sql.length()==0)
sql.append("INSERT INTO topconfig (uid, row, col, partid, param) VALUES "); sql.append("INSERT INTO sideboxes (uid, boxid, sequence, param) VALUES ");
else else
sql.append(", "); sql.append(", ");
sql.append("(").append(new_uid).append(", ").append(rs.getInt(1)).append(", "); sql.append("(").append(new_uid).append(", ").append(rs.getInt(1)).append(", ");
sql.append(rs.getInt(2)).append(", ").append(SQLUtil.encodeStringArg(rs.getString(3))); sql.append(rs.getInt(2)).append(", ").append(SQLUtil.encodeStringArg(rs.getString(3))).append(')');
sql.append(", ").append(SQLUtil.encodeStringArg(rs.getString(4))).append(')');
} // end while } // end while
@ -860,7 +965,7 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
} // end if } // end if
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
logger.debug("...loaded default top view config"); logger.debug("...loaded default sidebox config");
} // end try } // end try
finally finally
@ -1255,6 +1360,12 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
} // end getMaxNumSIGMembersDisplay } // end getMaxNumSIGMembersDisplay
public List getMasterSideBoxList()
{
return new MasterSideBoxList(sideboxes);
} // end getMasterSideBoxList
/*-------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------
* Implementations from interface EngineBackend * Implementations from interface EngineBackend
*-------------------------------------------------------------------------------- *--------------------------------------------------------------------------------
@ -1663,4 +1774,10 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
} // end forceParamReload } // end forceParamReload
public SideBoxDescriptor getMasterSideBoxDescriptor(int id)
{
return (SideBoxDescriptor)(sidebox_ids.get(new Integer(id)));
} // end getMasterSideBoxDescriptor
} // end class VeniceEngineImpl } // end class VeniceEngineImpl

View File

@ -76,7 +76,7 @@ public class Top extends VeniceServlet
try try
{ // attempt to get the user content { // attempt to get the user content
return new TopContent(user); return new TopDisplay(getServletContext(),user);
} // end try } // end try
catch (DataException de) catch (DataException de)
@ -84,6 +84,11 @@ public class Top extends VeniceServlet
return new ErrorBox("Database Error","Error loading front page: " + de.getMessage(),null); return new ErrorBox("Database Error","Error loading front page: " + de.getMessage(),null);
} // end catch } // end catch
catch (AccessError ae)
{ // there was an access error, whoops!
return new ErrorBox("Access Error",ae.getMessage(),null);
} // end catch
} // end doVeniceGet } // end doVeniceGet

View File

@ -311,28 +311,6 @@ public abstract class VeniceServlet extends HttpServlet
} // end isImageButtonClicked } // end isImageButtonClicked
/*
protected static final VeniceEngine getVeniceEngine(ServletContext ctxt) throws ServletException
{
return Variables.getVeniceEngine(ctxt);
} // end getVeniceEngine
protected final VeniceEngine getVeniceEngine() throws ServletException
{
return Variables.getVeniceEngine(getServletContext());
} // end getVeniceEngine
*/
/*
protected final UserContext getUserContext(HttpServletRequest request) throws ServletException
{
return Variables.getUserContext(getServletContext(),request,request.getSession(true));
} // end getUserContext
*/
protected final void putUserContext(HttpServletRequest request, UserContext ctxt) protected final void putUserContext(HttpServletRequest request, UserContext ctxt)
{ {
Variables.putUserContext(request.getSession(true),ctxt); Variables.putUserContext(request.getSession(true),ctxt);
@ -387,15 +365,6 @@ public abstract class VeniceServlet extends HttpServlet
} // end clearMenu } // end clearMenu
/*
protected final RenderData createRenderData(HttpServletRequest request, HttpServletResponse response)
throws ServletException
{
return RenderConfig.createRenderData(getServletContext(),request,response);
} // end createRenderData
*/
protected final String getStandardCommandParam(ServletRequest request) protected final String getStandardCommandParam(ServletRequest request)
{ {
String foo = request.getParameter("cmd"); String foo = request.getParameter("cmd");

View File

@ -252,6 +252,12 @@ public class RenderData
} // end storeJSPRender } // end storeJSPRender
public void setRequestAttribute(String name, Object value)
{
request.setAttribute(name,value);
} // end setRequestAttribute
public void forwardDispatch(RequestDispatcher dispatcher) throws IOException, ServletException public void forwardDispatch(RequestDispatcher dispatcher) throws IOException, ServletException
{ {
dispatcher.forward(request,response); dispatcher.forward(request,response);

View File

@ -0,0 +1,80 @@
/*
* 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 java.util.*;
import com.silverwrist.venice.core.*;
public class SideBoxConferences implements ContentRender
{
/*--------------------------------------------------------------------------------
* Attributes
*--------------------------------------------------------------------------------
*/
private UserContext uc;
/*--------------------------------------------------------------------------------
* Constructor
*--------------------------------------------------------------------------------
*/
public SideBoxConferences(UserContext uc, String parameter)
{
this.uc = uc;
} // end constructor
/*--------------------------------------------------------------------------------
* Implementations from interface VeniceContent
*--------------------------------------------------------------------------------
*/
public String getPageTitle(RenderData rdat)
{
if (uc.isLoggedIn())
return "Your Conference Hotlist:";
else
return "Featured Conferences:";
} // end getPageTitle
/*--------------------------------------------------------------------------------
* Implementations from interface ContentRender
*--------------------------------------------------------------------------------
*/
public void renderHere(Writer out, RenderData rdat) throws IOException
{
/* BEGIN TEMP */
out.write("<FONT FACE=\"Arial, Helvetica\" SIZE=2><UL>\n");
out.write("<LI>BOFH (Benevolent Dictators)</LI>\n");
out.write("<LI>Playground (Electric Minds)</LI>\n");
out.write("<LI>Commons (Electric Minds)</LI>\n");
out.write("<LI>Top Ten Lists (Pamela's Lounge)</LI>\n");
out.write("</UL></FONT>\n");
/* END TEMP */
// write the link at the end
out.write("<P>" + rdat.getStdFontTag(null,1) + "<B>[ <A HREF=\"" + rdat.getEncodedServletPath("TODO")
+ "\">Manage</A> ]</B></FONT>");
} // end renderHere
} // end class SideBoxConferences

View File

@ -0,0 +1,103 @@
/*
* 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 java.util.*;
import com.silverwrist.util.StringUtil;
import com.silverwrist.venice.core.*;
public class SideBoxSIGs implements ContentRender
{
/*--------------------------------------------------------------------------------
* Attributes
*--------------------------------------------------------------------------------
*/
private UserContext uc;
private List sig_list;
/*--------------------------------------------------------------------------------
* Constructor
*--------------------------------------------------------------------------------
*/
public SideBoxSIGs(UserContext uc, String parameter) throws DataException
{
this.uc = uc;
this.sig_list = uc.getMemberSIGs();
} // end constructor
/*--------------------------------------------------------------------------------
* Implementations from interface VeniceContent
*--------------------------------------------------------------------------------
*/
public String getPageTitle(RenderData rdat)
{
if (uc.isLoggedIn())
return "Your SIGs:";
else
return "Featured SIGs:";
} // end getPageTitle
/*--------------------------------------------------------------------------------
* Implementations from interface ContentRender
*--------------------------------------------------------------------------------
*/
public void renderHere(Writer out, RenderData rdat) throws IOException
{
out.write(rdat.getStdFontTag(null,2) + "\n");
if (sig_list.size()>0)
{ // display the list of available SIGs
out.write("<TABLE ALIGN=CENTER BORDER=0 CELLPADDING=0 CELLSPACING=2>\n");
Iterator it = sig_list.iterator();
while (it.hasNext())
{ // display the names of the SIGs one by one
SIGContext sig = (SIGContext)(it.next());
out.write("<TR VALIGN=MIDDLE>\n<TD ALIGN=CENTER WIDTH=14><IMG SRC=\""
+ rdat.getFullImagePath("purple-ball.gif")
+ "\" ALT=\"*\" WIDTH=14 HEIGHT=14 BORDER=0></TD>\n");
out.write("<TD ALIGN=LEFT>\n" + rdat.getStdFontTag(null,2) + "<B><A HREF=\""
+ rdat.getEncodedServletPath("sig/" + sig.getAlias()) + "\">"
+ StringUtil.encodeHTML(sig.getName()) + "</A></B></FONT>\n");
if (sig.isAdmin())
out.write("&nbsp;<IMG SRC=\"" + rdat.getFullImagePath("tag_host.gif")
+ "\" ALT=\"Host!\" BORDER=0 WIDTH=40 HEIGHT=20>\n");
out.write("</TD>\n</TR>\n");
} // end while
out.write("</TABLE>\n");
} // end if
else
out.write(rdat.getStdFontTag(null,2) + "<EM>You are not a member of any SIGs.</EM></FONT>\n");
// write the two links at the end
out.write("<P>" + rdat.getStdFontTag(null,1) + "<B>[ <A HREF=\"" + rdat.getEncodedServletPath("TODO")
+ "\">Manage</A> | <A HREF=\"" + rdat.getEncodedServletPath("sigops?cmd=C")
+ "\">Create New</A> ]</B></FONT>");
} // end renderHere
} // end class SideBoxSIGs

View File

@ -1,67 +0,0 @@
/*
* 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 Community 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.Writer;
import java.io.IOException;
import com.silverwrist.venice.core.UserContext;
import com.silverwrist.venice.core.DataException;
public class TCPanelConferences extends TCStandardPanel
{
public TCPanelConferences()
{
super("Your Favorite Conferences:",null);
addButton("bn_manage.gif","Manage",null,true,80,24);
} // end constructor
public TCPanelConferences(TCPanelConferences other)
{
super(other);
} // end constructor
public void renderContent(Writer out, RenderData rdat) throws IOException
{
/* BEGIN TEMP */
out.write("<FONT FACE=\"Arial, Helvetica\" SIZE=2><UL>\n");
out.write("<LI>BOFH (Benevolent Dictators)</LI>\n");
out.write("<LI>Playground (Electric Minds)</LI>\n");
out.write("<LI>Commons (Electric Minds)</LI>\n");
out.write("<LI>Top Ten Lists (Pamela's Lounge)</LI>\n");
out.write("</UL></FONT>\n");
/* END TEMP */
} // end renderHere
public void configure(UserContext uc, String parameter) throws DataException
{ // TEMP - do nothing
super.configure(uc,parameter);
if (!(uc.isLoggedIn()))
setTitle("Featured Conferences:");
} // end configure
public Object clone()
{
return new TCPanelConferences(this);
} // end clone
} // end class TCPanelSIGs

View File

@ -1,92 +0,0 @@
/*
* 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 Community 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.Writer;
import java.io.IOException;
import java.util.List;
import java.util.Iterator;
import com.silverwrist.venice.core.SIGContext;
import com.silverwrist.venice.core.UserContext;
import com.silverwrist.venice.core.DataException;
public class TCPanelSIGs extends TCStandardPanel
{
private List my_sigs = null;
public TCPanelSIGs()
{
super("Your SIGs:",null);
addButton("bn_manage.gif","Manage",null,true,80,24);
addButton("bn_create_new.gif","Create New","sigops?cmd=C",true,80,24);
} // end constructor
protected TCPanelSIGs(TCPanelSIGs other)
{
super(other);
} // end constructor
public void renderContent(Writer out, RenderData rdat) throws IOException
{
out.write(rdat.getStdFontTag(null,2) + "\n");
if (my_sigs.size()>0)
{ // display the list of available SIGs
out.write("<UL>\n");
Iterator it = my_sigs.iterator();
while (it.hasNext())
{ // display the names of the SIGs one by one
SIGContext sig = (SIGContext)(it.next());
// TODO: make this fancier than just an unordered list
out.write("<LI><B><A HREF=\"" + rdat.getEncodedServletPath("sig/" + sig.getAlias())
+ "\">" + sig.getName() + "</A></B>");
if (sig.isAdmin())
out.write("&nbsp;<IMG SRC=\"" + rdat.getFullImagePath("tag_host.gif")
+ "\" ALT=\"Host!\" BORDER=0 WIDTH=40 HEIGHT=20>");
out.write("</LI>\n");
} // end while
out.write("</UL>\n");
} // end if
else
out.write("<EM>You are not a member of any SIGs.</EM>\n");
out.write("</FONT>\n");
} // end renderContent
public void configure(UserContext uc, String parameter) throws DataException
{
super.configure(uc,parameter);
if (!(uc.isLoggedIn()))
setTitle("Featured SIGs:");
my_sigs = uc.getMemberSIGs();
} // end configure
public Object clone()
{
return new TCPanelSIGs(this);
} // end clone
} // end class TCPanelSIGs

View File

@ -1,184 +0,0 @@
/*
* 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 Community 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.Writer;
import java.io.IOException;
import java.util.Enumeration;
import java.util.Vector;
import com.silverwrist.venice.core.UserContext;
import com.silverwrist.venice.core.DataException;
public abstract class TCStandardPanel extends TopContentPanel
{
class TCButton implements ComponentRender
{
private String image;
private String alt_text;
private String url;
private boolean login_only;
private int width;
private int height;
public TCButton(String image, String alt_text, String url, boolean login_only, int width, int height)
{
this.image = image;
this.alt_text = alt_text;
this.url = url;
this.login_only = login_only;
this.width = width;
this.height = height;
} // end constructor
public void renderHere(Writer out, RenderData rdat) throws IOException
{
if (url!=null)
out.write("<A HREF=\"" + rdat.getEncodedServletPath(url) + "\">");
out.write("<IMG SRC=\"" + rdat.getFullImagePath(image) + "\" ALT=\"" + alt_text);
out.write("\" BORDER=0 WIDTH=" + String.valueOf(width) + " HEIGHT=" + String.valueOf(height) + ">");
if (url!=null)
out.write("</A>");
} // end renderHere
public boolean isLoginOnly()
{
return login_only;
} // end isLoginOnly
} // end class TCButton
// Attributes
private String title;
private String subtitle;
private Vector buttons;
private String real_title;
private String real_subtitle;
private boolean logged_in;
protected TCStandardPanel(String title, String subtitle)
{
this.title = title;
this.subtitle = subtitle;
this.buttons = new Vector();
this.real_title = title;
this.real_subtitle = subtitle;
} // end constructor
protected TCStandardPanel(TCStandardPanel other)
{
super(other);
this.title = other.title;
this.subtitle = other.subtitle;
this.buttons = other.buttons;
this.real_title = other.title;
this.real_subtitle = other.subtitle;
} // end constructor
private boolean displayButtons()
{
if (buttons.size()==0)
return false;
else if (logged_in)
return true;
boolean login_only = true;
Enumeration enum = buttons.elements();
while (login_only && enum.hasMoreElements())
{ // attempt to determine if there are any non-"login only" buttons
TCButton bn = (TCButton)(enum.nextElement());
login_only = bn.isLoginOnly();
} // end while
return !login_only;
} // end displayButtons
protected void addButton(String image, String alt_text, String url, boolean login_only, int width,
int height)
{
buttons.addElement(new TCButton(image,alt_text,url,login_only,width,height));
} // end addButton
protected abstract void renderContent(Writer out, RenderData rdat) throws IOException;
public void renderHere(Writer out, RenderData rdat) throws IOException
{
rdat.writeContentHeader(out,real_title,real_subtitle);
if (displayButtons())
{ // want to print the buttons
out.write("<DIV ALIGN=\"LEFT\">\n");
Enumeration enum = buttons.elements();
boolean first_post = true;
while (enum.hasMoreElements())
{ // figure out whether to display this button
TCButton bn = (TCButton)(enum.nextElement());
boolean display_me = logged_in;
if (logged_in)
display_me = true;
else
display_me = !(bn.isLoginOnly());
if (display_me)
{ // display this button
if (first_post)
first_post = false;
else
out.write("&nbsp;&nbsp;");
bn.renderHere(out,rdat);
} // end if
} // end while
out.write("\n</DIV>\n");
} // end if
renderContent(out,rdat);
} // end renderHere
public void configure(UserContext uc, String parameter) throws DataException
{
logged_in = uc.isLoggedIn();
} // end configure
public void setTitle(String title)
{
this.real_title = title;
} // end setTitle
public void setSubtitle(String title)
{
this.real_subtitle = subtitle;
} // end setTitle
} // end class TCPanelSIGs

View File

@ -1,142 +0,0 @@
/*
* 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.Writer;
import java.io.IOException;
import java.util.*;
import com.silverwrist.venice.core.*;
public class TopContent implements ContentRender
{
/*--------------------------------------------------------------------------------
* Static data members
*--------------------------------------------------------------------------------
*/
public static final int MAX_COLS = 2;
/*--------------------------------------------------------------------------------
* Attributes
*--------------------------------------------------------------------------------
*/
private int actual_cols = MAX_COLS;
private int[] col_sizes;
private Vector panels = new Vector();
private boolean display_configure;
/*--------------------------------------------------------------------------------
* Constructor
*--------------------------------------------------------------------------------
*/
public TopContent(UserContext uc) throws DataException
{
int i; // loop counter
// get the current view configuration
FrontPageViewConfig vconfig = uc.getFrontPageViewConfig(MAX_COLS);
if (vconfig.getNumColumns()<MAX_COLS)
actual_cols = vconfig.getNumColumns();
// compute the column sizes in percentages
col_sizes = new int[actual_cols];
int base_amt = 100 / actual_cols;
int rem_amt = 100 % actual_cols;
for (i=0; i<actual_cols; i++)
{ // initialize the column sizes
col_sizes[i] = base_amt;
if (i<rem_amt)
col_sizes[i]++;
} // end for
// load the top content
TopContentPanel parray[];
for (i=0; i<vconfig.getNumRows(); i++)
{ // create array and load it with panels
parray = new TopContentPanel[actual_cols];
for (int j=0; j<actual_cols; j++)
{ // create and configure the parts in this row
parray[j] = TopContentPanel.create(vconfig.getPartID(i,j));
parray[j].configure(uc,vconfig.getParameter(i,j));
} // end for
panels.addElement(parray);
} // end for
display_configure = uc.isLoggedIn();
} // end constructor
/*--------------------------------------------------------------------------------
* Implementations from interface VeniceContent
*--------------------------------------------------------------------------------
*/
public String getPageTitle(RenderData rdat)
{
return "My Front Page";
} // end getPageTitle
/*--------------------------------------------------------------------------------
* Implementations from interface ContentRender
*--------------------------------------------------------------------------------
*/
public void renderHere(Writer out, RenderData rdat) throws IOException
{
out.write("<TABLE BORDER=0 ALIGN=CENTER WIDTH=\"100%\" CELLPADDING=4 CELLSPACING=0>\n");
Enumeration enum = panels.elements();
while (enum.hasMoreElements())
{ // output each row in turn
TopContentPanel[] rowarray = (TopContentPanel[])(enum.nextElement());
out.write("<TR VALIGN=TOP>\n");
for (int i=0; i<actual_cols; i++)
{ // write the table data header and then render the content
out.write("<TD ALIGN=LEFT WIDTH=\"" + String.valueOf(col_sizes[i]) + "%\">\n");
rowarray[i].renderHere(out,rdat);
out.write("</TD>\n");
} // end for
out.write("</TR>\n");
} // end while
out.write("</TABLE>\n");
if (display_configure)
{ // display the Configure button
out.write("<HR WIDTH=\"80%\"><DIV ALIGN=\"LEFT\">\n<A HREF=\"\"><IMG SRC=\"");
out.write(rdat.getFullImagePath("bn_configure.gif"));
out.write("\" ALT=\"Configure\" WIDTH=80 HEIGHT=24 BORDER=0></A>\n</DIV>\n");
} // end if
rdat.writeFooter(out);
} // end renderHere
} // end class TopContent

View File

@ -1,50 +0,0 @@
/*
* 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 Community 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.Writer;
import java.io.IOException;
import com.silverwrist.venice.core.UserContext;
import com.silverwrist.venice.core.DataException;
public abstract class TopContentPanel implements ComponentRender, Cloneable
{
protected TopContentPanel()
{ // do nothing
} // end constructor
protected TopContentPanel(TopContentPanel other)
{ // do nothing
} // end constructor
public abstract void renderHere(Writer out, RenderData rdat) throws IOException;
public abstract void configure(UserContext uc, String parameter) throws DataException;
public static TopContentPanel create(String partid)
{
if (partid.equals("SIGS"))
return new TCPanelSIGs();
if (partid.equals("CONF"))
return new TCPanelConferences();
return null;
} // end create
} // end class TopContentPanel

View File

@ -0,0 +1,245 @@
/*
* 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.Writer;
import java.io.IOException;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import com.silverwrist.util.StringUtil;
import com.silverwrist.venice.core.*;
public class TopDisplay implements ContentRender
{
/*--------------------------------------------------------------------------------
* Static data values
*--------------------------------------------------------------------------------
*/
private static final String ATTR_NAME = "com.silverwrist.venice.TopDisplay";
/*--------------------------------------------------------------------------------
* Attributes
*--------------------------------------------------------------------------------
*/
private ServletContext ctxt;
private UserContext uc;
private List descrs;
private VeniceContent[] sideboxes;
/*--------------------------------------------------------------------------------
* Constructor
*--------------------------------------------------------------------------------
*/
public TopDisplay(ServletContext ctxt, UserContext uc) throws DataException, AccessError, ErrorBox
{
// Stash some basic information.
this.ctxt = ctxt;
this.uc = uc;
this.descrs = uc.getSideBoxList();
// Create the arrays used to construct sideboxes.
Class[] ctor_argtypes = new Class[2];
ctor_argtypes[0] = UserContext.class;
ctor_argtypes[1] = String.class;
Object[] ctor_args = new Object[2];
ctor_args[0] = uc;
// Create the actual sideboxes.
sideboxes = new VeniceContent[descrs.size()];
for (int i=0; i<descrs.size(); i++)
{ // create each sidebox in turn...
SideBoxDescriptor d = (SideBoxDescriptor)(descrs.get(i));
String cn = "com.silverwrist.venice.servlets.format." + d.getClassname();
try
{ // get the class name and the constructor pointer
Class sb_class = Class.forName(cn);
if (!(VeniceContent.class.isAssignableFrom(sb_class)))
throw new ErrorBox(null,"Invalid sidebox class: " + cn,null);
java.lang.reflect.Constructor ctor = sb_class.getDeclaredConstructor(ctor_argtypes);
// create the side box!
ctor_args[1] = d.getParameter();
sideboxes[i] = (VeniceContent)(ctor.newInstance(ctor_args));
} // end try
catch (ClassNotFoundException cnfe)
{ // Class.forName didn't work? yIkes!
throw new ErrorBox(null,"Cannot find sidebox class: " + cn,null);
} // end catch
catch (NoSuchMethodException nsme)
{ // no constructor matching the prototype? yIkes!
throw new ErrorBox(null,"Cannot find sidebox class constructor: " + cn,null);
} // end catch
catch (SecurityException se)
{ // how'd we trip the security manager? oh well...
throw new ErrorBox(null,"Security violation on class: " + cn,null);
} // end catch
catch (InstantiationException ie)
{ // the target class is an abstract class - oh, that's not right!
throw new ErrorBox(null,"Invalid sidebox class: " + cn,null);
} // end catch
catch (IllegalAccessException iae1)
{ // the constructor isn't public - oh, that's not right!
throw new ErrorBox(null,"Invalid sidebox class: " + cn,null);
} // end catch
catch (IllegalArgumentException iae2)
{ // the arguments to the constructor are wrong - we should've caught this!
throw new ErrorBox(null,"Invalid constructor call: " + cn,null);
} // end catch
catch (java.lang.reflect.InvocationTargetException ite)
{ // the constructor itself threw an exception
Throwable sub_e = ite.getTargetException();
if (sub_e instanceof DataException)
throw (DataException)sub_e;
if (sub_e instanceof AccessError)
throw (AccessError)sub_e;
throw new ErrorBox(null,"Unknown exception creating: " + cn,null);
} // end catch
} // end for
} // end constructor
/*--------------------------------------------------------------------------------
* External static operations
*--------------------------------------------------------------------------------
*/
public static TopDisplay retrieve(ServletRequest request)
{
return (TopDisplay)(request.getAttribute(ATTR_NAME));
} // end retrieve
/*--------------------------------------------------------------------------------
* Implementations from interface VeniceContent
*--------------------------------------------------------------------------------
*/
public String getPageTitle(RenderData rdat)
{
return "My Front Page";
} // end getPageTitle
/*--------------------------------------------------------------------------------
* Implementations from interface ContentRender
*--------------------------------------------------------------------------------
*/
public void renderHere(Writer out, RenderData rdat) throws IOException
{
// Write out the start of the content structure.
out.write("<TABLE BORDER=0 ALIGN=CENTER WIDTH=\"100%\" CELLPADDING=4 CELLSPACING=0><TR VALIGN=TOP>\n");
out.write("<TD ALIGN=LEFT>\n");
// The top content is a JSP page, so include it here.
rdat.setRequestAttribute(ATTR_NAME,this);
RequestDispatcher dispatcher = ctxt.getRequestDispatcher(rdat.getFormatJSPPath("top_content.jsp"));
out.flush();
rdat.flushOutput(); // make sure the stuff to be output first is output
try
{ // include me!
rdat.includeDispatch(dispatcher);
} // end try
catch (ServletException se)
{ // since we can't throw ServletException, we throw IOException
throw new IOException("Failure including top_content.jsp");
} // end catch
rdat.flushOutput(); // now make sure the included page is properly flushed
out.write("</TD>\n<TD ALIGN=CENTER WIDTH=210>\n"); // break to the sidebox column
for (int i=0; i<sideboxes.length; i++)
{ // draw in the outer framework of the sidebox
out.write("<TABLE ALIGN=CENTER WIDTH=200 BORDER=0 CELLPADDING=2 CELLSPACING=0>"
+ "<TR VALIGN=MIDDLE BGCOLOR=\"#6666CC\"><TD ALIGN=LEFT>\n");
out.write(rdat.getStdFontTag("white",3) + "<B>" + StringUtil.encodeHTML(sideboxes[i].getPageTitle(rdat))
+ "</B></FONT>\n");
out.write("</TD></TR><TR VALIGN=TOP BGCOLOR=\"#9999FF\"><TD ALIGN=LEFT>\n");
// Fill in the sidebox by calling down to the base.
if (sideboxes[i] instanceof ContentRender)
{ // we have a direct-rendering component here - do it
ContentRender cr = (ContentRender)(sideboxes[i]);
cr.renderHere(out,rdat);
} // end if
else if (sideboxes[i] instanceof JSPRender)
{ // we have a JSP rendering component here - bounce to the appropriate JSP file
JSPRender jr = (JSPRender)(sideboxes[i]);
rdat.storeJSPRender(jr);
dispatcher = ctxt.getRequestDispatcher(rdat.getFormatJSPPath(jr.getTargetJSPName()));
out.flush();
rdat.flushOutput(); // make sure the stuff to be output first is output
try
{ // include me!
rdat.includeDispatch(dispatcher);
} // end try
catch (ServletException se)
{ // since we can't throw ServletException, we throw IOException
out.write(rdat.getStdFontTag(null,2) + "<EM>failure rendering class "
+ sideboxes[i].getClass().getName() + ": " + StringUtil.encodeHTML(se.getMessage())
+ "</EM></FONT>\n");
out.flush();
} // end catch
rdat.flushOutput(); // now make sure the included page is properly flushed
} // end else if
else // this is bogus - just display a little error here
out.write(rdat.getStdFontTag(null,2) + "<EM>cannot display sidebox of class: "
+ sideboxes[i].getClass().getName() + "</EM></FONT>\n");
// close up the framework of this sidebox
out.write("</TD></TR></TABLE><P>\n");
} // end for
if (uc.isLoggedIn())
{ // write the Configure button below the sideboxes
out.write("<A HREF=\"" + rdat.getEncodedServletPath("TODO") + "\"><IMG SRC=\""
+ rdat.getFullImagePath("bn_configure.gif")
+ "\" ALT=\"Configure\" WIDTH=80 HEIGHT=24 BORDER=0></A>\n");
} // end if
// Finish up.
out.write("</TD>\n</TR></TABLE>");
rdat.writeFooter(out);
} // end renderHere
} // end class TopDisplay

View File

@ -0,0 +1,30 @@
<%--
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.*" %>
<%
TopDisplay data = TopDisplay.retrieve(request);
Variables.failIfNull(data);
RenderData rdat = RenderConfig.createRenderData(application,request,response);
%>
<% if (rdat.useHTMLComments()) { %><!-- Top content panel --><% } %>
<% rdat.writeContentHeader(out,"Venice Currents",null); %>
TODO: Something profound goes here. :-)