From 681ec6a8a0af74dcf18d910ac28a0810b1a8283a Mon Sep 17 00:00:00 2001 From: "Eric J. Bowersox" Date: Mon, 19 Jul 2004 08:18:19 +0000 Subject: [PATCH] fixed up a few HTML generation issues in tag classes and JSP templates; added the authenticatePrivileged method; added SQL date parameter method to the XML-RPC Request object --- etc/venice-config.xml | 4 + .../silverwrist/venice/core/UserContext.java | 2 + .../venice/core/impl/UserContextImpl.java | 89 +++++++++++++++++++ .../venice/core/internals/GlobalSiteImpl.java | 53 +++++++---- .../silverwrist/venice/svc/GlobalSite.java | 14 +-- .../venice/ui/config/ButtonHolder.java | 48 +++++----- .../venice/ui/jsp/UtilButtonTag.java | 26 +++--- .../venice/ui/jsp/UtilLinkTag.java | 64 ++++++------- .../venice/ui/jsp/UtilStdBulletTag.java | 10 +-- .../venice/ui/jsp/UtilXLinkTag.java | 82 ++++++++--------- .../venice/ui/rpc/XmlRpcRequest.java | 83 ++++++++++------- web/format/comm/profile.jsp | 75 ++++++++-------- web/format/conf/conferences.jsp | 39 ++++---- web/format/conf/posts.jsp | 38 ++++---- web/format/conf/topics.jsp | 32 +++---- 15 files changed, 401 insertions(+), 258 deletions(-) diff --git a/etc/venice-config.xml b/etc/venice-config.xml index 44a353f..f77b5cf 100644 --- a/etc/venice-config.xml +++ b/etc/venice-config.xml @@ -29,6 +29,10 @@ WEB-INF/services-config.xml + + + diff --git a/src/com/silverwrist/venice/core/UserContext.java b/src/com/silverwrist/venice/core/UserContext.java index 919b09e..94228f6 100644 --- a/src/com/silverwrist/venice/core/UserContext.java +++ b/src/com/silverwrist/venice/core/UserContext.java @@ -130,5 +130,7 @@ public interface UserContext extends SearchMode public void setDateOfBirth(java.sql.Date date) throws DataException; + public void authenticatePrivileged(String username) throws AccessError, DataException; + } // end interface UserContext diff --git a/src/com/silverwrist/venice/core/impl/UserContextImpl.java b/src/com/silverwrist/venice/core/impl/UserContextImpl.java index 748a754..c6c014c 100644 --- a/src/com/silverwrist/venice/core/impl/UserContextImpl.java +++ b/src/com/silverwrist/venice/core/impl/UserContextImpl.java @@ -1667,6 +1667,95 @@ class UserContextImpl implements UserContext, ServiceProvider, PropertyProvider } // end setDateOfBirth + public void authenticatePrivileged(String username) throws AccessError, DataException + { + if (isLoggedIn()) + { // already authenticated, can't authenticate again + logger.error("UserContext already authenticated (with uid " + uid + ")"); + throw new InternalStateError("context already authenticated"); + + } // end if + + if (logger.isDebugEnabled()) + logger.debug("authenticatePrivileged(): authenticating user \"" + username + "\"..."); + + if (!(globalsite.isPrivilegedAddress(remote_addr))) + { // not privileged - f**k off + logger.error("source address " + remote_addr + " is not privileged!"); + throw new AccessError("Remote address is not privileged!"); + + } // end if + + Connection conn = null; + PreparedStatement stmt = null; + AuditRecord ar = null; + + try + { // look for a user name matching this user record + conn = globalsite.getConnection(null); + stmt = conn.prepareStatement("SELECT * FROM users WHERE username = ?;"); + stmt.setString(1,username); + ResultSet rs = stmt.executeQuery(); + + if (!(rs.next())) + { // user not found + logger.error("...user not found"); + ar = new AuditRecord(AuditRecord.LOGIN_FAIL,0,remote_addr,"Bad username: " + username); + throw new AccessError("The user account you have specified does not exist. Please try again."); + + } // end if + + int the_uid = rs.getInt("uid"); + + if (rs.getBoolean("is_anon")) + { // can't log in as Anonymous Honyak + logger.error("...user is the Anonymous Honyak, can't explicitly login"); + ar = new AuditRecord(AuditRecord.LOGIN_FAIL,the_uid,remote_addr,"Anonymous user"); + throw new AccessError("This account cannot be explicitly logged into. Please try again."); + + } // end if + + if (logger.isDebugEnabled()) + logger.debug("...authenticated"); + + // we're authenticated - load the user data into the context + loadUserData(rs); + rs.close(); + + // update the "last access" time in the database + stmt.close(); + stmt = conn.prepareStatement("UPDATE users SET lastaccess = ? WHERE uid = ?;"); + java.util.Date mydate = new java.util.Date(); + SQLUtil.setFullDateTime(stmt,1,mydate); + stmt.setInt(2,uid); + stmt.executeUpdate(); + + // update the "last access" time in this object + last_access = mydate; + + // an audit record indicating we logged in OK + ar = new AuditRecord(AuditRecord.LOGIN_OK,the_uid,remote_addr,"[privileged]"); + + if (logger.isDebugEnabled()) + logger.debug("...context loaded, we're ready :-)"); + + } // end try + catch (SQLException e) + { // database error - this is a DataException + logger.error("DB error reading user data: " + e.getMessage(),e); + throw new DataException("unable to access user data: " + e.getMessage(),e); + + } // end catch + finally + { // make sure the connection is released before we go + SQLUtil.shutdown(stmt); + AuditRecord.store(conn,ar); + SQLUtil.shutdown(conn); + + } // end if + + } // end authenticatePrivileged + /*-------------------------------------------------------------------------------- * Implementations from interface ServiceProvider *-------------------------------------------------------------------------------- diff --git a/src/com/silverwrist/venice/core/internals/GlobalSiteImpl.java b/src/com/silverwrist/venice/core/internals/GlobalSiteImpl.java index 48883aa..6bb9cc5 100644 --- a/src/com/silverwrist/venice/core/internals/GlobalSiteImpl.java +++ b/src/com/silverwrist/venice/core/internals/GlobalSiteImpl.java @@ -9,9 +9,9 @@ * * The Original Code is the Venice Web Communities System. * - * The Initial Developer of the Original Code is Eric J. Bowersox , + * The Initial Developer of the Original Code is Eric J. Bowersox , * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001-02 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * Copyright (C) 2001-2004 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. * * Contributor(s): */ @@ -117,17 +117,18 @@ public class GlobalSiteImpl implements GlobalSite *-------------------------------------------------------------------------------- */ - private ServiceProvider engine_svc = null; // ServiceProvider for the VeniceEngine - private DataPool datapool = null; // the database pool - private Properties email_props = null; // email properties - private javax.mail.Session mailsession = null; // email session object - private StockMessages stock_messages = null; // stock messages holder - private HashMap html_checkers = new HashMap(); // HTML checkers - private SecurityMonitorEnvironment sm_env; // security monitor environment - private volatile boolean task_running = true; // running tasks flag - private Object task_semaphore = new Object(); // semaphore used for tasks - private LinkedList[] task_queues; // the task queues - private Thread[] task_threads; // the task threads + private ServiceProvider engine_svc = null; // ServiceProvider for the VeniceEngine + private Set m_privileged_addrs = Collections.EMPTY_SET; // privileged addresses + private DataPool datapool = null; // the database pool + private Properties email_props = null; // email properties + private javax.mail.Session mailsession = null; // email session object + private StockMessages stock_messages = null; // stock messages holder + private HashMap html_checkers = new HashMap(); // HTML checkers + private SecurityMonitorEnvironment sm_env; // security monitor environment + private volatile boolean task_running = true; // running tasks flag + private Object task_semaphore = new Object(); // semaphore used for tasks + private LinkedList[] task_queues; // the task queues + private Thread[] task_threads; // the task threads /*-------------------------------------------------------------------------------- * Constructor @@ -140,9 +141,25 @@ public class GlobalSiteImpl implements GlobalSite this.engine_svc = engine_svc; XMLLoader loader = XMLLoader.get(); - // Get the section. + // Get the section. DOMElementHelper config_h = new DOMElementHelper(config); Element sect = loader.configGetSubSection(config_h,"database"); + DOMElementHelper sect_h = new DOMElementHelper(sect); + + // Get the value. + String s = sect_h.getSubElementText("privileged-addresses"); + if (!(StringUtil.isStringEmpty(s))) + { // break it up by commas + String[] addrs = StringUtil.splitArray(s,","); + HashSet tmp = new HashSet(); + for (int i=0; i section. + sect = loader.configGetSubSection(config_h,"database"); try { // allocate the data pool object @@ -158,7 +175,7 @@ public class GlobalSiteImpl implements GlobalSite // Get the section. sect = loader.configGetSubSection(config_h,"email"); - DOMElementHelper sect_h = new DOMElementHelper(sect); + sect_h = new DOMElementHelper(sect); // initialize the email properties and get a mail session object email_props = new Properties(); @@ -580,6 +597,12 @@ public class GlobalSiteImpl implements GlobalSite *-------------------------------------------------------------------------------- */ + public boolean isPrivilegedAddress(String addr) + { + return m_privileged_addrs.contains(addr); + + } // end isPrivilegedAddress + public Connection getConnection(String db_selector) throws SQLException { // db_selector is ignored for now diff --git a/src/com/silverwrist/venice/svc/GlobalSite.java b/src/com/silverwrist/venice/svc/GlobalSite.java index 2829d83..da454d3 100644 --- a/src/com/silverwrist/venice/svc/GlobalSite.java +++ b/src/com/silverwrist/venice/svc/GlobalSite.java @@ -9,9 +9,9 @@ * * The Original Code is the Venice Web Communities System. * - * The Initial Developer of the Original Code is Eric J. Bowersox , + * The Initial Developer of the Original Code is Eric J. Bowersox , * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2002 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * Copyright (C) 2002-2004 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. * * Contributor(s): */ @@ -27,12 +27,14 @@ public interface GlobalSite extends ServiceProvider public static final int TASK_PRIO_NORMAL = 3; public static final int TASK_PRIO_MAX = 7; - public abstract Connection getConnection(String db_selector) throws SQLException; + public boolean isPrivilegedAddress(String addr); - public abstract String getStockMessage(String key); + public Connection getConnection(String db_selector) throws SQLException; - public abstract void queueTask(Runnable task, int priority); + public String getStockMessage(String key); - public abstract void queueTask(Runnable task); + public void queueTask(Runnable task, int priority); + + public void queueTask(Runnable task); } // end interface GlobalSite diff --git a/src/com/silverwrist/venice/ui/config/ButtonHolder.java b/src/com/silverwrist/venice/ui/config/ButtonHolder.java index 95e4e6e..320120c 100644 --- a/src/com/silverwrist/venice/ui/config/ButtonHolder.java +++ b/src/com/silverwrist/venice/ui/config/ButtonHolder.java @@ -9,9 +9,9 @@ * * The Original Code is the Venice Web Communities System. * - * The Initial Developer of the Original Code is Eric J. Bowersox , + * The Initial Developer of the Original Code is Eric J. Bowersox , * 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-2004 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. * * Contributor(s): */ @@ -31,11 +31,11 @@ class ButtonHolder *-------------------------------------------------------------------------------- */ - private int width; - private int height; - private Map id_to_caption; - private Map id_to_image; - private String tail_tag; + private int m_width; + private int m_height; + private Map m_id_to_caption; + private Map m_id_to_image; + private String m_tail_tag; /*-------------------------------------------------------------------------------- * Constructor @@ -47,9 +47,9 @@ class ButtonHolder // get the initial header information XMLLoader loader = XMLLoader.get(); loader.configVerifyNodeName(cfg,"buttons"); - width = loader.configGetAttributeInt(cfg,"width"); - height = loader.configGetAttributeInt(cfg,"height"); - tail_tag = "\" WIDTH=" + width + " HEIGHT=" + height + " BORDER=0>"; + m_width = loader.configGetAttributeInt(cfg,"width"); + m_height = loader.configGetAttributeInt(cfg,"height"); + m_tail_tag = "\" width=\"" + m_width + "\" height=\"" + m_height + "\" border=\"0\" />"; // load the individual button descriptors HashMap tmp_caption = new HashMap(); @@ -78,30 +78,30 @@ class ButtonHolder } // end for if (tmp_caption.isEmpty()) - id_to_caption = Collections.EMPTY_MAP; + m_id_to_caption = Collections.EMPTY_MAP; else - id_to_caption = Collections.unmodifiableMap(tmp_caption); + m_id_to_caption = Collections.unmodifiableMap(tmp_caption); if (tmp_image.isEmpty()) - id_to_image = Collections.EMPTY_MAP; + m_id_to_image = Collections.EMPTY_MAP; else - id_to_image = Collections.unmodifiableMap(tmp_image); + m_id_to_image = Collections.unmodifiableMap(tmp_image); } // end constructor final String getButtonVisual(String id) { // Look up the caption and image. - String img = (String)(id_to_image.get(id)); + String img = (String)(m_id_to_image.get(id)); if (img==null) return ""; - String caption = (String)(id_to_caption.get(id)); + String caption = (String)(m_id_to_caption.get(id)); // Build the returned tag. - StringBuffer buf = new StringBuffer("\""); buf.append("[ ").append(caption).append(" ]"); - buf.append(tail_tag); + buf.append(m_tail_tag); return buf.toString(); } // end getButtonVisual @@ -109,17 +109,17 @@ class ButtonHolder final String getButtonInput(String id) { // Look up the caption and image. - String img = (String)(id_to_image.get(id)); + String img = (String)(m_id_to_image.get(id)); if (img==null) return ""; - String caption = (String)(id_to_caption.get(id)); + String caption = (String)(m_id_to_caption.get(id)); // Build the returned tag. - StringBuffer buf = new StringBuffer(", + * The Initial Developer of the Original Code is Eric J. Bowersox , * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001-02 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * Copyright (C) 2001-2004 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. * * Contributor(s): */ @@ -30,8 +30,8 @@ public class UtilButtonTag extends VeniceTagSupport *-------------------------------------------------------------------------------- */ - private String type = "img"; - private String id = null; + private String m_type = "img"; + private String m_id = null; /*-------------------------------------------------------------------------------- * Overrides from class TagSupport @@ -40,17 +40,17 @@ public class UtilButtonTag extends VeniceTagSupport public int doStartTag() throws JspException { - if (id==null) + if (m_id==null) throw new JspTagException(" ID not specified!"); - if (!(type.equals("img") || type.equals("input"))) + if (!(m_type.equals("img") || m_type.equals("input"))) throw new JspTagException(" type not valid!"); String data; HTMLRendering html = (HTMLRendering)(getRequestOutput().queryService(HTMLRendering.class)); - if (type.equals("img")) - data = html.getButtonVisual(id); + if (m_type.equals("img")) + data = html.getButtonVisual(m_id); else - data = html.getButtonInput(id); + data = html.getButtonInput(m_id); try { // write out what we came here to accomplish @@ -71,8 +71,8 @@ public class UtilButtonTag extends VeniceTagSupport public void release() { super.release(); - type = "img"; - id = null; + m_type = "img"; + m_id = null; } // end release @@ -83,13 +83,13 @@ public class UtilButtonTag extends VeniceTagSupport public void setType(String s) { - type = s.trim().toLowerCase(); + m_type = s.trim().toLowerCase(); } // end setType public void setId(String s) { - id = s; + m_id = s; } // end setId diff --git a/src/com/silverwrist/venice/ui/jsp/UtilLinkTag.java b/src/com/silverwrist/venice/ui/jsp/UtilLinkTag.java index 236f96c..94b515f 100644 --- a/src/com/silverwrist/venice/ui/jsp/UtilLinkTag.java +++ b/src/com/silverwrist/venice/ui/jsp/UtilLinkTag.java @@ -9,7 +9,7 @@ * * The Original Code is the Venice Web Communities System. * - * The Initial Developer of the Original Code is Eric J. Bowersox , + * The Initial Developer of the Original Code is Eric J. Bowersox , * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are * Copyright (C) 2001-2004 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. * @@ -39,11 +39,11 @@ public class UtilLinkTag extends VeniceTagSupport *-------------------------------------------------------------------------------- */ - private String href = null; - private String type = null; - private String cls = null; - private String target = null; - private String title = null; + private String m_href = null; + private String m_type = null; + private String m_class = null; + private String m_target = null; + private String m_title = null; /*-------------------------------------------------------------------------------- * Overrides from class TagSupport @@ -53,39 +53,39 @@ public class UtilLinkTag extends VeniceTagSupport public int doStartTag() throws JspException { // Check the parameters! - if (href==null) + if (m_href==null) throw new JspTagException(" href not specified!"); - if (type==null) + if (m_type==null) throw new JspTagException(" type not specified!"); RequestInput ri = getRequestInput(); HTMLRendering html = (HTMLRendering)(ri.queryService(HTMLRendering.class)); - int ityp = html.convertLinkType(type); + int ityp = html.convertLinkType(m_type); if (ityp==-1) throw new JspTagException(" invalid link type!"); try { // Do parameter replacement on the HREF string if necessary. - if (href.indexOf(LOCATION_PARAM)>=0) - href = StringUtil.replaceAllInstances(href,LOCATION_PARAM,URLEncoder.encode(ri.getLocation(),"UTF-8")); + if (m_href.indexOf(LOCATION_PARAM)>=0) + m_href = StringUtil.replaceAllInstances(m_href,LOCATION_PARAM,URLEncoder.encode(ri.getLocation(),"UTF-8")); // write out what we came here to accomplish JspWriter out = pageContext.getOut(); - out.write(""); } // end try catch (IOException e) { // convert the I/O error into something the servlet engine can deal with - throw new JspTagException("error writing tag - " + e.getMessage()); + throw new JspTagException("error writing tag - " + e.getMessage()); } // end catch @@ -98,12 +98,12 @@ public class UtilLinkTag extends VeniceTagSupport try { // write out what we came here to accomplish JspWriter out = pageContext.getOut(); - out.write(""); + out.write(""); } // end try catch (IOException e) { // convert the I/O error into something the servlet engine can deal with - throw new JspTagException("error writing tag - " + e.getMessage()); + throw new JspTagException("error writing tag - " + e.getMessage()); } // end catch @@ -114,11 +114,11 @@ public class UtilLinkTag extends VeniceTagSupport public void release() { super.release(); - href = null; - type = null; - cls = null; - target = null; - title = null; + m_href = null; + m_type = null; + m_class = null; + m_target = null; + m_title = null; } // end release @@ -129,31 +129,31 @@ public class UtilLinkTag extends VeniceTagSupport public void setHref(String s) { - href = s; + m_href = s; } // end setHref public void setType(String s) { - type = s; + m_type = s; } // end setType public void setAclass(String s) { - cls = s; + m_class = s; } // end setAclass public void setTarget(String s) { - target = s; + m_target = s; } // end setTarget public void setTitle(String s) { - title = s; + m_title = s; } // end setTitle diff --git a/src/com/silverwrist/venice/ui/jsp/UtilStdBulletTag.java b/src/com/silverwrist/venice/ui/jsp/UtilStdBulletTag.java index 8fee4a2..a2d1043 100644 --- a/src/com/silverwrist/venice/ui/jsp/UtilStdBulletTag.java +++ b/src/com/silverwrist/venice/ui/jsp/UtilStdBulletTag.java @@ -9,9 +9,9 @@ * * The Original Code is the Venice Web Communities System. * - * The Initial Developer of the Original Code is Eric J. Bowersox , + * The Initial Developer of the Original Code is Eric J. Bowersox , * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2001-02 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * Copyright (C) 2001-2004 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. * * Contributor(s): */ @@ -38,13 +38,13 @@ public class UtilStdBulletTag extends VeniceTagSupport { // write out what we came here to accomplish JspWriter out = pageContext.getOut(); // TODO: make this configurable - out.write("\"*\""); + out.write("\"*\""); } // end try catch (IOException e) { // convert the I/O error into something the servlet engine can deal with - throw new JspTagException("error writing button - " + e.getMessage()); + throw new JspTagException("error writing standard bullet - " + e.getMessage()); } // end catch diff --git a/src/com/silverwrist/venice/ui/jsp/UtilXLinkTag.java b/src/com/silverwrist/venice/ui/jsp/UtilXLinkTag.java index 99ab01c..3d08938 100644 --- a/src/com/silverwrist/venice/ui/jsp/UtilXLinkTag.java +++ b/src/com/silverwrist/venice/ui/jsp/UtilXLinkTag.java @@ -9,7 +9,7 @@ * * The Original Code is the Venice Web Communities System. * - * The Initial Developer of the Original Code is Eric J. Bowersox , + * The Initial Developer of the Original Code is Eric J. Bowersox , * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are * Copyright (C) 2001-2004 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. * @@ -39,13 +39,13 @@ public class UtilXLinkTag extends VeniceBodyTagSupport *-------------------------------------------------------------------------------- */ - private String href = null; - private int type = -1; - private String cls = null; - private String target = null; - private String text = null; - private String title = null; - private boolean target_external = false; + private String m_href = null; + private int m_type = -1; + private String m_class = null; + private String m_target = null; + private String m_text = null; + private String m_title = null; + private boolean m_target_external = false; /*-------------------------------------------------------------------------------- * Overrides from class BodyTagSupport @@ -67,11 +67,11 @@ public class UtilXLinkTag extends VeniceBodyTagSupport public int doEndTag() throws JspException { // Do some shorts-checking on our stored data. - if (href==null) + if (m_href==null) throw new JspTagException(" does not have a !"); - if (type<0) + if (m_type<0) throw new JspTagException(" does not have a !"); - if (text==null) + if (m_text==null) throw new JspTagException(" does not have a !"); // Dig out the RequestInput and HTMLRendering service. @@ -80,35 +80,35 @@ public class UtilXLinkTag extends VeniceBodyTagSupport try { // Do parameter replacement on the HREF string if necessary. - if (href.indexOf(LOCATION_PARAM)>=0) - href = StringUtil.replaceAllInstances(href,LOCATION_PARAM,URLEncoder.encode(ri.getLocation(),"UTF-8")); + if (m_href.indexOf(LOCATION_PARAM)>=0) + m_href = StringUtil.replaceAllInstances(m_href,LOCATION_PARAM,URLEncoder.encode(ri.getLocation(),"UTF-8")); // write out what we came here to accomplish JspWriter out = pageContext.getOut(); - out.write("" + text + ""); + out.write("" + m_text + ""); } // end try catch (IOException e) { // convert the I/O error into something the servlet engine can deal with - throw new JspTagException("error writing tag - " + e.getMessage()); + throw new JspTagException("error writing tag - " + e.getMessage()); } // end catch - href = null; - type = -1; - text = null; - title = null; - if (target_external) - target = null; - target_external = false; + m_href = null; + m_type = -1; + m_text = null; + m_title = null; + if (m_target_external) + m_target = null; + m_target_external = false; return EVAL_PAGE; } // end doEndTag @@ -116,8 +116,8 @@ public class UtilXLinkTag extends VeniceBodyTagSupport public void release() { super.release(); - cls = null; - target = null; + m_class = null; + m_target = null; } // end release @@ -128,13 +128,13 @@ public class UtilXLinkTag extends VeniceBodyTagSupport public void setAclass(String s) { - cls = s; + m_class = s; } // end setAclass public void setTarget(String s) { - target = s; + m_target = s; } // end setTarget @@ -145,29 +145,29 @@ public class UtilXLinkTag extends VeniceBodyTagSupport final void setLink(String href, int type) { - this.href = href; - this.type = type; + m_href = href; + m_type = type; } // end setLink final void setText(String text) { - this.text = text; + m_text = text; } // end setText final void setTitle(String title) { - this.title = title; + m_title = title; } // end setTitle final void setTarget2(String s) { - if (target==null) + if (m_target==null) { // set target via external tag - target = s; - target_external = true; + m_target = s; + m_target_external = true; } // end if diff --git a/src/com/silverwrist/venice/ui/rpc/XmlRpcRequest.java b/src/com/silverwrist/venice/ui/rpc/XmlRpcRequest.java index 27b4284..2a8c241 100644 --- a/src/com/silverwrist/venice/ui/rpc/XmlRpcRequest.java +++ b/src/com/silverwrist/venice/ui/rpc/XmlRpcRequest.java @@ -9,9 +9,9 @@ * * The Original Code is the Venice Web Communities System. * - * The Initial Developer of the Original Code is Eric J. Bowersox , + * The Initial Developer of the Original Code is Eric J. Bowersox , * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2002 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * Copyright (C) 2002-2004 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. * * Contributor(s): */ @@ -36,18 +36,18 @@ public class XmlRpcRequest *-------------------------------------------------------------------------------- */ - private static Category logger = Category.getInstance(XmlRpcRequest.class); + private static Logger logger = Logger.getLogger(XmlRpcRequest.class); - private static SimpleTimeZone utc = new SimpleTimeZone(0,"UTC"); + private static SimpleTimeZone s_utc = new SimpleTimeZone(0,"UTC"); /*-------------------------------------------------------------------------------- * Attributes *-------------------------------------------------------------------------------- */ - RequestInput req; // request input system - String method_name; // the method name - List method_params; // the method parameters + RequestInput m_req; // request input system + String m_method_name; // the method name + List m_method_params; // the method parameters /*-------------------------------------------------------------------------------- * Constructors @@ -64,7 +64,7 @@ public class XmlRpcRequest XMLLoader loader = XMLLoader.get(); Element root = loader.postGetRootElement(req_doc,"methodCall"); DOMElementHelper root_h = new DOMElementHelper(root); - method_name = loader.postGetSubElementText(root_h,"methodName"); + m_method_name = loader.postGetSubElementText(root_h,"methodName"); // parse the parameters Element params = root_h.getSubElement("params"); @@ -91,11 +91,11 @@ public class XmlRpcRequest // save the method parameters if (tmp_method_params.isEmpty()) - method_params = Collections.EMPTY_LIST; + m_method_params = Collections.EMPTY_LIST; else { // make it read-only before tmp_method_params.trimToSize(); - method_params = Collections.unmodifiableList(tmp_method_params); + m_method_params = Collections.unmodifiableList(tmp_method_params); } // end else @@ -106,15 +106,15 @@ public class XmlRpcRequest } // end catch - this.req = req; // save reference off + m_req = req; // save reference off } // end constructor XmlRpcRequest(RequestInput req, String method_name, List method_params) { - this.req = req; - this.method_name = method_name; - this.method_params = method_params; + m_req = req; + m_method_name = method_name; + m_method_params = method_params; } // end constructor @@ -226,7 +226,7 @@ public class XmlRpcRequest try { // use a GregorianCalendar to convert the fields into the appropriate format - GregorianCalendar cal = new GregorianCalendar(utc); + GregorianCalendar cal = new GregorianCalendar(s_utc); cal.set(Calendar.YEAR,Integer.parseInt(dstr.substring(0,4))); cal.set(Calendar.MONTH,Integer.parseInt(dstr.substring(4,6)) - 1 + Calendar.JANUARY); cal.set(Calendar.DAY_OF_MONTH,Integer.parseInt(dstr.substring(6,8))); @@ -396,31 +396,31 @@ public class XmlRpcRequest public final String getMethod() { - return method_name; + return m_method_name; } // end getMethod public final int getParamCount() { - return method_params.size(); + return m_method_params.size(); } // end getParamCount public final List getParams() { - return method_params; + return m_method_params; } // end getParams public final Object getParam(int ndx) { - return method_params.get(ndx); + return m_method_params.get(ndx); } // end getParam public final String getParamType(int ndx) { - Object foo = method_params.get(ndx); + Object foo = m_method_params.get(ndx); if (foo instanceof Integer) return "int"; if (foo instanceof Boolean) @@ -429,7 +429,7 @@ public class XmlRpcRequest return "string"; if (foo instanceof Double) return "double"; - if (foo instanceof Date) + if (foo instanceof java.util.Date) return "dateTime"; if (foo instanceof byte[]) return "base64"; @@ -443,7 +443,7 @@ public class XmlRpcRequest public final int getParamInt(int ndx) throws XmlRpcFault { - Object foo = method_params.get(ndx); + Object foo = m_method_params.get(ndx); if (foo instanceof Integer) return ((Integer)foo).intValue(); else if (foo instanceof Boolean) @@ -455,11 +455,11 @@ public class XmlRpcRequest public final double getParamDouble(int ndx) throws XmlRpcFault { - Object foo = method_params.get(ndx); + Object foo = m_method_params.get(ndx); if ((foo instanceof Integer) || (foo instanceof Double)) return ((Number)foo).doubleValue(); else if (foo instanceof Boolean) - return ((Boolean)foo).booleanValue() ? 1 : 0; + return ((Boolean)foo).booleanValue() ? 1.0 : 0.0; else throw new XmlRpcFault(XmlRpcFault.INVALID_PARAMS,"parameter type mismatch"); @@ -467,7 +467,7 @@ public class XmlRpcRequest public final String getParamString(int ndx) throws XmlRpcFault { - Object foo = method_params.get(ndx); + Object foo = m_method_params.get(ndx); if ((foo instanceof byte[]) || (foo instanceof List) || (foo instanceof Map)) throw new XmlRpcFault(XmlRpcFault.INVALID_PARAMS,"parameter type mismatch"); @@ -475,22 +475,43 @@ public class XmlRpcRequest } // end getParamString + public final java.sql.Date getParamSQLDate(int ndx) throws XmlRpcFault + { + Object foo = m_method_params.get(ndx); + if (!(foo instanceof java.util.Date)) + throw new XmlRpcFault(XmlRpcFault.INVALID_PARAMS,"parameter type mismatch"); + + // need to crosswise convert this + Calendar cal_src = new GregorianCalendar(s_utc); + cal_src.setTime((java.util.Date)foo); + Calendar cal_dest = Calendar.getInstance(); + cal_dest.set(Calendar.YEAR,cal_src.get(Calendar.YEAR)); + cal_dest.set(Calendar.MONTH,cal_src.get(Calendar.MONTH)); + cal_dest.set(Calendar.DAY_OF_MONTH,cal_src.get(Calendar.DAY_OF_MONTH)); + cal_dest.set(Calendar.HOUR,0); + cal_dest.set(Calendar.MINUTE,0); + cal_dest.set(Calendar.SECOND,0); + cal_dest.set(Calendar.MILLISECOND,0); + return new java.sql.Date(cal_dest.getTimeInMillis()); + + } // end getParamSQLDate + public final CommunityContext getParamCommunity(int ndx) throws XmlRpcFault, DataException { - Object foo = method_params.get(ndx); + Object foo = m_method_params.get(ndx); if ((foo instanceof byte[]) || (foo instanceof List) || (foo instanceof Map) || (foo instanceof Boolean)) throw new XmlRpcFault(XmlRpcFault.INVALID_PARAMS,"parameter type mismatch"); if (foo instanceof Integer) - return req.getUser().getCommunityContext(((Integer)foo).intValue()); + return m_req.getUser().getCommunityContext(((Integer)foo).intValue()); else - return req.getUser().getCommunityContext(foo.toString().trim()); + return m_req.getUser().getCommunityContext(foo.toString().trim()); } // end getParamCommunity public final ConferenceContext getParamConference(int ndx, CommunityContext comm) throws XmlRpcFault, DataException, AccessError { - Object foo = method_params.get(ndx); + Object foo = m_method_params.get(ndx); if ((foo instanceof byte[]) || (foo instanceof List) || (foo instanceof Map) || (foo instanceof Boolean)) throw new XmlRpcFault(XmlRpcFault.INVALID_PARAMS,"parameter type mismatch"); if (foo instanceof Integer) @@ -503,7 +524,7 @@ public class XmlRpcRequest public final TopicContext getParamTopic(int ndx, ConferenceContext conf) throws XmlRpcFault, DataException, AccessError { - Object foo = method_params.get(ndx); + Object foo = m_method_params.get(ndx); if (!(foo instanceof Integer)) throw new XmlRpcFault(XmlRpcFault.INVALID_PARAMS,"parameter type mismatch"); return conf.getTopic(((Integer)foo).shortValue()); @@ -513,7 +534,7 @@ public class XmlRpcRequest public final TopicMessageContext getParamPost(int ndx, TopicContext topic) throws XmlRpcFault, DataException, AccessError { - Object foo = method_params.get(ndx); + Object foo = m_method_params.get(ndx); if (!(foo instanceof Integer)) throw new XmlRpcFault(XmlRpcFault.INVALID_PARAMS,"parameter type mismatch"); return topic.getMessage(((Integer)foo).intValue()); diff --git a/web/format/comm/profile.jsp b/web/format/comm/profile.jsp index 125a990..28c7ac8 100644 --- a/web/format/comm/profile.jsp +++ b/web/format/comm/profile.jsp @@ -9,9 +9,9 @@ The Original Code is the Venice Web Communities System. - The Initial Developer of the Original Code is Eric J. Bowersox , + The Initial Developer of the Original Code is Eric J. Bowersox , for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - Copyright (C) 2001-02 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + Copyright (C) 2001-2004 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. Contributor(s): --%> @@ -32,24 +32,24 @@ <%= comm.getName() %> - - +
- <%= view.getRequestAttribute("community.logo").toString() %>
+ + + - -
+ <%= view.getRequestAttribute("community.logo").toString() %>
<% java.util.Date tmpd = comm.getCreationDate(); %> <% if (tmpd!=null) { %> - Community created:
<%= view.formatDate(tmpd) %>
+ Community created:
<%= view.formatDate(tmpd) %>
<% } // end if %> <% tmpd = comm.getLastAccessDate(); %> <% if (tmpd!=null) { %> - Last accessed:
<%= view.formatDate(tmpd) %>
+ Last accessed:
<%= view.formatDate(tmpd) %>
<% } // end if %> <% tmpd = comm.getLastUpdateDate(); %> <% if (tmpd!=null) { %> - Profile last updated:
<%= view.formatDate(tmpd) %>
+ Profile last updated:
<%= view.formatDate(tmpd) %>
<% } // end if %> -
+
comm/join.js.vs?cc= @@ -64,20 +64,20 @@ -
+
-
- Public Community - Private Community + + Public Community + Private Community -
- Category: +
+ Category: <% CategoryDescriptor cat = (CategoryDescriptor)(view.getRequestAttribute("category")); %> <% for (int i=0; i <% if (i>0) { %>: <% } %> - + find.js.vs?disp=<%= FindView.FD_COMMUNITIES %>&cat=<%= cat.getIDAtLevel(i) %> @@ -85,39 +85,40 @@ <% } // end for %>
-

+
-

+

<% UserProfile prof = (UserProfile)(view.getRequestAttribute("host.profile")); %> - Host: - + Host: + user/<%= prof.getUserName() %> <%= prof.getUserName() %> -
+

<% ContactInfo ci = (ContactInfo)(view.getRequestAttribute("contact.info")); %> - Location:
+ Location:
<% tmp = ci.getCompany(); %> - <% if (!(StringUtil.isStringEmpty(tmp))) { %><%= tmp %>
<% } %> + <% if (!(StringUtil.isStringEmpty(tmp))) { %><%= tmp %>
<% } %> <% tmp = ci.getAddressLine1(); %> - <% if (!(StringUtil.isStringEmpty(tmp))) { %><%= tmp %>
<% } %> + <% if (!(StringUtil.isStringEmpty(tmp))) { %><%= tmp %>
<% } %> <% tmp = ci.getAddressLine2(); %> - <% if (!(StringUtil.isStringEmpty(tmp))) { %><%= tmp %>
<% } %> + <% if (!(StringUtil.isStringEmpty(tmp))) { %><%= tmp %>
<% } %> <% tmp = view.getRequestAttribute("address.lastline").toString(); %> - <% if (!(StringUtil.isStringEmpty(tmp))) { %><%= tmp %>
<% } %> + <% if (!(StringUtil.isStringEmpty(tmp))) { %><%= tmp %>
<% } %> <% tmp = view.getRequestAttribute("address.country").toString(); %> - <% if (!(StringUtil.isStringEmpty(tmp))) { %><%= tmp %>
<% } %> -
+ <% if (!(StringUtil.isStringEmpty(tmp))) { %><%= tmp %>
<% } %> +
<% tmp = comm.getLanguageFullName(); %> - <% if (!(StringUtil.isStringEmpty(tmp))) { %>Primary Language: - <%= tmp %>
<% } %> + <% if (!(StringUtil.isStringEmpty(tmp))) { %>Primary Language: + <%= tmp %>
<% } %> <% tmp = comm.getRules(); %> - <% if (!(StringUtil.isStringEmpty(tmp))) { %>Standards of Conduct: - <%= tmp %>
<% } %> + <% if (!(StringUtil.isStringEmpty(tmp))) { %>Standards of Conduct: + <%= tmp %>
<% } %> <% tmp = ci.getURL(); %> - <% if (!(StringUtil.isStringEmpty(tmp))) { %>Homepage: - <%= tmp %>
<% } %> + <% if (!(StringUtil.isStringEmpty(tmp))) { %>Homepage: + <%= tmp %>
<% } %> -

+
+<%-- EOF --%> diff --git a/web/format/conf/conferences.jsp b/web/format/conf/conferences.jsp index 43f0ee4..5daa02d 100644 --- a/web/format/conf/conferences.jsp +++ b/web/format/conf/conferences.jsp @@ -9,9 +9,9 @@ The Original Code is the Venice Web Communities System. - The Initial Developer of the Original Code is Eric J. Bowersox , + The Initial Developer of the Original Code is Eric J. Bowersox , for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - Copyright (C) 2001-02 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + Copyright (C) 2001-2004 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. Contributor(s): --%> @@ -31,13 +31,13 @@ <% if (confs.size()>0) { %> - +
<% for (int i=0; i - - - + + - +
+ <%= conf.getDescription() %> + + <% } // end for %> -
+
<% ConferenceContext conf = (ConferenceContext)(confs.get(i)); %> - + conf/topics.js.vs?cc=&conf=<%= conf.getConfID() %> <%= conf.getName() %> - @@ -48,32 +48,32 @@ <% } // end if %> -
+
<% List hosts1 = (List)(hosts.get(i)); %> <% if (hosts1.size()>0) { %> <% if (hosts1.size()>1) { %>Hosts:<% } else { %>Host:<% } %> <% for (int j=0; j <% UserFound uf = (UserFound)(hosts1.get(j)); %> <% if (j>0) { %>, <% } %> - + user/<%= uf.getName() %> <%= uf.getName() %> <% } // end for %> <% } else { %> - Hosts: (none) + Hosts: (none) <% } // end if (hosts present in the conterence) %> -
- <%= conf.getDescription() %> -

+
<% } else { %> - No conferences found in this community.
+ No conferences found in this community.
<% } // end if %> -

-

+

+

conf/find.js.vs?cc= @@ -90,4 +90,5 @@   -
+
+<%-- EOF --%> diff --git a/web/format/conf/posts.jsp b/web/format/conf/posts.jsp index 763a715..e7392a6 100644 --- a/web/format/conf/posts.jsp +++ b/web/format/conf/posts.jsp @@ -147,13 +147,13 @@ Upper navigation linkset
[  - + conf/posts.js.vs?<%= topic_locator %>&p1=0&p2=-1 View All <% if (my_first>0) { %>  |  - + conf/posts.js.vs?<%= topic_locator %>&p1=<%= Math.max(my_first - my_pagesize,0) %>&p2=<%= my_first - 1 - Math.min(my_first - my_pagesize,0) %> @@ -164,14 +164,14 @@ conf/posts.js.vs?<%= topic_locator %>&p1=<%= Math.max(my_first - my_pagesize,0) if ((my_total_msg - (my_last + 1))>0) { %>  |  - + conf/posts.js.vs?<%= topic_locator %>&p1=<%= my_last + 1 %>&p2=<%= Math.min(my_last + my_pagesize,my_total_msg - 1) %> Scroll Down <%= my_pagesize %>  |  - + conf/posts.js.vs?<%= topic_locator %>&p1=<%= my_total_msg - my_pagesize %>&p2=<%= my_total_msg - 1 %> @@ -179,18 +179,18 @@ conf/posts.js.vs?<%= topic_locator %>&p1=<%= my_last + 1 %>&p2=<%= Math.min(my_l <% } // end if %>  |  - Bottom + Bottom  ] - + <%= view.getPageQID() %> [Permalink to this topic]    - + <%= view.getPageQID() %>.<%= my_first %>-<%= my_last %> [Permalink to these posts] @@ -222,20 +222,20 @@ conf/posts.js.vs?<%= topic_locator %>&p1=<%= my_last + 1 %>&p2=<%= Math.min(my_l out.write(view.getUserPhotoTag(JSPView.getRequestOutput(request),msg.getCreatorUID())); } // end if %> - + conf/posts.js.vs?<%= topic_locator %>&shac=1&p1=<%= msg.getPostNumber() %> <%= msg.getPostNumber() %> of - + conf/posts.js.vs?<%= topic_locator %>&<%= last_post %> <%= my_total_msg - 1 %> <<%= view.getTopicStem() %><%= msg.getPostNumber() %>>    - + <%= view.getPageQID() %>.<%= msg.getPostNumber() %> [Permalink] @@ -249,7 +249,7 @@ conf/posts.js.vs?<%= topic_locator %>&p1=<%= my_last + 1 %>&p2=<%= Math.min(my_l if (view.showBozoFilteredIndicator(msg.getCreatorUID())) { %> (User filtered; - + conf/message_bozo.js.vs?<%= topic_locator %>&msg=<%= msg.getPostNumber() %>&flag=0 @@ -264,7 +264,7 @@ conf/posts.js.vs?<%= topic_locator %>&p1=<%= my_last + 1 %>&p2=<%= Math.min(my_l
<%= msg.getPseud() %> ( - + user/<%= poster %> <%= poster %> , @@ -418,12 +418,12 @@ conf/posts.js.vs?<%= topic_locator %>&p1=<%= my_last + 1 %>&p2=<%= Math.min(my_l diff --git a/web/format/conf/topics.jsp b/web/format/conf/topics.jsp index 617d109..589c1d7 100644 --- a/web/format/conf/topics.jsp +++ b/web/format/conf/topics.jsp @@ -84,7 +84,7 @@  
- + <%= view.getPageQID() %> [Permalink to this conference] @@ -96,31 +96,31 @@
- + <%= view.getPageQID() %> [Permalink to this topic]    - + <%= view.getPageQID() %>.<%= my_first %>-<%= my_last %> [Permalink to these posts] @@ -434,13 +434,13 @@ conf/posts.js.vs?<%= topic_locator %>&p1=<%= my_last + 1 %>&p2=<%= Math.min(my_l Lower navigation linkset [  - + conf/posts.js.vs?<%= topic_locator %>&p1=0&p2=-1 View All <% if (my_first>0) { %>  |  - + conf/posts.js.vs?<%= topic_locator %>&p1=<%= Math.max(my_first - my_pagesize,0) %>&p2=<%= my_first - 1 - Math.min(my_first - my_pagesize,0) %> @@ -449,14 +449,14 @@ conf/posts.js.vs?<%= topic_locator %>&p1=<%= Math.max(my_first - my_pagesize,0) <% } // end if %> <% if ((my_total_msg - (my_last + 1))>0) { %>  |  - + conf/posts.js.vs?<%= topic_locator %>&p1=<%= my_last + 1 %>&p2=<%= Math.min(my_last + my_pagesize,my_total_msg - 1) %> Scroll Down <%= my_pagesize %>  |  - + conf/posts.js.vs?<%= topic_locator %>&p1=<%= my_total_msg - my_pagesize %>&p2=<%= my_total_msg - 1 %> @@ -464,7 +464,7 @@ conf/posts.js.vs?<%= topic_locator %>&p1=<%= my_last + 1 %>&p2=<%= Math.min(my_l <% } // end if %>  |  - Top + Top  ]
- + conf/topics.js.vs?<%= base_locator %>&sort=<%= ((sort_opt==SORT_NUMBER) ? -SORT_NUMBER : SORT_NUMBER) %> #    - + conf/topics.js.vs?<%= base_locator %>&sort=<%= ((sort_opt==SORT_NAME) ? -SORT_NAME : SORT_NAME) %> Topic Name - + conf/topics.js.vs?<%= base_locator %>&sort=<%= ((sort_opt==SORT_UNREAD) ? -SORT_UNREAD : SORT_UNREAD) %> New - + conf/topics.js.vs?<%= base_locator %>&sort=<%= ((sort_opt==SORT_TOTAL) ? -SORT_TOTAL : SORT_TOTAL) %> Total - + conf/topics.js.vs?<%= base_locator %>&sort=<%= ((sort_opt==SORT_DATE) ? -SORT_DATE : SORT_DATE) %> Last Response @@ -137,13 +137,13 @@ %>
- + conf/posts.js.vs?<%= my_locator %>&rnm=1 <%= num %>    - + conf/posts.js.vs?<%= my_locator %>&rnm=1 <%= topic.getName() %> @@ -157,19 +157,19 @@ <% } // end if %> - + conf/posts.js.vs?<%= my_locator %>&rnm=1 <%= topic.getUnreadMessages() %> - + conf/posts.js.vs?<%= my_locator %>&p1=0&p2=-1 <%= topic.getTotalMessages() %> - + conf/posts.js.vs?<%= my_locator %>&rnm=1 <%= view.formatDate(topic.getLastUpdateDate()) %> @@ -212,7 +212,7 @@ <% if (view_opt==DISPLAY_NEW) { %> New <% } else { %> - + conf/topics.js.vs?<%= base_locator %>&view=<%= DISPLAY_NEW %> New @@ -221,7 +221,7 @@ <% if (view_opt==DISPLAY_ACTIVE) { %> Active <% } else { %> - + conf/topics.js.vs?<%= base_locator %>&view=<%= DISPLAY_ACTIVE %> Active @@ -230,7 +230,7 @@ <% if (view_opt==DISPLAY_ALL) { %> All <% } else { %> - + conf/topics.js.vs?<%= base_locator %>&view=<%= DISPLAY_ALL %> All @@ -239,7 +239,7 @@ <% if (view_opt==DISPLAY_HIDDEN) { %> Hidden <% } else { %> - + conf/topics.js.vs?<%= base_locator %>&view=<%= DISPLAY_HIDDEN %> Hidden @@ -248,7 +248,7 @@ <% if (view_opt==DISPLAY_ARCHIVED) { %> Archived <% } else { %> - + conf/topics.js.vs?<%= base_locator %>&view=<%= DISPLAY_ARCHIVED %> Archived