,
- * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
- * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
- *
- * Contributor(s):
- */
-package com.silverwrist.venice.servlets.format;
-
-import java.io.*;
-import java.util.*;
-import com.silverwrist.util.StringUtil;
-import com.silverwrist.venice.core.*;
-
-public class SideBoxConferences implements ContentRender, ColorSelectors
-{
- /*--------------------------------------------------------------------------------
- * Attributes
- *--------------------------------------------------------------------------------
- */
-
- private UserContext uc;
- private List hotlist;
-
- /*--------------------------------------------------------------------------------
- * Constructor
- *--------------------------------------------------------------------------------
- */
-
- public SideBoxConferences(UserContext uc, String parameter) throws DataException
- {
- this.uc = uc;
- this.hotlist = uc.getConferenceHotlist();
-
- } // end constructor
-
- /*--------------------------------------------------------------------------------
- * Implementations from interface VeniceContent
- *--------------------------------------------------------------------------------
- */
-
- public String getPageTitle(RenderData rdat)
- {
- if (uc.isLoggedIn())
- return "Your Conference Hotlist:";
- else
- return "Featured Conferences:";
-
- } // end getPageTitle
-
- public String getPageQID()
- {
- return null;
-
- } // end getPageQID
-
- /*--------------------------------------------------------------------------------
- * Implementations from interface ContentRender
- *--------------------------------------------------------------------------------
- */
-
- public void renderHere(Writer out, RenderData rdat) throws IOException
- {
- String norm_font = rdat.getStdFontTag(SIDEBOX_CONTENT_FOREGROUND,2);
- String hilite = rdat.getStdFontTag(SIDEBOX_CONTENT_LINK,2);
- String purple_ball = rdat.getFullImagePath("purple-ball.gif");
- String new_image = rdat.getFullImagePath("tag_new.gif");
- if (hotlist.size()>0)
- { // display the list of conferences
- out.write("\n");
- Iterator it = hotlist.iterator();
- while (it.hasNext())
- { // display the names of the conferences and SIGs one by one
- ConferenceHotlistEntry hle = (ConferenceHotlistEntry)(it.next());
- ConferenceContext conf = hle.getConference();
- String href = "confdisp?sig=" + conf.getEnclosingSIG().getSIGID() + "&conf=" + conf.getConfID();
- out.write("\n | \n\n"
- + norm_font + ""
- + hilite + StringUtil.encodeHTML(conf.getName()) + " ("
- + StringUtil.encodeHTML(conf.getEnclosingSIG().getName()) + ")\n");
- if (conf.anyUnread())
- out.write(" \n");
- out.write(" | \n
\n");
-
- } // end while
-
- out.write("
\n");
-
- } // end if
- else
- out.write(norm_font + "You have no conferences in your hotlist.\n");
-
- if (uc.isLoggedIn())
- { // write the link at the end
- out.write("" + rdat.getStdFontTag(SIDEBOX_CONTENT_FOREGROUND,1) + "[ "
- + rdat.getStdFontTag(SIDEBOX_CONTENT_LINK,1) + "Manage ]");
-
- } // end if
-
- } // end renderHere
-
-} // end class SideBoxConferences
diff --git a/src/com/silverwrist/venice/servlets/format/SideBoxList.java b/src/com/silverwrist/venice/servlets/format/SideBoxList.java
new file mode 100644
index 0000000..2b533c7
--- /dev/null
+++ b/src/com/silverwrist/venice/servlets/format/SideBoxList.java
@@ -0,0 +1,156 @@
+/*
+ * The contents of this file are subject to the Mozilla Public License Version 1.1
+ * (the "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at .
+ *
+ * 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 ,
+ * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
+ * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
+ *
+ * Contributor(s):
+ */
+package com.silverwrist.venice.servlets.format;
+
+import java.util.*;
+import javax.servlet.*;
+import javax.servlet.http.*;
+import com.silverwrist.venice.core.*;
+
+public class SideBoxList implements JSPRender
+{
+ /*--------------------------------------------------------------------------------
+ * Static data members
+ *--------------------------------------------------------------------------------
+ */
+
+ // Attribute name for request attribute
+ protected static final String ATTR_NAME = "com.silverwrist.venice.content.SideBoxList";
+
+ /*--------------------------------------------------------------------------------
+ * Attributes
+ *--------------------------------------------------------------------------------
+ */
+
+ private UserContext uc; // user context
+ private List in_list; // sideboxes that are "in"
+ private List out_list; // sideboxes that are "out"
+
+ /*--------------------------------------------------------------------------------
+ * Constructor
+ *--------------------------------------------------------------------------------
+ */
+
+ public SideBoxList(VeniceEngine engine, UserContext uc) throws DataException
+ {
+ this.uc = uc;
+ this.in_list = uc.getSideBoxList();
+ HashSet ids = new HashSet(in_list.size());
+ Iterator it = in_list.iterator();
+ while (it.hasNext())
+ { // add the IDs of all the sideboxes to the set
+ SideBoxDescriptor d = (SideBoxDescriptor)(it.next());
+ ids.add(new Integer(d.getID()));
+
+ } // end while
+
+ List all_list = engine.getMasterSideBoxList();
+ if (all_list.size()>in_list.size())
+ { // allocate an ArrayList to hold the sideboxes
+ out_list = new ArrayList(all_list.size()-in_list.size());
+ it = all_list.iterator();
+ while (it.hasNext())
+ { // get all sideboxes not in the "in" list and put them in the "out" list
+ SideBoxDescriptor d = (SideBoxDescriptor)(it.next());
+ if (!(ids.contains(new Integer(d.getID()))))
+ out_list.add(d);
+
+ } // end while
+
+ } // end if
+ else // all sideboxes are "in"...
+ out_list = Collections.EMPTY_LIST;
+
+ } // end constructor
+
+ /*--------------------------------------------------------------------------------
+ * External static functions
+ *--------------------------------------------------------------------------------
+ */
+
+ public static SideBoxList retrieve(ServletRequest request)
+ {
+ return (SideBoxList)(request.getAttribute(ATTR_NAME));
+
+ } // end retrieve
+
+ /*--------------------------------------------------------------------------------
+ * Implementations from interface VeniceContent
+ *--------------------------------------------------------------------------------
+ */
+
+ public String getPageTitle(RenderData rdat)
+ {
+ return "Your Front Page Configuration";
+
+ } // end getPageTitle
+
+ public String getPageQID()
+ {
+ return null;
+
+ } // end getPageQID
+
+ /*--------------------------------------------------------------------------------
+ * Implementations from interface JSPRender
+ *--------------------------------------------------------------------------------
+ */
+
+ public void store(ServletRequest request)
+ {
+ request.setAttribute(ATTR_NAME,this);
+
+ } // end store
+
+ public String getTargetJSPName()
+ {
+ return "sideboxlist.jsp";
+
+ } // end getTargetJSPName
+
+ /*--------------------------------------------------------------------------------
+ * External operations
+ *--------------------------------------------------------------------------------
+ */
+
+ public int getInListSize()
+ {
+ return in_list.size();
+
+ } // end getInListSize
+
+ public SideBoxDescriptor getInListItem(int index)
+ {
+ return (SideBoxDescriptor)(in_list.get(index));
+
+ } // end getInListItem
+
+ public int getOutListSize()
+ {
+ return out_list.size();
+
+ } // end getOutListSize
+
+ public SideBoxDescriptor getOutListItem(int index)
+ {
+ return (SideBoxDescriptor)(out_list.get(index));
+
+ } // end getInListItem
+
+} // end class SideBoxList
+
diff --git a/src/com/silverwrist/venice/servlets/format/SideBoxSIGs.java b/src/com/silverwrist/venice/servlets/format/SideBoxSIGs.java
deleted file mode 100644
index 8fe9485..0000000
--- a/src/com/silverwrist/venice/servlets/format/SideBoxSIGs.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * (the "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at .
- *
- * 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 ,
- * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
- * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
- *
- * Contributor(s):
- */
-package com.silverwrist.venice.servlets.format;
-
-import java.io.*;
-import java.util.*;
-import com.silverwrist.util.StringUtil;
-import com.silverwrist.venice.core.*;
-
-public class SideBoxSIGs implements ContentRender, ColorSelectors
-{
- /*--------------------------------------------------------------------------------
- * Attributes
- *--------------------------------------------------------------------------------
- */
-
- private UserContext uc;
- private List sig_list;
-
- /*--------------------------------------------------------------------------------
- * Constructor
- *--------------------------------------------------------------------------------
- */
-
- public SideBoxSIGs(UserContext uc, String parameter) throws DataException
- {
- this.uc = uc;
- this.sig_list = uc.getMemberSIGs();
-
- } // end constructor
-
- /*--------------------------------------------------------------------------------
- * Implementations from interface VeniceContent
- *--------------------------------------------------------------------------------
- */
-
- public String getPageTitle(RenderData rdat)
- {
- if (uc.isLoggedIn())
- return "Your SIGs:";
- else
- return "Featured SIGs:";
-
- } // end getPageTitle
-
- public String getPageQID()
- {
- return null;
-
- } // end getPageQID
-
- /*--------------------------------------------------------------------------------
- * Implementations from interface ContentRender
- *--------------------------------------------------------------------------------
- */
-
- public void renderHere(Writer out, RenderData rdat) throws IOException
- {
- if (sig_list.size()>0)
- { // display the list of available SIGs
- String purple_ball = rdat.getFullImagePath("purple-ball.gif");
- String link_font = rdat.getStdFontTag(SIDEBOX_CONTENT_LINK,2);
- String host_image = null;
- out.write("\n");
- Iterator it = sig_list.iterator();
- while (it.hasNext())
- { // display the names of the SIGs one by one
- SIGContext sig = (SIGContext)(it.next());
- out.write("\n | \n\n"
- + "" + link_font + "" + StringUtil.encodeHTML(sig.getName()) + "\n");
- if (sig.isAdmin())
- { // write the "Host!" image at the end
- if (host_image==null)
- host_image = rdat.getFullImagePath("tag_host.gif");
- out.write(" \n");
-
- } // end if
-
- out.write(" | \n
\n");
-
- } // end while
-
- out.write("
\n");
-
- } // end if
- else
- out.write(rdat.getStdFontTag(SIDEBOX_CONTENT_FOREGROUND,2)
- + "You are not a member of any SIGs.\n");
-
- if (uc.isLoggedIn())
- { // write the two links at the end
- String hilite = rdat.getStdFontTag(SIDEBOX_CONTENT_LINK,1);
- out.write("" + rdat.getStdFontTag(SIDEBOX_CONTENT_FOREGROUND,1) + "[ " + hilite
- + "Manage | " + hilite
- + "Create New ]");
-
- } // end if
-
- } // end renderHere
-
-} // end class SideBoxSIGs
-
diff --git a/src/com/silverwrist/venice/servlets/format/TopDisplay.java b/src/com/silverwrist/venice/servlets/format/TopDisplay.java
index cfb568a..8c8fee1 100644
--- a/src/com/silverwrist/venice/servlets/format/TopDisplay.java
+++ b/src/com/silverwrist/venice/servlets/format/TopDisplay.java
@@ -52,7 +52,7 @@ public class TopDisplay implements ContentRender, ColorSelectors
*/
public TopDisplay(ServletContext ctxt, VeniceEngine engine, UserContext uc)
- throws DataException, AccessError, ErrorBox
+ throws ServletException, DataException, AccessError
{
// Stash some basic information.
this.ctxt = ctxt;
@@ -61,72 +61,13 @@ public class TopDisplay implements ContentRender, ColorSelectors
this.top_posts = engine.getPublishedMessages(false);
this.descrs = uc.getSideBoxList();
- // Create the arrays used to construct sideboxes.
- Class[] ctor_argtypes = new Class[2];
- ctor_argtypes[0] = UserContext.class;
- ctor_argtypes[1] = String.class;
- Object[] ctor_args = new Object[2];
- ctor_args[0] = uc;
-
- // Create the actual sideboxes.
+ // Create the sideboxes.
sideboxes = new VeniceContent[descrs.size()];
+ RenderConfig rconf = RenderConfig.getRenderConfig(ctxt);
for (int i=0; i"
+ "\n"
- + rdat.getStdFontTag(SIDEBOX_TITLE_FOREGROUND,3) + ""
- + StringUtil.encodeHTML(sideboxes[i].getPageTitle(rdat))
+ + rdat.getStdFontTag(SIDEBOX_TITLE_FOREGROUND,3) + "" + sideboxes[i].getPageTitle(rdat)
+ "\n |
\n");
@@ -243,7 +183,7 @@ public class TopDisplay implements ContentRender, ColorSelectors
if (uc.isLoggedIn())
{ // write the Configure button below the sideboxes
- out.write("\n");
diff --git a/src/com/silverwrist/venice/servlets/format/sideboxes/ConferenceBox.java b/src/com/silverwrist/venice/servlets/format/sideboxes/ConferenceBox.java
new file mode 100644
index 0000000..a3f4d7f
--- /dev/null
+++ b/src/com/silverwrist/venice/servlets/format/sideboxes/ConferenceBox.java
@@ -0,0 +1,277 @@
+/*
+ * The contents of this file are subject to the Mozilla Public License Version 1.1
+ * (the "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at .
+ *
+ * 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 ,
+ * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
+ * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
+ *
+ * Contributor(s):
+ */
+package com.silverwrist.venice.servlets.format.sideboxes;
+
+import java.io.*;
+import java.util.*;
+import org.w3c.dom.*;
+import com.silverwrist.util.DOMElementHelper;
+import com.silverwrist.util.StringUtil;
+import com.silverwrist.venice.core.*;
+import com.silverwrist.venice.servlets.format.*;
+
+public class ConferenceBox implements SideBoxFactory
+{
+ /*--------------------------------------------------------------------------------
+ * Internal class that implements the actual sidebox
+ *--------------------------------------------------------------------------------
+ */
+
+ class ConferenceBoxImpl implements ContentRender, ColorSelectors
+ {
+ private UserContext uc; // current user context
+ private List hotlist; // current conference hotlist
+
+ ConferenceBoxImpl(UserContext uc) throws DataException
+ {
+ this.uc = uc;
+ this.hotlist = uc.getConferenceHotlist();
+
+ } // end constructor
+
+ public String getPageTitle(RenderData rdat)
+ {
+ if (uc.isLoggedIn())
+ return title;
+ else
+ return anon_title;
+
+ } // end getPageTitle
+
+ public String getPageQID()
+ {
+ return null;
+
+ } // end getPageQID
+
+ public void renderHere(Writer out, RenderData rdat) throws IOException
+ {
+ String norm_font = rdat.getStdFontTag(SIDEBOX_CONTENT_FOREGROUND,2);
+ if (hotlist.size()>0)
+ { // write out the hotlist....
+ String hilite = rdat.getStdFontTag(SIDEBOX_CONTENT_LINK,2);
+ out.write("\n");
+ Iterator it = hotlist.iterator();
+ while (it.hasNext())
+ { // get the next hotlist entry and add it to the display
+ ConferenceHotlistEntry hle = (ConferenceHotlistEntry)(it.next());
+ ConferenceContext conf = hle.getConference();
+ String href = "confdisp?sig=" + conf.getEnclosingSIG().getSIGID() + "&conf=" + conf.getConfID();
+ out.write("\n");
+ renderBullet(out,rdat);
+ out.write(" | \n\n" + norm_font
+ + "" + hilite
+ + StringUtil.encodeHTML(conf.getName()) + " ("
+ + StringUtil.encodeHTML(conf.getEnclosingSIG().getName()) + ")\n");
+ if (conf.anyUnread())
+ { // write out the new-messages tag and its enclosing link
+ out.write(" ");
+ renderNewMessageTag(out,rdat);
+ out.write("\n");
+
+ } // end if
+
+ out.write(" | \n \n");
+
+ } // end while
+
+ out.write(" \n");
+
+ } // end if
+ else // write the "null" message
+ out.write(norm_font + "" + null_message + "\n");
+
+ if (uc.isLoggedIn())
+ { // write the link at the end
+ out.write("" + rdat.getStdFontTag(SIDEBOX_CONTENT_FOREGROUND,1)
+ + "[ "
+ + rdat.getStdFontTag(SIDEBOX_CONTENT_LINK,1) + manage_link + " ]");
+
+ } // end if
+
+ } // end renderHere
+
+ } // end class ConferenceBoxImpl
+
+ /*--------------------------------------------------------------------------------
+ * Attributes
+ *--------------------------------------------------------------------------------
+ */
+
+ private String title; // title of sidebox for logged-in users
+ private String anon_title; // title of sidebox for not-logged-in users
+ private String null_message; // message if they have no hotlist conferences
+ private String manage_link; // "Manage" link text
+ private String bullet_url; // URL to bullet image
+ private boolean bullet_fixup; // does bullet image need to be run through getFullImagePath?
+ private int bullet_width; // width of bullet image
+ private int bullet_height; // height of bullet image
+ private String newmsg_url; // URL to new messages tag image
+ private boolean newmsg_fixup; // does new messages image need to be run through getFullImagePath?
+ private String newmsg_alt; // ALT text to use for new message tag image
+ private int newmsg_width; // width of new message tag image
+ private int newmsg_height; // height of new message tag image
+
+ /*--------------------------------------------------------------------------------
+ * Constructor
+ *--------------------------------------------------------------------------------
+ */
+
+ public ConferenceBox()
+ { // do nothing
+ } // end constructor
+
+ /*--------------------------------------------------------------------------------
+ * Internal operations
+ *--------------------------------------------------------------------------------
+ */
+
+ private void renderBullet(Writer out, RenderData rdat) throws IOException
+ {
+ synchronized (this)
+ { // this may be called by more than one class, so protect this part
+ if (bullet_fixup)
+ { // fix up the bullet URL
+ bullet_url = rdat.getFullImagePath(bullet_url);
+ bullet_fixup = false;
+
+ } // end if
+
+ } // end synchronized block
+
+ out.write("");
+
+ } // end renderBullet
+
+ private void renderNewMessageTag(Writer out, RenderData rdat) throws IOException
+ {
+ synchronized (this)
+ { // this may be called by more than one class, so protect this part
+ if (newmsg_fixup)
+ { // fix up the host tag URL
+ newmsg_url = rdat.getFullImagePath(newmsg_url);
+ newmsg_fixup = false;
+
+ } // end if
+
+ } // end synchronized block
+
+ out.write("");
+
+ } // end renderNewMessageTag
+
+ /*--------------------------------------------------------------------------------
+ * Implementations from interface SideBoxFactory
+ *--------------------------------------------------------------------------------
+ */
+
+ public void setConfiguration(Element cfg) throws ConfigException
+ {
+ DOMElementHelper cfg_h = new DOMElementHelper(cfg);
+ title = cfg_h.getSubElementText("title");
+ if (title==null)
+ throw new ConfigException("no specified for conference list sidebox",cfg);
+ title += ":";
+ anon_title = cfg_h.getSubElementText("anon-title");
+ if (anon_title==null)
+ anon_title = title;
+ else
+ anon_title += ":";
+
+ null_message = cfg_h.getSubElementText("null-msg");
+ if (null_message==null)
+ null_message = "You are not a member of any SIGs.";
+
+ manage_link = cfg_h.getSubElementText("manage-link");
+ if (manage_link==null)
+ manage_link = "Manage";
+
+ Element x = cfg_h.getSubElement("bullet");
+ if (x!=null)
+ { // get the parameters for the bullet image
+ DOMElementHelper x_h = new DOMElementHelper(x);
+ bullet_url = x_h.getElementText();
+ if (StringUtil.isStringEmpty(bullet_url))
+ { // default the bullet URL and fixup parameter
+ bullet_url = "purple-ball.gif";
+ bullet_fixup = true;
+
+ } // end if
+ else // get the "fixup" parameter
+ bullet_fixup = x_h.hasAttribute("fixup");
+
+ Integer xi = x_h.getAttributeInt("width");
+ bullet_width = (xi!=null) ? xi.intValue() : 14;
+ xi = x_h.getAttributeInt("height");
+ bullet_height = (xi!=null) ? xi.intValue() : 14;
+
+ } // end if
+ else
+ { // just default all the bullet parameters
+ bullet_url = "purple-ball.gif";
+ bullet_fixup = true;
+ bullet_width = 14;
+ bullet_height = 14;
+
+ } // end else
+
+ x = cfg_h.getSubElement("new-image");
+ if (x!=null)
+ { // get the parameters for the host tag image
+ DOMElementHelper x_h = new DOMElementHelper(x);
+ newmsg_url = x_h.getElementText();
+ if (StringUtil.isStringEmpty(newmsg_url))
+ { // default the host tag image URL and fixup parameter
+ newmsg_url = "tag_new.gif";
+ newmsg_fixup = true;
+
+ } // end if
+ else // get the "fixup" parameter
+ newmsg_fixup = x_h.hasAttribute("fixup");
+
+ newmsg_alt = x.getAttribute("alt");
+ if (StringUtil.isStringEmpty(newmsg_alt))
+ newmsg_alt = "New!";
+
+ Integer xi = x_h.getAttributeInt("width");
+ newmsg_width = (xi!=null) ? xi.intValue() : 40;
+ xi = x_h.getAttributeInt("height");
+ newmsg_height = (xi!=null) ? xi.intValue() : 20;
+
+ } // end if
+ else
+ { // just default all the host tag parameters
+ newmsg_url = "tag_new.gif";
+ newmsg_fixup = true;
+ newmsg_alt = "New!";
+ newmsg_width = 40;
+ newmsg_height = 20;
+
+ } // end else
+
+ } // end setConfiguration
+
+ public VeniceContent create(VeniceEngine engine, UserContext uc) throws AccessError, DataException
+ {
+ return new ConferenceBoxImpl(uc);
+
+ } // end create
+
+} // end class ConferenceBox
diff --git a/src/com/silverwrist/venice/servlets/format/sideboxes/JSPSideBox.java b/src/com/silverwrist/venice/servlets/format/sideboxes/JSPSideBox.java
new file mode 100644
index 0000000..e980ef0
--- /dev/null
+++ b/src/com/silverwrist/venice/servlets/format/sideboxes/JSPSideBox.java
@@ -0,0 +1,133 @@
+/*
+ * The contents of this file are subject to the Mozilla Public License Version 1.1
+ * (the "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at .
+ *
+ * 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 ,
+ * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
+ * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
+ *
+ * Contributor(s):
+ */
+package com.silverwrist.venice.servlets.format.sideboxes;
+
+import java.io.*;
+import java.util.*;
+import javax.servlet.*;
+import javax.servlet.http.*;
+import com.silverwrist.venice.core.*;
+import com.silverwrist.venice.servlets.format.*;
+
+public class JSPSideBox implements JSPRender
+{
+ /*--------------------------------------------------------------------------------
+ * Static data members
+ *--------------------------------------------------------------------------------
+ */
+
+ // Attribute name for request attribute
+ protected static final String ATTR_NAME = "com.silverwrist.venice.content.sidebox.JSP";
+
+ /*--------------------------------------------------------------------------------
+ * Attributes
+ *--------------------------------------------------------------------------------
+ */
+
+ private JSPSideBoxFactory factory;
+ private VeniceEngine engine;
+ private UserContext uc;
+
+ /*--------------------------------------------------------------------------------
+ * Constructor
+ *--------------------------------------------------------------------------------
+ */
+
+ JSPSideBox(JSPSideBoxFactory factory, VeniceEngine engine, UserContext uc)
+ {
+ this.factory = factory;
+ this.engine = engine;
+ this.uc = uc;
+
+ } // end constructor
+
+ /*--------------------------------------------------------------------------------
+ * External static functions
+ *--------------------------------------------------------------------------------
+ */
+
+ public static JSPSideBox retrieve(ServletRequest request)
+ {
+ return (JSPSideBox)(request.getAttribute(ATTR_NAME));
+
+ } // end retrieve
+
+ /*--------------------------------------------------------------------------------
+ * Implementations from interface VeniceContent
+ *--------------------------------------------------------------------------------
+ */
+
+ public String getPageTitle(RenderData rdat)
+ {
+ return factory.getTitle(uc.isLoggedIn());
+
+ } // end getPageTitle
+
+ public String getPageQID()
+ {
+ return null;
+
+ } // end getPageQID
+
+ /*--------------------------------------------------------------------------------
+ * Implementations from interface JSPRender
+ *--------------------------------------------------------------------------------
+ */
+
+ public void store(ServletRequest request)
+ {
+ request.setAttribute(ATTR_NAME,this);
+
+ } // end store
+
+ public String getTargetJSPName()
+ {
+ return factory.getTargetJSPName();
+
+ } // end getTargetJSPName
+
+ /*--------------------------------------------------------------------------------
+ * External operations
+ *--------------------------------------------------------------------------------
+ */
+
+ public VeniceEngine getEngine()
+ {
+ return engine;
+
+ } // end getEngine
+
+ public UserContext getUser()
+ {
+ return uc;
+
+ } // end getUser
+
+ public String getString(String key)
+ {
+ return factory.getString(key);
+
+ } // end getString
+
+ public String replaceStrings(String base)
+ {
+ return factory.replaceStrings(base);
+
+ } // end replaceStrings
+
+} // end class JSPSideBox
diff --git a/src/com/silverwrist/venice/servlets/format/sideboxes/JSPSideBoxFactory.java b/src/com/silverwrist/venice/servlets/format/sideboxes/JSPSideBoxFactory.java
new file mode 100644
index 0000000..80e49b1
--- /dev/null
+++ b/src/com/silverwrist/venice/servlets/format/sideboxes/JSPSideBoxFactory.java
@@ -0,0 +1,131 @@
+/*
+ * The contents of this file are subject to the Mozilla Public License Version 1.1
+ * (the "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at .
+ *
+ * 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 ,
+ * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
+ * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
+ *
+ * Contributor(s):
+ */
+package com.silverwrist.venice.servlets.format.sideboxes;
+
+import java.io.*;
+import java.util.*;
+import org.w3c.dom.*;
+import com.silverwrist.util.DOMElementHelper;
+import com.silverwrist.util.StringUtil;
+import com.silverwrist.venice.core.*;
+import com.silverwrist.venice.servlets.format.*;
+
+public class JSPSideBoxFactory implements SideBoxFactory
+{
+ /*--------------------------------------------------------------------------------
+ * Attributes
+ *--------------------------------------------------------------------------------
+ */
+
+ private String title; // title of sidebox for logged-in users
+ private String anon_title; // title of sidebox for not-logged-in users
+ private String format_jsp; // name of formatting JSP file
+ private Map strings; // the strings we can access from the JSP page
+
+ /*--------------------------------------------------------------------------------
+ * Constructor
+ *--------------------------------------------------------------------------------
+ */
+
+ public JSPSideBoxFactory()
+ { // do nothing
+ } // end constructor
+
+ /*--------------------------------------------------------------------------------
+ * Internal functions
+ *--------------------------------------------------------------------------------
+ */
+
+ String getTitle(boolean logged_in)
+ {
+ return (logged_in ? title : anon_title);
+
+ } // end getTitle
+
+ String getTargetJSPName()
+ {
+ return format_jsp;
+
+ } // end getTargetJSPName
+
+ String getString(String key)
+ {
+ return (String)(strings.get(key));
+
+ } // end getString
+
+ String replaceStrings(String base)
+ {
+ return StringUtil.replaceAllVariables(base,strings);
+
+ } // end replaceStrings
+
+ /*--------------------------------------------------------------------------------
+ * Implementations from interface SideBoxFactory
+ *--------------------------------------------------------------------------------
+ */
+
+ public void setConfiguration(Element cfg) throws ConfigException
+ {
+ DOMElementHelper cfg_h = new DOMElementHelper(cfg);
+ title = cfg_h.getSubElementText("title");
+ if (title==null)
+ throw new ConfigException("no specified for sidebox",cfg);
+ title += ":";
+ anon_title = cfg_h.getSubElementText("anon-title");
+ if (anon_title==null)
+ anon_title = title;
+ else
+ anon_title += ":";
+
+ format_jsp = cfg_h.getSubElementText("format-jsp");
+ if (format_jsp==null)
+ throw new ConfigException("no specified for sidebox",cfg);
+
+ Element s = cfg_h.getSubElement("strings");
+ if (s!=null)
+ { // we've got some replacement strings to add
+ HashMap tmp = new HashMap();
+ NodeList sl = s.getChildNodes();
+ for (int i=0; i.
+ *
+ * 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 ,
+ * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
+ * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
+ *
+ * Contributor(s):
+ */
+package com.silverwrist.venice.servlets.format.sideboxes;
+
+import java.io.*;
+import java.util.*;
+import org.w3c.dom.*;
+import com.silverwrist.util.DOMElementHelper;
+import com.silverwrist.util.StringUtil;
+import com.silverwrist.venice.core.*;
+import com.silverwrist.venice.servlets.format.*;
+
+public class SIGBox implements SideBoxFactory
+{
+ /*--------------------------------------------------------------------------------
+ * Internal class that implements the actual sidebox
+ *--------------------------------------------------------------------------------
+ */
+
+ class SIGBoxImpl implements ContentRender, ColorSelectors
+ {
+ private UserContext uc;
+ private List sig_list;
+
+ SIGBoxImpl(UserContext uc) throws DataException
+ {
+ this.uc = uc;
+ this.sig_list = uc.getMemberSIGs();
+
+ } // end constructor
+
+ public String getPageTitle(RenderData rdat)
+ {
+ if (uc.isLoggedIn())
+ return title;
+ else
+ return anon_title;
+
+ } // end getPageTitle
+
+ public String getPageQID()
+ {
+ return null;
+
+ } // end getPageQID
+
+ public void renderHere(Writer out, RenderData rdat) throws IOException
+ {
+ if (sig_list.size()>0)
+ { // load up the rendering data and render the contents of the list
+ String link_font = rdat.getStdFontTag(SIDEBOX_CONTENT_LINK,2);
+ out.write("\n");
+ Iterator it = sig_list.iterator();
+ while (it.hasNext())
+ { // write each SIG out in turn
+ SIGContext sig = (SIGContext)(it.next());
+ out.write("\n");
+ renderBullet(out,rdat);
+ out.write(" | \n\n" + link_font + ""
+ + StringUtil.encodeHTML(sig.getName()) + "\n");
+ if (sig.isAdmin())
+ { // write the host tag at the end
+ out.write(" ");
+ renderHostTag(out,rdat);
+
+ } // end if
+
+ out.write(" | \n \n");
+
+ } // end while
+
+ out.write(" \n");
+
+ } // end if
+ else // write the "no SIGs" message
+ out.write(rdat.getStdFontTag(SIDEBOX_CONTENT_FOREGROUND,2) + "" + null_message + "\n");
+
+ if (uc.isLoggedIn())
+ { // write the links at the end
+ String hilite = rdat.getStdFontTag(SIDEBOX_CONTENT_LINK,1);
+ out.write("" + rdat.getStdFontTag(SIDEBOX_CONTENT_FOREGROUND,1)
+ + "[ " + hilite + manage_link + " ");
+ if (uc.canCreateSIG())
+ out.write("| "
+ + hilite + create_new_link + " ");
+ out.write("]");
+
+ } // end if
+
+ } // end renderHere
+
+ } // end class SIGBoxImpl
+
+ /*--------------------------------------------------------------------------------
+ * Attributes
+ *--------------------------------------------------------------------------------
+ */
+
+ private String title; // title of sidebox for logged-in users
+ private String anon_title; // title of sidebox for not-logged-in users
+ private String null_message; // message if they're not a member of any SIGs
+ private String manage_link; // "Manage" link text
+ private String create_new_link; // "Create New" link text
+ private String bullet_url; // URL to bullet image
+ private boolean bullet_fixup; // does bullet image need to be run through getFullImagePath?
+ private int bullet_width; // width of bullet image
+ private int bullet_height; // height of bullet image
+ private String host_url; // URL to host tag image
+ private boolean host_fixup; // does host tag image need to be run through getFullImagePath?
+ private String host_alt; // ALT text to use for host tag image
+ private int host_width; // width of host tag image
+ private int host_height; // height of host tag image
+
+ /*--------------------------------------------------------------------------------
+ * Constructor
+ *--------------------------------------------------------------------------------
+ */
+
+ public SIGBox()
+ { // do nothing
+ } // end constructor
+
+ /*--------------------------------------------------------------------------------
+ * Internal operations
+ *--------------------------------------------------------------------------------
+ */
+
+ private void renderBullet(Writer out, RenderData rdat) throws IOException
+ {
+ synchronized (this)
+ { // this may be called by more than one class, so protect this part
+ if (bullet_fixup)
+ { // fix up the bullet URL
+ bullet_url = rdat.getFullImagePath(bullet_url);
+ bullet_fixup = false;
+
+ } // end if
+
+ } // end synchronized block
+
+ out.write("");
+
+ } // end renderBullet
+
+ private void renderHostTag(Writer out, RenderData rdat) throws IOException
+ {
+ synchronized (this)
+ { // this may be called by more than one class, so protect this part
+ if (host_fixup)
+ { // fix up the host tag URL
+ host_url = rdat.getFullImagePath(host_url);
+ host_fixup = false;
+
+ } // end if
+
+ } // end synchronized block
+
+ out.write("");
+
+ } // end renderBullet
+
+ /*--------------------------------------------------------------------------------
+ * Implementations from interface SideBoxFactory
+ *--------------------------------------------------------------------------------
+ */
+
+ public void setConfiguration(Element cfg) throws ConfigException
+ {
+ DOMElementHelper cfg_h = new DOMElementHelper(cfg);
+ title = cfg_h.getSubElementText("title");
+ if (title==null)
+ throw new ConfigException("no specified for SIG list sidebox",cfg);
+ title += ":";
+ anon_title = cfg_h.getSubElementText("anon-title");
+ if (anon_title==null)
+ anon_title = title;
+ else
+ anon_title += ":";
+
+ null_message = cfg_h.getSubElementText("null-msg");
+ if (null_message==null)
+ null_message = "You are not a member of any SIGs.";
+
+ manage_link = cfg_h.getSubElementText("manage-link");
+ if (manage_link==null)
+ manage_link = "Manage";
+
+ create_new_link = cfg_h.getSubElementText("create-new-link");
+ if (create_new_link==null)
+ create_new_link = "Create New";
+
+ Element x = cfg_h.getSubElement("bullet");
+ if (x!=null)
+ { // get the parameters for the bullet image
+ DOMElementHelper x_h = new DOMElementHelper(x);
+ bullet_url = x_h.getElementText();
+ if (StringUtil.isStringEmpty(bullet_url))
+ { // default the bullet URL and fixup parameter
+ bullet_url = "purple-ball.gif";
+ bullet_fixup = true;
+
+ } // end if
+ else // get the "fixup" parameter
+ bullet_fixup = x_h.hasAttribute("fixup");
+
+ Integer xi = x_h.getAttributeInt("width");
+ bullet_width = (xi!=null) ? xi.intValue() : 14;
+ xi = x_h.getAttributeInt("height");
+ bullet_height = (xi!=null) ? xi.intValue() : 14;
+
+ } // end if
+ else
+ { // just default all the bullet parameters
+ bullet_url = "purple-ball.gif";
+ bullet_fixup = true;
+ bullet_width = 14;
+ bullet_height = 14;
+
+ } // end else
+
+ x = cfg_h.getSubElement("host-image");
+ if (x!=null)
+ { // get the parameters for the host tag image
+ DOMElementHelper x_h = new DOMElementHelper(x);
+ host_url = x_h.getElementText();
+ if (StringUtil.isStringEmpty(host_url))
+ { // default the host tag image URL and fixup parameter
+ host_url = "tag_host.gif";
+ host_fixup = true;
+
+ } // end if
+ else // get the "fixup" parameter
+ host_fixup = x_h.hasAttribute("fixup");
+
+ host_alt = x.getAttribute("alt");
+ if (StringUtil.isStringEmpty(host_alt))
+ host_alt = "Host!";
+
+ Integer xi = x_h.getAttributeInt("width");
+ host_width = (xi!=null) ? xi.intValue() : 40;
+ xi = x_h.getAttributeInt("height");
+ host_height = (xi!=null) ? xi.intValue() : 20;
+
+ } // end if
+ else
+ { // just default all the host tag parameters
+ host_url = "tag_host.gif";
+ host_fixup = true;
+ host_alt = "Host!";
+ host_width = 40;
+ host_height = 20;
+
+ } // end else
+
+ } // end setConfiguration
+
+ public VeniceContent create(VeniceEngine engine, UserContext uc) throws DataException
+ {
+ return new SIGBoxImpl(uc);
+
+ } // end create
+
+} // end class SIGBox
diff --git a/src/com/silverwrist/venice/servlets/format/sideboxes/SideBoxFactory.java b/src/com/silverwrist/venice/servlets/format/sideboxes/SideBoxFactory.java
new file mode 100644
index 0000000..8c3521c
--- /dev/null
+++ b/src/com/silverwrist/venice/servlets/format/sideboxes/SideBoxFactory.java
@@ -0,0 +1,35 @@
+/*
+ * The contents of this file are subject to the Mozilla Public License Version 1.1
+ * (the "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at .
+ *
+ * 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 ,
+ * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
+ * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
+ *
+ * Contributor(s):
+ */
+package com.silverwrist.venice.servlets.format.sideboxes;
+
+import org.w3c.dom.*;
+import com.silverwrist.venice.core.ConfigException;
+import com.silverwrist.venice.core.AccessError;
+import com.silverwrist.venice.core.DataException;
+import com.silverwrist.venice.core.SideBoxDescriptor;
+import com.silverwrist.venice.core.UserContext;
+import com.silverwrist.venice.core.VeniceEngine;
+import com.silverwrist.venice.servlets.format.VeniceContent;
+
+public interface SideBoxFactory
+{
+ public abstract void setConfiguration(Element cfg) throws ConfigException;
+
+ public abstract VeniceContent create(VeniceEngine engine, UserContext uc) throws AccessError, DataException;
+
+} // end interface SideBoxFactory
diff --git a/web/format/sideboxlist.jsp b/web/format/sideboxlist.jsp
new file mode 100644
index 0000000..7113188
--- /dev/null
+++ b/web/format/sideboxlist.jsp
@@ -0,0 +1,109 @@
+<%--
+ The contents of this file are subject to the Mozilla Public License Version 1.1
+ (the "License"); you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at .
+
+ 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 ,
+ for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
+ Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
+
+ Contributor(s):
+--%>
+<%@ page import = "java.util.*" %>
+<%@ page import = "com.silverwrist.util.StringUtil" %>
+<%@ page import = "com.silverwrist.venice.core.*" %>
+<%@ page import = "com.silverwrist.venice.servlets.Variables" %>
+<%@ page import = "com.silverwrist.venice.servlets.format.*" %>
+<%
+ SideBoxList data = SideBoxList.retrieve(request);
+ Variables.failIfNull(data);
+ RenderData rdat = RenderConfig.createRenderData(application,request,response);
+ String stdfont = rdat.getStdFontTag(ColorSelectors.CONTENT_FOREGROUND,2);
+ int i;
+ SideBoxDescriptor d;
+%>
+<% if (rdat.useHTMLComments()) { %><% } %>
+<% rdat.writeContentHeader(out,"Your Front Page Configuration",null); %>
+<%= stdfont %>">Return to Front Page
+<% if (data.getInListSize()>0) { %>
+
+
+
+
+ " ALT="[Down]" BORDER=0 WIDTH=16 HEIGHT=16>
+ |
+ <%= stdfont %>
+ Click this symbol to move the specified sidebox down on your Front Page.
+ |
+
+
+
+ " ALT="[Up]" BORDER=0 WIDTH=16 HEIGHT=16>
+ |
+ <%= stdfont %>
+ Click this symbol to move the specified sidebox up on your Front Page.
+ |
+
+
+
+ " ALT="[Remove]" BORDER=0 WIDTH=16 HEIGHT=16>
+ |
+ <%= stdfont %>
+ Click this symbol to remove the specified sidebox from your Front Page.
+ |
+
+
+<% } else { %>
+ <%= stdfont %>You have no sideboxes on your Front Page.
+<% } // end if %>
+<% if (data.getOutListSize()>0) { %>
+
+
+<% } // end if %>
\ No newline at end of file
diff --git a/web/format/test/test_sidebox.jsp b/web/format/test/test_sidebox.jsp
new file mode 100644
index 0000000..1e99a04
--- /dev/null
+++ b/web/format/test/test_sidebox.jsp
@@ -0,0 +1,29 @@
+<%--
+ The contents of this file are subject to the Mozilla Public License Version 1.1
+ (the "License"); you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at .
+
+ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
+ WARRANTY OF ANY KIND, either express or implied. See the License for the specific
+ language governing rights and limitations under the License.
+
+ The Original Code is the Venice Web Community System.
+
+ The Initial Developer of the Original Code is Eric J. Bowersox ,
+ for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
+ Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
+
+ Contributor(s):
+--%>
+<%@ page import = "com.silverwrist.venice.servlets.Variables" %>
+<%@ page import = "com.silverwrist.venice.servlets.format.*" %>
+<%@ page import = "com.silverwrist.venice.servlets.format.sideboxes.JSPSideBox" %>
+<%
+ JSPSideBox data = JSPSideBox.retrieve(request);
+ Variables.failIfNull(data);
+ RenderData rdat = RenderConfig.createRenderData(application,request,response);
+%>
+<% if (rdat.useHTMLComments()) { %><% } %>
+<%= rdat.getStdFontTag(ColorSelectors.SIDEBOX_CONTENT_FOREGROUND,2) %>
+ <%= data.replaceStrings("${test1} ${test2} ${test3}") %>
+
|