Reworked the sidebox implementation to depend less on the database and more

on XML config files...the implementation should now be much more customizable
and less klunky.  Added a provision for implementing "generic" (JSP-driven)
sideboxes.  Implemented the sidebox configure button on the front page
(finally!).  Implemented a random password generator class which will be used
in a future implementation of reminder-driven automatic forgotten-password
changing.  Fixed some minor funnies in SIG menu generation.
This commit is contained in:
Eric J. Bowersox 2001-11-04 05:57:58 +00:00
parent bf040973ba
commit 1c69955046
32 changed files with 2049 additions and 495 deletions

View File

@ -89,6 +89,9 @@
<site-logo width="140" height="80"
href="http://venice.sourceforge.net">/venice/images/powered-by-venice.gif</site-logo>
<!-- The location of the sidebox configuration file, relative to the application root. -->
<sidebox-config>WEB-INF/sidebox-config.xml</sidebox-config>
</paths>
<!-- Contains standard messages displayed by front end -->

57
etc/sidebox-config.xml Normal file
View File

@ -0,0 +1,57 @@
<?xml version="1.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):
-->
<!-- Configuration file for sideboxes, referenced by both venice-config.xml and render-config.xml -->
<sidebox-config>
<sidebox id="1">
<title>Your SIGs</title>
<anon-title>Featured SIGs</anon-title>
<factory-class>com.silverwrist.venice.servlets.format.sideboxes.SIGBox</factory-class>
<null-msg>You are not a member of any SIGs.</null-msg>
<manage-link>Manage</manage-link>
<create-new-link>Create New</create-new-link>
<bullet width="14" height="14" fixup="true">purple-ball.gif</bullet>
<host-image width="40" height="20" alt="Host!" fixup="true">tag_host.gif</host-image>
</sidebox>
<sidebox id="2">
<title>Your Conference Hotlist</title>
<anon-title>Featured Conferences</anon-title>
<factory-class>com.silverwrist.venice.servlets.format.sideboxes.ConferenceBox</factory-class>
<null-msg>You have no conferences in your hotlist.</null-msg>
<manage-link>Manage</manage-link>
<bullet width="14" height="14" fixup="true">purple-ball.gif</bullet>
<new-image width="40" height="20" alt="New!" fixup="true">tag_new.gif</new-image>
</sidebox>
<!-- test sidebox only, do not use -->
<!--
<sidebox id="-1">
<title>Test Sidebox</title>
<factory-class>com.silverwrist.venice.servlets.format.sideboxes.JSPSideBoxFactory</factory-class>
<format-jsp>test/test_sidebox.jsp</format-jsp>
<strings>
<test1>This is a test.</test1>
<test2>This is only a test.</test2>
<test3>If this had been an actual emergency, we would all be dead by now.</test3>
</strings>
</sidebox>
-->
</sidebox-config>

View File

@ -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
@ -23,6 +23,9 @@
<engine>
<!-- The fully-qualified Java classname of the Venice engine class. -->
<classname>com.silverwrist.venice.core.impl.VeniceEngineImpl</classname>
<!-- The pathname of the sidebox config file, relative to the Web application root directory. -->
<sidebox-config>WEB-INF/sidebox-config.xml</sidebox-config>
</engine>
<!-- This section is used to configure the database pool system. -->
@ -94,7 +97,7 @@ Venice - community services, conferencing and more. <http://venice.sourceforge.
</signature>
<!-- This is the message sent out with the email confirmation number. -->
<!-- Parameters: $USERNAME - account user name, $CONFNUM - confirmation number -->
<!-- Parameters: username - account user name, confnum - confirmation number -->
<email-confirm>
<![CDATA[
Welcome to the Venice conferencing system! In order to fully activate your
@ -102,7 +105,7 @@ account after you register or change your E-mail address, you must provide a
confirmation number to the system. Please enter this number into the "Confirm
E-mail Address" dialog on the system when indicated.
Your confirmation number for your account "$USERNAME" is $CONFNUM.
Your confirmation number for your account "${username}" is ${confnum}.
Thank you, and enjoy the Venice conferencing system!
@ -110,13 +113,16 @@ Thank you, and enjoy the Venice conferencing system!
]]>
</email-confirm>
<!-- The subject of the message with the email confirmation number. -->
<email-confirm-subject>Venice Email Confirmation</email-confirm-subject>
<!-- This is the "password reminder" message. -->
<!-- Parameters: $USERNAME - account user name, $REMINDER - password reminder -->
<!-- Parameters: username - account user name, reminder - password reminder -->
<reminder>
<![CDATA[
Here is the password reminder for your account "$USERNAME" as you requested:
Here is the password reminder for your account "${username}" as you requested:
$REMINDER
${reminder}
If this reminder is not sufficient for you to remember what your password is,
please contact the server administrator for further assistance.
@ -125,50 +131,53 @@ please contact the server administrator for further assistance.
]]>
</reminder>
<reminder-subject>Venice Password Reminder Message</reminder-subject>
<!-- Invitation message to a public SIG -->
<!-- Parameters: $SIGNAME = name of SIG, $SIGALIAS = alias of SIG, $PERSONAL = personal message,
$FULLNAME = name of inviter, $USERNAME = user name of inviter -->
<!-- Parameters: signame = name of SIG, sigalias = alias of SIG, personal = personal message,
fullname = name of inviter, username = user name of inviter -->
<invite-public>
<![CDATA[
Hi! I would like to invite you to join the "$SIGNAME" Special Interest Group (SIG) on the Venice
Hi! I would like to invite you to join the "${signame}" Special Interest Group (SIG) on the Venice
conferencing system. To do so, you must register as a user, which is absolutely free! Just point
your Web browser at <http://delenn:8080/venice/sig/$SIGALIAS> and click the "Create Account" link
your Web browser at <http://delenn:8080/venice/sig/${sigalias}> and click the "Create Account" link
at the top of the page, or click the "Log In" link if you already have a Venice account. Once you have
completed the process, click the "Join Now" button. You will then be able to take part in the conferences
that are going on in the SIG.
$PERSONAL
${personal}
Hope to see you in "$SIGNAME" soon!
Hope to see you in "${signame}" soon!
-- $FULLNAME (Venice user ID: $USERNAME)
-- ${fullname} (Venice user ID: ${username})
]]>
</invite-public>
<!-- Invitation message to a private SIG -->
<!-- Parameters: $SIGNAME = name of SIG, $SIGALIAS = alias of SIG, $JOINKEY = join key for SIG,
$PERSONAL = personal message, $FULLNAME = name of inviter,
$USERNAME = user name of inviter -->
<!-- Parameters: signame = name of SIG, sigalias = alias of SIG, joinkey = join key for SIG,
personal = personal message, fullname = name of inviter,
username = user name of inviter -->
<invite-private>
<![CDATA[
Hi! I would like to invite you to join the "$SIGNAME" Special Interest Group (SIG) on the Venice
Hi! I would like to invite you to join the "${signame}" Special Interest Group (SIG) on the Venice
conferencing system. To do so, you must register as a user, which is absolutely free! Just point
your Web browser at <http://delenn:8080/venice/sig/$SIGALIAS> and click the "Create Account" link
your Web browser at <http://delenn:8080/venice/sig/${sigalias}> and click the "Create Account" link
at the top of the page, or click the "Log In" link if you already have a Venice account. Once you have
completed the process, click the "Join Now" button. You will be prompted for the "password" for this
SIG, which is "$JOINKEY". You will then be able to take part in the conferences that are going on in the SIG.
SIG, which is "${joinkey}". You will then be able to take part in the conferences that are going on in the
SIG.
$PERSONAL
${personal}
Hope to see you in "$SIGNAME" soon!
Hope to see you in "${signame}" soon!
-- $FULLNAME (Venice user ID: $USERNAME)
-- ${fullname} (Venice user ID: ${username})
]]>
</invite-private>
<!-- Subject line for invitation messages -->
<!-- Parameters: $SIGNAME = name of SIG -->
<subj-invite>Invitation to "$SIGNAME" SIG</subj-invite>
<!-- Parameters: signame = name of SIG -->
<subj-invite>Invitation to "${signame}" SIG</subj-invite>
</messages>

View File

@ -103,14 +103,6 @@ CREATE TABLE sideboxes (
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.
CREATE TABLE contacts (
contactid INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
@ -489,12 +481,6 @@ INSERT INTO refaudit (type, descr) VALUES
(315, 'Delete Conference'),
(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
# <http://www.din.de/gremien/nas/nabd/iso3166ma/>.
INSERT INTO refcountry (code, name) VALUES

View File

@ -124,6 +124,12 @@ public class DOMElementHelper
} // end hasChildElement
public boolean hasAttribute(String name)
{
return !(StringUtil.isStringEmpty(elt.getAttribute(name)));
} // end hasAttribute
public Integer getAttributeInt(String name)
{
String tmp = elt.getAttribute(name);

View File

@ -23,12 +23,8 @@ public interface SideBoxDescriptor
public abstract int getSequence();
public abstract String getParameter();
public abstract String getTitle(boolean anonymous);
public abstract String getDescription();
public abstract String getParamDescription();
public abstract String getClassname();
public abstract String getFactoryClassName();
} // end interface SideBoxDescriptor

View File

@ -48,7 +48,48 @@ public class Startup
*--------------------------------------------------------------------------------
*/
private static Document loadConfiguration(String configname) throws ConfigException
private static String getEngineClassName(Document config) throws ConfigException
{
// Make sure the configuration is valid...
Element root = config.getDocumentElement();
if (!(root.getTagName().equals("venice-config")))
{ // not the correct root tag name
logger.fatal("config document is not a <venice-config/> document (root tag: <"
+ root.getTagName() + "/>)");
throw new ConfigException("document is not a <venice-config/> document",root);
} // end if
// Get the <engine/> section.
DOMElementHelper root_h = new DOMElementHelper(root);
Element engine_sect = root_h.getSubElement("engine");
if (engine_sect==null)
{ // no <engine/> section - bail out now!
logger.fatal("config document has no <engine/> section");
throw new ConfigException("no <engine/> section found in config file",root);
} // end if
// Get the classname out of that section.
DOMElementHelper engine_sect_h = new DOMElementHelper(engine_sect);
String rc = engine_sect_h.getSubElementText("classname");
if (rc==null)
{ // no <classname/> specified - bail out now!
logger.fatal("config document <engine/> section has no <classname/>");
throw new ConfigException("no <classname/> found in <engine/> section",engine_sect);
} // end if
return rc;
} // end getEngineClassName
/*--------------------------------------------------------------------------------
* External static methods (global functions)
*--------------------------------------------------------------------------------
*/
public static Document loadConfiguration(String configname) throws ConfigException
{
try
{ // create a simple DOM parser by using the Java XML parsing API
@ -105,48 +146,8 @@ public class Startup
} // end loadConfiguration
private static String getEngineClassName(Document config) throws ConfigException
{
// Make sure the configuration is valid...
Element root = config.getDocumentElement();
if (!(root.getTagName().equals("venice-config")))
{ // not the correct root tag name
logger.fatal("config document is not a <venice-config/> document (root tag: <"
+ root.getTagName() + "/>)");
throw new ConfigException("document is not a <venice-config/> document",root);
} // end if
// Get the <engine/> section.
DOMElementHelper root_h = new DOMElementHelper(root);
Element engine_sect = root_h.getSubElement("engine");
if (engine_sect==null)
{ // no <engine/> section - bail out now!
logger.fatal("config document has no <engine/> section");
throw new ConfigException("no <engine/> section found in config file",root);
} // end if
// Get the classname out of that section.
DOMElementHelper engine_sect_h = new DOMElementHelper(engine_sect);
String rc = engine_sect_h.getSubElementText("classname");
if (rc==null)
{ // no <classname/> specified - bail out now!
logger.fatal("config document <engine/> section has no <classname/>");
throw new ConfigException("no <classname/> found in <engine/> section",engine_sect);
} // end if
return rc;
} // end getEngineClassName
/*--------------------------------------------------------------------------------
* External static methods (global functions)
*--------------------------------------------------------------------------------
*/
public static VeniceEngine createEngine(String configname) throws ConfigException, DataException
public static VeniceEngine createEngine(String configname, String app_root)
throws ConfigException, DataException
{
// load the configuration data
Document config = loadConfiguration(configname);
@ -168,7 +169,7 @@ public class Startup
logger.debug("VeniceEngine created successfully");
// initialize the engine
engine.initialize(config);
engine.initialize(config,app_root);
// and return it
return engine;

View File

@ -89,6 +89,8 @@ public interface UserContext extends SearchMode
public abstract List getSideBoxList() throws DataException;
public abstract void addSideBox(int id) throws DataException;
public abstract List getConferenceHotlist() throws DataException;
public abstract boolean hasAdminAccess();

View File

@ -0,0 +1,26 @@
/*
* 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;
public interface UserSideBoxDescriptor extends SideBoxDescriptor
{
public abstract void setSequence(int seq) throws DataException;
public abstract void remove() throws DataException;
} // end interface UserSideBoxDescriptor

View File

@ -25,7 +25,7 @@ import com.silverwrist.venice.htmlcheck.HTMLChecker;
public interface VeniceEngine extends SearchMode
{
public abstract void initialize(Document config) throws ConfigException, DataException;
public abstract void initialize(Document config, String app_root) throws ConfigException, DataException;
public abstract int getNumFeatures();

View File

@ -1237,24 +1237,32 @@ class SIGUserContextImpl implements SIGContext, SIGBackend
SIGData my_sig = getSIGData();
my_sig.testMembership(level,is_member);
// Prepare the message text to be sent to the user.
boolean is_pub = my_sig.isPublicSIG();
String msg = engine.getStockMessage(is_pub ? "invite-public" : "invite-private");
String signame = my_sig.getName();
msg = StringUtil.replaceAllInstances(msg,"$SIGNAME",signame);
msg = StringUtil.replaceAllInstances(msg,"$SIGALIAS",my_sig.getAlias());
if (!is_pub)
msg = StringUtil.replaceAllInstances(msg,"$JOINKEY",my_sig.getJoinKey());
msg = StringUtil.replaceAllInstances(msg,"$PERSONAL",personal_message);
msg = StringUtil.replaceAllInstances(msg,"$FULLNAME",user.realFullName());
String uname = user.realUserName();
msg = StringUtil.replaceAllInstances(msg,"$USERNAME",uname);
StringBuffer msg_buf = new StringBuffer(msg);
msg_buf.append("\n\n--\n").append(engine.getStockMessage("signature"));
// Prepare the subject line to be sent to the user.
String subject = engine.getStockMessage("subj-invite");
subject = StringUtil.replaceAllInstances(subject,"$SIGNAME",signame);
HashMap vars = new HashMap(5);
vars.put("signame",my_sig.getName());
subject = StringUtil.replaceAllVariables(subject,vars);
// Prepare the message text to be sent to the user.
String msg;
if (my_sig.isPublicSIG())
msg = engine.getStockMessage("invite-public");
else
{ // get the private invite message and set the join key variable
msg = engine.getStockMessage("invite-private");
vars.put("joinkey",my_sig.getJoinKey());
} // end else
// Set the remaining variables and replace them.
vars.put("sigalias",my_sig.getAlias());
vars.put("personal",personal_message);
vars.put("fullname",user.realFullName());
String uname = user.realUserName();
vars.put("username",uname);
msg = StringUtil.replaceAllVariables(msg,vars);
StringBuffer msg_buf = new StringBuffer(msg);
msg_buf.append("\n\n--\n").append(engine.getStockMessage("signature"));
// Get a SimpleEmailer object, set it up, and send it.
SimpleEmailer em = engine.createEmailer();

View File

@ -17,29 +17,41 @@
*/
package com.silverwrist.venice.core.impl;
import com.silverwrist.venice.core.SideBoxDescriptor;
import java.sql.*;
import org.apache.log4j.*;
import com.silverwrist.venice.core.*;
import com.silverwrist.venice.db.*;
class SideBoxDescriptorImpl implements SideBoxDescriptor
class SideBoxDescriptorImpl implements UserSideBoxDescriptor
{
/*--------------------------------------------------------------------------------
* Static data members
*--------------------------------------------------------------------------------
*/
private static Category logger = Category.getInstance(SideBoxDescriptorImpl.class);
/*--------------------------------------------------------------------------------
* Attributes
*--------------------------------------------------------------------------------
*/
private SideBoxDescriptor parent;
private int sequence;
private String param;
private int uid; // the user ID
private SideBoxDescriptor parent; // the master side box descriptor
private DataPool datapool; // the data pool used by this object
private int sequence; // the sequence number
/*--------------------------------------------------------------------------------
* Constructor
*--------------------------------------------------------------------------------
*/
SideBoxDescriptorImpl(SideBoxDescriptor parent, int sequence, String param)
SideBoxDescriptorImpl(int uid, SideBoxDescriptor parent, DataPool datapool, int sequence)
{
this.uid = uid;
this.parent = parent;
this.datapool = datapool;
this.sequence = sequence;
this.param = param;
} // end constructor
@ -60,28 +72,85 @@ class SideBoxDescriptorImpl implements SideBoxDescriptor
} // end getSequence
public String getParameter()
public String getTitle(boolean anonymous)
{
return param;
return parent.getTitle(anonymous);
} // end getParameter
} // end getTitle
public String getDescription()
public String getFactoryClassName()
{
return parent.getDescription();
return parent.getFactoryClassName();
} // end getDescription
} // end getFactoryClassName
public String getParamDescription()
/*--------------------------------------------------------------------------------
* Implementations from interface UserSideBoxDescriptor
*--------------------------------------------------------------------------------
*/
public void setSequence(int seq) throws DataException
{
return parent.getParamDescription();
Connection conn = null;
} // end getParamDescription
try
{ // retrieve a connection from the datapool
conn = datapool.getConnection();
Statement stmt = conn.createStatement();
public String getClassname()
// create the UPDATE statement and just execute it blind (if this sidebox is not in the list,
// the UPDATE is a no-op).
StringBuffer sql = new StringBuffer("UPDATE sideboxes SET sequence = ");
sql.append(seq).append(" WHERE uid = ").append(uid).append(" AND boxid = ").append(parent.getID());
sql.append(';');
stmt.executeUpdate(sql.toString());
this.sequence = seq;
} // end try
catch (SQLException e)
{ // this becomes a DataException
logger.error("DB error setting sidebox sequence: " + e.getMessage(),e);
throw new DataException("error setting sidebox sequence: " + e.getMessage(),e);
} // end catch
finally
{ // make sure we release the connection before we go
if (conn!=null)
datapool.releaseConnection(conn);
} // end finally
} // end setSequence
public void remove() throws DataException
{
return parent.getClassname();
Connection conn = null;
} // end getClassname
try
{ // retrieve a connection from the datapool
conn = datapool.getConnection();
Statement stmt = conn.createStatement();
// create the DELETE statement and just execute it blind (if this conference is not in the hotlist,
// the DELETE is a no-op).
StringBuffer sql = new StringBuffer("DELETE FROM sideboxes WHERE uid = ");
sql.append(uid).append(" AND boxid = ").append(parent.getID()).append(';');
stmt.executeUpdate(sql.toString());
} // end try
catch (SQLException e)
{ // this becomes a DataException
logger.error("DB error removing from sidebox list: " + e.getMessage(),e);
throw new DataException("error removing from sidebox list: " + e.getMessage(),e);
} // end catch
finally
{ // make sure we release the connection before we go
if (conn!=null)
datapool.releaseConnection(conn);
} // end finally
} // end remove
} // end class SideBoxDescriptorImpl

View File

@ -202,13 +202,20 @@ class UserContextImpl implements UserContext, UserBackend
} // end if
message = StringUtil.replaceAllInstances(message,"$USERNAME",username);
message = StringUtil.replaceAllInstances(message,"$CONFNUM",String.valueOf(confirm_num));
// Replace the variables in the text.
HashMap vars = new HashMap(2);
vars.put("username",username);
vars.put("confnum",String.valueOf(confirm_num));
message = StringUtil.replaceAllVariables(message,vars);
String subject = engine.getStockMessage("email-confirm-subject");
if (subject==null)
subject = "Venice Email Confirmation";
// Create the emailer and send the message.
SimpleEmailer emailer = engine.createEmailer();
emailer.setTo(my_email);
emailer.setSubject("Venice Email Confirmation");
emailer.setSubject(subject);
emailer.setText(message);
emailer.send();
if (logger.isDebugEnabled())
@ -974,12 +981,12 @@ class UserContextImpl implements UserContext, UserBackend
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
ResultSet rs = stmt.executeQuery("SELECT boxid, sequence 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));
SideBoxDescriptor sbd = new SideBoxDescriptorImpl(uid,engine.getMasterSideBoxDescriptor(rs.getInt(1)),
datapool,rs.getInt(2));
rc.add(sbd);
} // end while
@ -1002,6 +1009,65 @@ class UserContextImpl implements UserContext, UserBackend
} // end getSideBoxList
public void addSideBox(int id) throws DataException
{
if (engine.getMasterSideBoxDescriptor(id)==null)
throw new DataException("invalid sidebox ID: " + id);
Connection conn = null;
try
{ // retrieve a connection from the datapool
conn = datapool.getConnection();
Statement stmt = conn.createStatement();
stmt.executeUpdate("LOCK TABLES sideboxes WRITE;");
try
{ // do a quickie query to see if we're already in the sidebox list
StringBuffer sql = new StringBuffer("SELECT sequence FROM sideboxes WHERE uid = ");
sql.append(uid).append(" AND boxid = ").append(id).append(';');
ResultSet rs = stmt.executeQuery(sql.toString());
if (rs.next())
return; // already in sidebox list - this is a no-op
// find a sequence number for the new entry
sql.setLength(0);
sql.append("SELECT MAX(sequence) FROM sideboxes WHERE uid = ").append(uid).append(';');
rs = stmt.executeQuery(sql.toString());
if (!(rs.next()))
throw new InternalStateError("bogus query result on addSideBox");
int new_sequence = rs.getInt(1) + 100;
// add the new record
sql.setLength(0);
sql.append("INSERT INTO sideboxes (uid, sequence, boxid) VALUES (").append(uid).append(", ");
sql.append(new_sequence).append(", ").append(id).append(");");
stmt.executeUpdate(sql.toString());
} // end try
finally
{ // make sure the table is unlocked before we go
Statement ulk_stmt = conn.createStatement();
ulk_stmt.executeUpdate("UNLOCK TABLES;");
} // end finally
} // end try
catch (SQLException e)
{ // this becomes a DataException
logger.error("DB error adding to sidebox list: " + e.getMessage(),e);
throw new DataException("error adding to sidebox list: " + e.getMessage(),e);
} // end catch
finally
{ // make sure we release the connection before we go
if (conn!=null)
datapool.releaseConnection(conn);
} // end finally
} // end addSideBox
public List getConferenceHotlist() throws DataException
{
return ConferenceUserContextImpl.getUserHotlist(engine,this,datapool);

View File

@ -200,16 +200,58 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
class MasterSideBox implements SideBoxDescriptor
{
private int id;
private String description;
private String param_descr;
private String title;
private String anon_title;
private String classname;
MasterSideBox(ResultSet rs) throws SQLException
MasterSideBox(Element section) throws ConfigException
{
this.id = rs.getInt("boxid");
this.description = rs.getString("description");
this.param_descr = rs.getString("param_descr");
this.classname = rs.getString("classname");
try
{ // get the ID value for this sidebox
String tmp = section.getAttribute("id");
if (StringUtil.isStringEmpty(tmp))
{ // there's no
logger.fatal("<sidebox/> specified with no ID!");
throw new ConfigException("no ID specified in <sidebox/>",section);
} // end if
id = Integer.parseInt(tmp);
} // end try
catch (NumberFormatException e)
{ // sidebox ID not numeric
logger.fatal("<sidebox/> ID not numeric!");
throw new ConfigException("non-numeric ID specified in <sidebox/>",section);
} // end catch
DOMElementHelper section_h = new DOMElementHelper(section);
title = section_h.getSubElementText("title");
anon_title = section_h.getSubElementText("anon-title");
classname = section_h.getSubElementText("factory-class");
if (StringUtil.isStringEmpty(title) || StringUtil.isStringEmpty(classname))
{ // the configuration is not complete
logger.fatal("<sidebox/> config incomplete (missing <title/> or <factory-class/>)!");
throw new ConfigException("configuration of <sidebox/> is not complete!",section);
} // end if
try
{ // try to resolve the classname here so we can be sure it's cool
Class.forName(classname);
} // end try
catch (ClassNotFoundException e)
{ // the class can't be resolved - we are h0sed
logger.fatal("<sidebox/> config <factory-class/> not valid!");
throw new ConfigException("<factory-class/> in <sidebox/> is not a valid class!",section);
} // end catch
if (StringUtil.isStringEmpty(anon_title))
anon_title = title; // just set as the same in the event of difficulty
} // end constructor
@ -225,25 +267,13 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
} // end getSequence
public String getParameter()
public String getTitle(boolean anonymous)
{
return null;
return (anonymous ? anon_title : title);
} // end getParameter
} // end getTitle
public String getDescription()
{
return description;
} // end getDescription
public String getParamDescription()
{
return param_descr;
} // end getParamDescription
public String getClassname()
public String getFactoryClassName()
{
return classname;
@ -471,12 +501,13 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
* Loads the Venice engine configuration from the named XML file and creates appropriate subobjects,
* such as the data pool.
*
* @param config The XML document conating the configuration information for the engine.
* @param config The XML document containing the configuration information for the engine.
* @param app_root The root directory of the Web application, which ends with a "/".
* @exception com.silverwrist.venice.core.ConfigException An error occurred during engine configuration;
* the engine could not be initialized.
* @exception com.silverwrist.venice.core.DataException The Venice engine data could not be loaded.
*/
public void initialize(Document config) throws ConfigException, DataException
public void initialize(Document config, String app_root) throws ConfigException, DataException
{
int i; // loop counter
@ -501,8 +532,56 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
} // end if
// Get the <database/> section.
DOMElementHelper root_h = new DOMElementHelper(root);
// Get the <engine/> section.
Element engine_sect = root_h.getSubElement("engine");
if (engine_sect==null)
{ // unable to find the engine section
logger.fatal("config document has no <engine/> section");
throw new ConfigException("no <engine/> section found in config file",root);
} // end if
DOMElementHelper engine_h = new DOMElementHelper(engine_sect);
// Get the name of the sidebox config file.
String sidebox_config = engine_h.getSubElementText("sidebox-config");
if (sidebox_config==null)
{ // unable to find the sidebox config file
logger.fatal("<engine/> section has no <sidebox-config/> element");
throw new ConfigException("no <sidebox-config/> element found in <engine/> section",engine_sect);
} // end if
if (!(sidebox_config.startsWith("/")))
sidebox_config = app_root + sidebox_config;
Document sidebox_cfg_file = Startup.loadConfiguration(sidebox_config);
Element sb_root = sidebox_cfg_file.getDocumentElement();
if (!(sb_root.getTagName().equals("sidebox-config")))
{ // the sidebox configuration file isn't the right type
logger.fatal("config document is not a <sidebox-config/> document (root tag: <"
+ sb_root.getTagName() + "/>)");
throw new ConfigException("document is not a <sidebox-config/> document",sb_root);
} // end if
NodeList sb_nodes = sb_root.getChildNodes();
ArrayList sidebox_tmp = new ArrayList();
for (i=0; i<sb_nodes.getLength(); i++)
{ // extract each sidebox section from the list and build a new master sidebox object
Node s = sb_nodes.item(i);
if ((s.getNodeType()==Node.ELEMENT_NODE) && (s.getNodeName().equals("sidebox")))
sidebox_tmp.add(new MasterSideBox((Element)s));
} // end for
// store the real master sidebox table as an array
sideboxes = (MasterSideBox[])(sidebox_tmp.toArray(new MasterSideBox[0]));
if (logger.isDebugEnabled())
logger.debug(sideboxes.length + " sidebox definitions loaded from database");
// Get the <database/> section.
Element db_sect = root_h.getSubElement("database");
if (db_sect==null)
{ // unable to find the database section
@ -642,6 +721,9 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
} // end catch
for (i=0; i<sideboxes.length; i++) // insert sideboxes into hashtable
sidebox_ids.put(new Integer(sideboxes[i].getID()),sideboxes[i]);
// Allocate the global parameter arrays.
gp_ints = new int[IPC_NUM_PARAMS];
@ -671,17 +753,6 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
if (logger.isDebugEnabled())
logger.debug(max_value + " features loaded from database");
// load the master sidebox table
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 = (MasterSideBox[])(sidebox_tmp.toArray(new MasterSideBox[0]));
if (logger.isDebugEnabled())
logger.debug(sideboxes.length + " sidebox definitions loaded from database");
// load the global defaults
loadDefaults(stmt);
@ -702,9 +773,6 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
for (i=0; i<features.length; i++) // insert feature symbols into hashtable
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.
// Start by creating some of the subsidiary objects that get added to HTML Checker configs.
EmailRewriter email_rewriter = new EmailRewriter();
@ -982,13 +1050,21 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
} // end if
message = StringUtil.replaceAllInstances(message,"$USERNAME",username);
message = StringUtil.replaceAllInstances(message,"$REMINDER",rs.getString(2));
// Replace the message variables.
HashMap vars = new HashMap(2);
vars.put("username",username);
vars.put("reminder",rs.getString(2));
message = StringUtil.replaceAllVariables(message,vars);
// Find the message subject.
String subject = getStockMessage("reminder-subject");
if (subject==null)
subject = "Venice Password Reminder Message";
// Create the emailer and send the message.
SimpleEmailer emailer = createEmailer();
emailer.setTo(email_addr);
emailer.setSubject("Venice Password Reminder Message");
emailer.setSubject(subject);
emailer.setText(message);
emailer.send();
if (logger.isDebugEnabled())
@ -1074,17 +1150,17 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
logger.debug("...created userprefs");
// get the sidebox configuration for this user
rs = stmt.executeQuery("SELECT sideboxes.boxid, sideboxes.sequence, sideboxes.param FROM sideboxes, "
rs = stmt.executeQuery("SELECT sideboxes.boxid, sideboxes.sequence FROM sideboxes, "
+ "users WHERE sideboxes.uid = users.uid AND users.is_anon = 1;");
sql.setLength(0);
while (rs.next())
{ // set up to insert into the sideboxes table
if (sql.length()==0)
sql.append("INSERT INTO sideboxes (uid, boxid, sequence, param) VALUES ");
sql.append("INSERT INTO sideboxes (uid, boxid, sequence) VALUES ");
else
sql.append(", ");
sql.append("(").append(new_uid).append(", ").append(rs.getInt(1)).append(", ");
sql.append(rs.getInt(2)).append(", ").append(SQLUtil.encodeStringArg(rs.getString(3))).append(')');
sql.append(rs.getInt(2)).append(')');
} // end while

View File

@ -0,0 +1,114 @@
/*
* 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.security;
import java.util.Random;
public class PasswordGenerator
{
/*--------------------------------------------------------------------------------
* Static data members
*--------------------------------------------------------------------------------
*/
private static final String[] syllabary = {
"ba", "be", "bi", "bo", "bu",
"da", "de", "di", "do", "du",
"cha", "chi", "cho", "chu",
"fa", "fe", "fi", "fo", "fu",
"ga", "ge", "gi", "go", "gu",
"ha", "he", "hi", "ho", "hu",
"ja", "je", "ji", "jo", "ju",
"ka", "ke", "ki", "ko", "ku",
"la", "le", "li", "lo", "lu",
"ma", "me", "mi", "mo", "mu",
"na", "ne", "ni", "no", "nu",
"pa", "pe", "pi", "po", "pu",
"ra", "re", "ri", "ro", "ru",
"sa", "se", "si", "so", "su",
"sha", "she", "sho", "shu",
"ta", "te", "ti", "to", "tu",
"va", "ve", "vi", "vo", "vu",
"wa", "we", "wi", "wo", "wu",
"ya", "ye", "yi", "yo", "yu",
"za", "ze", "zi", "zo", "zu"
}; // 98 syllables
private static final char[] digits = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' };
/*--------------------------------------------------------------------------------
* Attributes
*--------------------------------------------------------------------------------
*/
private String value; // the password value
/*--------------------------------------------------------------------------------
* Constructor
*--------------------------------------------------------------------------------
*/
public PasswordGenerator()
{
Random rng = new Random();
StringBuffer buf = new StringBuffer();
int i;
for (i=0; i<4; i++) // 4 random syllables
buf.append(syllabary[rng.nextInt(syllabary.length)]);
for (i=0; i<3; i++) // 3 random digits
buf.append(digits[rng.nextInt(digits.length)]);
value = buf.toString();
// total possible number of passwords = 92,236,816,000
} // end constructor
/*--------------------------------------------------------------------------------
* Overrides from class Object
*--------------------------------------------------------------------------------
*/
public String toString()
{
return value;
} // end toString
public boolean equals(Object obj)
{
if (obj==null)
return false; // trivial case
else if (obj==(Object)this)
return true; // trivial case
if (obj instanceof PasswordGenerator)
{ // compare value of PasswordHash argument to value
PasswordGenerator other = (PasswordGenerator)obj;
return value.equals(other.value);
} // end if
else
return value.equals(obj.toString());
} // end equals
public int hashCode()
{
return value.hashCode();
} // end hashCode
} // end class PasswordGenerator

View File

@ -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
@ -21,9 +21,18 @@ import java.security.MessageDigest;
public class PasswordHash
{
// Attributes
/*--------------------------------------------------------------------------------
* Attributes
*--------------------------------------------------------------------------------
*/
private String value; // the hashed password value
/*--------------------------------------------------------------------------------
* Constructors
*--------------------------------------------------------------------------------
*/
public PasswordHash()
{
value = "";
@ -84,11 +93,10 @@ public class PasswordHash
} // end constructor
protected void finalize()
{
value = null;
} // end finalize
/*--------------------------------------------------------------------------------
* Overrides from class Object
*--------------------------------------------------------------------------------
*/
public String toString()
{
@ -108,17 +116,22 @@ public class PasswordHash
return value.equals(other.value);
} // end if
else if (obj instanceof String)
{ // compare string argument to value
String os = (String)obj;
return value.equals(os);
} // end else if
else
return false;
return value.equals(obj.toString());
} // end equals
public int hashCode()
{
return value.hashCode();
} // end hashCode
/*--------------------------------------------------------------------------------
* Test program
*--------------------------------------------------------------------------------
*/
public static void main(String[] args)
{
if (args.length<1)

View File

@ -87,6 +87,24 @@ public class Settings extends VeniceServlet
} // end findHotlistIndex
private static int getBoxIDParameter(ServletRequest request) throws ErrorBox
{
String foo = request.getParameter("box");
if (foo==null)
throw new ErrorBox(null,"Parameter not specified!","settings?cmd=B");
try
{ // parse the integer and get the box ID
return Integer.parseInt(foo);
} // end try
catch (NumberFormatException e)
{ // error in parsing...
throw new ErrorBox(null,"Parameter invalid!","settings?cmd=B");
} // end catch
} // end getBoxIDParameter
/*--------------------------------------------------------------------------------
* Overrides from class HttpServlet
*--------------------------------------------------------------------------------
@ -258,10 +276,148 @@ public class Settings extends VeniceServlet
} // end if ("SX" command)
if (cmd.equals("B"))
{ // "B" - Configure Sideboxes
try
{ // return the sidebox viewer
setMyLocation(request,"settings?cmd=B");
return new SideBoxList(engine,user);
} // end try
catch (DataException de)
{ // Database error getting sidebox list
return new ErrorBox("Database Error","Error getting sidebox list: " + de.getMessage(),"top");
} // end catch
} // end if ("B" command)
if (cmd.equals("BU") || cmd.equals("BD") || cmd.equals("BX"))
{ // move sidebox up or down in list, or delete it
int boxid = getBoxIDParameter(request);
try
{ // get the box ID, find it in the list
List sidebox_list = user.getSideBoxList();
UserSideBoxDescriptor prev = null;
UserSideBoxDescriptor curr = null;
Iterator it = sidebox_list.iterator();
boolean found = false;
while (!found && it.hasNext())
{ // track the previous descriptor so we can do the swap
prev = curr;
curr = (UserSideBoxDescriptor)(it.next());
if (curr.getID()==boxid)
{ // found it - trip the loop exit
found = true;
if (cmd.equals("BD"))
{ // make "prev" actually be the NEXT descriptor
if (it.hasNext())
prev = (UserSideBoxDescriptor)(it.next());
else
prev = null;
} // end if
} // end if (found)
} // end while
if (found)
{ // the current one needs to be operated on
if (cmd.equals("BX"))
curr.remove(); // remove the "current" sidebox
else if (prev!=null)
{ // exchange the sequence numbers of "curr" and "prev"
int seq_curr = curr.getSequence();
int seq_prev = prev.getSequence();
curr.setSequence(seq_prev); // do the first "set"
boolean restore = true;
try
{ // do the second "set"
prev.setSequence(seq_curr);
restore = false;
} // end try
finally
{ // restore first if second failed
if (restore)
curr.setSequence(seq_curr);
} // end finally
} // end else if
// else just fall out and do nothing
} // end if
// else just fall out and don't do anything
} // end try
catch (DataException de)
{ // there was a data problem
return new ErrorBox("Database Error","Error adjusting sidebox list: " + de.getMessage(),
"settings?cmd=B");
} // end catch
try
{ // return the sidebox viewer
setMyLocation(request,"settings?cmd=B");
return new SideBoxList(engine,user);
} // end try
catch (DataException de)
{ // Database error getting sidebox list
return new ErrorBox("Database Error","Error getting sidebox list: " + de.getMessage(),"top");
} // end catch
} // end if ("BD"/"BU"/"BX" commands)
// command not found!
logger.error("invalid command to Settings.doGet: " + cmd);
return new ErrorBox("Internal Error","Invalid command to Settings.doGet","top");
} // end doVeniceGet
protected VeniceContent doVenicePost(HttpServletRequest request, VeniceEngine engine,
UserContext user, RenderData rdat)
throws ServletException, IOException, VeniceServletResult
{
String cmd = getStandardCommandParam(request);
if (cmd.equals("BA"))
{ // "BA" - add new sidebox
int boxid = getBoxIDParameter(request);
try
{ // add the sidebox
user.addSideBox(boxid);
} // end try
catch (DataException de)
{ // error adding to sideboxes
return new ErrorBox("Database Error","Error adding to sidebox list: " + de.getMessage(),
"settings?cmd=B");
} // end catch
try
{ // return the sidebox viewer
setMyLocation(request,"settings?cmd=B");
return new SideBoxList(engine,user);
} // end try
catch (DataException de)
{ // Database error getting sidebox list
return new ErrorBox("Database Error","Error getting sidebox list: " + de.getMessage(),"top");
} // end catch
} // end if ("BA" command)
// command not found!
logger.error("invalid command to Settings.doGet: " + cmd);
return new ErrorBox("Internal Error","Invalid command to Settings.doGet","top");
} // end doVenicePost
} // end class Settings

View File

@ -80,7 +80,7 @@ public class Variables
try
{ // extract the configuration file name and create the engine
VeniceEngine engine = Startup.createEngine(cfgfile);
VeniceEngine engine = Startup.createEngine(cfgfile,root_file_path);
ctxt.setAttribute(ENGINE_ATTRIBUTE,engine);
return engine;

View File

@ -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

View File

@ -29,10 +29,14 @@ import org.xml.sax.SAXParseException;
import com.silverwrist.util.DOMElementHelper;
import com.silverwrist.util.IOUtil;
import com.silverwrist.util.StringUtil;
import com.silverwrist.venice.core.AccessError;
import com.silverwrist.venice.core.ConfigException;
import com.silverwrist.venice.core.DataException;
import com.silverwrist.venice.core.UserContext;
import com.silverwrist.venice.core.VeniceEngine;
import com.silverwrist.venice.servlets.Variables;
import com.silverwrist.venice.servlets.format.menus.LeftMenu;
import com.silverwrist.venice.servlets.format.sideboxes.SideBoxFactory;
public class RenderConfig implements ColorSelectors
{
@ -44,7 +48,7 @@ public class RenderConfig implements ColorSelectors
protected static final String ATTR_NAME = "com.silverwrist.venice.servlets.RenderConfig";
protected static final String CONFIG_FILE_PARAM = "render.config";
private static Category logger = Category.getInstance(RenderConfig.class.getName());
private static Category logger = Category.getInstance(RenderConfig.class);
private static Map colornames_map;
@ -71,6 +75,7 @@ public class RenderConfig implements ColorSelectors
private HashMap menus;
private String[] colors_array;
private int footer_logo_scale;
private Map sidebox_factories;
/*--------------------------------------------------------------------------------
* Constructor
@ -263,6 +268,101 @@ public class RenderConfig implements ColorSelectors
if (logger.isDebugEnabled())
logger.debug("Site logo: " + site_logo);
// Load the sidebox configuration information.
String sidebox_config = paths_sect_h.getSubElementText("sidebox-config");
if (sidebox_config==null)
{ // the sidebox config was not present
logger.fatal("<paths/> section has no <sidebox-config/> element");
throw new ConfigException("no <sidebox-config/> found in <paths/> section",paths_sect);
} // end if
if (!(sidebox_config.startsWith("/")))
sidebox_config = root_file_path + sidebox_config;
Document sb_doc = loadConfiguration(sidebox_config);
Element sb_root = sb_doc.getDocumentElement();
if (!(sb_root.getTagName().equals("sidebox-config")))
{ // the sidebox configuration file isn't the right type
logger.fatal("config document is not a <sidebox-config/> document (root tag: <"
+ sb_root.getTagName() + "/>)");
throw new ConfigException("document is not a <sidebox-config/> document",sb_root);
} // end if
NodeList sb_nodes = sb_root.getChildNodes();
HashMap tmp_factories = new HashMap();
for (i=0; i<sb_nodes.getLength(); i++)
{ // extract each sidebox section from the list and build a new master sidebox object
Node s = sb_nodes.item(i);
if ((s.getNodeType()==Node.ELEMENT_NODE) && (s.getNodeName().equals("sidebox")))
{ // get the various attributes of the sidebox
Element sb = (Element)s;
try
{ // get the ID of the sidebox first
tmp = sb.getAttribute("id");
if (StringUtil.isStringEmpty(tmp))
{ // there was no ID specified for the sidebox
logger.fatal("<sidebox/> specified with no ID!");
throw new ConfigException("no ID specified in <sidebox/>",sb);
} // end if
// convert to an integer which we'll be using later in the HashMap
Integer id = new Integer(tmp);
// get the name of the factory class
DOMElementHelper sb_h = new DOMElementHelper(sb);
tmp = sb_h.getSubElementText("factory-class");
if (StringUtil.isStringEmpty(tmp))
{ // the factory class was not specified!
logger.fatal("<sidebox/> config incomplete (missing <factory-class/>)!");
throw new ConfigException("configuration of <sidebox/> is not complete!",sb);
} // end if
Class factory_class = Class.forName(tmp);
SideBoxFactory factory = (SideBoxFactory)(factory_class.newInstance());
factory.setConfiguration(sb);
tmp_factories.put(id,factory);
} // end if
catch (NumberFormatException e1)
{ // ID value was not an integer
logger.fatal("<sidebox/> ID not numeric!");
throw new ConfigException("non-numeric ID specified in <sidebox/>",sb);
} // end catch
catch (ClassNotFoundException e2)
{ // sidebox could not be configured
logger.fatal("<sidebox/> config <factory-class/> not valid!",e2);
throw new ConfigException("<factory-class/> in <sidebox/> is not a valid class!",sb);
} // end catch
catch (IllegalAccessException e3)
{ // could not access class and/or constructor
logger.fatal("<sidebox/> <factory-class/> is not accessible!",e3);
throw new ConfigException("<factory-class/> in <sidebox/> is not accessible!",sb);
} // end catch
catch (InstantiationException e4)
{ // unable to create the class
logger.fatal("<sidebox/> <factory-class/> could not be instantiated!",e4);
throw new ConfigException("<factory-class/> in <sidebox/> could not be created!",sb);
} // end catch
catch (ClassCastException e5)
{ // the class is not a SideBoxFactory implementor - cannot create
logger.fatal("<sidebox/> <factory-class/> is not a SideBoxFactory!",e5);
throw new ConfigException("<factory-class/> in <sidebox/> is not the correct type!",sb);
} // end catch
} // end if
} // end for
sidebox_factories = Collections.unmodifiableMap(tmp_factories);
Element msg_sect = root_h.getSubElement("messages");
if (msg_sect==null)
{ // no <messages/> section - bail out now!
@ -602,6 +702,15 @@ public class RenderConfig implements ColorSelectors
} // end useStyleSheet
VeniceContent createSideBox(int id, VeniceEngine engine, UserContext uc) throws AccessError, DataException
{
SideBoxFactory fact = (SideBoxFactory)(sidebox_factories.get(new Integer(id)));
if (fact==null)
throw new DataException("invalid sidebox ID!");
return fact.create(engine,uc);
} // end createSideBox
/*--------------------------------------------------------------------------------
* Static operations for use by VeniceServlet
*--------------------------------------------------------------------------------

View File

@ -28,6 +28,7 @@ import com.silverwrist.util.StringUtil;
import com.silverwrist.venice.core.DataException;
import com.silverwrist.venice.core.IDUtils;
import com.silverwrist.venice.core.UserContext;
import com.silverwrist.venice.core.VeniceEngine;
import com.silverwrist.venice.db.PostLinkRewriter;
import com.silverwrist.venice.db.UserNameRewriter;
import com.silverwrist.venice.servlets.format.menus.LeftMenu;

View File

@ -1,115 +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.*;
import java.util.*;
import com.silverwrist.util.StringUtil;
import com.silverwrist.venice.core.*;
public class SideBoxConferences implements ContentRender, ColorSelectors
{
/*--------------------------------------------------------------------------------
* Attributes
*--------------------------------------------------------------------------------
*/
private UserContext uc;
private List hotlist;
/*--------------------------------------------------------------------------------
* Constructor
*--------------------------------------------------------------------------------
*/
public SideBoxConferences(UserContext uc, String parameter) throws DataException
{
this.uc = uc;
this.hotlist = uc.getConferenceHotlist();
} // end constructor
/*--------------------------------------------------------------------------------
* Implementations from interface VeniceContent
*--------------------------------------------------------------------------------
*/
public String getPageTitle(RenderData rdat)
{
if (uc.isLoggedIn())
return "Your Conference Hotlist:";
else
return "Featured Conferences:";
} // end getPageTitle
public String getPageQID()
{
return null;
} // end getPageQID
/*--------------------------------------------------------------------------------
* Implementations from interface ContentRender
*--------------------------------------------------------------------------------
*/
public void renderHere(Writer out, RenderData rdat) throws IOException
{
String norm_font = rdat.getStdFontTag(SIDEBOX_CONTENT_FOREGROUND,2);
String hilite = rdat.getStdFontTag(SIDEBOX_CONTENT_LINK,2);
String purple_ball = rdat.getFullImagePath("purple-ball.gif");
String new_image = rdat.getFullImagePath("tag_new.gif");
if (hotlist.size()>0)
{ // display the list of conferences
out.write("<TABLE ALIGN=CENTER BORDER=0 CELLPADDING=0 CELLSPACING=2>\n");
Iterator it = hotlist.iterator();
while (it.hasNext())
{ // display the names of the conferences and SIGs one by one
ConferenceHotlistEntry hle = (ConferenceHotlistEntry)(it.next());
ConferenceContext conf = hle.getConference();
String href = "confdisp?sig=" + conf.getEnclosingSIG().getSIGID() + "&conf=" + conf.getConfID();
out.write("<TR VALIGN=MIDDLE>\n<TD ALIGN=CENTER WIDTH=14><IMG SRC=\"" + purple_ball
+ "\" ALT=\"*\" WIDTH=14 HEIGHT=14 BORDER=0></TD>\n<TD ALIGN=LEFT CLASS=\"sidebox\">\n"
+ norm_font + "<B><A CLASS=\"sidebox\" HREF=\"" + rdat.getEncodedServletPath(href) + "\">"
+ hilite + StringUtil.encodeHTML(conf.getName()) + "</FONT></A></B> ("
+ StringUtil.encodeHTML(conf.getEnclosingSIG().getName()) + ")</FONT>\n");
if (conf.anyUnread())
out.write("&nbsp;<A HREF=\"" + rdat.getEncodedServletPath(href + "&rnm=1") + "\"><IMG SRC=\""
+ new_image + "\" ALT=\"New!\" BORDER=0 WIDTH=40 HEIGHT=20></A>\n");
out.write("</TD>\n</TR>\n");
} // end while
out.write("</TABLE>\n");
} // end if
else
out.write(norm_font + "<EM>You have no conferences in your hotlist.</EM></FONT>\n");
if (uc.isLoggedIn())
{ // write the link at the end
out.write("<P>" + rdat.getStdFontTag(SIDEBOX_CONTENT_FOREGROUND,1) + "<B>[ <A CLASS=\"sidebox\" HREF=\""
+ rdat.getEncodedServletPath("settings?cmd=H") + "\">"
+ rdat.getStdFontTag(SIDEBOX_CONTENT_LINK,1) + "Manage</FONT></A> ]</B></FONT>");
} // end if
} // end renderHere
} // end class SideBoxConferences

View File

@ -0,0 +1,156 @@
/*
* 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 SideBoxList implements JSPRender
{
/*--------------------------------------------------------------------------------
* Static data members
*--------------------------------------------------------------------------------
*/
// Attribute name for request attribute
protected static final String ATTR_NAME = "com.silverwrist.venice.content.SideBoxList";
/*--------------------------------------------------------------------------------
* Attributes
*--------------------------------------------------------------------------------
*/
private UserContext uc; // user context
private List in_list; // sideboxes that are "in"
private List out_list; // sideboxes that are "out"
/*--------------------------------------------------------------------------------
* Constructor
*--------------------------------------------------------------------------------
*/
public SideBoxList(VeniceEngine engine, UserContext uc) throws DataException
{
this.uc = uc;
this.in_list = uc.getSideBoxList();
HashSet ids = new HashSet(in_list.size());
Iterator it = in_list.iterator();
while (it.hasNext())
{ // add the IDs of all the sideboxes to the set
SideBoxDescriptor d = (SideBoxDescriptor)(it.next());
ids.add(new Integer(d.getID()));
} // end while
List all_list = engine.getMasterSideBoxList();
if (all_list.size()>in_list.size())
{ // allocate an ArrayList to hold the sideboxes
out_list = new ArrayList(all_list.size()-in_list.size());
it = all_list.iterator();
while (it.hasNext())
{ // get all sideboxes not in the "in" list and put them in the "out" list
SideBoxDescriptor d = (SideBoxDescriptor)(it.next());
if (!(ids.contains(new Integer(d.getID()))))
out_list.add(d);
} // end while
} // end if
else // all sideboxes are "in"...
out_list = Collections.EMPTY_LIST;
} // end constructor
/*--------------------------------------------------------------------------------
* External static functions
*--------------------------------------------------------------------------------
*/
public static SideBoxList retrieve(ServletRequest request)
{
return (SideBoxList)(request.getAttribute(ATTR_NAME));
} // end retrieve
/*--------------------------------------------------------------------------------
* Implementations from interface VeniceContent
*--------------------------------------------------------------------------------
*/
public String getPageTitle(RenderData rdat)
{
return "Your Front Page Configuration";
} // end getPageTitle
public String getPageQID()
{
return null;
} // end getPageQID
/*--------------------------------------------------------------------------------
* Implementations from interface JSPRender
*--------------------------------------------------------------------------------
*/
public void store(ServletRequest request)
{
request.setAttribute(ATTR_NAME,this);
} // end store
public String getTargetJSPName()
{
return "sideboxlist.jsp";
} // end getTargetJSPName
/*--------------------------------------------------------------------------------
* External operations
*--------------------------------------------------------------------------------
*/
public int getInListSize()
{
return in_list.size();
} // end getInListSize
public SideBoxDescriptor getInListItem(int index)
{
return (SideBoxDescriptor)(in_list.get(index));
} // end getInListItem
public int getOutListSize()
{
return out_list.size();
} // end getOutListSize
public SideBoxDescriptor getOutListItem(int index)
{
return (SideBoxDescriptor)(out_list.get(index));
} // end getInListItem
} // end class SideBoxList

View File

@ -1,121 +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.*;
import java.util.*;
import com.silverwrist.util.StringUtil;
import com.silverwrist.venice.core.*;
public class SideBoxSIGs implements ContentRender, ColorSelectors
{
/*--------------------------------------------------------------------------------
* 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
public String getPageQID()
{
return null;
} // end getPageQID
/*--------------------------------------------------------------------------------
* Implementations from interface ContentRender
*--------------------------------------------------------------------------------
*/
public void renderHere(Writer out, RenderData rdat) throws IOException
{
if (sig_list.size()>0)
{ // display the list of available SIGs
String purple_ball = rdat.getFullImagePath("purple-ball.gif");
String link_font = rdat.getStdFontTag(SIDEBOX_CONTENT_LINK,2);
String host_image = null;
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=\"" + purple_ball
+ "\" ALT=\"*\" WIDTH=14 HEIGHT=14 BORDER=0></TD>\n<TD ALIGN=LEFT CLASS=\"sidebox\">\n"
+ "<A CLASS=\"sidebox\" HREF=\"" + rdat.getEncodedServletPath("sig/" + sig.getAlias())
+ "\">" + link_font + "<B>" + StringUtil.encodeHTML(sig.getName()) + "</B></FONT></A>\n");
if (sig.isAdmin())
{ // write the "Host!" image at the end
if (host_image==null)
host_image = rdat.getFullImagePath("tag_host.gif");
out.write("&nbsp;<IMG SRC=\"" + host_image + "\" ALT=\"Host!\" BORDER=0 WIDTH=40 HEIGHT=20>\n");
} // end if
out.write("</TD>\n</TR>\n");
} // end while
out.write("</TABLE>\n");
} // end if
else
out.write(rdat.getStdFontTag(SIDEBOX_CONTENT_FOREGROUND,2)
+ "<EM>You are not a member of any SIGs.</EM></FONT>\n");
if (uc.isLoggedIn())
{ // write the two links at the end
String hilite = rdat.getStdFontTag(SIDEBOX_CONTENT_LINK,1);
out.write("<P>" + rdat.getStdFontTag(SIDEBOX_CONTENT_FOREGROUND,1) + "<B>[ <A CLASS=\"sidebox\" HREF=\""
+ rdat.getEncodedServletPath("settings?cmd=S") + "\">" + hilite
+ "Manage</FONT></A> | <A CLASS=\"sidebox\" HREF=\""
+ rdat.getEncodedServletPath("sigops?cmd=C") + "\">" + hilite
+ "Create New</FONT></A> ]</B></FONT>");
} // end if
} // end renderHere
} // end class SideBoxSIGs

View File

@ -52,7 +52,7 @@ public class TopDisplay implements ContentRender, ColorSelectors
*/
public TopDisplay(ServletContext ctxt, VeniceEngine engine, UserContext uc)
throws DataException, AccessError, ErrorBox
throws ServletException, DataException, AccessError
{
// Stash some basic information.
this.ctxt = ctxt;
@ -61,72 +61,13 @@ public class TopDisplay implements ContentRender, ColorSelectors
this.top_posts = engine.getPublishedMessages(false);
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.
// Create the sideboxes.
sideboxes = new VeniceContent[descrs.size()];
RenderConfig rconf = RenderConfig.getRenderConfig(ctxt);
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
sideboxes[i] = rconf.createSideBox(d.getID(),engine,uc);
} // end for
@ -196,8 +137,7 @@ public class TopDisplay implements ContentRender, ColorSelectors
out.write("<TABLE ALIGN=CENTER WIDTH=200 BORDER=0 CELLPADDING=2 CELLSPACING=0>"
+ "<TR VALIGN=MIDDLE BGCOLOR=\"" + rdat.getStdColor(SIDEBOX_TITLE_BACKGROUND)
+ "\"><TD ALIGN=LEFT CLASS=\"sideboxtop\">\n"
+ rdat.getStdFontTag(SIDEBOX_TITLE_FOREGROUND,3) + "<B>"
+ StringUtil.encodeHTML(sideboxes[i].getPageTitle(rdat))
+ rdat.getStdFontTag(SIDEBOX_TITLE_FOREGROUND,3) + "<B>" + sideboxes[i].getPageTitle(rdat)
+ "</B></FONT>\n</TD></TR><TR VALIGN=TOP BGCOLOR=\""
+ rdat.getStdColor(SIDEBOX_CONTENT_BACKGROUND) + "\"><TD ALIGN=LEFT CLASS=\"sidebox\">\n");
@ -243,7 +183,7 @@ public class TopDisplay implements ContentRender, ColorSelectors
if (uc.isLoggedIn())
{ // write the Configure button below the sideboxes
out.write("<A HREF=\"" + rdat.getEncodedServletPath("TODO") + "\"><IMG SRC=\""
out.write("<A HREF=\"" + rdat.getEncodedServletPath("settings?cmd=B") + "\"><IMG SRC=\""
+ rdat.getFullImagePath("bn_configure.gif")
+ "\" ALT=\"Configure\" WIDTH=80 HEIGHT=24 BORDER=0></A>\n");

View File

@ -0,0 +1,277 @@
/*
* 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.sideboxes;
import java.io.*;
import java.util.*;
import org.w3c.dom.*;
import com.silverwrist.util.DOMElementHelper;
import com.silverwrist.util.StringUtil;
import com.silverwrist.venice.core.*;
import com.silverwrist.venice.servlets.format.*;
public class ConferenceBox implements SideBoxFactory
{
/*--------------------------------------------------------------------------------
* Internal class that implements the actual sidebox
*--------------------------------------------------------------------------------
*/
class ConferenceBoxImpl implements ContentRender, ColorSelectors
{
private UserContext uc; // current user context
private List hotlist; // current conference hotlist
ConferenceBoxImpl(UserContext uc) throws DataException
{
this.uc = uc;
this.hotlist = uc.getConferenceHotlist();
} // end constructor
public String getPageTitle(RenderData rdat)
{
if (uc.isLoggedIn())
return title;
else
return anon_title;
} // end getPageTitle
public String getPageQID()
{
return null;
} // end getPageQID
public void renderHere(Writer out, RenderData rdat) throws IOException
{
String norm_font = rdat.getStdFontTag(SIDEBOX_CONTENT_FOREGROUND,2);
if (hotlist.size()>0)
{ // write out the hotlist....
String hilite = rdat.getStdFontTag(SIDEBOX_CONTENT_LINK,2);
out.write("<TABLE ALIGN=CENTER BORDER=0 CELLPADDING=0 CELLSPACING=2>\n");
Iterator it = hotlist.iterator();
while (it.hasNext())
{ // get the next hotlist entry and add it to the display
ConferenceHotlistEntry hle = (ConferenceHotlistEntry)(it.next());
ConferenceContext conf = hle.getConference();
String href = "confdisp?sig=" + conf.getEnclosingSIG().getSIGID() + "&conf=" + conf.getConfID();
out.write("<TR VALIGN=MIDDLE>\n<TD ALIGN=CENTER WIDTH=" + bullet_width + ">");
renderBullet(out,rdat);
out.write("</TD>\n<TD ALIGN=LEFT CLASS=\"sidebox\">\n" + norm_font
+ "<B><A CLASS=\"sidebox\" HREF=\"" + rdat.getEncodedServletPath(href) + "\">" + hilite
+ StringUtil.encodeHTML(conf.getName()) + "</FONT></A></B> ("
+ StringUtil.encodeHTML(conf.getEnclosingSIG().getName()) + ")</FONT>\n");
if (conf.anyUnread())
{ // write out the new-messages tag and its enclosing link
out.write("&nbsp;<A HREF=\"" + rdat.getEncodedServletPath(href + "&rnm=1") + "\">");
renderNewMessageTag(out,rdat);
out.write("</A>\n");
} // end if
out.write("</TD>\n</TR>\n");
} // end while
out.write("</TABLE>\n");
} // end if
else // write the "null" message
out.write(norm_font + "<EM>" + null_message + "</EM></FONT>\n");
if (uc.isLoggedIn())
{ // write the link at the end
out.write("<P>" + rdat.getStdFontTag(SIDEBOX_CONTENT_FOREGROUND,1)
+ "<B>[ <A CLASS=\"sidebox\" HREF=\"" + rdat.getEncodedServletPath("settings?cmd=H") + "\">"
+ rdat.getStdFontTag(SIDEBOX_CONTENT_LINK,1) + manage_link + "</FONT></A> ]</B></FONT>");
} // end if
} // end renderHere
} // end class ConferenceBoxImpl
/*--------------------------------------------------------------------------------
* Attributes
*--------------------------------------------------------------------------------
*/
private String title; // title of sidebox for logged-in users
private String anon_title; // title of sidebox for not-logged-in users
private String null_message; // message if they have no hotlist conferences
private String manage_link; // "Manage" link text
private String bullet_url; // URL to bullet image
private boolean bullet_fixup; // does bullet image need to be run through getFullImagePath?
private int bullet_width; // width of bullet image
private int bullet_height; // height of bullet image
private String newmsg_url; // URL to new messages tag image
private boolean newmsg_fixup; // does new messages image need to be run through getFullImagePath?
private String newmsg_alt; // ALT text to use for new message tag image
private int newmsg_width; // width of new message tag image
private int newmsg_height; // height of new message tag image
/*--------------------------------------------------------------------------------
* Constructor
*--------------------------------------------------------------------------------
*/
public ConferenceBox()
{ // do nothing
} // end constructor
/*--------------------------------------------------------------------------------
* Internal operations
*--------------------------------------------------------------------------------
*/
private void renderBullet(Writer out, RenderData rdat) throws IOException
{
synchronized (this)
{ // this may be called by more than one class, so protect this part
if (bullet_fixup)
{ // fix up the bullet URL
bullet_url = rdat.getFullImagePath(bullet_url);
bullet_fixup = false;
} // end if
} // end synchronized block
out.write("<IMG SRC=\"" + bullet_url + "\" ALT=\"*\" WIDTH=" + bullet_width + " HEIGHT=" + bullet_height
+ " BORDER=0>");
} // end renderBullet
private void renderNewMessageTag(Writer out, RenderData rdat) throws IOException
{
synchronized (this)
{ // this may be called by more than one class, so protect this part
if (newmsg_fixup)
{ // fix up the host tag URL
newmsg_url = rdat.getFullImagePath(newmsg_url);
newmsg_fixup = false;
} // end if
} // end synchronized block
out.write("<IMG SRC=\"" + newmsg_url + "\" ALT=\"" + newmsg_alt + "\" WIDTH=" + newmsg_width + " HEIGHT="
+ newmsg_height + " BORDER=0>");
} // end renderNewMessageTag
/*--------------------------------------------------------------------------------
* Implementations from interface SideBoxFactory
*--------------------------------------------------------------------------------
*/
public void setConfiguration(Element cfg) throws ConfigException
{
DOMElementHelper cfg_h = new DOMElementHelper(cfg);
title = cfg_h.getSubElementText("title");
if (title==null)
throw new ConfigException("no <title/> specified for conference list sidebox",cfg);
title += ":";
anon_title = cfg_h.getSubElementText("anon-title");
if (anon_title==null)
anon_title = title;
else
anon_title += ":";
null_message = cfg_h.getSubElementText("null-msg");
if (null_message==null)
null_message = "You are not a member of any SIGs.";
manage_link = cfg_h.getSubElementText("manage-link");
if (manage_link==null)
manage_link = "Manage";
Element x = cfg_h.getSubElement("bullet");
if (x!=null)
{ // get the parameters for the bullet image
DOMElementHelper x_h = new DOMElementHelper(x);
bullet_url = x_h.getElementText();
if (StringUtil.isStringEmpty(bullet_url))
{ // default the bullet URL and fixup parameter
bullet_url = "purple-ball.gif";
bullet_fixup = true;
} // end if
else // get the "fixup" parameter
bullet_fixup = x_h.hasAttribute("fixup");
Integer xi = x_h.getAttributeInt("width");
bullet_width = (xi!=null) ? xi.intValue() : 14;
xi = x_h.getAttributeInt("height");
bullet_height = (xi!=null) ? xi.intValue() : 14;
} // end if
else
{ // just default all the bullet parameters
bullet_url = "purple-ball.gif";
bullet_fixup = true;
bullet_width = 14;
bullet_height = 14;
} // end else
x = cfg_h.getSubElement("new-image");
if (x!=null)
{ // get the parameters for the host tag image
DOMElementHelper x_h = new DOMElementHelper(x);
newmsg_url = x_h.getElementText();
if (StringUtil.isStringEmpty(newmsg_url))
{ // default the host tag image URL and fixup parameter
newmsg_url = "tag_new.gif";
newmsg_fixup = true;
} // end if
else // get the "fixup" parameter
newmsg_fixup = x_h.hasAttribute("fixup");
newmsg_alt = x.getAttribute("alt");
if (StringUtil.isStringEmpty(newmsg_alt))
newmsg_alt = "New!";
Integer xi = x_h.getAttributeInt("width");
newmsg_width = (xi!=null) ? xi.intValue() : 40;
xi = x_h.getAttributeInt("height");
newmsg_height = (xi!=null) ? xi.intValue() : 20;
} // end if
else
{ // just default all the host tag parameters
newmsg_url = "tag_new.gif";
newmsg_fixup = true;
newmsg_alt = "New!";
newmsg_width = 40;
newmsg_height = 20;
} // end else
} // end setConfiguration
public VeniceContent create(VeniceEngine engine, UserContext uc) throws AccessError, DataException
{
return new ConferenceBoxImpl(uc);
} // end create
} // end class ConferenceBox

View File

@ -0,0 +1,133 @@
/*
* 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.sideboxes;
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import com.silverwrist.venice.core.*;
import com.silverwrist.venice.servlets.format.*;
public class JSPSideBox implements JSPRender
{
/*--------------------------------------------------------------------------------
* Static data members
*--------------------------------------------------------------------------------
*/
// Attribute name for request attribute
protected static final String ATTR_NAME = "com.silverwrist.venice.content.sidebox.JSP";
/*--------------------------------------------------------------------------------
* Attributes
*--------------------------------------------------------------------------------
*/
private JSPSideBoxFactory factory;
private VeniceEngine engine;
private UserContext uc;
/*--------------------------------------------------------------------------------
* Constructor
*--------------------------------------------------------------------------------
*/
JSPSideBox(JSPSideBoxFactory factory, VeniceEngine engine, UserContext uc)
{
this.factory = factory;
this.engine = engine;
this.uc = uc;
} // end constructor
/*--------------------------------------------------------------------------------
* External static functions
*--------------------------------------------------------------------------------
*/
public static JSPSideBox retrieve(ServletRequest request)
{
return (JSPSideBox)(request.getAttribute(ATTR_NAME));
} // end retrieve
/*--------------------------------------------------------------------------------
* Implementations from interface VeniceContent
*--------------------------------------------------------------------------------
*/
public String getPageTitle(RenderData rdat)
{
return factory.getTitle(uc.isLoggedIn());
} // end getPageTitle
public String getPageQID()
{
return null;
} // end getPageQID
/*--------------------------------------------------------------------------------
* Implementations from interface JSPRender
*--------------------------------------------------------------------------------
*/
public void store(ServletRequest request)
{
request.setAttribute(ATTR_NAME,this);
} // end store
public String getTargetJSPName()
{
return factory.getTargetJSPName();
} // end getTargetJSPName
/*--------------------------------------------------------------------------------
* External operations
*--------------------------------------------------------------------------------
*/
public VeniceEngine getEngine()
{
return engine;
} // end getEngine
public UserContext getUser()
{
return uc;
} // end getUser
public String getString(String key)
{
return factory.getString(key);
} // end getString
public String replaceStrings(String base)
{
return factory.replaceStrings(base);
} // end replaceStrings
} // end class JSPSideBox

View File

@ -0,0 +1,131 @@
/*
* 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.sideboxes;
import java.io.*;
import java.util.*;
import org.w3c.dom.*;
import com.silverwrist.util.DOMElementHelper;
import com.silverwrist.util.StringUtil;
import com.silverwrist.venice.core.*;
import com.silverwrist.venice.servlets.format.*;
public class JSPSideBoxFactory implements SideBoxFactory
{
/*--------------------------------------------------------------------------------
* Attributes
*--------------------------------------------------------------------------------
*/
private String title; // title of sidebox for logged-in users
private String anon_title; // title of sidebox for not-logged-in users
private String format_jsp; // name of formatting JSP file
private Map strings; // the strings we can access from the JSP page
/*--------------------------------------------------------------------------------
* Constructor
*--------------------------------------------------------------------------------
*/
public JSPSideBoxFactory()
{ // do nothing
} // end constructor
/*--------------------------------------------------------------------------------
* Internal functions
*--------------------------------------------------------------------------------
*/
String getTitle(boolean logged_in)
{
return (logged_in ? title : anon_title);
} // end getTitle
String getTargetJSPName()
{
return format_jsp;
} // end getTargetJSPName
String getString(String key)
{
return (String)(strings.get(key));
} // end getString
String replaceStrings(String base)
{
return StringUtil.replaceAllVariables(base,strings);
} // end replaceStrings
/*--------------------------------------------------------------------------------
* Implementations from interface SideBoxFactory
*--------------------------------------------------------------------------------
*/
public void setConfiguration(Element cfg) throws ConfigException
{
DOMElementHelper cfg_h = new DOMElementHelper(cfg);
title = cfg_h.getSubElementText("title");
if (title==null)
throw new ConfigException("no <title/> specified for sidebox",cfg);
title += ":";
anon_title = cfg_h.getSubElementText("anon-title");
if (anon_title==null)
anon_title = title;
else
anon_title += ":";
format_jsp = cfg_h.getSubElementText("format-jsp");
if (format_jsp==null)
throw new ConfigException("no <format-jsp/> specified for sidebox",cfg);
Element s = cfg_h.getSubElement("strings");
if (s!=null)
{ // we've got some replacement strings to add
HashMap tmp = new HashMap();
NodeList sl = s.getChildNodes();
for (int i=0; i<sl.getLength(); i++)
{ // get all the replacement strings and add them to the map
Node n = sl.item(i);
if (n.getNodeType()==Node.ELEMENT_NODE)
{ // get the text inside this subelement and save it off
DOMElementHelper s_h = new DOMElementHelper((Element)n);
tmp.put(n.getNodeName(),s_h.getElementText());
} // end if
} // end for
strings = Collections.unmodifiableMap(tmp);
} // end if
else // no replacement strings
strings = Collections.EMPTY_MAP;
} // end setConfiguration
public VeniceContent create(VeniceEngine engine, UserContext uc)
{
return new JSPSideBox(this,engine,uc);
} // end create
} // end class JSPSideBoxFactory

View File

@ -0,0 +1,282 @@
/*
* 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.sideboxes;
import java.io.*;
import java.util.*;
import org.w3c.dom.*;
import com.silverwrist.util.DOMElementHelper;
import com.silverwrist.util.StringUtil;
import com.silverwrist.venice.core.*;
import com.silverwrist.venice.servlets.format.*;
public class SIGBox implements SideBoxFactory
{
/*--------------------------------------------------------------------------------
* Internal class that implements the actual sidebox
*--------------------------------------------------------------------------------
*/
class SIGBoxImpl implements ContentRender, ColorSelectors
{
private UserContext uc;
private List sig_list;
SIGBoxImpl(UserContext uc) throws DataException
{
this.uc = uc;
this.sig_list = uc.getMemberSIGs();
} // end constructor
public String getPageTitle(RenderData rdat)
{
if (uc.isLoggedIn())
return title;
else
return anon_title;
} // end getPageTitle
public String getPageQID()
{
return null;
} // end getPageQID
public void renderHere(Writer out, RenderData rdat) throws IOException
{
if (sig_list.size()>0)
{ // load up the rendering data and render the contents of the list
String link_font = rdat.getStdFontTag(SIDEBOX_CONTENT_LINK,2);
out.write("<TABLE ALIGN=CENTER BORDER=0 CELLPADDING=0 CELLSPACING=2>\n");
Iterator it = sig_list.iterator();
while (it.hasNext())
{ // write each SIG out in turn
SIGContext sig = (SIGContext)(it.next());
out.write("<TR VALIGN=MIDDLE>\n<TD ALIGN=CENTER WIDTH=" + bullet_width + ">");
renderBullet(out,rdat);
out.write("</TD>\n<TD ALIGN=LEFT CLASS=\"sidebox\">\n<A CLASS=\"sidebox\" HREF=\""
+ rdat.getEncodedServletPath("sig/" + sig.getAlias()) + "\">" + link_font + "<B>"
+ StringUtil.encodeHTML(sig.getName()) + "</B></FONT></A>\n");
if (sig.isAdmin())
{ // write the host tag at the end
out.write("&nbsp;");
renderHostTag(out,rdat);
} // end if
out.write("</TD>\n</TR>\n");
} // end while
out.write("</TABLE>\n");
} // end if
else // write the "no SIGs" message
out.write(rdat.getStdFontTag(SIDEBOX_CONTENT_FOREGROUND,2) + "<EM>" + null_message + "</EM></FONT>\n");
if (uc.isLoggedIn())
{ // write the links at the end
String hilite = rdat.getStdFontTag(SIDEBOX_CONTENT_LINK,1);
out.write("<P>" + rdat.getStdFontTag(SIDEBOX_CONTENT_FOREGROUND,1)
+ "<B>[ <A CLASS=\"sidebox\" HREF=\"" + rdat.getEncodedServletPath("settings?cmd=S")
+ "\">" + hilite + manage_link + "</FONT></A> ");
if (uc.canCreateSIG())
out.write("| <A CLASS=\"sidebox\" HREF=\"" + rdat.getEncodedServletPath("sigops?cmd=C") + "\">"
+ hilite + create_new_link + "</FONT></A> ");
out.write("]</B></FONT>");
} // end if
} // end renderHere
} // end class SIGBoxImpl
/*--------------------------------------------------------------------------------
* Attributes
*--------------------------------------------------------------------------------
*/
private String title; // title of sidebox for logged-in users
private String anon_title; // title of sidebox for not-logged-in users
private String null_message; // message if they're not a member of any SIGs
private String manage_link; // "Manage" link text
private String create_new_link; // "Create New" link text
private String bullet_url; // URL to bullet image
private boolean bullet_fixup; // does bullet image need to be run through getFullImagePath?
private int bullet_width; // width of bullet image
private int bullet_height; // height of bullet image
private String host_url; // URL to host tag image
private boolean host_fixup; // does host tag image need to be run through getFullImagePath?
private String host_alt; // ALT text to use for host tag image
private int host_width; // width of host tag image
private int host_height; // height of host tag image
/*--------------------------------------------------------------------------------
* Constructor
*--------------------------------------------------------------------------------
*/
public SIGBox()
{ // do nothing
} // end constructor
/*--------------------------------------------------------------------------------
* Internal operations
*--------------------------------------------------------------------------------
*/
private void renderBullet(Writer out, RenderData rdat) throws IOException
{
synchronized (this)
{ // this may be called by more than one class, so protect this part
if (bullet_fixup)
{ // fix up the bullet URL
bullet_url = rdat.getFullImagePath(bullet_url);
bullet_fixup = false;
} // end if
} // end synchronized block
out.write("<IMG SRC=\"" + bullet_url + "\" ALT=\"*\" WIDTH=" + bullet_width + " HEIGHT=" + bullet_height
+ " BORDER=0>");
} // end renderBullet
private void renderHostTag(Writer out, RenderData rdat) throws IOException
{
synchronized (this)
{ // this may be called by more than one class, so protect this part
if (host_fixup)
{ // fix up the host tag URL
host_url = rdat.getFullImagePath(host_url);
host_fixup = false;
} // end if
} // end synchronized block
out.write("<IMG SRC=\"" + host_url + "\" ALT=\"" + host_alt + "\" WIDTH=" + host_width + " HEIGHT="
+ host_height + " BORDER=0>");
} // end renderBullet
/*--------------------------------------------------------------------------------
* Implementations from interface SideBoxFactory
*--------------------------------------------------------------------------------
*/
public void setConfiguration(Element cfg) throws ConfigException
{
DOMElementHelper cfg_h = new DOMElementHelper(cfg);
title = cfg_h.getSubElementText("title");
if (title==null)
throw new ConfigException("no <title/> specified for SIG list sidebox",cfg);
title += ":";
anon_title = cfg_h.getSubElementText("anon-title");
if (anon_title==null)
anon_title = title;
else
anon_title += ":";
null_message = cfg_h.getSubElementText("null-msg");
if (null_message==null)
null_message = "You are not a member of any SIGs.";
manage_link = cfg_h.getSubElementText("manage-link");
if (manage_link==null)
manage_link = "Manage";
create_new_link = cfg_h.getSubElementText("create-new-link");
if (create_new_link==null)
create_new_link = "Create New";
Element x = cfg_h.getSubElement("bullet");
if (x!=null)
{ // get the parameters for the bullet image
DOMElementHelper x_h = new DOMElementHelper(x);
bullet_url = x_h.getElementText();
if (StringUtil.isStringEmpty(bullet_url))
{ // default the bullet URL and fixup parameter
bullet_url = "purple-ball.gif";
bullet_fixup = true;
} // end if
else // get the "fixup" parameter
bullet_fixup = x_h.hasAttribute("fixup");
Integer xi = x_h.getAttributeInt("width");
bullet_width = (xi!=null) ? xi.intValue() : 14;
xi = x_h.getAttributeInt("height");
bullet_height = (xi!=null) ? xi.intValue() : 14;
} // end if
else
{ // just default all the bullet parameters
bullet_url = "purple-ball.gif";
bullet_fixup = true;
bullet_width = 14;
bullet_height = 14;
} // end else
x = cfg_h.getSubElement("host-image");
if (x!=null)
{ // get the parameters for the host tag image
DOMElementHelper x_h = new DOMElementHelper(x);
host_url = x_h.getElementText();
if (StringUtil.isStringEmpty(host_url))
{ // default the host tag image URL and fixup parameter
host_url = "tag_host.gif";
host_fixup = true;
} // end if
else // get the "fixup" parameter
host_fixup = x_h.hasAttribute("fixup");
host_alt = x.getAttribute("alt");
if (StringUtil.isStringEmpty(host_alt))
host_alt = "Host!";
Integer xi = x_h.getAttributeInt("width");
host_width = (xi!=null) ? xi.intValue() : 40;
xi = x_h.getAttributeInt("height");
host_height = (xi!=null) ? xi.intValue() : 20;
} // end if
else
{ // just default all the host tag parameters
host_url = "tag_host.gif";
host_fixup = true;
host_alt = "Host!";
host_width = 40;
host_height = 20;
} // end else
} // end setConfiguration
public VeniceContent create(VeniceEngine engine, UserContext uc) throws DataException
{
return new SIGBoxImpl(uc);
} // end create
} // end class SIGBox

View File

@ -0,0 +1,35 @@
/*
* 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.sideboxes;
import org.w3c.dom.*;
import com.silverwrist.venice.core.ConfigException;
import com.silverwrist.venice.core.AccessError;
import com.silverwrist.venice.core.DataException;
import com.silverwrist.venice.core.SideBoxDescriptor;
import com.silverwrist.venice.core.UserContext;
import com.silverwrist.venice.core.VeniceEngine;
import com.silverwrist.venice.servlets.format.VeniceContent;
public interface SideBoxFactory
{
public abstract void setConfiguration(Element cfg) throws ConfigException;
public abstract VeniceContent create(VeniceEngine engine, UserContext uc) throws AccessError, DataException;
} // end interface SideBoxFactory

109
web/format/sideboxlist.jsp Normal file
View File

@ -0,0 +1,109 @@
<%--
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.*" %>
<%
SideBoxList data = SideBoxList.retrieve(request);
Variables.failIfNull(data);
RenderData rdat = RenderConfig.createRenderData(application,request,response);
String stdfont = rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2);
int i;
SideBoxDescriptor d;
%>
<% if (rdat.useHTMLComments()) { %><!-- User sidebox list --><% } %>
<% rdat.writeContentHeader(out,"Your Front Page Configuration",null); %>
<%= stdfont %><A HREF="<%= rdat.getEncodedServletPath("top") %>">Return to Front Page</A></FONT><P>
<% if (data.getInListSize()>0) { %>
<TABLE BORDER=0 ALIGN=CENTER CELLPADDING=0 CELLSPACING=3>
<% for (i=0; i<data.getInListSize(); i++) { %>
<% d = data.getInListItem(i); %>
<TR VALIGN=MIDDLE>
<TD ALIGN=CENTER WIDTH=16>
<% if (i==(data.getInListSize()-1)) { %>&nbsp;<% } else { %>
<A HREF="<%= rdat.getEncodedServletPath("settings?cmd=BD&box=" + d.getID()) %>"><IMG
SRC="<%= rdat.getFullImagePath("icn_down.gif") %>" ALT="[Down]" BORDER=0 WIDTH=16
HEIGHT=16></A>
<% } // end if %>
</TD>
<TD ALIGN=CENTER WIDTH=16>
<% if (i==0) { %>&nbsp;<% } else { %>
<A HREF="<%= rdat.getEncodedServletPath("settings?cmd=BU&box=" + d.getID()) %>"><IMG
SRC="<%= rdat.getFullImagePath("icn_up.gif") %>" ALT="[Up]" BORDER=0 WIDTH=16
HEIGHT=16></A>
<% } // end if %>
</TD>
<TD ALIGN=CENTER WIDTH=16>
<A HREF="<%= rdat.getEncodedServletPath("settings?cmd=BX&box=" + d.getID()) %>"><IMG
SRC="<%= rdat.getFullImagePath("icn_x.gif") %>" ALT="[Remove]" BORDER=0 WIDTH=16
HEIGHT=16></A>
</TD>
<TD ALIGN=LEFT CLASS="content"><%= stdfont %>
<B><%= StringUtil.encodeHTML(d.getTitle(false)) %></B>
</FONT></TD>
</TR>
<% } // end for %>
</TABLE><P>
<TABLE BORDER=0 CELLPADDING=2 CELLSPACING=0>
<TR VALIGN=MIDDLE>
<TD ALIGN=CENTER WIDTH=16>
<IMG SRC="<%= rdat.getFullImagePath("icn_down.gif") %>" ALT="[Down]" BORDER=0 WIDTH=16 HEIGHT=16>
</TD>
<TD ALIGN=LEFT CLASS="content"><%= stdfont %>
Click this symbol to move the specified sidebox down on your Front Page.
</FONT></TD>
</TR>
<TR VALIGN=MIDDLE>
<TD ALIGN=CENTER WIDTH=16>
<IMG SRC="<%= rdat.getFullImagePath("icn_up.gif") %>" ALT="[Up]" BORDER=0 WIDTH=16 HEIGHT=16>
</TD>
<TD ALIGN=LEFT CLASS="content"><%= stdfont %>
Click this symbol to move the specified sidebox up on your Front Page.
</FONT></TD>
</TR>
<TR VALIGN=MIDDLE>
<TD ALIGN=CENTER WIDTH=16>
<IMG SRC="<%= rdat.getFullImagePath("icn_x.gif") %>" ALT="[Remove]" BORDER=0 WIDTH=16 HEIGHT=16>
</TD>
<TD ALIGN=LEFT CLASS="content"><%= stdfont %>
Click this symbol to remove the specified sidebox from your Front Page.
</FONT></TD>
</TR>
</TABLE>
<% } else { %>
<%= stdfont %><EM>You have no sideboxes on your Front Page.</EM></FONT>
<% } // end if %>
<% if (data.getOutListSize()>0) { %>
<P>
<FORM METHOD="POST" ACTION="<%= rdat.getEncodedServletPath("settings") %>">
<DIV CLASS="content"><%= stdfont %>
<INPUT TYPE="HIDDEN" NAME="cmd" VALUE="BA">
<B>Add sidebox:</B>&nbsp;&nbsp;
<SELECT NAME="box" SIZE=1>
<% for (i=0; i<data.getOutListSize(); i++) { %>
<% d = data.getOutListItem(i); %>
<OPTION VALUE="<%= d.getID() %>"><%= StringUtil.encodeHTML(d.getTitle(false)) %></OPTION>
<% } // end for %>
</SELECT>&nbsp;&nbsp;
<INPUT TYPE="IMAGE" SRC="<%= rdat.getFullImagePath("bn_add.gif") %>" NAME="add" ALT="Add"
ALIGN=MIDDLE WIDTH=80 HEIGHT=24 BORDER=0>
</FONT></DIV>
</FORM>
<% } // end if %>

View File

@ -0,0 +1,29 @@
<%--
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):
--%>
<%@ page import = "com.silverwrist.venice.servlets.Variables" %>
<%@ page import = "com.silverwrist.venice.servlets.format.*" %>
<%@ page import = "com.silverwrist.venice.servlets.format.sideboxes.JSPSideBox" %>
<%
JSPSideBox data = JSPSideBox.retrieve(request);
Variables.failIfNull(data);
RenderData rdat = RenderConfig.createRenderData(application,request,response);
%>
<% if (rdat.useHTMLComments()) { %><!-- Test Sidebox Here --><% } %>
<%= rdat.getStdFontTag(ColorSelectors.SIDEBOX_CONTENT_FOREGROUND,2) %>
<%= data.replaceStrings("${test1}<BR>${test2}<BR>${test3}") %>
</FONT>