the erbo_reorg_04202002 branch is no more...development continues on the

trunk while the stable_branch_04202002 branch takes the 'stable' role
This commit is contained in:
Eric J. Bowersox 2002-04-24 06:39:29 +00:00
parent a459e02e79
commit e4e0223452
79 changed files with 2275 additions and 1043 deletions

View File

@ -18,6 +18,7 @@
importPackage(java.util);
importPackage(Packages.com.silverwrist.venice.core);
importPackage(Packages.com.silverwrist.venice.ui.helpers);
importPackage(Packages.com.silverwrist.venice.ui.rpc);
rinput = bsf.lookupBean("request");
@ -32,7 +33,8 @@ if ("destroy"==call_name)
vlib.output(new XmlRpcFault(XmlRpcFault.INVALID_PARAMS,"parameter count mismatch"));
else
{ // end the session
rinput.endSession();
sctl = vlib.querySessionControl(rinput);
sctl.endSession();
vlib.output(vlib.booleanObject(true));
} // end else

View File

@ -38,7 +38,8 @@ if ("GET"==rinput.verb)
{ // set up the invitation screen parameters
rinput.setRequestAttribute("invitation.title","Send Community Invitation:");
rinput.setRequestAttribute("invitation.subtitle",comm.name);
rinput.setRequestAttribute("invitation.action",rinput.formatURL("comm/invite.js.vs",LinkTypes.SERVLET));
html = vlib.queryHTMLRendering(rinput);
rinput.setRequestAttribute("invitation.action",html.formatURL("comm/invite.js.vs",html.SERVLET));
rinput.setRequestAttribute("invitation.params",
"<INPUT TYPE=\"HIDDEN\" NAME=\"cc\" VALUE=\"" + comm.communityID + "\">");

View File

@ -43,7 +43,8 @@ if ("GET"==rinput.verb)
{ // create and initialize the PhotoUploader
rc = new PhotoUploader("Upload Community Logo","comm/photo.js.vs",LinkTypes.SERVLET);
rc.addHiddenParameter("cc",comm.communityID);
rc.photoTag = rinput.getCommunityLogoTag(comm.getContactInfo().photoURL);
html = vlib.queryHTMLRendering(rinput);
rc.photoTag = html.getCommunityLogoTag(comm.getContactInfo().photoURL);
rc.label = "New community logo";
} // end try

View File

@ -68,7 +68,8 @@ try
rinput.setRequestAttribute("address.country",ce.name);
// Save off the community logo tag.
rinput.setRequestAttribute("community.logo",rinput.getCommunityLogoTag(ci.photoURL));
html = vlib.queryHTMLRendering(rinput);
rinput.setRequestAttribute("community.logo",html.getCommunityLogoTag(ci.photoURL));
// create the view object
rc = new JSPView("Community Profile: " + comm.name,"comm/profile.jsp");

View File

@ -41,7 +41,8 @@ if ("GET"==rinput.verb)
{ // set up the invitation screen parameters
rinput.setRequestAttribute("invitation.title","Send Conference Invitation:");
rinput.setRequestAttribute("invitation.subtitle",conf.name);
rinput.setRequestAttribute("invitation.action",rinput.formatURL("conf/invite_conf.js.vs",LinkTypes.SERVLET));
html = vlib.queryHTMLRendering(rinput);
rinput.setRequestAttribute("invitation.action",html.formatURL("conf/invite_conf.js.vs",html.SERVLET));
rinput.setRequestAttribute("invitation.params",
"<INPUT TYPE=\"HIDDEN\" NAME=\"cc\" VALUE=\"" + comm.communityID
+ "\"><INPUT TYPE=\"HIDDEN\" NAME=\"conf\" VALUE=\"" + conf.confID + "\">");

View File

@ -45,8 +45,8 @@ if ("GET"==rinput.verb)
{ // set up the invitation screen parameters
rinput.setRequestAttribute("invitation.title","Send Topic Invitation:");
rinput.setRequestAttribute("invitation.subtitle",topic.name);
rinput.setRequestAttribute("invitation.action",
rinput.formatURL("conf/invite_topic.js.vs",LinkTypes.SERVLET));
html = vlib.queryHTMLRendering(rinput);
rinput.setRequestAttribute("invitation.action",html.formatURL("conf/invite_topic.js.vs",html.SERVLET));
rinput.setRequestAttribute("invitation.params",
"<INPUT TYPE=\"HIDDEN\" NAME=\"cc\" VALUE=\"" + comm.communityID
+ "\"><INPUT TYPE=\"HIDDEN\" NAME=\"conf\" VALUE=\"" + conf.confID

View File

@ -92,8 +92,9 @@ try
rc.topCustom = conf.getCustomBlock(ConferenceContext.CUST_BLOCK_TOP);
rc.bottomCustom = conf.getCustomBlock(ConferenceContext.CUST_BLOCK_BOTTOM);
rc.title = topic.name;
html = vlib.queryHTMLRendering(rinput);
rc.subtitle = topic.totalMessages + " Total; " + rc.unread + " New; Last: "
+ rinput.formatDate(topic.lastUpdateDate);
+ html.formatDate(topic.lastUpdateDate);
// do a "read new" on this topic
if (read_new)

View File

@ -93,10 +93,12 @@ else if (op=="login")
logger.debug("User \"" + user.userName + "\" logged in successfully");
// If the user wants a cookie, give it to them!
if (dlg.getValue("saveme").booleanValue())
rinput.savePersistentCookie(RequestInput.LOGIN_COOKIE,user.getAuthenticationToken(),
RequestInput.LOGIN_COOKIE_AGE);
{ // If the user wants a cookie, give it to them!
cctl = vlib.queryCookieControl(rinput);
cctl.savePersistentCookie(CookieControl.LOGIN_COOKIE,user.getAuthenticationToken(),
CookieControl.LOGIN_COOKIE_AGE);
} // end if
// Clear the left menus (to force recomputation) and bounce us back to whereever we were
// supposed to go.

View File

@ -30,8 +30,10 @@ user = rinput.user;
if (user.isLoggedIn())
{ // user is logged in - we want to log out
// TODO: only remove the login cookie if it was actually set!
rinput.deleteCookie(RequestInput.LOGIN_COOKIE); // remove the login cookie
rinput.endSession();
cctl = vlib.queryCookieControl(rinput);
cctl.deleteCookie(CookieControl.LOGIN_COOKIE); // remove the login cookie
sctl = vlib.querySessionControl(rinput);
sctl.endSession();
target = "top.js.vs"; // take 'em back to the top

View File

@ -37,8 +37,9 @@ if (user.isLoggedIn())
// Return the text of the User Agreement.
rinput.displayLogin = false;
rc = new TextMessage(rinput.getStockMessage("user-agreement-title"),
rinput.getStockMessage("user-agreement-subtitle"));
html = vlib.queryHTMLRendering(rinput);
rc = new TextMessage(html.getStockMessage("user-agreement-title"),
html.getStockMessage("user-agreement-subtitle"));
rc.text = rinput.getStockMessage("user-agreement");
rc.addButton(LinkTypes.SERVLET,"new_account_2.js.vs?tgt=" + vlib.encodeURL(target),"ua_accept");
rc.addButton(LinkTypes.SERVLET,"top.js.vs","ua_decline");

View File

@ -97,7 +97,9 @@ if (op=="create")
// save the contact info for the user (this also sends email confirmation messages as needed)
uc.putContactInfo(ci);
rinput.replaceUser(uc); // this is now the user for this session!
// this is now the user for this session!
sctl = vlib.querySessionControl(rinput);
sctl.replaceUser(uc);
// Now bounce us immediately to the Verification dialog.
rc = new Redirect("verify_email.js.vs?tgt=" + vlib.encodeURL(target),LinkTypes.SERVLET);

View File

@ -45,7 +45,8 @@ if ("GET"==rinput.verb)
{ // create and initialize the PhotoUploader
rc = new PhotoUploader("Upload User Photo","profile_photo.js.vs",LinkTypes.SERVLET);
rc.addHiddenParameter("tgt",target);
rc.photoTag = rinput.getUserPhotoTag(user.getContactInfo().photoURL);
html = vlib.queryHTMLRendering(rinput);
rc.photoTag = html.getUserPhotoTag(user.getContactInfo().photoURL);
rc.label = "New user photo";
rinput.displayLogin = false;

View File

@ -88,7 +88,8 @@ try
rinput.setRequestAttribute("address.lastline",buf.toString());
// Save off the user photo tag.
rinput.setRequestAttribute("user.photo",rinput.getUserPhotoTag(prof.photoURL));
html = vlib.queryHTMLRendering(rinput);
rinput.setRequestAttribute("user.photo",html.getUserPhotoTag(prof.photoURL));
// Create a view object and send it out.
rc = new JSPView("User Profile - " + username,"user_profile.jsp");

View File

@ -50,7 +50,8 @@ if ("GET"==rinput.verb)
admuser = adm.getUserContext(uid);
rc = new PhotoUploader("Upload User Photo","sysadmin/modify_photo.js.vs",LinkTypes.SERVLET);
rc.addHiddenParameter("uid",uid);
rc.photoTag = rinput.getUserPhotoTag(admuser.getContactInfo().photoURL);
html = vlib.queryHTMLRendering(rinput);
rc.photoTag = html.getUserPhotoTag(admuser.getContactInfo().photoURL);
rc.label = "New user photo";
} // end try

View File

@ -20,15 +20,8 @@ package com.silverwrist.venice.except;
import java.io.PrintStream;
import java.io.PrintWriter;
public class InternalStateError extends RuntimeException
public class InternalStateError extends VeniceRuntimeException
{
/*--------------------------------------------------------------------------------
* Attributes
*--------------------------------------------------------------------------------
*/
private Throwable inner = null; // internal "root cause" exception
/*--------------------------------------------------------------------------------
* Constructors
*--------------------------------------------------------------------------------
@ -61,8 +54,7 @@ public class InternalStateError extends RuntimeException
*/
public InternalStateError(Throwable inner)
{
super(inner.getMessage());
this.inner = inner;
super(inner);
} // end constructor
@ -74,78 +66,8 @@ public class InternalStateError extends RuntimeException
*/
public InternalStateError(String msg, Throwable inner)
{
super(msg);
this.inner = inner;
super(msg,inner);
} // end constructor
/*--------------------------------------------------------------------------------
* Overrides from class Throwable
*--------------------------------------------------------------------------------
*/
/**
* Prints this exception and its backtrace to the standard error stream. Also prints the backtrace
* of any "wrapped" exception.
*
* @see java.lang.System#err
*/
public void printStackTrace()
{
this.printStackTrace(System.err);
} // end printStackTrace
/**
* Prints this exception and its backtrace to the specified <CODE>PrintStream</CODE>. Also prints the
* backtrace of any "wrapped" exception.
*
* @param s <CODE>PrintStream</CODE> to use for output.
*/
public void printStackTrace(PrintStream s)
{
super.printStackTrace(s);
if (inner!=null)
{ // print the inner stack trace
s.print("Root cause: ");
inner.printStackTrace(s);
} // end if
} // end printStackTrace
/**
* Prints this exception and its backtrace to the specified <CODE>PrintWriter</CODE>. Also prints the
* backtrace of any "wrapped" exception.
*
* @param s <CODE>PrintWriter</CODE> to use for output.
*/
public void printStackTrace(PrintWriter s)
{
super.printStackTrace(s);
if (inner!=null)
{ // print the inner stack trace
s.print("Root cause: ");
inner.printStackTrace(s);
} // end if
} // end printStackTrace
/*--------------------------------------------------------------------------------
* External operations
*--------------------------------------------------------------------------------
*/
/**
* Returns the exception wrapped by this exception, or <CODE>null</CODE> if there is none.
*
* @return See above.
*/
public Throwable getException()
{
return inner;
} // end getException
} // end class InternalStateError

View File

@ -0,0 +1,60 @@
/*
* 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) 2002 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
package com.silverwrist.venice.except;
/**
* An exception thrown by objects that implement <CODE>ServiceProvider</CODE> when they
* don't implement a service of a specified class and ID.
*
* @author Eric J. Bowersox &lt;erbo@silcom.com&gt;
* @version X
* @see com.silverwrist.venice.util.ServiceProvider
*/
public class NoSuchServiceException extends VeniceRuntimeException
{
/*--------------------------------------------------------------------------------
* Constructors
*--------------------------------------------------------------------------------
*/
/**
* Constructs a new <CODE>NoSuchServiceException</CODE>.
*
* @param context Context for the generated exception.
* @param klass Class of the service that was requested.
*/
public NoSuchServiceException(String context, Class klass)
{
super(context + ": no service with class " + klass.getName());
} // end constructor
/**
* Constructs a new <CODE>NoSuchServiceException</CODE>.
*
* @param context Context for the generated exception.
* @param klass Class of the service that was requested.
* @param serviceid ID of the service that was requested.
*/
public NoSuchServiceException(String context, Class klass, String serviceid)
{
super(context + ": no service with class " + klass.getName() + " and ID " + serviceid);
} // end constructor
} // end class NoSuchServiceException

View File

@ -112,12 +112,7 @@ public class VeniceException extends Exception implements SupplyFaultCode
public void printStackTrace(PrintStream s)
{
super.printStackTrace(s);
if (inner!=null)
{ // print the inner stack trace
s.print("Root cause: ");
inner.printStackTrace(s);
} // end if
printRootCause(s,inner);
} // end printStackTrace
@ -130,12 +125,7 @@ public class VeniceException extends Exception implements SupplyFaultCode
public void printStackTrace(PrintWriter s)
{
super.printStackTrace(s);
if (inner!=null)
{ // print the inner stack trace
s.print("Root cause: ");
inner.printStackTrace(s);
} // end if
printRootCause(s,inner);
} // end printStackTrace
@ -150,6 +140,33 @@ public class VeniceException extends Exception implements SupplyFaultCode
} // end getFaultCode
/*--------------------------------------------------------------------------------
* External static operations
*--------------------------------------------------------------------------------
*/
public static void printRootCause(PrintStream s, Throwable t)
{
if (t!=null)
{ // print the inner stack trace
s.print("Root cause: ");
t.printStackTrace(s);
} // end if
} // end printRootCause
public static void printRootCause(PrintWriter s, Throwable t)
{
if (t!=null)
{ // print the inner stack trace
s.print("Root cause: ");
t.printStackTrace(s);
} // end if
} // end printRootCause
/*--------------------------------------------------------------------------------
* External operations
*--------------------------------------------------------------------------------

View File

@ -0,0 +1,159 @@
/*
* 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) 2002 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
package com.silverwrist.venice.except;
import java.io.PrintStream;
import java.io.PrintWriter;
/**
* The root exception of all runtime exceptions thrown by the Venice core code. It is capable of
* "wrapping" another exception within it.
*
* @author Eric J. Bowersox &lt;erbo@silcom.com&gt;
* @version X
*/
public class VeniceRuntimeException extends RuntimeException implements SupplyFaultCode
{
/*--------------------------------------------------------------------------------
* Attributes
*--------------------------------------------------------------------------------
*/
private Throwable inner = null; // internal "root cause" exception
/*--------------------------------------------------------------------------------
* Constructors
*--------------------------------------------------------------------------------
*/
/**
* Constructs a new <CODE>VeniceRuntimeException</CODE>.
*/
public VeniceRuntimeException()
{
super();
} // end constructor
/**
* Constructs a new <CODE>VeniceRuntimeException</CODE> with a text message.
*
* @param msg The message to set in this exception.
*/
public VeniceRuntimeException(String msg)
{
super(msg);
} // end constructor
/**
* Constructs a new <CODE>VeniceRuntimeException</CODE> wrapping another exception.
*
* @param inner The exception wrapped by this one.
*/
public VeniceRuntimeException(Throwable inner)
{
super(inner.getMessage());
this.inner = inner;
} // end constructor
/**
* Constructs a new <CODE>VeniceRuntimeException</CODE> wrapping another exception.
*
* @param msg The message to set in this exception.
* @param inner The exception wrapped by this one.
*/
public VeniceRuntimeException(String msg, Throwable inner)
{
super(msg);
this.inner = inner;
} // end constructor
/*--------------------------------------------------------------------------------
* Overrides from class Throwable
*--------------------------------------------------------------------------------
*/
/**
* Prints this exception and its backtrace to the standard error stream. Also prints the backtrace
* of any "wrapped" exception.
*
* @see java.lang.System#err
*/
public void printStackTrace()
{
this.printStackTrace(System.err);
} // end printStackTrace
/**
* Prints this exception and its backtrace to the specified <CODE>PrintStream</CODE>. Also prints the
* backtrace of any "wrapped" exception.
*
* @param s <CODE>PrintStream</CODE> to use for output.
*/
public void printStackTrace(PrintStream s)
{
super.printStackTrace(s);
VeniceException.printRootCause(s,inner);
} // end printStackTrace
/**
* Prints this exception and its backtrace to the specified <CODE>PrintWriter</CODE>. Also prints the
* backtrace of any "wrapped" exception.
*
* @param s <CODE>PrintWriter</CODE> to use for output.
*/
public void printStackTrace(PrintWriter s)
{
super.printStackTrace(s);
VeniceException.printRootCause(s,inner);
} // end printStackTrace
/*--------------------------------------------------------------------------------
* Implementations from interface SupplyFaultCode
*--------------------------------------------------------------------------------
*/
public int getFaultCode()
{
return 0;
} // end getFaultCode
/*--------------------------------------------------------------------------------
* External operations
*--------------------------------------------------------------------------------
*/
/**
* Returns the exception wrapped by this exception, or <CODE>null</CODE> if there is none.
*
* @return See above.
*/
public Throwable getException()
{
return inner;
} // end getException
} // end class VeniceException

View File

@ -17,10 +17,8 @@
*/
package com.silverwrist.venice.ui;
import java.awt.Dimension;
import java.io.InputStream;
import java.io.IOException;
import java.util.Date;
import java.util.Enumeration;
import java.util.Map;
import org.w3c.dom.Document;
@ -33,163 +31,333 @@ import com.silverwrist.venice.ui.dlg.Dialog;
import com.silverwrist.venice.ui.helpers.ErrorBox;
import com.silverwrist.venice.ui.menus.MenuComponent;
import com.silverwrist.venice.ui.script.ScriptManager;
import com.silverwrist.venice.util.ServiceProvider;
public interface RequestInput extends LinkTypes
public interface RequestInput extends ServiceProvider
{
public static final String LOGIN_COOKIE = "VeniceAuth";
public static final int LOGIN_COOKIE_AGE = 60*60*24*365; // one year
public static final String LEFT_MENU_SESSION_ATTR = "LeftMenu";
/**
* Returns a <CODE>String</CODE> containing the real path for a given virtual path. For example,
* the virtual path &quot;/index.html&quot; has a real path of whatever file on the server's filesystem
* would be served by a request for &quot;/index.html&quot;.<P>
* This method returns <CODE>null</CODE> if the virtual path cannot be translated to a real path for
* any reason.
*
* @param s A <CODE>String</CODE> specifying a virtual path.
* @return A <CODE>String</CODE> specifying the real path, or <CODE>null</CODE> if the translation cannot
* be performed.
*/
public abstract String mapPath(String s);
/**
* Returns the portion of the request URI that indicates the context of the request, i.e. the servlet
* context under which Venice is installed. The context path always comes first in a request URI. The
* path starts with a &quot;/&quot; character but does not end with a &quot;/&quot; character.
*
* @return A <CODE>String</CODE> specifying the portion of the request URI that indicates the context
* of the request.
*/
public abstract String getContextPath();
/**
* Returns the part of this request's URI that calls the servlet. This includes either the servlet name
* or a path to the servlet, but does not include any extra path information or a query string.
*
* @return A <CODE>String</CODE> containing the name or path of the servlet being called, as specified
* in the request URI.
*/
public abstract String getServletPath();
/**
* Returns any extra path information associated with the URI the client sent when it made this request.
* The extra path information follows the servlet path but precedes the query string. This method
* returns <CODE>null</CODE> if there was no extra path information. In Venice, the path information is
* used to specify parameters in certain servlets.
*
* @return A <CODE>String</CODE> specifying extra path information that comes after the servlet path
* but before the query string in the request URI; or <CODE>null</CODE> if the URI does not
* have any extra path information.
*/
public abstract String getPathInfo();
/**
* Returns the query string that is contained in the request URI after the path. This method returns
* <CODE>null</CODE> if the URI does not have a query string.
*
* @return A <CODE>String</CODE> containing the query string or <CODE>null</CODE> if the URI contains
* no query string.
*/
public abstract String getQueryString();
/**
* Returns the name of the HTTP method with which this request was made, for example, GET, POST, or PUT.
*
* @return A <CODE>String</CODE> specifying the name of the method with which this request was made.
*/
public abstract String getVerb();
/**
* Returns the Internet Protocol (IP) address of the client that sent the request.
*
* @return A <CODE>String</CODE> containing the IP address of the client that sent the request.
*/
public abstract String getSourceAddress();
public abstract void endSession();
/**
* Returns <CODE>true</CODE> if the request parameter with the specified name is defined,
* <CODE>false</CODE> if not. For standard Venice requests, parameters are contained in the
* query string or posted form data.
*
* @param name Parameter name to be checked.
* @return See above.
*/
public abstract boolean hasParameter(String name);
/**
* Returns the value of a request parameter as a <CODE>String</CODE>, or <CODE>null</CODE> if the
* parameter does not exist. For standard Venice requests, parameters are contained in the query
* string or posted form data.<P>
* You should only use this method when you are sure the parameter has only one value. If the parameter
* might have more than one value, use {@link #getParameterValues(java.lang.String)}.<P>
* If you use this method with a multivalued parameter, the value returned is equal to the first value
* in the array returned by <CODE>getParameterValues</CODE>.
*
* @param name A <CODE>String</CODE> specifying the name of the parameter.
* @return A <CODE>String</CODE> representing the single value of the parameter.
* @see #getParameterValues(java.lang.String)
*/
public abstract String getParameter(String name);
/**
* Returns the value of a request parameter as a <CODE>int</CODE>, or a specified default value if
* the parameter does not exist. For standard Venice requests, parameters are contained in the query
* string or posted form data.<P>
* If you use this method with a multivalued parameter, the value returned is equal to the
* <CODE>int</CODE> equivalent of the first value in the array returned by <CODE>getParameterValues</CODE>.
*
* @param name A <CODE>String</CODE> specifying the name of the parameter.
* @param default_value The default value to use for the parameter if the specified parameter does not exist.
* @return An <CODE>int</CODE> representing the single value of the parameter.
*/
public abstract int getParameterInt(String name, int default_value);
/**
* Returns the value of a request parameter as a <CODE>short</CODE>, or a specified default value if
* the parameter does not exist. For standard Venice requests, parameters are contained in the query
* string or posted form data.<P>
* If you use this method with a multivalued parameter, the value returned is equal to the
* <CODE>short</CODE> equivalent of the first value in the array returned by <CODE>getParameterValues</CODE>.
*
* @param name A <CODE>String</CODE> specifying the name of the parameter.
* @param default_value The default value to use for the parameter if the specified parameter does not exist.
* @return A <CODE>short</CODE> representing the single value of the parameter.
*/
public abstract short getParameterShort(String name, short default_value);
/**
* Returns the value of a request parameter as a <CODE>long</CODE>, or a specified default value if
* the parameter does not exist. For standard Venice requests, parameters are contained in the query
* string or posted form data.<P>
* If you use this method with a multivalued parameter, the value returned is equal to the
* <CODE>long</CODE> equivalent of the first value in the array returned by <CODE>getParameterValues</CODE>.
*
* @param name A <CODE>String</CODE> specifying the name of the parameter.
* @param default_value The default value to use for the parameter if the specified parameter does not exist.
* @return A <CODE>long</CODE> representing the single value of the parameter.
*/
public abstract long getParameterLong(String name, long default_value);
/**
* Returns an <CODE>Enumeration</CODE> of <CODE>String</CODE> objects containing the names of the
* parameters contained in this request. If the request has no parameters, the method returns an empty
* <CODE>Enumeration.</CODE>
*
* @return An <CODE>Enumeration</CODE> of <CODE>String</CODE> objects, each <CODE>String</CODE>
* containing the name of a request parameter, or an empty <CODE>Enumeration</CODE> if the
* request has no parameters.
*/
public abstract Enumeration getParameterNames();
/**
* Returns an array of <CODE>String</CODE> objects containing all of the values the given request
* parameter has, or <CODE>null</CODE> if the parameter does not exist.<P>
* If the parameter has a single value, the array has a length of 1.
*
* @param name A <CODE>String</CODE> containing the name of the parameter whose value is requested.
* @return An array of <CODE>String</CODE> objects containing the parameter's values.
* @see #getParameter(java.lang.String)
*/
public abstract String[] getParameterValues(String name);
/**
* Returns <CODE>true</CODE> if the specified parameter is a file parameter, <CODE>false</CODE> if
* not. If the parameter does not exist, the return value is <CODE>false</CODE>.
*
* @param name A <CODE>String</CODE> containing the name of the parameter to test.
* @return See above.
*/
public abstract boolean isFileParam(String name);
/**
* Returns the MIME type of the specified parameter. If the type cannot be determined, the return
* value is <CODE>null</CODE>.<P>
* N.B.: For non-file parameters, or all parameters to a request that is not a file upload, the MIME
* type is &quot;text/plain&quot;.
*
* @param name A <CODE>String</CODE> containing the name of the parameter to test.
* @return See above.
*/
public abstract String getParameterType(String name);
/**
* Returns the size in bytes of the specified parameter. If the size cannot be determined, the return
* value is -1.<P>
* N.B.: For non-file parameters, or all parameters to a request that is not a file upload, the size
* is the number of bytes occupied by the parameter, expressed in UTF-8 encoding.
*
* @param name A <CODE>String</CODE> containing the name of the parameter to test.
* @return See above.
*/
public abstract int getParameterSize(String name);
/**
* Returns an <CODE>InputStream</CODE> reading from the data of the named file parameter. If the
* named parameter does not exist or is not a file parameter, returns <CODE>null;
*
* @param name A <CODE>String</CODE> containing the name of the parameter whose value is requested.
* @return See above.
* @exception com.silverwrist.util.ServletMultipartException If there is a problem retrieving
* the parameter data stream.
*/
public abstract InputStream getParameterDataStream(String name) throws ServletMultipartException;
public abstract Document getRequestDocument();
public abstract boolean sessionBound();
/**
* Returns <CODE>true</CODE> if the parameter set reflects the clicking of an image button with a
* specified name, <CODE>false</CODE> if not.
*
* @param name A <CODE>String</CODE> containing the name of the image button to test.
* @return See above.
*/
public abstract boolean isImageButtonClicked(String name);
/**
* Returns the application-level attribute with the given name, or <CODE>null</CODE> if there is no
* attribute by that name.
*
* @param name A <CODE>String</CODE> specifying the name of the attribute.
* @return An <CODE>Object</CODE> containing the value of the attribute, or <CODE>null</CODE> if no
* attribute exists matching the given name.
*/
public abstract Object getAppAttribute(String name);
/**
* Sets the application-level attribute with the given name.
*
* @param name A <CODE>String</CODE> specifying the name of the attribute.
* @param o The object to be bound as the value of that attribute, or <CODE>null</CODE> if the binding
* is to be removed.
*/
public abstract void setAppAttribute(String name, Object o);
/**
* Returns the session-level attribute with the given name, or <CODE>null</CODE> if there is no
* attribute by that name.
*
* @param name A <CODE>String</CODE> specifying the name of the attribute.
* @return An <CODE>Object</CODE> containing the value of the attribute, or <CODE>null</CODE> if no
* attribute exists matching the given name.
*/
public abstract Object getSessionAttribute(String name);
/**
* Sets the session-level attribute with the given name.
*
* @param name A <CODE>String</CODE> specifying the name of the attribute.
* @param o The object to be bound as the value of that attribute, or <CODE>null</CODE> if the binding
* is to be removed.
*/
public abstract void setSessionAttribute(String name, Object o);
/**
* Returns the request-level attribute with the given name, or <CODE>null</CODE> if there is no
* attribute by that name.
*
* @param name A <CODE>String</CODE> specifying the name of the attribute.
* @return An <CODE>Object</CODE> containing the value of the attribute, or <CODE>null</CODE> if no
* attribute exists matching the given name.
*/
public abstract Object getRequestAttribute(String name);
/**
* Sets the request-level attribute with the given name.
*
* @param name A <CODE>String</CODE> specifying the name of the attribute.
* @param o The object to be bound as the value of that attribute, or <CODE>null</CODE> if the binding
* is to be removed.
*/
public abstract void setRequestAttribute(String name, Object o);
public abstract void savePersistentCookie(String name, String value, int max_age);
public abstract void saveTemporaryCookie(String name, String value);
public abstract void deleteCookie(String name);
/**
* Returns the instance of the Venice engine associated with the application.
*
* @return See above.
*/
public abstract VeniceEngine getEngine();
/**
* Returns the instance of the Venice user object associated with the session.
*
* @return See above.
*/
public abstract UserContext getUser();
public abstract void replaceUser(UserContext new_user);
public abstract ScriptManager getScriptManager();
public abstract String getStyleSheetData() throws IOException;
public abstract String getColor(int selector);
public abstract String getColor(String name);
public abstract boolean useHTMLComments();
public abstract String formatURL(String url, int type);
public abstract String formatDate(Date date);
public abstract String getFontTag(int colorsel, int size);
public abstract String getFontTag(String color, int size);
public abstract String getFontTag(int colorsel, String size);
public abstract String getFontTag(String color, String size);
public abstract int convertLinkType(String str);
/**
* Returns the current servlet location. This is used, for instance, as the context to return to
* after a login.
*
* @return The current servlet location.
*/
public abstract String getLocation();
/**
* Sets the &quot;current&quot; servlet location that is displayed. This is used, for instance,
* as the context to return to after a login.
*
* @param str The new location to be set.
*/
public abstract void setLocation(String str);
/**
* Returns <CODE>true</CODE> if the &quot;Log In&quot; link is to be displayed on the outer frame,
* <CODE>false</CODE> if not.
*
* @return See above.
*/
public abstract boolean getDisplayLogin();
/**
* Sets whether or not the &quot;Log In&quot; link is to be displayed on the outer frame.
*
* @param val <CODE>true</CODE> to display the &quot;Log In&quot; link on the outer frame,
* <CODE>false</CODE> to omit it.
*/
public abstract void setDisplayLogin(boolean val);
public abstract String getStockMessage(String key);
public abstract String getStockMessage(String key, Map vars);
public abstract String getStaticPath(String s);
public abstract String getExternalStaticPath(String s);
public abstract String getImagePath(String s);
public abstract MenuComponent getMenu(String name);
public abstract MenuComponent getMenu(String name, Map vars);
public abstract String getScriptName(String raw_name);
public abstract String getScriptName(boolean strip_ext);
public abstract String getScriptLoggerName(String raw_name);
public abstract String getScriptLoggerName();
public abstract String getRPCScriptName(String raw_name);
public abstract String getRPCScriptLoggerName(String raw_name);
public abstract Dialog getDialog(String name);
public abstract Content[] getSideBoxes() throws AccessError, DataException;
public abstract String getUserPhotoTag(String url);
public abstract String getUserPhotoTag(String url, Dimension size);
public abstract CommunityContext getCommunity();
public abstract CommunityContext getCommunity(boolean required, String on_error) throws ErrorBox;
public abstract String getActivityString(Date date);
public abstract String getDefaultServletAddress(CommunityContext comm);
public abstract String getCommunityLogoTag(String url);
public abstract String expandServletPath(String spath);
public abstract void registerCleanup(AutoCleanup ac);
public abstract void pushSession(VeniceUISession sess);
public abstract void popSession();
} // end interface RequestInput

View File

@ -11,20 +11,18 @@
*
* 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.
* Copyright (C) 2001-02 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
package com.silverwrist.venice.ui;
import java.awt.Dimension;
import java.io.IOException;
import java.io.Writer;
import java.util.Date;
import java.util.Map;
import javax.servlet.ServletException;
import com.silverwrist.venice.util.ServiceProvider;
public interface RequestOutput extends LinkTypes
public interface RequestOutput extends ServiceProvider, LinkTypes
{
public abstract Writer getWriter() throws IOException;
@ -54,42 +52,4 @@ public interface RequestOutput extends LinkTypes
public abstract void writeContentHeader(String primary, String secondary) throws IOException;
public abstract String formatURL(String url, int type);
public abstract String formatDate(Date date);
public abstract String getColor(int selector);
public abstract String getColor(String name);
public abstract String getFontTag(int colorsel, int size);
public abstract String getFontTag(String color, int size);
public abstract String getFontTag(int colorsel, String size);
public abstract String getFontTag(String color, String size);
public abstract String getStockMessage(String key);
public abstract String getStockMessage(String key, Map vars);
public abstract String getStaticPath(String s);
public abstract String getExternalStaticPath(String s);
public abstract String getImagePath(String s);
public abstract String getButtonVisual(String id);
public abstract String getButtonInput(String id);
public abstract String getUserPhotoTag(String url);
public abstract String getUserPhotoTag(String url, Dimension size);
public abstract String getActivityString(Date date);
public abstract String getCommunityLogoTag(String url);
} // end interface RequestOutput

View File

@ -11,7 +11,7 @@
*
* 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.
* Copyright (C) 2001-02 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
@ -22,8 +22,9 @@ import java.util.*;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
import com.silverwrist.venice.ui.*;
import com.silverwrist.venice.ui.helpers.HTMLRendering;
public class PostBoxTag extends VeniceConfBodyTagSupport implements ColorSelectors
public class PostBoxTag extends VeniceConfBodyTagSupport
{
/*--------------------------------------------------------------------------------
* Attributes
@ -53,7 +54,8 @@ public class PostBoxTag extends VeniceConfBodyTagSupport implements ColorSelecto
{
if (action==null)
throw new JspTagException("<post:box/> action= attribute not specified!");
real_type = getRequestInput().convertLinkType(type);
HTMLRendering html = (HTMLRendering)(getRequestInput().queryService(HTMLRendering.class));
real_type = html.convertLinkType(type);
if (real_type<0)
throw new JspTagException("<post:box/> type= attribute not a valid link type");
return EVAL_BODY_TAG;
@ -76,11 +78,13 @@ public class PostBoxTag extends VeniceConfBodyTagSupport implements ColorSelecto
throw new JspTagException("<post:box/> tag has no <post:text/> tag inside it!");
if (buttons.isEmpty())
throw new JspTagException("<post:box/> tag has no <post:button/> tags inside it!");
RequestOutput ro = getRequestOutput();
HTMLRendering html = (HTMLRendering)(getRequestOutput().queryService(HTMLRendering.class));
try
{ // write out what we came here to accomplish
JspWriter out = pageContext.getOut();
out.write("<FORM METHOD=\"POST\" ACTION=\"" + ro.formatURL(action,real_type)
out.write("<FORM METHOD=\"POST\" ACTION=\"" + html.formatURL(action,real_type)
+ "\"><DIV CLASS=\"content\">\n");
Iterator it = params.entrySet().iterator();
while (it.hasNext())
@ -91,7 +95,7 @@ public class PostBoxTag extends VeniceConfBodyTagSupport implements ColorSelecto
} // end while
String my_font = ro.getFontTag(CONTENT_FOREGROUND,"content");
String my_font = html.getFontTag(html.CONTENT_FOREGROUND,"content");
out.write("<TABLE BORDER=0 CELLPADDING=0>\n");
if (newtopic_name!=null)
{ // write the "new topic name" field
@ -117,7 +121,7 @@ public class PostBoxTag extends VeniceConfBodyTagSupport implements ColorSelecto
out.write(" CHECKED");
out.write("> Attach a file</FONT>\n</TD></TR>\n<TR>\n<TD ALIGN=LEFT CLASS=\"content\">\n"
+ my_font + "Message:</FONT>\n</TD>\n<TD ALIGN=RIGHT CLASS=\"content\">" + my_font
+ "\n<A HREF=\"" + ro.getExternalStaticPath("html-reference.html")
+ "\n<A HREF=\"" + html.getExternalStaticPath("html-reference.html")
+ "\" TARGET=\"_blank\">HTML Guide</A>\n</FONT></TD>\n</TR>\n<TR>"
+ "<TD ALIGN=LEFT COLSPAN=2 CLASS=\"cinput\">\n<TEXTAREA NAME=\"" + text_name
+ "\" WRAP=SOFT ROWS=7 COLS=51>");
@ -133,7 +137,7 @@ public class PostBoxTag extends VeniceConfBodyTagSupport implements ColorSelecto
first = false;
else
out.write("&nbsp;");
out.write(ro.getButtonInput(id) + "\n");
out.write(html.getButtonInput(id) + "\n");
} // end while

View File

@ -23,9 +23,10 @@ import javax.servlet.jsp.tagext.*;
import com.silverwrist.venice.db.PostLinkRewriter;
import com.silverwrist.venice.db.UserNameRewriter;
import com.silverwrist.venice.ui.*;
import com.silverwrist.venice.ui.helpers.HTMLRendering;
import com.silverwrist.venice.util.IDUtils;
public class PostRewriteTag extends VeniceConfBodyTagSupport implements LinkTypes
public class PostRewriteTag extends VeniceConfBodyTagSupport
{
/*--------------------------------------------------------------------------------
* Internal operations
@ -66,7 +67,7 @@ public class PostRewriteTag extends VeniceConfBodyTagSupport implements LinkType
} // end if
StringBuffer buf = new StringBuffer();
RequestInput ri = getRequestInput();
HTMLRendering html = (HTMLRendering)(getRequestInput().queryService(HTMLRendering.class));
String t;
int p;
@ -87,7 +88,7 @@ public class PostRewriteTag extends VeniceConfBodyTagSupport implements LinkType
if (p>0)
{ // append the post link to the "go" servlet path, and encode the lot
buf.append(ri.formatURL("go/" + t.substring(0,p),SERVLET));
buf.append(html.formatURL("go/" + t.substring(0,p),html.SERVLET));
t = t.substring(p);
} // end if
@ -130,7 +131,7 @@ public class PostRewriteTag extends VeniceConfBodyTagSupport implements LinkType
if (p>0)
{ // append the post link to the "user" servlet path, and encode the lot
buf.append(ri.formatURL("user/" + t.substring(0,p),SERVLET));
buf.append(html.formatURL("user/" + t.substring(0,p),html.SERVLET));
t = t.substring(p);
} // end if

View File

@ -11,7 +11,7 @@
*
* 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.
* Copyright (C) 2001-02 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
@ -25,6 +25,7 @@ import com.silverwrist.venice.core.*;
import com.silverwrist.venice.except.*;
import com.silverwrist.venice.ui.*;
import com.silverwrist.venice.ui.conf.*;
import com.silverwrist.venice.ui.helpers.HTMLRendering;
import com.silverwrist.venice.ui.servlet.RequestImpl;
public class FindPostView implements ContentJSP
@ -35,6 +36,7 @@ public class FindPostView implements ContentJSP
*/
private RequestInput rinput = null;
private HTMLRendering html = null;
private CommunityContext comm;
private ConferenceContext conf;
private TopicContext topic;
@ -100,12 +102,14 @@ public class FindPostView implements ContentJSP
public void initialize(RequestInput req)
{
rinput = req;
html = (HTMLRendering)(req.queryService(HTMLRendering.class));
} // end initialize
public void terminate(RequestInput req)
{
rinput = null;
html = null;
} // end terminate
@ -194,7 +198,7 @@ public class FindPostView implements ContentJSP
public final String formatDate(Date date)
{
return ((rinput==null) ? null : rinput.formatDate(date));
return ((html==null) ? null : html.formatDate(date));
} // end formatDate

View File

@ -11,7 +11,7 @@
*
* 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.
* Copyright (C) 2001-02 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
@ -26,6 +26,7 @@ import com.silverwrist.venice.core.*;
import com.silverwrist.venice.except.*;
import com.silverwrist.venice.ui.*;
import com.silverwrist.venice.ui.conf.*;
import com.silverwrist.venice.ui.helpers.HTMLRendering;
import com.silverwrist.venice.ui.servlet.RequestImpl;
public class PostsView implements ContentJSP
@ -52,6 +53,7 @@ public class PostsView implements ContentJSP
private boolean show_advanced = false;
private boolean no_bozos = false;
private RequestInput rinput = null;
private HTMLRendering html = null;
private List messages = Collections.EMPTY_LIST;
private TopicVisitOrder tvo = null;
private String topic_stem = "";
@ -121,12 +123,14 @@ public class PostsView implements ContentJSP
public void initialize(RequestInput req)
{
rinput = req;
html = (HTMLRendering)(req.queryService(HTMLRendering.class));
} // end initialize
public void terminate(RequestInput req)
{
rinput = null;
html = null;
} // end terminate
@ -428,13 +432,14 @@ public class PostsView implements ContentJSP
{
if ((photo_dims==null) || (photo_map==null))
return ""; // user photos not enabled
return ro.getUserPhotoTag((String)(photo_map.get(new Integer(uid))),photo_dims);
HTMLRendering html = (HTMLRendering)(ro.queryService(HTMLRendering.class));
return html.getUserPhotoTag((String)(photo_map.get(new Integer(uid))),photo_dims);
} // end getUserPhotoTag
public final String formatDate(Date date)
{
return ((rinput==null) ? null : rinput.formatDate(date));
return ((html==null) ? null : html.formatDate(date));
} // end formatDate

View File

@ -11,7 +11,7 @@
*
* 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.
* Copyright (C) 2001-02 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
@ -22,9 +22,10 @@ import org.w3c.dom.*;
import com.silverwrist.util.*;
import com.silverwrist.venice.except.*;
import com.silverwrist.venice.ui.*;
import com.silverwrist.venice.ui.helpers.HTMLRendering;
import com.silverwrist.venice.util.XMLLoader;
public abstract class BaseDialogField implements DialogField, ColorSelectors
public abstract class BaseDialogField implements DialogField
{
/*--------------------------------------------------------------------------------
* Attributes
@ -94,7 +95,9 @@ public abstract class BaseDialogField implements DialogField, ColorSelectors
private final void renderCaption(RequestOutput out) throws IOException
{
out.write(out.getFontTag(enabled ? CONTENT_FOREGROUND : CONTENT_DISABLED,"content")
HTMLRendering html = (HTMLRendering)(out.queryService(HTMLRendering.class));
out.write(html.getFontTag(enabled ? html.CONTENT_FOREGROUND : html.CONTENT_DISABLED,"content")
+ StringUtil.encodeHTML(caption));
if (!(StringUtil.isStringEmpty(caption2)))
out.write(" " + StringUtil.encodeHTML(caption2));
@ -102,7 +105,7 @@ public abstract class BaseDialogField implements DialogField, ColorSelectors
out.write(":");
out.write("</FONT>");
if (required)
out.write(out.getFontTag("red","content") + "*</FONT>");
out.write(html.getFontTag("red","content") + "*</FONT>");
} // end renderCaption

View File

@ -11,7 +11,7 @@
*
* 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.
* Copyright (C) 2001-02 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
@ -22,6 +22,7 @@ import org.w3c.dom.*;
import com.silverwrist.util.*;
import com.silverwrist.venice.except.*;
import com.silverwrist.venice.ui.*;
import com.silverwrist.venice.ui.helpers.HTMLRendering;
import com.silverwrist.venice.util.XMLLoader;
public class CategoryHeader implements DialogField, ColorSelectors
@ -88,7 +89,8 @@ public class CategoryHeader implements DialogField, ColorSelectors
public void render(RequestOutput out) throws IOException
{
String open_font = out.getFontTag(enabled ? CONTENT_FOREGROUND : CONTENT_DISABLED,"content");
HTMLRendering html = (HTMLRendering)(out.queryService(HTMLRendering.class));
String open_font = html.getFontTag(enabled ? html.CONTENT_FOREGROUND : html.CONTENT_DISABLED,"content");
out.write("<TR VALIGN=MIDDLE><TD ALIGN=RIGHT CLASS=\"content\">" + open_font + "<B>"
+ StringUtil.encodeHTML(caption) + ":</B></FONT></TD><TD ALIGN=LEFT CLASS=\"content\">");
if (rtext==null)

View File

@ -21,6 +21,7 @@ import java.io.IOException;
import org.w3c.dom.*;
import com.silverwrist.venice.except.*;
import com.silverwrist.venice.ui.*;
import com.silverwrist.venice.ui.helpers.HTMLRendering;
import com.silverwrist.venice.util.XMLLoader;
public class CommunityLogoField extends BaseDialogField implements LinkTypes
@ -86,9 +87,11 @@ public class CommunityLogoField extends BaseDialogField implements LinkTypes
protected void renderField(RequestOutput out) throws IOException
{
HTMLRendering html = (HTMLRendering)(out.queryService(HTMLRendering.class));
if (isEnabled())
out.write("<A HREF=\"" + out.formatURL(link_url,link_type) + "\">");
out.write(out.getCommunityLogoTag(getStringValue()));
out.write("<A HREF=\"" + html.formatURL(link_url,link_type) + "\">");
out.write(html.getCommunityLogoTag(getStringValue()));
if (isEnabled())
out.write("</A>");

View File

@ -24,9 +24,10 @@ import com.silverwrist.util.*;
import com.silverwrist.venice.except.*;
import com.silverwrist.venice.ui.*;
import com.silverwrist.venice.ui.config.RootConfig;
import com.silverwrist.venice.ui.helpers.HTMLRendering;
import com.silverwrist.venice.util.XMLLoader;
public class Dialog implements Cloneable, ContentDirect, ColorSelectors, LinkTypes
public class Dialog implements Cloneable, ContentDirect
{
/*--------------------------------------------------------------------------------
* Attributes
@ -40,7 +41,7 @@ public class Dialog implements Cloneable, ContentDirect, ColorSelectors, LinkTyp
private String formname; // name of the built-in form
private boolean file_form = false; // is this a file form?
private String action; // action URL
private int action_type = SERVLET; // action URL type
private int action_type = LinkTypes.SERVLET; // action URL type
private String error_message = null; // error message
private String instructions = null; // instructions
private Map command_buttons; // the command buttons
@ -354,19 +355,21 @@ public class Dialog implements Cloneable, ContentDirect, ColorSelectors, LinkTyp
public void render(RequestOutput out) throws IOException
{
HTMLRendering html = (HTMLRendering)(out.queryService(HTMLRendering.class));
out.writeContentHeader(title,subtitle);
// write the error message
if (error_message!=null)
out.write("<DIV ALIGN=\"center\" CLASS=\"content\">\n" + out.getFontTag(CONTENT_ERROR,"dlg-error")
out.write("<DIV ALIGN=\"center\" CLASS=\"content\">\n" + html.getFontTag(html.CONTENT_ERROR,"dlg-error")
+ "<B>" + StringUtil.encodeHTML(error_message) + "</B></FONT>\n</DIV><P>\n");
// Output the start of the form.
out.write("<FORM NAME=\"" + formname + "\"");
if (file_form)
out.write(" ENCTYPE=\"multipart/form-data\"");
out.write(" METHOD=POST ACTION=\"" + out.formatURL(action,action_type) + "\"><DIV CLASS=\"content\">"
+ out.getFontTag(CONTENT_FOREGROUND,"content") + "\n");
out.write(" METHOD=POST ACTION=\"" + html.formatURL(action,action_type) + "\"><DIV CLASS=\"content\">"
+ html.getFontTag(html.CONTENT_FOREGROUND,"content") + "\n");
// Render the hidden fields.
Iterator it = form_order.iterator();
@ -384,7 +387,7 @@ public class Dialog implements Cloneable, ContentDirect, ColorSelectors, LinkTyp
{ // write out the "required" instructions
if (instructions!=null)
out.write("<P>");
out.write("Required fields are marked with a " + out.getFontTag("red","content") + "*</FONT>.<BR>\n");
out.write("Required fields are marked with a " + html.getFontTag("red","content") + "*</FONT>.<BR>\n");
} // end if
else if (instructions!=null)
@ -475,7 +478,7 @@ public class Dialog implements Cloneable, ContentDirect, ColorSelectors, LinkTyp
public final void setAction(String action)
{
this.setAction(action,SERVLET);
this.setAction(action,LinkTypes.SERVLET);
} // end setAction

View File

@ -22,6 +22,7 @@ import org.w3c.dom.*;
import com.silverwrist.util.*;
import com.silverwrist.venice.except.*;
import com.silverwrist.venice.ui.*;
import com.silverwrist.venice.ui.helpers.HTMLRendering;
import com.silverwrist.venice.util.XMLLoader;
public class ImageButton implements DialogCommandButton
@ -65,7 +66,8 @@ public class ImageButton implements DialogCommandButton
public void render(RequestOutput out) throws IOException
{
out.write(out.getButtonInput(buttonid));
HTMLRendering html = (HTMLRendering)(out.queryService(HTMLRendering.class));
out.write(html.getButtonInput(buttonid));
} // end render

View File

@ -21,6 +21,7 @@ import java.io.IOException;
import org.w3c.dom.*;
import com.silverwrist.venice.except.*;
import com.silverwrist.venice.ui.*;
import com.silverwrist.venice.ui.helpers.HTMLRendering;
import com.silverwrist.venice.util.XMLLoader;
public class UserPhotoField extends BaseDialogField implements LinkTypes
@ -86,9 +87,11 @@ public class UserPhotoField extends BaseDialogField implements LinkTypes
protected void renderField(RequestOutput out) throws IOException
{
HTMLRendering html = (HTMLRendering)(out.queryService(HTMLRendering.class));
if (isEnabled())
out.write("<A HREF=\"" + out.formatURL(link_url,link_type) + "\">");
out.write(out.getUserPhotoTag(getStringValue()));
out.write("<A HREF=\"" + html.formatURL(link_url,link_type) + "\">");
out.write(html.getUserPhotoTag(getStringValue()));
if (isEnabled())
out.write("</A>");

View File

@ -11,7 +11,7 @@
*
* 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.
* Copyright (C) 2001-02 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
@ -22,7 +22,7 @@ import java.io.IOException;
import com.silverwrist.util.StringUtil;
import com.silverwrist.venice.ui.*;
public class ConfirmBox implements ContentDirect, ColorSelectors, LinkTypes
public class ConfirmBox implements ContentDirect
{
/*--------------------------------------------------------------------------------
* Static data members
@ -123,14 +123,15 @@ public class ConfirmBox implements ContentDirect, ColorSelectors, LinkTypes
public void render(RequestOutput out) throws IOException
{
HTMLRendering html = (HTMLRendering)(out.queryService(HTMLRendering.class));
out.write("<P><TABLE ALIGN=CENTER WIDTH=\"70%\" BORDER=1 CELLPADDING=2 CELLSPACING=1><TR VALIGN=MIDDLE>"
+ "<TD ALIGN=CENTER BGCOLOR=\"" + out.getColor(CONFIRM_TITLE_BACKGROUND) + "\">\n"
+ out.getFontTag(CONFIRM_TITLE_FOREGROUND,"confirmbox") + StringUtil.encodeHTML(title)
+ "<TD ALIGN=CENTER BGCOLOR=\"" + html.getColor(html.CONFIRM_TITLE_BACKGROUND) + "\">\n"
+ html.getFontTag(html.CONFIRM_TITLE_FOREGROUND,"confirmbox") + StringUtil.encodeHTML(title)
+ "</FONT>\n</TD></TR><TR VALIGN=MIDDLE><TD ALIGN=CENTER>\n"
+ out.getFontTag(CONTENT_FOREGROUND,"confirmbox") + "<P>" + StringUtil.encodeHTML(message)
+ "<P>\n<A HREF=\"" + out.formatURL(confirm_url,confirm_url_type) + "\">"
+ out.getButtonVisual("yes") + "</A>&nbsp;&nbsp;\n<A HREF=\""
+ out.formatURL(deny_url,deny_url_type) + "\">" + out.getButtonVisual("no")
+ html.getFontTag(html.CONTENT_FOREGROUND,"confirmbox") + "<P>" + StringUtil.encodeHTML(message)
+ "<P>\n<A HREF=\"" + html.formatURL(confirm_url,confirm_url_type) + "\">"
+ html.getButtonVisual("yes") + "</A>&nbsp;&nbsp;\n<A HREF=\""
+ html.formatURL(deny_url,deny_url_type) + "\">" + html.getButtonVisual("no")
+ "</A>\n</FONT></TD></TR></TABLE><P>\n");
} // end render

View File

@ -0,0 +1,31 @@
/*
* 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) 2002 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
package com.silverwrist.venice.ui.helpers;
public interface CookieControl
{
public static final String LOGIN_COOKIE = "VeniceAuth";
public static final int LOGIN_COOKIE_AGE = 60*60*24*365; // one year
public abstract void savePersistentCookie(String name, String value, int max_age);
public abstract void saveTemporaryCookie(String name, String value);
public abstract void deleteCookie(String name);
} // end interface CookieControl

View File

@ -21,7 +21,7 @@ import java.io.IOException;
import com.silverwrist.util.StringUtil;
import com.silverwrist.venice.ui.*;
public class ErrorBox extends ThrowableContent implements ContentDirect, ColorSelectors, LinkTypes
public class ErrorBox extends ThrowableContent implements ContentDirect
{
/*--------------------------------------------------------------------------------
* Static data members
@ -58,7 +58,7 @@ public class ErrorBox extends ThrowableContent implements ContentDirect, ColorSe
public ErrorBox(String title, String message, String back)
{
this(title,message,back,SERVLET);
this(title,message,back,LinkTypes.SERVLET);
} // end constructor
@ -76,7 +76,7 @@ public class ErrorBox extends ThrowableContent implements ContentDirect, ColorSe
public ErrorBox(String title, Throwable t, String back)
{
this(title,t,back,SERVLET);
this(title,t,back,LinkTypes.SERVLET);
} // end constructor
@ -94,7 +94,7 @@ public class ErrorBox extends ThrowableContent implements ContentDirect, ColorSe
public ErrorBox(String title, String message, Throwable t, String back)
{
this(title,message,t,back,SERVLET);
this(title,message,t,back,LinkTypes.SERVLET);
} // end constructor
@ -134,16 +134,18 @@ public class ErrorBox extends ThrowableContent implements ContentDirect, ColorSe
public void render(RequestOutput out) throws IOException
{
HTMLRendering html = (HTMLRendering)(out.queryService(HTMLRendering.class));
out.write("<P><TABLE ALIGN=CENTER WIDTH=\"70%\" BORDER=1 CELLPADDING=2 CELLSPACING=1><TR VALIGN=MIDDLE>"
+ "<TD ALIGN=CENTER BGCOLOR=\"" + out.getColor(ERROR_TITLE_BACKGROUND) + "\">\n"
+ out.getFontTag(ERROR_TITLE_FOREGROUND,"errorbox") + StringUtil.encodeHTML(title)
+ "<TD ALIGN=CENTER BGCOLOR=\"" + html.getColor(html.ERROR_TITLE_BACKGROUND) + "\">\n"
+ html.getFontTag(html.ERROR_TITLE_FOREGROUND,"errorbox") + StringUtil.encodeHTML(title)
+ "</FONT>\n</TD></TR>" + "<TR VALIGN=MIDDLE><TD ALIGN=CENTER>\n"
+ out.getFontTag(CONTENT_FOREGROUND,"errorbox") + "<P>" + StringUtil.encodeHTML(getMessage())
+ "<P>\n");
+ html.getFontTag(html.CONTENT_FOREGROUND,"errorbox") + "<P>"
+ StringUtil.encodeHTML(getMessage()) + "<P>\n");
if (back==null)
out.write("Use your browser's <B>Back</B> button to go back.\n");
else
out.write("<A HREF=\"" + out.formatURL(back,back_linktype) + "\">Go back.</A>\n");
out.write("<A HREF=\"" + html.formatURL(back,back_linktype) + "\">Go back.</A>\n");
out.write("<P></FONT></TD></TR></TABLE><P>\n");
if (canPrintStackTrace())
{ // put the stack trace in an HTML comment so we can see what may be going on...

View File

@ -0,0 +1,72 @@
/*
* 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) 2002 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
package com.silverwrist.venice.ui.helpers;
import java.awt.Dimension;
import java.util.Date;
import java.util.Map;
import com.silverwrist.venice.ui.ColorSelectors;
import com.silverwrist.venice.ui.LinkTypes;
public interface HTMLRendering extends ColorSelectors, LinkTypes
{
public abstract String getColor(int selector);
public abstract String getColor(String name);
public abstract boolean useHTMLComments();
public abstract String formatURL(String url, int type);
public abstract String formatDate(Date date);
public abstract String getFontTag(int colorsel, int size);
public abstract String getFontTag(String color, int size);
public abstract String getFontTag(int colorsel, String size);
public abstract String getFontTag(String color, String size);
public abstract int convertLinkType(String str);
public abstract String getStockMessage(String key);
public abstract String getStockMessage(String key, Map vars);
public abstract String getStaticPath(String s);
public abstract String getExternalStaticPath(String s);
public abstract String getImagePath(String s);
public abstract String getButtonVisual(String id);
public abstract String getButtonInput(String id);
public abstract String getUserPhotoTag(String url);
public abstract String getUserPhotoTag(String url, Dimension size);
public abstract String getActivityString(Date date);
public abstract String getCommunityLogoTag(String url);
public abstract String expandServletPath(String spath);
} // end interface HTMLRendering

View File

@ -168,7 +168,8 @@ public class ImageHandler implements RenderDirect
{ // this may be called by more than one class, so protect this part
if (fixup)
{ // fix up the host tag URL
url = out.getImagePath(url);
HTMLRendering html = (HTMLRendering)(out.queryService(HTMLRendering.class));
url = html.getImagePath(url);
fixup = false;
} // end if

View File

@ -0,0 +1,33 @@
/*
* 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) 2002 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
package com.silverwrist.venice.ui.helpers;
import com.silverwrist.venice.core.UserContext;
import com.silverwrist.venice.ui.VeniceUISession;
public interface SessionControl
{
public abstract void endSession();
public abstract void pushSession(VeniceUISession sess);
public abstract void popSession();
public abstract void replaceUser(UserContext new_user);
} // end interface SessionControl

View File

@ -11,7 +11,7 @@
*
* 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.
* Copyright (C) 2001-02 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
@ -19,7 +19,21 @@ package com.silverwrist.venice.ui.helpers;
import java.io.PrintStream;
import java.io.PrintWriter;
import com.silverwrist.venice.except.VeniceException;
/**
* Intended as the &quot;superclass&quot; of content objects which may be thrown from UI code, as
* if they were exceptions. These are generally used in a similar context to exceptions, such as,
* for example, {@link com.silverwrist.venice.ui.helpers.ErrorBox <CODE>ErrorBox</CODE>}, which
* displays an error message.<P>
* Objects extending this class will generally also implement one or more of the
* {@link com.silverwrist.venice.ui.Content <CODE>Content</CODE>} interfaces, such as
* {@link com.silverwrist.venice.ui.ContentDirect <CODE>ContentDirect</CODE>} or
* {@link com.silverwrist.venice.ui.ContentJSP <CODE>ContentJSP</CODE>}.
*
* @author Eric J. Bowersox &lt;erbo@silcom.com&gt;
* @version X
*/
public abstract class ThrowableContent extends Throwable
{
/*--------------------------------------------------------------------------------
@ -27,36 +41,62 @@ public abstract class ThrowableContent extends Throwable
*--------------------------------------------------------------------------------
*/
private Throwable inner;
private boolean have_stack_trace = false;
private Throwable inner; // encapsulated exception
private boolean have_stack_trace = false; // do we have a stack trace?
/*--------------------------------------------------------------------------------
* Constructors
*--------------------------------------------------------------------------------
*/
public ThrowableContent()
/**
* Constructs a new <CODE>ThrowableContent</CODE> with <CODE>null</CODE> as its error message
* string. Also, the method {@link #fillInStackTrace() fillInStackTrace()} is called for this object.
*/
protected ThrowableContent()
{
super();
inner = null;
} // end constructor
public ThrowableContent(String msg)
/**
* Constructs a new <CODE>ThrowableContent</CODE> with the specified error message. Also, the method
* {@link #fillInStackTrace() fillInStackTrace()} is called for this object.
*
* @param msg The error message. The error message is saved for later retrieval by the
* {@link java.lang.Throwable#getMessage() getMessage()} method.
*/
protected ThrowableContent(String msg)
{
super(msg);
inner = null;
} // end constructor
public ThrowableContent(Throwable t)
/**
* Constructs a <CODE>ThrowableContent</CODE> that wraps another exception. The error message of the
* &quot;wrapped&quot; exception is used as the error message of this exception. Also, the method
* {@link #fillInStackTrace() fillInStackTrace()} is called for this object.
*
* @param t The exception to be wrapped by this <CODE>ThrowableContent</CODE>.
*/
protected ThrowableContent(Throwable t)
{
super(t.getMessage());
inner = t;
} // end constructor
public ThrowableContent(String msg, Throwable t)
/**
* Constructs a <CODE>ThrowableContent</CODE> that wraps another exception, with a specified error message.
* Also, the method {@link #fillInStackTrace() fillInStackTrace()} is called for this object.
*
* @param msg The error message. The error message is saved for later retrieval by the
* {@link java.lang.Throwable#getMessage() getMessage()} method.
* @param t The exception to be wrapped by this <CODE>ThrowableContent</CODE>.
*/
protected ThrowableContent(String msg, Throwable t)
{
super(msg);
inner = t;
@ -68,6 +108,11 @@ public abstract class ThrowableContent extends Throwable
*--------------------------------------------------------------------------------
*/
/**
* Returns a short description of this throwable object.
*
* @return See above.
*/
public String toString()
{
return getMessage();
@ -79,6 +124,14 @@ public abstract class ThrowableContent extends Throwable
*--------------------------------------------------------------------------------
*/
/**
* Fills in the execution stack trace. This method records within this <CODE>Throwable</CODE> object
* information about the current state of the stack frames for the current thread. This method is useful
* when an application is re-throwing an error or exception.
*
* @return This <CODE>Throwable</CODE> object.
* @see java.lang.Throwable#fillInStackTrace
*/
public Throwable fillInStackTrace()
{
have_stack_trace = true;
@ -88,7 +141,7 @@ public abstract class ThrowableContent extends Throwable
/**
* Prints this exception and its backtrace to the standard error stream. Also prints the backtrace
* of any "wrapped" exception.
* of any &quot;wrapped&quot; exception.
*
* @see java.lang.System#err
*/
@ -100,7 +153,7 @@ public abstract class ThrowableContent extends Throwable
/**
* Prints this exception and its backtrace to the specified <CODE>PrintStream</CODE>. Also prints the
* backtrace of any "wrapped" exception.
* backtrace of any &quot;wrapped&quot; exception.
*
* @param s <CODE>PrintStream</CODE> to use for output.
*/
@ -108,18 +161,13 @@ public abstract class ThrowableContent extends Throwable
{
if (have_stack_trace)
super.printStackTrace(s);
if (inner!=null)
{ // print the inner stack trace
s.print("Root cause: ");
inner.printStackTrace(s);
} // end if
VeniceException.printRootCause(s,inner);
} // end printStackTrace
/**
* Prints this exception and its backtrace to the specified <CODE>PrintWriter</CODE>. Also prints the
* backtrace of any "wrapped" exception.
* backtrace of any &quot;wrapped&quot; exception.
*
* @param s <CODE>PrintWriter</CODE> to use for output.
*/
@ -127,12 +175,7 @@ public abstract class ThrowableContent extends Throwable
{
if (have_stack_trace)
super.printStackTrace(s);
if (inner!=null)
{ // print the inner stack trace
s.print("Root cause: ");
inner.printStackTrace(s);
} // end if
VeniceException.printRootCause(s,inner);
} // end printStackTrace
@ -152,6 +195,12 @@ public abstract class ThrowableContent extends Throwable
} // end getException
/**
* Returns <CODE>true</CODE> if this object contains a stack trace which can be printed,
* <CODE>false</CODE> if not.
*
* @return See above.
*/
public boolean canPrintStackTrace()
{
return (have_stack_trace || (inner!=null));

View File

@ -21,6 +21,7 @@ import java.io.IOException;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
import com.silverwrist.venice.ui.*;
import com.silverwrist.venice.ui.helpers.HTMLRendering;
public class FrameBodyTag extends VeniceTagSupport implements ColorSelectors
{
@ -38,10 +39,12 @@ public class FrameBodyTag extends VeniceTagSupport implements ColorSelectors
public int doStartTag() throws JspException
{
HTMLRendering html = (HTMLRendering)(getRequestInput().queryService(HTMLRendering.class));
try
{ // write out what we came here to accomplish
JspWriter out = pageContext.getOut();
out.write("<BODY BGCOLOR=\"" + getRequestInput().getColor(FRAME_BACKGROUND) + "\"");
out.write("<BODY BGCOLOR=\"" + html.getColor(FRAME_BACKGROUND) + "\"");
if (extra!=null)
out.write(" " + extra);
out.write(">");

View File

@ -11,7 +11,7 @@
*
* 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.
* Copyright (C) 2001-02 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
@ -21,6 +21,7 @@ import java.io.IOException;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
import com.silverwrist.venice.ui.*;
import com.silverwrist.venice.ui.helpers.HTMLRendering;
public class UtilButtonTag extends VeniceTagSupport
{
@ -45,10 +46,11 @@ public class UtilButtonTag extends VeniceTagSupport
throw new JspTagException("<util:button/> type not valid!");
String data;
HTMLRendering html = (HTMLRendering)(getRequestOutput().queryService(HTMLRendering.class));
if (type.equals("img"))
data = getRequestOutput().getButtonVisual(id);
data = html.getButtonVisual(id);
else
data = getRequestOutput().getButtonInput(id);
data = html.getButtonInput(id);
try
{ // write out what we came here to accomplish

View File

@ -21,6 +21,7 @@ import java.io.IOException;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
import com.silverwrist.venice.ui.*;
import com.silverwrist.venice.ui.helpers.HTMLRendering;
public class UtilColorTag extends VeniceTagSupport
{
@ -41,10 +42,12 @@ public class UtilColorTag extends VeniceTagSupport
if (name==null)
throw new JspTagException("<color/> tag specified without a color name");
HTMLRendering html = (HTMLRendering)(getRequestInput().queryService(HTMLRendering.class));
try
{ // write out what we came here to accomplish
JspWriter out = pageContext.getOut();
out.write(getRequestInput().getColor(name));
out.write(html.getColor(name));
} // end try
catch (IOException e)

View File

@ -21,6 +21,7 @@ import java.io.IOException;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
import com.silverwrist.venice.ui.*;
import com.silverwrist.venice.ui.helpers.HTMLRendering;
public class UtilCommentTag extends VeniceTagSupport
{
@ -38,7 +39,8 @@ public class UtilCommentTag extends VeniceTagSupport
public int doStartTag() throws JspException
{
enable = getRequestInput().useHTMLComments();
HTMLRendering html = (HTMLRendering)(getRequestInput().queryService(HTMLRendering.class));
enable = html.useHTMLComments();
if (!enable)
return SKIP_BODY;

View File

@ -11,7 +11,7 @@
*
* 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.
* Copyright (C) 2001-02 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
@ -21,6 +21,7 @@ import java.io.IOException;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
import com.silverwrist.venice.ui.*;
import com.silverwrist.venice.ui.helpers.HTMLRendering;
public class UtilExpandServletTag extends VeniceBodyTagSupport
{
@ -31,11 +32,13 @@ public class UtilExpandServletTag extends VeniceBodyTagSupport
public int doAfterBody() throws JspException
{
HTMLRendering html = (HTMLRendering)(getRequestInput().queryService(HTMLRendering.class));
BodyContent body = getBodyContent();
try
{ // write the escaped information
JspWriter out = body.getEnclosingWriter();
out.write(getRequestInput().expandServletPath(body.getString()));
out.write(html.expandServletPath(body.getString()));
} // end try
catch (IOException e)

View File

@ -11,7 +11,7 @@
*
* 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.
* Copyright (C) 2001-02 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
@ -21,6 +21,7 @@ import java.io.IOException;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
import com.silverwrist.venice.ui.*;
import com.silverwrist.venice.ui.helpers.HTMLRendering;
public class UtilFontTag extends VeniceTagSupport
{
@ -39,10 +40,12 @@ public class UtilFontTag extends VeniceTagSupport
public int doStartTag() throws JspException
{
HTMLRendering html = (HTMLRendering)(getRequestInput().queryService(HTMLRendering.class));
try
{ // write out what we came here to accomplish
JspWriter out = pageContext.getOut();
out.write(getRequestInput().getFontTag(color,size_str));
out.write(html.getFontTag(color,size_str));
} // end try
catch (IOException e)

View File

@ -11,7 +11,7 @@
*
* 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.
* Copyright (C) 2001-02 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
@ -23,6 +23,7 @@ import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
import com.silverwrist.util.StringUtil;
import com.silverwrist.venice.ui.*;
import com.silverwrist.venice.ui.helpers.HTMLRendering;
public class UtilFormTag extends VeniceTagSupport
{
@ -58,8 +59,11 @@ public class UtilFormTag extends VeniceTagSupport
throw new JspTagException("<util:form/> action not specified!");
if (type==null)
throw new JspTagException("<util:form/> type not specified!");
RequestInput ri = getRequestInput();
int ityp = ri.convertLinkType(type);
HTMLRendering html = (HTMLRendering)(ri.queryService(HTMLRendering.class));
int ityp = html.convertLinkType(type);
if (ityp==-1)
throw new JspTagException("<util:form/> invalid action type!");
@ -75,7 +79,7 @@ public class UtilFormTag extends VeniceTagSupport
out.write("CLASS=\"" + cls + "\" ");
if ((isfile!=null) && isfile.equals("true"))
out.write("ENCTYPE=\"multipart/form-data\" ");
out.write("ACTION=\"" + ri.formatURL(action,ityp) + "\">");
out.write("ACTION=\"" + html.formatURL(action,ityp) + "\">");
} // end try
catch (IOException e)

View File

@ -23,6 +23,7 @@ import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
import com.silverwrist.util.StringUtil;
import com.silverwrist.venice.ui.*;
import com.silverwrist.venice.ui.helpers.HTMLRendering;
public class UtilHeaderTag extends VeniceBodyTagSupport
{
@ -56,13 +57,14 @@ public class UtilHeaderTag extends VeniceBodyTagSupport
public int doEndTag() throws JspException
{
RequestOutput ro = getRequestOutput();
HTMLRendering html = (HTMLRendering)(ro.queryService(HTMLRendering.class));
// find the real title string
String real_title = null;
if (title!=null)
real_title = title;
else if (stocktitle!=null)
real_title = ro.getStockMessage(stocktitle);
real_title = html.getStockMessage(stocktitle);
if (real_title==null)
throw new JspTagException("<util:header/> contains no title= or stocktitle= attributes!");
@ -71,7 +73,7 @@ public class UtilHeaderTag extends VeniceBodyTagSupport
if (subtitle!=null)
real_subtitle = subtitle;
else if (stocksubtitle!=null)
real_subtitle = ro.getStockMessage(stocksubtitle);
real_subtitle = html.getStockMessage(stocksubtitle);
try
{ // write out what we came here to accomplish

View File

@ -20,6 +20,7 @@ package com.silverwrist.venice.ui.jsp;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
import com.silverwrist.venice.ui.*;
import com.silverwrist.venice.ui.helpers.HTMLRendering;
public class UtilHrefTag extends VeniceBodyTagSupport
{
@ -40,7 +41,8 @@ public class UtilHrefTag extends VeniceBodyTagSupport
{
if (type==null)
throw new JspTagException("<util:href/> type= attribute not specified");
real_type = getRequestInput().convertLinkType(type);
HTMLRendering html = (HTMLRendering)(getRequestInput().queryService(HTMLRendering.class));
real_type = html.convertLinkType(type);
if (real_type<0)
throw new JspTagException("<util:href/> type= attribute not a valid link type");
return EVAL_BODY_TAG;

View File

@ -21,6 +21,7 @@ import java.io.IOException;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
import com.silverwrist.venice.ui.*;
import com.silverwrist.venice.ui.helpers.HTMLRendering;
public class UtilImageTag extends VeniceBodyTagSupport
{
@ -95,7 +96,11 @@ public class UtilImageTag extends VeniceBodyTagSupport
String real_src;
if (fixup!=null)
real_src = getRequestOutput().getImagePath(src);
{ // fix up the image path
HTMLRendering html = (HTMLRendering)(getRequestOutput().queryService(HTMLRendering.class));
real_src = html.getImagePath(src);
} // end if
else
real_src = src;

View File

@ -11,7 +11,7 @@
*
* 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.
* Copyright (C) 2001-02 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
@ -23,6 +23,7 @@ import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
import com.silverwrist.util.StringUtil;
import com.silverwrist.venice.ui.*;
import com.silverwrist.venice.ui.helpers.HTMLRendering;
public class UtilLinkTag extends VeniceTagSupport
{
@ -56,8 +57,11 @@ public class UtilLinkTag extends VeniceTagSupport
throw new JspTagException("<util:link/> href not specified!");
if (type==null)
throw new JspTagException("<util:link/> type not specified!");
RequestInput ri = getRequestInput();
int ityp = ri.convertLinkType(type);
HTMLRendering html = (HTMLRendering)(ri.queryService(HTMLRendering.class));
int ityp = html.convertLinkType(type);
if (ityp==-1)
throw new JspTagException("<util:link/> invalid link type!");
@ -71,7 +75,7 @@ public class UtilLinkTag extends VeniceTagSupport
out.write("<A ");
if (cls!=null)
out.write("CLASS=\"" + cls + "\" ");
out.write("HREF=\"" + ri.formatURL(href,ityp) + "\"");
out.write("HREF=\"" + html.formatURL(href,ityp) + "\"");
if (title!=null)
out.write(" TITLE=\"" + title + "\"");
if (target!=null)

View File

@ -11,7 +11,7 @@
*
* 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.
* Copyright (C) 2001-02 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
@ -23,8 +23,9 @@ import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
import com.silverwrist.util.StringUtil;
import com.silverwrist.venice.ui.*;
import com.silverwrist.venice.ui.helpers.HTMLRendering;
public class UtilMenuHeaderTag extends VeniceBodyTagSupport implements ColorSelectors
public class UtilMenuHeaderTag extends VeniceBodyTagSupport
{
/*--------------------------------------------------------------------------------
* Internal class for holding the menu links
@ -45,12 +46,12 @@ public class UtilMenuHeaderTag extends VeniceBodyTagSupport implements ColorSele
} // end constructor
final void write(JspWriter out, RequestOutput ro, boolean selected) throws IOException
final void write(JspWriter out, HTMLRendering html, boolean selected) throws IOException
{
if (selected)
out.write("<B>");
else
out.write("<A HREF=\"" + ro.formatURL(href,type) + "\">");
out.write("<A HREF=\"" + html.formatURL(href,type) + "\">");
out.write(text);
if (selected)
out.write("</B>");
@ -95,14 +96,14 @@ public class UtilMenuHeaderTag extends VeniceBodyTagSupport implements ColorSele
if (items.isEmpty())
throw new JspTagException("<util:menuheader/> has no menu header items!");
RequestOutput ro = getRequestOutput();
HTMLRendering html = (HTMLRendering)(getRequestOutput().queryService(HTMLRendering.class));
try
{ // write out what we came here to accomplish
JspWriter out = pageContext.getOut();
out.write("<SPAN CLASS=\"chead1\">" + ro.getFontTag(CONTENT_HEADER,"header") + "<B>"
out.write("<SPAN CLASS=\"chead1\">" + html.getFontTag(html.CONTENT_HEADER,"header") + "<B>"
+ StringUtil.encodeHTML(caption) + "</B></FONT></SPAN>&nbsp;&nbsp;<SPAN CLASS=\"chead2\">"
+ ro.getFontTag(CONTENT_HEADER,"subhead"));
+ html.getFontTag(html.CONTENT_HEADER,"subhead"));
boolean first = true;
Iterator it = items.iterator();
while (it.hasNext())
@ -117,7 +118,7 @@ public class UtilMenuHeaderTag extends VeniceBodyTagSupport implements ColorSele
else // write the separator
out.write("|");
out.write("&nbsp;");
mi.write(out,ro,(mi==selected_item));
mi.write(out,html,(mi==selected_item));
out.write("&nbsp;");
} // end while

View File

@ -11,7 +11,7 @@
*
* 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.
* Copyright (C) 2001-02 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
@ -21,6 +21,7 @@ import java.io.IOException;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
import com.silverwrist.venice.ui.*;
import com.silverwrist.venice.ui.helpers.HTMLRendering;
public class UtilStdBulletTag extends VeniceTagSupport
{
@ -31,12 +32,13 @@ public class UtilStdBulletTag extends VeniceTagSupport
public int doStartTag() throws JspException
{
RequestOutput ro = getRequestOutput();
HTMLRendering html = (HTMLRendering)(getRequestOutput().queryService(HTMLRendering.class));
try
{ // write out what we came here to accomplish
JspWriter out = pageContext.getOut();
// TODO: make this configurable
out.write("<IMG SRC=\"" + ro.getImagePath("purple-ball.gif")
out.write("<IMG SRC=\"" + html.getImagePath("purple-ball.gif")
+ "\" ALT=\"*\" WIDTH=14 HEIGHT=14 BORDER=0>");
} // end try

View File

@ -11,7 +11,7 @@
*
* 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.
* Copyright (C) 2001-02 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
@ -21,6 +21,7 @@ import java.io.IOException;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
import com.silverwrist.venice.ui.*;
import com.silverwrist.venice.ui.helpers.HTMLRendering;
public class UtilStockMessageTag extends VeniceTagSupport
{
@ -40,7 +41,8 @@ public class UtilStockMessageTag extends VeniceTagSupport
{
if (key==null)
throw new JspTagException("<util:stock-message/> key not specified!");
String msg = getRequestInput().getStockMessage(key);
HTMLRendering html = (HTMLRendering)(getRequestInput().queryService(HTMLRendering.class));
String msg = html.getStockMessage(key);
if (msg==null)
return SKIP_BODY;

View File

@ -11,7 +11,7 @@
*
* 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.
* Copyright (C) 2001-02 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
@ -23,6 +23,7 @@ import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
import com.silverwrist.util.StringUtil;
import com.silverwrist.venice.ui.*;
import com.silverwrist.venice.ui.helpers.HTMLRendering;
public class UtilXLinkTag extends VeniceBodyTagSupport
{
@ -77,13 +78,15 @@ public class UtilXLinkTag extends VeniceBodyTagSupport
if (href.indexOf(LOCATION_PARAM)>=0)
href = StringUtil.replaceAllInstances(href,LOCATION_PARAM,URLEncoder.encode(ri.getLocation()));
HTMLRendering html = (HTMLRendering)(ri.queryService(HTMLRendering.class));
try
{ // write out what we came here to accomplish
JspWriter out = pageContext.getOut();
out.write("<A ");
if (cls!=null)
out.write("CLASS=\"" + cls + "\" ");
out.write("HREF=\"" + ri.formatURL(href,type) + "\"");
out.write("HREF=\"" + html.formatURL(href,type) + "\"");
if (title!=null)
out.write(" TITLE=\"" + title + "\"");
if (target!=null)

View File

@ -24,8 +24,9 @@ import com.silverwrist.util.*;
import com.silverwrist.venice.core.*;
import com.silverwrist.venice.except.*;
import com.silverwrist.venice.ui.*;
import com.silverwrist.venice.ui.helpers.HTMLRendering;
public class CommunityMenu implements MenuComponent, ColorSelectors, LinkTypes
public class CommunityMenu implements MenuComponent
{
/*--------------------------------------------------------------------------------
* Attributes
@ -77,11 +78,13 @@ public class CommunityMenu implements MenuComponent, ColorSelectors, LinkTypes
public void render(RequestOutput out, Writer wr, Set defines) throws IOException
{
HTMLRendering html = (HTMLRendering)(out.queryService(HTMLRendering.class));
if (wr==null)
wr = out.getWriter();
wr.write("<TABLE BORDER=0 CELLPADDING=2 CELLSPACING=0><TR VALIGN=BOTTOM>\n<TD ALIGN=LEFT WIDTH=110>"
+ out.getCommunityLogoTag(image_url) + "</TD>\n<TD ALIGN=LEFT>\n");
+ html.getCommunityLogoTag(image_url) + "</TD>\n<TD ALIGN=LEFT>\n");
// display the title
out.writeContentHeader(wr,title,null);
@ -97,9 +100,9 @@ public class CommunityMenu implements MenuComponent, ColorSelectors, LinkTypes
} // end while
if (show_unjoin) // display the "Unjoin" link
wr.write("<P><IMG SRC=\"" + out.getImagePath("purple-ball.gif")
wr.write("<P><IMG SRC=\"" + html.getImagePath("purple-ball.gif")
+ "\" ALT=\"*\" WIDTH=14 HEIGHT=14 BORDER=0><A HREF=\""
+ out.formatURL("comm/unjoin.js.vs?cc=" + cid,SERVLET) + "\">Unjoin</A><BR>\n");
+ html.formatURL("comm/unjoin.js.vs?cc=" + cid,html.SERVLET) + "\">Unjoin</A><BR>\n");
wr.write("\n"); // all done...
@ -113,12 +116,14 @@ public class CommunityMenu implements MenuComponent, ColorSelectors, LinkTypes
public void renderOnLeft(RequestOutput out, Writer wr, Set defines) throws IOException
{
HTMLRendering html = (HTMLRendering)(out.queryService(HTMLRendering.class));
if (wr==null)
wr = out.getWriter();
String hilite = out.getFontTag(LEFT_LINK,null);
String hilite = html.getFontTag(html.LEFT_LINK,null);
// display the image URL and title
wr.write("<DIV ALIGN=\"LEFT\">" + out.getCommunityLogoTag(image_url) + "</DIV>\n<B>"
wr.write("<DIV ALIGN=\"LEFT\">" + html.getCommunityLogoTag(image_url) + "</DIV>\n<B>"
+ StringUtil.encodeHTML(title) + "</B><BR>\n");
// display the menu items
@ -131,7 +136,7 @@ public class CommunityMenu implements MenuComponent, ColorSelectors, LinkTypes
} // end while
if (show_unjoin)
wr.write("<BR>\n<A CLASS=\"lbar\" HREF=\"" + out.formatURL("comm/unjoin.js.vs?cc=" + cid,SERVLET)
wr.write("<BR>\n<A CLASS=\"lbar\" HREF=\"" + html.formatURL("comm/unjoin.js.vs?cc=" + cid,html.SERVLET)
+ "\">" + hilite + "Unjoin</FONT></A>\n");
wr.write("\n"); // all done...

View File

@ -24,6 +24,7 @@ import org.w3c.dom.*;
import com.silverwrist.util.DOMElementHelper;
import com.silverwrist.venice.except.ConfigException;
import com.silverwrist.venice.ui.RequestOutput;
import com.silverwrist.venice.ui.helpers.HTMLRendering;
import com.silverwrist.venice.util.XMLLoader;
class ImageItem implements MenuComponent
@ -85,7 +86,8 @@ class ImageItem implements MenuComponent
wr.write("<IMG SRC=\"");
if (fixup)
{ // fix up the image path
src = out.getImagePath(src);
HTMLRendering html = (HTMLRendering)(out.queryService(HTMLRendering.class));
src = html.getImagePath(src);
fixup = false;
} // end if

View File

@ -27,9 +27,10 @@ import com.silverwrist.util.*;
import com.silverwrist.venice.except.ConfigException;
import com.silverwrist.venice.ui.*;
import com.silverwrist.venice.ui.config.RootConfig;
import com.silverwrist.venice.ui.helpers.HTMLRendering;
import com.silverwrist.venice.util.XMLLoader;
class LinkItem implements MenuComponent, ColorSelectors, LinkTypes
class LinkItem implements MenuComponent
{
/*--------------------------------------------------------------------------------
* Static data members
@ -76,7 +77,7 @@ class LinkItem implements MenuComponent, ColorSelectors, LinkTypes
} // end if
else // default to "absolute"
type = ABSOLUTE;
type = LinkTypes.ABSOLUTE;
// load the "target"
if (h.hasAttribute("target"))
@ -136,6 +137,18 @@ class LinkItem implements MenuComponent, ColorSelectors, LinkTypes
} // end constructor
/*--------------------------------------------------------------------------------
* Internal operations
*--------------------------------------------------------------------------------
*/
private final String getAddress(HTMLRendering html, Map vars)
{
String s = StringUtil.replaceAllVariables(href,vars);
return html.formatURL(s,type);
} // end getAddress
/*--------------------------------------------------------------------------------
* Implementations from interface MenuComponent
*--------------------------------------------------------------------------------
@ -153,15 +166,18 @@ class LinkItem implements MenuComponent, ColorSelectors, LinkTypes
return;
if ((ifndef_sym!=null) && defines.contains(ifndef_sym))
return;
HTMLRendering html = (HTMLRendering)(out.queryService(HTMLRendering.class));
if (wr==null)
wr = out.getWriter();
for (int i=0; i<indent; i++)
wr.write("&nbsp;&nbsp;&nbsp;&nbsp;"); // do indent
wr.write("<IMG SRC=\"" + out.getImagePath("purple-ball.gif")
wr.write("<IMG SRC=\"" + html.getImagePath("purple-ball.gif")
+ "\" ALT=\"*\" WIDTH=14 HEIGHT=14 BORDER=0>&nbsp;");
if (enabled)
{ // render the URL as an <A> tag
wr.write("<A HREF=\"" + out.formatURL(href,type) + "\"");
wr.write("<A HREF=\"" + html.formatURL(href,type) + "\"");
if (target!=null)
wr.write(" TARGET=\"" + target + "\"");
if (title!=null)
@ -172,7 +188,7 @@ class LinkItem implements MenuComponent, ColorSelectors, LinkTypes
} // end if
else // just disable the color
wr.write(out.getFontTag(CONTENT_DISABLED,null));
wr.write(html.getFontTag(html.CONTENT_DISABLED,null));
contents.render(out,wr,defines);
if (enabled)
wr.write("</A>");
@ -194,24 +210,27 @@ class LinkItem implements MenuComponent, ColorSelectors, LinkTypes
return;
if ((ifndef_sym!=null) && defines.contains(ifndef_sym))
return;
HTMLRendering html = (HTMLRendering)(out.queryService(HTMLRendering.class));
if (wr==null)
wr = out.getWriter();
for (int i=0; i<indent; i++)
wr.write("&nbsp;"); // do indent
if (enabled)
{ // write the opening <A> and <FONT> tags
wr.write("<A HREF=\"" + out.formatURL(href,type) + "\" CLASS=\"lbar\"");
wr.write("<A HREF=\"" + html.formatURL(href,type) + "\" CLASS=\"lbar\"");
if (target!=null)
wr.write(" TARGET=\"" + target + "\"");
if (title!=null)
wr.write(" TITLE=\"" + title + "\"");
if (on_click!=null)
wr.write(" onClick=\"" + on_click + "\"");
wr.write(">" + out.getFontTag(LEFT_LINK,null));
wr.write(">" + html.getFontTag(html.LEFT_LINK,null));
} // end if
else
wr.write(out.getFontTag(CONTENT_DISABLED,null));
wr.write(html.getFontTag(html.CONTENT_DISABLED,null));
contents.renderOnLeft(out,wr,defines);
wr.write("</FONT>");
if (enabled)
@ -233,15 +252,13 @@ class LinkItem implements MenuComponent, ColorSelectors, LinkTypes
final String getAddress(RequestOutput out, Map vars)
{
String s = StringUtil.replaceAllVariables(href,vars);
return out.formatURL(s,type);
return this.getAddress((HTMLRendering)(out.queryService(HTMLRendering.class)),vars);
} // end getAddress
final String getAddress(RequestInput inp, Map vars)
{
String s = StringUtil.replaceAllVariables(href,vars);
return inp.formatURL(s,type);
return this.getAddress((HTMLRendering)(inp.queryService(HTMLRendering.class)),vars);
} // end getAddress

View File

@ -27,9 +27,10 @@ import com.silverwrist.util.StringUtil;
import com.silverwrist.venice.except.*;
import com.silverwrist.venice.ui.*;
import com.silverwrist.venice.ui.config.RootConfig;
import com.silverwrist.venice.ui.helpers.HTMLRendering;
import com.silverwrist.venice.util.XMLLoader;
public class Menu implements MenuComponent, ColorSelectors
public class Menu implements MenuComponent
{
/*--------------------------------------------------------------------------------
* Constructor
@ -144,6 +145,8 @@ public class Menu implements MenuComponent, ColorSelectors
public void render(RequestOutput out, Writer wr, Set defines) throws IOException
{
HTMLRendering html = (HTMLRendering)(out.queryService(HTMLRendering.class));
if (title!=null)
{ // write the header
if (wr==null)
@ -155,12 +158,12 @@ public class Menu implements MenuComponent, ColorSelectors
if (wr!=null)
{ // write using specified writer
wr.write(out.getFontTag(CONTENT_FOREGROUND,"content") + "\n");
wr.write(html.getFontTag(html.CONTENT_FOREGROUND,"content") + "\n");
wr.flush();
} // end if
else
out.write(out.getFontTag(CONTENT_FOREGROUND,"content") + "\n");
out.write(html.getFontTag(html.CONTENT_FOREGROUND,"content") + "\n");
Iterator it = menu_items.iterator();
while (it.hasNext())

View File

@ -26,8 +26,10 @@ import com.silverwrist.util.*;
import com.silverwrist.venice.except.*;
import com.silverwrist.venice.ui.*;
import com.silverwrist.venice.ui.config.RootConfig;
import com.silverwrist.venice.ui.helpers.SessionControl;
import com.silverwrist.venice.ui.helpers.ThrowableContent;
import com.silverwrist.venice.ui.script.*;
import com.silverwrist.venice.util.ServiceProvider;
import com.silverwrist.venice.util.XMLLoader;
public class XmlRpcMethod
@ -178,7 +180,8 @@ public class XmlRpcMethod
} // end if
req.pushSession(vuis); // push the session into the request
SessionControl sctl = (SessionControl)(req.queryService(SessionControl.class));
sctl.pushSession(vuis); // push the session into the request
} // end bindSession
@ -233,7 +236,11 @@ public class XmlRpcMethod
finally
{ // pop the session we pushed
if (session_param>=0)
req.popSession();
{ // pop the session
SessionControl sctl = (SessionControl)(req.queryService(SessionControl.class));
sctl.popSession();
} // end if
} // end finally
@ -241,8 +248,9 @@ public class XmlRpcMethod
if (script_name!=null)
{ // script method call - prepare the script and execute it
String full_name = req.getRPCScriptName(script_name);
String logger_name = req.getRPCScriptLoggerName(script_name);
ScriptSupport ssup = (ScriptSupport)(req.queryService(ScriptSupport.class));
String full_name = ssup.getRPCScriptName(script_name);
String logger_name = ssup.getRPCScriptLoggerName(script_name);
if (logger.isDebugEnabled())
logger.debug("EXECUTING " + full_name);
try
@ -250,7 +258,7 @@ public class XmlRpcMethod
if (session_param>=0)
bindSession(req,xreq);
ScriptManager smgr = req.getScriptManager();
ScriptManager smgr = (ScriptManager)(req.queryService(ScriptManager.class));
smgr.pushContext();
smgr.register("xmlrpc",xreq);
smgr.register("environment",env);
@ -265,7 +273,11 @@ public class XmlRpcMethod
{ // make sure and pop the context before we return
smgr.popContext();
if (session_param>=0)
req.popSession();
{ // pop the session
SessionControl sctl = (SessionControl)(req.queryService(SessionControl.class));
sctl.popSession();
} // end if
} // end finally

View File

@ -23,6 +23,7 @@ import javax.servlet.*;
import javax.servlet.http.*;
import org.apache.log4j.*;
import org.apache.regexp.*;
import org.w3c.dom.Document;
import com.silverwrist.util.*;
import com.silverwrist.venice.core.*;
import com.silverwrist.venice.ui.*;
@ -115,7 +116,8 @@ public class XmlRpcServlet extends BaseServlet
XmlRpcRequest xreq;
try
{ // get the XML-RPC request structure
xreq = new XmlRpcRequest(req,req.getRequestDocument());
Document req_doc = (Document)(req.queryService(Document.class,"requestDocument"));
xreq = new XmlRpcRequest(req,req_doc);
} // end try
catch (XmlRpcFault f)

View File

@ -22,6 +22,9 @@ import java.util.*;
import org.w3c.dom.*;
import com.silverwrist.util.StringUtil;
import com.silverwrist.venice.core.*;
import com.silverwrist.venice.ui.helpers.CookieControl;
import com.silverwrist.venice.ui.helpers.HTMLRendering;
import com.silverwrist.venice.ui.helpers.SessionControl;
import com.silverwrist.venice.util.*;
public class ScriptLibrary
@ -196,6 +199,24 @@ public class ScriptLibrary
} // end join
public final CookieControl queryCookieControl(ServiceProvider sp)
{
return (CookieControl)(sp.queryService(CookieControl.class));
} // end queryCookieControl
public final HTMLRendering queryHTMLRendering(ServiceProvider sp)
{
return (HTMLRendering)(sp.queryService(HTMLRendering.class));
} // end queryHTMLRendering
public final SessionControl querySessionControl(ServiceProvider sp)
{
return (SessionControl)(sp.queryService(SessionControl.class));
} // end querySessionControl
public final List splitList(String data, String delims)
{
return StringUtil.splitList(data,delims);

View File

@ -38,10 +38,12 @@ public class ScriptManager
public Object exec(String script) throws ScriptingException, ThrowableContent
{
RequestInput ri = (RequestInput)(ScriptManager.this.lookupObject("request"));
String script_file = ri.getScriptName(script);
String logger_name = ri.getScriptLoggerName(script);
ScriptSupport ssup = (ScriptSupport)(ri.queryService(ScriptSupport.class));
String script_file = ssup.getScriptName(script);
String logger_name = ssup.getScriptLoggerName(script);
if (logger.isDebugEnabled())
logger.debug("EXECUTING " + script_file);
ScriptReturn sro = new ScriptReturn();
ScriptManager.this.exec(new File(script_file),logger_name,sro);
return sro.get();
@ -122,6 +124,9 @@ public class ScriptManager
private static Category logger = Category.getInstance(ScriptManager.class);
private static final Class[] fixupRhino_parmtypes = { Boolean.TYPE };
private static final Object[] fixupRhino_parms = { Boolean.FALSE };
/*--------------------------------------------------------------------------------
* Attributes
*--------------------------------------------------------------------------------
@ -137,6 +142,12 @@ public class ScriptManager
*--------------------------------------------------------------------------------
*/
/**
* Creates a new instance of <CODE>ScriptManager</CODE>.
*
* @param temp_dir Temporary directory that the scripting engines managed by this
* <CODE>ScriptManager</CODE> can use for storing temporary files.
*/
public ScriptManager(String temp_dir) throws ScriptingException
{
// initialize the BSFManager
@ -183,16 +194,18 @@ public class ScriptManager
*--------------------------------------------------------------------------------
*/
/**
* What fixupRhino does is to turn off the fancy caching in the JavaScript engine. This is because
* caching involves dynamic creation of classes on the fly, and, for some reason (probably because
* of differing ClassLoader implementations), that doesn't work, whether Rhino is loaded in the
* Web application or in the JRE extensions. When caching is turned off, Rhino can be loaded as
* part of the web application, and it can see all the standard classes and all the Web application
* classes. But we have to turn it off by manipulating it via the Reflection API, as, for all we know,
* Rhino isn't even being loaded right now. (Though we have BSF load Rhino right away if it can,
* to try and get this straightened out.)
*/
private static void fixupRhino()
{
// What fixupRhino does is to turn off the fancy caching in the JavaScript engine. This is because
// caching involves dynamic creation of classes on the fly, and, for some reason (probably because
// of differing ClassLoader implementations), that doesn't work, whether Rhino is loaded in the
// Web application or in the JRE extensions. When caching is turned off, Rhino can be loaded as
// part of the web application, and it can see all the standard classes and all the Web application
// classes. But we have to turn it off by manipulating it via the Reflection API, as, for all we know,
// Rhino isn't even being loaded right now. (Though we have BSF load Rhino right away if it can,
// to try and get this straightened out.)
if (logger.isDebugEnabled())
logger.debug("Entered fixupRhino");
@ -201,12 +214,10 @@ public class ScriptManager
Class klass = Class.forName("org.mozilla.javascript.Context");
// get a pointer to its setCachingEnabled method
final Class[] parmtypes = { Boolean.TYPE };
Method m = klass.getMethod("setCachingEnabled",parmtypes);
Method m = klass.getMethod("setCachingEnabled",fixupRhino_parmtypes);
// invoke it to turn caching off!
final Object[] parms = { Boolean.FALSE };
m.invoke(null,parms);
m.invoke(null,fixupRhino_parms);
// all done!
if (logger.isDebugEnabled())
@ -237,6 +248,20 @@ public class ScriptManager
} // end translateReturnedObject
/**
* Translates an exception thrown by script execution into one of the exception types that
* <CODE>ScriptManager</CODE> officially supports throwing.
*
* @param source Source script name.
* @param lang Language the source script is in (JavaScript, Tcl, etc.)
* @param e <CODE>BSFException</CODE> that was thrown by a BSF method, which will be
* &quot;unwrapped&quot; by this method.
* @exception com.silverwrist.venice.ui.script.ScriptingException In most cases, the
* <CODE>BSFException</CODE> will translate to one of these.
* @exception com.silverwrist.venice.ui.helpers.ThrowableContent This is actually ordinary content
* which may have been &quot;thrown&quot; by the script, and will be processed at a
* higher level.
*/
private void translateScriptException(String source, String lang, BSFException e)
throws ScriptingException, ThrowableContent
{
@ -260,9 +285,10 @@ public class ScriptManager
} // end if
if (e.getReason()==BSFException.REASON_EXECUTION_ERROR)
if ( (e.getReason()==BSFException.REASON_EXECUTION_ERROR)
|| (e.getReason()==BSFException.REASON_OTHER_ERROR))
{ // throw a ScriptingException
logger.error("Execution exception while running script",t);
logger.error("Script compiler or execution exception",t);
if (t!=null)
{ // throw THIS exception
logger.error("Exception type: " + t.getClass().getName());
@ -273,19 +299,6 @@ public class ScriptManager
throw new ScriptingException(source,lang,e.getMessage(),e);
} // end if
else if (e.getReason()==BSFException.REASON_OTHER_ERROR)
{ // usually indicates a compiler error in the scripting engine
logger.error("Script compilation error",e);
if (t!=null)
{ // throw THIS exception
logger.error("Exception type: " + t.getClass().getName());
throw new ScriptingException(source,lang,e.getMessage(),t);
} // end if
else // throw the regular old name
throw new ScriptingException(source,lang,e.getMessage(),e);
} // end else if
else
{ // unknown exception type here!
logger.error("Unknown BSFException in script execution (reason " + e.getReason() + ")",e);

View File

@ -11,7 +11,7 @@
*
* 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.
* Copyright (C) 2001-02 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
@ -36,9 +36,9 @@ public class ScriptManagerContainer
*--------------------------------------------------------------------------------
*/
private String temp_directory;
private LinkedList cached_engines;
private ReferenceQueue rq_engines;
private String temp_directory; // temporary directory for scripts
private LinkedList cached_engines; // list of cached engines
private ReferenceQueue rq_engines; // reference queue of engines dumped from the cache
/*--------------------------------------------------------------------------------
* Constructor

View File

@ -0,0 +1,34 @@
/*
* 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) 2002 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
package com.silverwrist.venice.ui.script;
public interface ScriptSupport
{
public abstract String getScriptName(String raw_name);
public abstract String getScriptName(boolean strip_ext);
public abstract String getScriptLoggerName(String raw_name);
public abstract String getScriptLoggerName();
public abstract String getRPCScriptName(String raw_name);
public abstract String getRPCScriptLoggerName(String raw_name);
} // end interface ScriptSupport

View File

@ -116,10 +116,8 @@ public abstract class BaseServlet extends HttpServlet
RequestImpl the_request = null;
try
{ // create the request object
the_request = new RequestImpl(ctxt,request,response,
(VeniceEngine)(ctxt.getAttribute(ENGINE_ATTRIBUTE)),
(RootConfig)(ctxt.getAttribute(UICONFIG_ATTRIBUTE)),
getSessionFactory());
the_request = new RequestImpl(ctxt,request,response,getVeniceEngine(ctxt),
getRootConfig(ctxt),getSessionFactory());
} // end try
catch (ValidationException ve)
@ -252,6 +250,35 @@ public abstract class BaseServlet extends HttpServlet
} // end translateServletException
/*--------------------------------------------------------------------------------
* Internal operations
*--------------------------------------------------------------------------------
*/
protected final VeniceEngine getVeniceEngine(ServletContext ctxt)
{
return (VeniceEngine)(ctxt.getAttribute(ENGINE_ATTRIBUTE));
} // end getVeniceEngine
protected final VeniceEngine getVeniceEngine()
{
return this.getVeniceEngine(getServletContext());
} // end getVeniceEngine
protected final RootConfig getRootConfig(ServletContext ctxt)
{
return (RootConfig)(ctxt.getAttribute(UICONFIG_ATTRIBUTE));
} // end getRootConfig
protected final RootConfig getRootConfig()
{
return this.getRootConfig(getServletContext());
} // end getRootConfig
/*--------------------------------------------------------------------------------
* Overrides from class GenericServlet
*--------------------------------------------------------------------------------

View File

@ -195,7 +195,8 @@ public class FrameServlet extends BaseServlet
rc = (FramedData)(cache.get(page_name));
if (rc==null)
{ // we have to map the name to a static path and thence to a real filename
String locator = req.getStaticPath(page_name);
HTMLRendering html = (HTMLRendering)(req.queryService(HTMLRendering.class));
String locator = html.getStaticPath(page_name);
String real_path = req.mapPath(locator);
if (real_path==null)
{ // the mapper doesn't work!

View File

@ -24,6 +24,7 @@ import org.apache.log4j.*;
import com.silverwrist.venice.core.*;
import com.silverwrist.venice.except.*;
import com.silverwrist.venice.ui.*;
import com.silverwrist.venice.ui.helpers.CookieControl;
class HttpVeniceUISession implements VeniceUISession
{
@ -62,7 +63,7 @@ class HttpVeniceUISession implements VeniceUISession
Cookie[] cookies = request.getCookies();
for (int i=0; (venice_cookie==null) && (i<cookies.length); i++)
{ // look for a Venice authentication cookie
if (RequestInput.LOGIN_COOKIE.equals(cookies[i].getName()))
if (CookieControl.LOGIN_COOKIE.equals(cookies[i].getName()))
venice_cookie = cookies[i];
} // end for
@ -171,12 +172,17 @@ class HttpVeniceUISession implements VeniceUISession
try
{ // attempt authentication
if (!(user.authenticateWithToken(venice_cookie.getValue())))
ri.deleteCookie(RequestInput.LOGIN_COOKIE); // delete bogus cookie if it didn't work
{ // delete bogus cookie if it didn't work
CookieControl cctl = (CookieControl)(ri.queryService(CookieControl.class));
cctl.deleteCookie(CookieControl.LOGIN_COOKIE);
} // end if
} // end try
catch (DataException de)
{ // it didn't work...
ri.deleteCookie(RequestInput.LOGIN_COOKIE);
CookieControl cctl = (CookieControl)(ri.queryService(CookieControl.class));
cctl.deleteCookie(CookieControl.LOGIN_COOKIE);
} // end catch

File diff suppressed because it is too large Load Diff

View File

@ -11,7 +11,7 @@
*
* 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.
* Copyright (C) 2001-02 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
@ -39,11 +39,13 @@ public class ScriptExecServlet extends BaseServlet
public Object process(RequestInput req) throws Exception, ThrowableContent
{
String script_file = req.getScriptName(true);
String logger_name = req.getScriptLoggerName();
ScriptSupport ssup = (ScriptSupport)(req.queryService(ScriptSupport.class));
String script_file = ssup.getScriptName(true);
String logger_name = ssup.getScriptLoggerName();
if (logger.isDebugEnabled())
logger.debug("EXECUTING " + script_file);
ScriptManager smgr = req.getScriptManager();
ScriptManager smgr = (ScriptManager)(req.queryService(ScriptManager.class));
ScriptReturn sro = new ScriptReturn();
smgr.exec(new File(script_file),logger_name,sro);
return sro.get();

View File

@ -11,15 +11,18 @@
*
* 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.
* Copyright (C) 2001-02 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
package com.silverwrist.venice.ui.servlet;
import java.io.IOException;
import java.lang.ref.SoftReference;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletResponse;
import com.silverwrist.venice.ui.*;
import com.silverwrist.venice.ui.config.RootConfig;
public class StyleSheetServlet extends BaseServlet
{
@ -49,6 +52,13 @@ public class StyleSheetServlet extends BaseServlet
} // end class StyleSheetOutput
/*--------------------------------------------------------------------------------
* Attributes
*--------------------------------------------------------------------------------
*/
private SoftReference ref_stylesheet = null; // reference to stylesheet data
/*--------------------------------------------------------------------------------
* Implementations from class BaseServlet
*--------------------------------------------------------------------------------
@ -56,18 +66,39 @@ public class StyleSheetServlet extends BaseServlet
public Object process(RequestInput req)
{
String data;
String data = null;
ServletContext ctxt = getServletContext();
RootConfig config = getRootConfig(ctxt);
if (config.usingStyleSheet())
{ // we need to load the stylesheet data...
synchronized (this)
{ // see if the stylesheet data has already been loaded
if (ref_stylesheet!=null)
data = (String)(ref_stylesheet.get());
if ((data==null) || config.hasStyleSheetChanged())
{ // construct or reconstruct the stylesheet data, save a soft reference to it
if (ref_stylesheet!=null)
ref_stylesheet.clear();
try
{ // get the data from the request object
data = req.getStyleSheetData();
{ // retrieve the stylesheet data
data = config.loadStyleSheetData();
ref_stylesheet = new SoftReference(data);
} // end try
catch (IOException e)
{ // we can't load it
{ // can't load the stylesheet
data = null;
} // end catch
} // end if
} // end synchronized block
} // end if
// else not using stylesheet data at all...
return new StyleSheetOutput(data);
} // end process

View File

@ -45,11 +45,13 @@ public class UserServlet extends BaseServlet
req.setRequestAttribute("username",uname);
// Set up to execute a script to handle this request.
String script_file = req.getScriptName(SCRIPT_EXEC);
String logger_name = req.getScriptLoggerName(SCRIPT_EXEC);
ScriptSupport ssup = (ScriptSupport)(req.queryService(ScriptSupport.class));
String script_file = ssup.getScriptName(SCRIPT_EXEC);
String logger_name = ssup.getScriptLoggerName(SCRIPT_EXEC);
if (logger.isDebugEnabled())
logger.debug("EXECUTING " + script_file);
ScriptManager smgr = req.getScriptManager();
ScriptManager smgr = (ScriptManager)(req.queryService(ScriptManager.class));
ScriptReturn sro = new ScriptReturn();
smgr.exec(new File(script_file),logger_name,sro);
return sro.get();

View File

@ -11,7 +11,7 @@
*
* 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.
* Copyright (C) 2001-02 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
@ -24,6 +24,7 @@ import com.silverwrist.util.*;
import com.silverwrist.venice.core.*;
import com.silverwrist.venice.except.*;
import com.silverwrist.venice.ui.*;
import com.silverwrist.venice.ui.helpers.HTMLRendering;
import com.silverwrist.venice.ui.helpers.ImageHandler;
public class CommunityBox implements SideBoxFactory
@ -33,7 +34,7 @@ public class CommunityBox implements SideBoxFactory
*--------------------------------------------------------------------------------
*/
class CommunityBoxImpl implements ContentDirect, ColorSelectors, LinkTypes
class CommunityBoxImpl implements ContentDirect
{
private UserContext uc;
private List comm_list;
@ -82,9 +83,11 @@ public class CommunityBox implements SideBoxFactory
public void render(RequestOutput out) throws IOException
{
HTMLRendering html = (HTMLRendering)(out.queryService(HTMLRendering.class));
if (comm_list.size()>0)
{ // load up the rendering data and render the contents of the list
String link_font = out.getFontTag(SIDEBOX_CONTENT_LINK,"sidebox");
String link_font = html.getFontTag(html.SIDEBOX_CONTENT_LINK,"sidebox");
out.write("<TABLE ALIGN=CENTER BORDER=0 CELLPADDING=0 CELLSPACING=2>\n");
Iterator it = comm_list.iterator();
while (it.hasNext())
@ -93,7 +96,7 @@ public class CommunityBox implements SideBoxFactory
out.write("<TR VALIGN=MIDDLE>\n<TD ALIGN=CENTER WIDTH=" + bullet.getWidth() + ">");
bullet.render(out);
out.write("</TD>\n<TD ALIGN=LEFT CLASS=\"sidebox\">\n<A CLASS=\"sidebox\" HREF=\""
+ out.formatURL("community/" + comm.getAlias(),SERVLET) + "\">" + link_font + "<B>"
+ html.formatURL("community/" + comm.getAlias(),html.SERVLET) + "\">" + link_font + "<B>"
+ StringUtil.encodeHTML(comm.getName()) + "</B></FONT></A>\n");
if (comm.isAdmin())
@ -111,17 +114,17 @@ public class CommunityBox implements SideBoxFactory
} // end if
else // write the "no communities" message
out.write(out.getFontTag(SIDEBOX_CONTENT_FOREGROUND,"sidebox") + "<EM>"
out.write(html.getFontTag(html.SIDEBOX_CONTENT_FOREGROUND,"sidebox") + "<EM>"
+ StringUtil.encodeHTML(null_message) + "</EM></FONT>\n");
if (uc.isLoggedIn())
{ // write the links at the end
String hilite = out.getFontTag(SIDEBOX_CONTENT_LINK,"sidebox-footer");
out.write("<P>" + out.getFontTag(SIDEBOX_CONTENT_FOREGROUND,"sidebox-footer")
+ "<B>[ <A CLASS=\"sidebox\" HREF=\"" + out.formatURL("comm/sb_list.js.vs",SERVLET)
String hilite = html.getFontTag(html.SIDEBOX_CONTENT_LINK,"sidebox-footer");
out.write("<P>" + html.getFontTag(html.SIDEBOX_CONTENT_FOREGROUND,"sidebox-footer")
+ "<B>[ <A CLASS=\"sidebox\" HREF=\"" + html.formatURL("comm/sb_list.js.vs",html.SERVLET)
+ "\">" + hilite + StringUtil.encodeHTML(manage_link) + "</FONT></A> ");
if (uc.canCreateCommunity())
out.write("| <A CLASS=\"sidebox\" HREF=\"" + out.formatURL("comm/create.js.vs",SERVLET) + "\">"
out.write("| <A CLASS=\"sidebox\" HREF=\"" + html.formatURL("comm/create.js.vs",html.SERVLET) + "\">"
+ hilite + StringUtil.encodeHTML(create_new_link) + "</FONT></A> ");
out.write("]</B></FONT>");

View File

@ -11,7 +11,7 @@
*
* 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.
* Copyright (C) 2001-02 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
@ -24,6 +24,7 @@ import com.silverwrist.util.*;
import com.silverwrist.venice.core.*;
import com.silverwrist.venice.except.*;
import com.silverwrist.venice.ui.*;
import com.silverwrist.venice.ui.helpers.HTMLRendering;
import com.silverwrist.venice.ui.helpers.ImageHandler;
public class ConferenceBox implements SideBoxFactory
@ -33,7 +34,7 @@ public class ConferenceBox implements SideBoxFactory
*--------------------------------------------------------------------------------
*/
class ConferenceBoxImpl implements ContentDirect, ColorSelectors, LinkTypes
class ConferenceBoxImpl implements ContentDirect
{
private UserContext uc; // current user context
private List hotlist; // current conference hotlist
@ -82,10 +83,13 @@ public class ConferenceBox implements SideBoxFactory
public void render(RequestOutput out) throws IOException
{
String norm_font = out.getFontTag(SIDEBOX_CONTENT_FOREGROUND,"sidebox");
HTMLRendering html = (HTMLRendering)(out.queryService(HTMLRendering.class));
String norm_font = html.getFontTag(html.SIDEBOX_CONTENT_FOREGROUND,"sidebox");
if (hotlist.size()>0)
{ // write out the hotlist....
String hilite = out.getFontTag(SIDEBOX_CONTENT_LINK,"sidebox");
String hilite = html.getFontTag(html.SIDEBOX_CONTENT_LINK,"sidebox");
out.write("<TABLE ALIGN=CENTER BORDER=0 CELLPADDING=0 CELLSPACING=2>\n");
Iterator it = hotlist.iterator();
while (it.hasNext())
@ -97,14 +101,14 @@ public class ConferenceBox implements SideBoxFactory
out.write("<TR VALIGN=MIDDLE>\n<TD ALIGN=CENTER WIDTH=" + bullet.getWidth() + ">");
bullet.render(out);
out.write("</TD>\n<TD ALIGN=LEFT CLASS=\"sidebox\">\n" + norm_font
+ "<B><A CLASS=\"sidebox\" HREF=\"" + out.formatURL(href,SERVLET) + "\">" + hilite
+ "<B><A CLASS=\"sidebox\" HREF=\"" + html.formatURL(href,html.SERVLET) + "\">" + hilite
+ StringUtil.encodeHTML(conf.getName()) + "</FONT></A></B> ("
+ StringUtil.encodeHTML(conf.getEnclosingCommunity().getName()) + ")</FONT>\n");
if (conf.anyUnread())
{ // write out the new-messages tag and its enclosing link
href = "conf/read_new.js.vs?sig=" + conf.getEnclosingCommunity().getCommunityID() + "&conf="
+ conf.getConfID();
out.write("&nbsp;<A HREF=\"" + out.formatURL(href,SERVLET) + "\">");
out.write("&nbsp;<A HREF=\"" + html.formatURL(href,html.SERVLET) + "\">");
newmsg.render(out);
out.write("</A>\n");
@ -122,10 +126,10 @@ public class ConferenceBox implements SideBoxFactory
if (uc.isLoggedIn())
{ // write the link at the end
out.write("<P>" + out.getFontTag(SIDEBOX_CONTENT_FOREGROUND,"sidebox-footer")
+ "<B>[ <A CLASS=\"sidebox\" HREF=\"" + out.formatURL("conf/hotlist.js.vs",SERVLET) + "\">"
+ out.getFontTag(SIDEBOX_CONTENT_LINK,"sidebox-footer") + StringUtil.encodeHTML(manage_link)
+ "</FONT></A> ]</B></FONT>");
out.write("<P>" + html.getFontTag(html.SIDEBOX_CONTENT_FOREGROUND,"sidebox-footer")
+ "<B>[ <A CLASS=\"sidebox\" HREF=\"" + html.formatURL("conf/hotlist.js.vs",html.SERVLET)
+ "\">" + html.getFontTag(html.SIDEBOX_CONTENT_LINK,"sidebox-footer")
+ StringUtil.encodeHTML(manage_link) + "</FONT></A> ]</B></FONT>");
} // end if

View File

@ -11,7 +11,7 @@
*
* 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.
* Copyright (C) 2001-02 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
@ -23,9 +23,10 @@ import javax.servlet.*;
import com.silverwrist.util.StringUtil;
import com.silverwrist.venice.core.*;
import com.silverwrist.venice.ui.*;
import com.silverwrist.venice.ui.helpers.HTMLRendering;
import com.silverwrist.venice.ui.servlet.RequestImpl;
public class AuditView implements ContentDirect, ColorSelectors, LinkTypes
public class AuditView implements ContentDirect
{
/*--------------------------------------------------------------------------------
* Static data members
@ -114,33 +115,35 @@ public class AuditView implements ContentDirect, ColorSelectors, LinkTypes
public void render(RequestOutput out) throws IOException
{
HTMLRendering html = (HTMLRendering)(out.queryService(HTMLRendering.class));
out.writeContentHeader(title,null);
// Write the return URL
out.write("<DIV CLASS=\"content\">" + out.getFontTag(CONTENT_FOREGROUND,"content") + "<A HREF=\""
+ out.formatURL(return_url,SERVLET) + "\">" + StringUtil.encodeHTML(return_text)
out.write("<DIV CLASS=\"content\">" + html.getFontTag(html.CONTENT_FOREGROUND,"content") + "<A HREF=\""
+ html.formatURL(return_url,html.SERVLET) + "\">" + StringUtil.encodeHTML(return_text)
+ "</A></FONT></DIV>\n");
// Write the informational and navigational table
out.write("<TABLE WIDTH=\"100%\" BORDER=0><TR VALIGN=MIDDLE><TD ALIGN=LEFT CLASS=\"content\">"
+ out.getFontTag(CONTENT_FOREGROUND,"content") + "\nDisplaying records <B>" + (offset+1)
+ html.getFontTag(html.CONTENT_FOREGROUND,"content") + "\nDisplaying records <B>" + (offset+1)
+ "</B> to <B>" + last_index + "</B> of <B>" + total_count + "</B>\n"
+ "</FONT></TD><TD ALIGN=RIGHT>\n");
if (prev_url==null)
out.write(out.getButtonVisual("_null_"));
out.write(html.getButtonVisual("_null_"));
else
out.write("<A HREF=\"" + out.formatURL(prev_url,SERVLET) + "\">" + out.getButtonVisual("previous")
out.write("<A HREF=\"" + html.formatURL(prev_url,html.SERVLET) + "\">" + html.getButtonVisual("previous")
+ "</A>");
out.write("&nbsp;");
if (next_url==null)
out.write(out.getButtonVisual("_null_"));
out.write(html.getButtonVisual("_null_"));
else
out.write("<A HREF=\"" + out.formatURL(next_url,SERVLET) + "\">" + out.getButtonVisual("next") + "</A>");
out.write("<A HREF=\"" + html.formatURL(next_url,html.SERVLET) + "\">" + html.getButtonVisual("next")
+ "</A>");
out.write("\n</TD></TR></TABLE>\n");
// Start writing the table containing the actual audit records.
String tb_font = out.getFontTag(CONTENT_FOREGROUND,"content");
String tb_font = html.getFontTag(html.CONTENT_FOREGROUND,"content");
out.write("<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=3>\n<TR>\n<TH ALIGN=LEFT CLASS=\"content\" NOWRAP>"
+ tb_font + "<B>Date/Time</B></FONT></TH>\n<TH ALIGN=LEFT CLASS=\"content\" NOWRAP>"
+ tb_font + "<B>Description</B></FONT></TH>\n<TH ALIGN=LEFT CLASS=\"content\" NOWRAP>"
@ -152,7 +155,7 @@ public class AuditView implements ContentDirect, ColorSelectors, LinkTypes
while (it.hasNext())
{ // display each record in turn
AuditData dat = (AuditData)(it.next());
out.write("<TR>\n<TD ALIGN=LEFT CLASS=\"content\" NOWRAP>" + tb_font + out.formatDate(dat.getDateTime())
out.write("<TR>\n<TD ALIGN=LEFT CLASS=\"content\" NOWRAP>" + tb_font + html.formatDate(dat.getDateTime())
+ "</FONT></TD>\n<TD ALIGN=LEFT CLASS=\"content\" NOWRAP>" + tb_font
+ StringUtil.encodeHTML(dat.getDescription())
+ "</FONT></TD>\n<TD ALIGN=LEFT CLASS=\"content\" NOWRAP>" + tb_font

View File

@ -11,7 +11,7 @@
*
* 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.
* Copyright (C) 2001-02 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
@ -22,6 +22,7 @@ import javax.servlet.*;
import com.silverwrist.venice.core.*;
import com.silverwrist.venice.except.*;
import com.silverwrist.venice.ui.*;
import com.silverwrist.venice.ui.helpers.HTMLRendering;
import com.silverwrist.venice.ui.servlet.RequestImpl;
public class FindView implements ContentJSP
@ -48,6 +49,7 @@ public class FindView implements ContentJSP
private int display; // which display are we doing?
private int max_results; // the maximum number of results displayed
private RequestInput rinput = null; // the RequestInput (during execution)
private HTMLRendering html = null; // HTML Rendering module (during execution)
private int field = -1; // search field indicator
private int mode = -1; // search mode indicator
private String term = null; // current search term
@ -112,12 +114,14 @@ public class FindView implements ContentJSP
public void initialize(RequestInput req)
{
rinput = req;
html = (HTMLRendering)(req.queryService(HTMLRendering.class));
} // end initialize
public void terminate(RequestInput req)
{
rinput = null;
html = null;
} // end terminate
@ -128,13 +132,13 @@ public class FindView implements ContentJSP
public final String formatDate(Date date)
{
return ((rinput==null) ? null : rinput.formatDate(date));
return ((html==null) ? null : html.formatDate(date));
} // end formatDate
public final String getActivityString(Date date)
{
return (rinput==null) ? null : rinput.getActivityString(date);
return (html==null) ? null : html.getActivityString(date);
} // end getActivityString

View File

@ -11,7 +11,7 @@
*
* 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.
* Copyright (C) 2001-02 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
@ -22,6 +22,7 @@ import java.util.HashMap;
import javax.servlet.*;
import com.silverwrist.venice.core.CommunityContext;
import com.silverwrist.venice.ui.*;
import com.silverwrist.venice.ui.helpers.HTMLRendering;
import com.silverwrist.venice.ui.servlet.RequestImpl;
public class JSPView implements ContentJSP
@ -36,6 +37,7 @@ public class JSPView implements ContentJSP
private String qid = null;
private String jsp_name;
private RequestInput rinput = null;
private HTMLRendering html = null;
/*--------------------------------------------------------------------------------
* Constructor
@ -92,12 +94,14 @@ public class JSPView implements ContentJSP
public void initialize(RequestInput req)
{
rinput = req;
html = (HTMLRendering)(req.queryService(HTMLRendering.class));
} // end initialize
public void terminate(RequestInput req)
{
rinput = null;
html = null;
} // end terminate
@ -128,7 +132,7 @@ public class JSPView implements ContentJSP
public final String formatDate(Date date)
{
return ((rinput==null) ? null : rinput.formatDate(date));
return ((html==null) ? null : html.formatDate(date));
} // end formatDate
@ -140,7 +144,7 @@ public class JSPView implements ContentJSP
public final String getActivityString(Date date)
{
return ((rinput==null) ? null : rinput.getActivityString(date));
return ((html==null) ? null : html.getActivityString(date));
} // end getActivityString

View File

@ -21,6 +21,7 @@ import java.util.Date;
import javax.servlet.*;
import com.silverwrist.venice.core.CommunityContext;
import com.silverwrist.venice.ui.*;
import com.silverwrist.venice.ui.helpers.HTMLRendering;
import com.silverwrist.venice.ui.servlet.RequestImpl;
public class NestedJSPView implements ContentJSP
@ -33,6 +34,7 @@ public class NestedJSPView implements ContentJSP
private Content outer;
private String jspname;
private RequestInput rinput = null;
private HTMLRendering html = null;
/*--------------------------------------------------------------------------------
* Constructor
@ -89,12 +91,14 @@ public class NestedJSPView implements ContentJSP
public void initialize(RequestInput req)
{
rinput = req;
html = (HTMLRendering)(req.queryService(HTMLRendering.class));
} // end initialize
public void terminate(RequestInput req)
{
rinput = null;
html = null;
} // end terminate
@ -117,7 +121,7 @@ public class NestedJSPView implements ContentJSP
public final String formatDate(Date date)
{
return ((rinput==null) ? null : rinput.formatDate(date));
return ((html==null) ? null : html.formatDate(date));
} // end formatDate
@ -129,7 +133,7 @@ public class NestedJSPView implements ContentJSP
public final String getActivityString(Date date)
{
return ((rinput==null) ? null : rinput.getActivityString(date));
return ((html==null) ? null : html.getActivityString(date));
} // end getActivityString

View File

@ -20,6 +20,7 @@ package com.silverwrist.venice.ui.view;
import java.util.*;
import javax.servlet.*;
import com.silverwrist.venice.ui.*;
import com.silverwrist.venice.ui.helpers.HTMLRendering;
import com.silverwrist.venice.ui.servlet.RequestImpl;
public class PhotoUploader implements ContentJSP
@ -115,7 +116,10 @@ public class PhotoUploader implements ContentJSP
public final String getAction()
{
return ((rinput==null) ? action : rinput.formatURL(action,action_type));
if (rinput==null)
return action;
HTMLRendering html = (HTMLRendering)(rinput.queryService(HTMLRendering.class));
return html.formatURL(action,action_type);
} // end getAction

View File

@ -11,7 +11,7 @@
*
* 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.
* Copyright (C) 2001-02 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
@ -22,8 +22,9 @@ import javax.servlet.ServletException;
import com.silverwrist.venice.core.UserContext;
import com.silverwrist.venice.except.*;
import com.silverwrist.venice.ui.*;
import com.silverwrist.venice.ui.helpers.HTMLRendering;
public class SideBoxNestedView implements ContentDirect, ColorSelectors, LinkTypes
public class SideBoxNestedView implements ContentDirect
{
private Content inner;
private Content[] sideboxes;
@ -63,6 +64,8 @@ public class SideBoxNestedView implements ContentDirect, ColorSelectors, LinkTyp
public void render(RequestOutput out) throws IOException
{
HTMLRendering html = (HTMLRendering)(out.queryService(HTMLRendering.class));
try
{ // Write out the start of the content structure.
out.write("<TABLE BORDER=0 ALIGN=CENTER WIDTH=\"100%\" CELLPADDING=4 CELLSPACING=0><TR VALIGN=TOP>\n"
@ -76,11 +79,11 @@ public class SideBoxNestedView implements ContentDirect, ColorSelectors, LinkTyp
for (int i=0; i<sideboxes.length; i++)
{ // draw in the outer framework of the current sidebox
out.write("<TABLE ALIGN=CENTER WIDTH=200 BORDER=0 CELLPADDING=2 CELLSPACING=0><TR VALIGN=MIDDLE "
+ "BGCOLOR=\"" + out.getColor(SIDEBOX_TITLE_BACKGROUND)
+ "BGCOLOR=\"" + html.getColor(html.SIDEBOX_TITLE_BACKGROUND)
+ "\"><TD ALIGN=LEFT CLASS=\"sideboxtop\">\n"
+ out.getFontTag(SIDEBOX_TITLE_FOREGROUND,"sidebox-title") + "<B>"
+ html.getFontTag(html.SIDEBOX_TITLE_FOREGROUND,"sidebox-title") + "<B>"
+ sideboxes[i].getPageTitle(out) + "</B></FONT>\n</TD></TR><TR VALIGN=TOP BGCOLOR=\""
+ out.getColor(SIDEBOX_CONTENT_BACKGROUND) + "\"><TD ALIGN=LEFT CLASS=\"sidebox\">\n");
+ html.getColor(html.SIDEBOX_CONTENT_BACKGROUND) + "\"><TD ALIGN=LEFT CLASS=\"sidebox\">\n");
out.output(sideboxes[i]); // output the sidebox content
@ -90,8 +93,8 @@ public class SideBoxNestedView implements ContentDirect, ColorSelectors, LinkTyp
} // end for
if (do_configure) // write the Configure button below the sideboxes
out.write("<A HREF=\"" + out.formatURL("usr/sidebox.js.vs",SERVLET) + "\">"
+ out.getButtonVisual("configure") + "</A>\n");
out.write("<A HREF=\"" + html.formatURL("usr/sidebox.js.vs",html.SERVLET) + "\">"
+ html.getButtonVisual("configure") + "</A>\n");
// Finish up.
out.write("</TD>\n</TR></TABLE>");

View File

@ -11,7 +11,7 @@
*
* 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.
* Copyright (C) 2001-02 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
@ -21,8 +21,9 @@ import java.io.IOException;
import java.util.*;
import com.silverwrist.util.StringUtil;
import com.silverwrist.venice.ui.*;
import com.silverwrist.venice.ui.helpers.HTMLRendering;
public class TextMessage implements ContentDirect, ColorSelectors
public class TextMessage implements ContentDirect
{
/*--------------------------------------------------------------------------------
* Internal class that holds button details
@ -43,9 +44,9 @@ public class TextMessage implements ContentDirect, ColorSelectors
} // end constructor
public final String getEquivalent(RequestOutput ro)
public final String getEquivalent(HTMLRendering html)
{
return "<A HREF=\"" + ro.formatURL(link,linktype) + "\">" + ro.getButtonVisual(id) + "</A>";
return "<A HREF=\"" + html.formatURL(link,linktype) + "\">" + html.getButtonVisual(id) + "</A>";
} // end getEquivalent
@ -126,20 +127,22 @@ public class TextMessage implements ContentDirect, ColorSelectors
public void render(RequestOutput out) throws IOException
{
HTMLRendering html = (HTMLRendering)(out.queryService(HTMLRendering.class));
if (render_buttons==null)
{ // pre-render the buttons
render_buttons = new String[buttons.size()];
for (int i=0; i<render_buttons.length; i++)
{ // pre-render the buttons into an array
Button b = (Button)(buttons.get(i));
render_buttons[i] = b.getEquivalent(out);
render_buttons[i] = b.getEquivalent(html);
} // end for
} // end if
out.writeContentHeader(title,subtitle);
out.write(out.getFontTag(CONTENT_FOREGROUND,"content") + "\n" + text
out.write(html.getFontTag(html.CONTENT_FOREGROUND,"content") + "\n" + text
+ "</FONT><P>\n<DIV ALIGN=\"center\">\n" + StringUtil.join((Object[])render_buttons,"&nbsp;\n")
+ "</DIV>\n");

View File

@ -0,0 +1,58 @@
/*
* 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) 2002 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
package com.silverwrist.venice.util;
/**
* An interface that is implemented by objects that wish to provide other interfaces or objects as
* services, instead of through inheritance or interface implementation.
*
* @author Eric J. Bowersox &lt;erbo@silcom.com&gt;
* @version X
*/
public interface ServiceProvider
{
/**
* Queries this object for a specified service.
*
* @param klass The class of the object that should be returned as a service.
* @return A service object. The service object is guaranteed to be of the class
* specified by <CODE>klass</CODE>; that is, if <CODE>queryService(klass)</CODE>
* yields some object <CODE>x</CODE>, then the expression <CODE>klass.isInstance(x)</CODE>
* is true.
* @exception com.silverwrist.venice.except.NoSuchServiceException If no service is available in
* the specified class.
*/
public abstract Object queryService(Class klass);
/**
* Queries this object for a specified service.
*
* @param klass The class of the object that should be returned as a service.
* @param serviceid ID for the service to be requested, to further discriminate between requests.
* @return A service object. The service object is guaranteed to be of the class
* specified by <CODE>klass</CODE>; that is, if <CODE>queryService(klass)</CODE>
* yields some object <CODE>x</CODE>, then the expression <CODE>klass.isInstance(x)</CODE>
* is true.
* @exception com.silverwrist.venice.except.NoSuchServiceException If no service is available in
* the specified class.
*/
public abstract Object queryService(Class klass, String serviceid);
} // end interface ServiceProvider