diff --git a/etc/render-config.xml b/etc/render-config.xml
index 344f4c1..5b70984 100644
--- a/etc/render-config.xml
+++ b/etc/render-config.xml
@@ -144,30 +144,15 @@ Text of this agreement is TBD.
Front Page
-
-
+ Calendar
+ Chat
About This Site
-
-
+ Documentation
+ About Venice
diff --git a/src/com/silverwrist/venice/servlets/format/menus/FrameLeftMenuItem.java b/src/com/silverwrist/venice/servlets/format/menus/FrameLeftMenuItem.java
deleted file mode 100644
index ec0fd32..0000000
--- a/src/com/silverwrist/venice/servlets/format/menus/FrameLeftMenuItem.java
+++ /dev/null
@@ -1,57 +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.menus;
-
-import org.w3c.dom.*;
-import com.silverwrist.util.*;
-import com.silverwrist.venice.servlets.format.RenderData;
-
-class FrameLeftMenuItem extends LeftMenuItem
-{
- /*--------------------------------------------------------------------------------
- * Attributes
- *--------------------------------------------------------------------------------
- */
-
- String url;
-
- /*--------------------------------------------------------------------------------
- * Constructor
- *--------------------------------------------------------------------------------
- */
-
- FrameLeftMenuItem(Element elt)
- {
- super(elt);
- DOMElementHelper h = new DOMElementHelper(elt);
- url = h.getSubElementText("frame");
-
- } // end constructor
-
- /*--------------------------------------------------------------------------------
- * Overrides from class LeftMenuItem
- *--------------------------------------------------------------------------------
- */
-
- protected void appendURL(StringBuffer sbuf, RenderData rdat)
- {
- sbuf.append(rdat.getEncodedServletPath("frame/" + url));
-
- } // end appendURL
-
-} // end class FrameLeftMenuItem
diff --git a/src/com/silverwrist/venice/servlets/format/menus/LeftMenuItem.java b/src/com/silverwrist/venice/servlets/format/menus/ImageItem.java
similarity index 54%
rename from src/com/silverwrist/venice/servlets/format/menus/LeftMenuItem.java
rename to src/com/silverwrist/venice/servlets/format/menus/ImageItem.java
index 01d491e..76651dd 100644
--- a/src/com/silverwrist/venice/servlets/format/menus/LeftMenuItem.java
+++ b/src/com/silverwrist/venice/servlets/format/menus/ImageItem.java
@@ -19,46 +19,75 @@ package com.silverwrist.venice.servlets.format.menus;
import java.io.Writer;
import java.io.IOException;
+import org.apache.log4j.*;
import org.w3c.dom.*;
import com.silverwrist.util.*;
-import com.silverwrist.venice.servlets.format.ColorSelectors;
+import com.silverwrist.venice.core.ConfigException;
import com.silverwrist.venice.servlets.format.ComponentRender;
import com.silverwrist.venice.servlets.format.RenderData;
-abstract class LeftMenuItem implements ComponentRender, ColorSelectors
+class ImageItem implements ComponentRender
{
+ /*--------------------------------------------------------------------------------
+ * Static data members
+ *--------------------------------------------------------------------------------
+ */
+
+ private static Category logger = Category.getInstance(LinkItem.class);
+
/*--------------------------------------------------------------------------------
* Attributes
*--------------------------------------------------------------------------------
*/
- private String text;
- private boolean disabled = false;
- private boolean new_window = false;
+ private String src;
+ private String alt = null;
+ private int width;
+ private int height;
+ private boolean fixup;
/*--------------------------------------------------------------------------------
* Constructor
*--------------------------------------------------------------------------------
*/
- protected LeftMenuItem(Element elt)
+ ImageItem(Element elt) throws ConfigException
{
+ if (!(elt.getNodeName().equals("image")))
+ { // just some shorts-checking here to make sure the element is OK
+ logger.fatal("huh?!? this should have been a if it got here!");
+ throw new ConfigException("not a element");
+
+ } // end if
+
+ // get image source
DOMElementHelper h = new DOMElementHelper(elt);
- text = StringUtil.encodeHTML(h.getSubElementText("text"));
- if (h.hasChildElement("disabled"))
- disabled = true;
- if (h.hasChildElement("new-window"))
- new_window = true;
+ if (h.hasAttribute("src"))
+ src = elt.getAttribute("src");
+ else
+ throw new ConfigException("src= attribute of element not specified");
+
+ // get the image width
+ Integer tmp = h.getAttributeInt("width");
+ if (tmp!=null)
+ width = tmp.intValue();
+ else
+ throw new ConfigException("width= attribute of element not specified or invalid");
+
+ // get the image height
+ tmp = h.getAttributeInt("height");
+ if (tmp!=null)
+ height = tmp.intValue();
+ else
+ throw new ConfigException("height= attribute of element not specified or invalid");
+
+ if (h.hasAttribute("alt"))
+ alt = elt.getAttribute("alt");
+ if (h.hasAttribute("fixup"))
+ fixup = true;
} // end constructor
- /*--------------------------------------------------------------------------------
- * Abstract functions which MUST be overridden
- *--------------------------------------------------------------------------------
- */
-
- protected abstract void appendURL(StringBuffer sbuf, RenderData rdat);
-
/*--------------------------------------------------------------------------------
* Implementations from interface ComponentRender
*--------------------------------------------------------------------------------
@@ -66,27 +95,19 @@ abstract class LeftMenuItem implements ComponentRender, ColorSelectors
public void renderHere(Writer out, RenderData rdat) throws IOException
{
- StringBuffer buf = new StringBuffer();
+ out.write("");
- else
- { // write the tag
- buf.append("");
+ } // end if
- } // end else (writing tag)
-
- buf.append(text).append("");
- if (!disabled)
- buf.append("");
- buf.append(" \n");
- out.write(buf.toString());
+ out.write(src + "\" WIDTH=" + width + " HEIGHT=" + height);
+ if (alt!=null)
+ out.write(" ALT=\"" + alt + "\"");
+ out.write(" BORDER=0>");
} // end renderHere
-} // end class LeftMenuItem
+} // end class ImageItem
diff --git a/src/com/silverwrist/venice/servlets/format/menus/LeftMenu.java b/src/com/silverwrist/venice/servlets/format/menus/LeftMenu.java
index 1748894..3b8953b 100644
--- a/src/com/silverwrist/venice/servlets/format/menus/LeftMenu.java
+++ b/src/com/silverwrist/venice/servlets/format/menus/LeftMenu.java
@@ -36,20 +36,20 @@ public class LeftMenu implements ComponentRender
static class Header implements ComponentRender
{
- private String txt; // the actual stored text
+ private TextItem item;
Header(Element elt)
{
DOMElementHelper h = new DOMElementHelper(elt);
- StringBuffer buf = new StringBuffer("");
- buf.append(StringUtil.encodeHTML(h.getElementText())).append(" \n");
- txt = buf.toString();
+ item = new TextItem(h.getElementText());
} // end constructor
public void renderHere(Writer out, RenderData rdat) throws IOException
{
- out.write(txt);
+ out.write("");
+ item.renderHere(out,rdat);
+ out.write(" \n");
} // end renderHere
@@ -110,37 +110,20 @@ public class LeftMenu implements ComponentRender
Node n = items.item(i);
if (n.getNodeType()==Node.ELEMENT_NODE)
{ // we've found a child element - what type is it?
- if (n.getNodeName().equals("menuitem"))
- { // investigate the contents of the subelement
- DOMElementHelper h = new DOMElementHelper((Element)n);
- if (!(h.hasChildElement("text")))
- { // no menu item text!
- logger.fatal(" element has no subelement");
- throw new ConfigException(" element has no subelement",h.getElement());
-
- } // end if
-
- LeftMenuItem mitem = null;
- if (h.hasChildElement("servlet"))
- mitem = new ServletLeftMenuItem(h.getElement());
- else if (h.hasChildElement("absolute"))
- mitem = new AbsoluteLeftMenuItem(h.getElement());
- else if (h.hasChildElement("frame"))
- mitem = new FrameLeftMenuItem(h.getElement());
- else
- { // we don't know what type of menu this is!
- logger.fatal("unknown type seen in menu");
- throw new ConfigException("unknown type seen in menu",h.getElement());
-
- } // end else
-
- menu_items.add(mitem);
-
- } // end if
- else if (n.getNodeName().equals("header"))
+ if (n.getNodeName().equals("header"))
menu_items.add(new Header((Element)n)); // add a new header
else if (n.getNodeName().equals("separator"))
menu_items.add(separator_singleton); // all separators are exactly the same
+ else if (n.getNodeName().equals("text"))
+ { // add a text item
+ DOMElementHelper h = new DOMElementHelper((Element)n);
+ menu_items.add(new TextItem(h.getElementText()));
+
+ } // end else if
+ else if (n.getNodeName().equals("link"))
+ menu_items.add(new LinkItem((Element)n));
+ else if (n.getNodeName().equals("image"))
+ menu_items.add(new ImageItem((Element)n));
else
{ // menu definition has an unknown item
logger.fatal("unknown element <" + n.getNodeName() + "/> inside ");
diff --git a/src/com/silverwrist/venice/servlets/format/menus/LinkItem.java b/src/com/silverwrist/venice/servlets/format/menus/LinkItem.java
new file mode 100644
index 0000000..e544d42
--- /dev/null
+++ b/src/com/silverwrist/venice/servlets/format/menus/LinkItem.java
@@ -0,0 +1,137 @@
+/*
+ * 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.menus;
+
+import java.io.Writer;
+import java.io.IOException;
+import org.apache.log4j.*;
+import org.w3c.dom.*;
+import com.silverwrist.util.*;
+import com.silverwrist.venice.core.ConfigException;
+import com.silverwrist.venice.servlets.format.ColorSelectors;
+import com.silverwrist.venice.servlets.format.ComponentRender;
+import com.silverwrist.venice.servlets.format.RenderData;
+
+class LinkItem implements ComponentRender, ColorSelectors
+{
+ /*--------------------------------------------------------------------------------
+ * Static data members
+ *--------------------------------------------------------------------------------
+ */
+
+ private static final String ABSOLUTE = "absolute";
+ private static final String SERVLET = "servlet";
+ private static final String FRAME = "frame";
+ private static final String[] valid_types = { ABSOLUTE, SERVLET, FRAME };
+
+ private static Category logger = Category.getInstance(LinkItem.class);
+
+ /*--------------------------------------------------------------------------------
+ * Attributes
+ *--------------------------------------------------------------------------------
+ */
+
+ private String href;
+ private String type;
+ private boolean enabled = true;
+ private String target = null;
+ private ComponentRender contents;
+
+ /*--------------------------------------------------------------------------------
+ * Constructor
+ *--------------------------------------------------------------------------------
+ */
+
+ LinkItem(Element elt) throws ConfigException
+ {
+ if (!(elt.getNodeName().equals("link")))
+ { // just some shorts-checking here to make sure the element is OK
+ logger.fatal("huh?!? this should have been a if it got here!");
+ throw new ConfigException("not a element");
+
+ } // end if
+
+ DOMElementHelper h = new DOMElementHelper(elt);
+ href = elt.getAttribute("href");
+ if (h.hasAttribute("type"))
+ { // get the "type" and check it
+ type = elt.getAttribute("type").trim().toLowerCase();
+ boolean err = true;
+ for (int i=0; err && (i");
+
+ } // end if
+
+ } // end if
+ else // default to "absolute"
+ type = ABSOLUTE;
+
+ // load the "target"
+ if (h.hasAttribute("target"))
+ target = elt.getAttribute("target");
+
+ // load the "disabled" attribute
+ if (h.hasAttribute("disabled"))
+ enabled = false;
+
+ // load the contents
+ Element x = h.getSubElement("image");
+ if (x!=null)
+ contents = new ImageItem(x);
+ else
+ contents = new TextItem(h.getElementText());
+
+ } // end constructor
+
+ /*--------------------------------------------------------------------------------
+ * Implementations from interface ComponentRender
+ *--------------------------------------------------------------------------------
+ */
+
+ public void renderHere(Writer out, RenderData rdat) throws IOException
+ {
+ if (enabled)
+ { // write the opening and tags
+ out.write("");
+ } // end if
+ else // write the "disabled" indicator
+ out.write("");
+ contents.renderHere(out,rdat);
+ out.write("");
+ if (enabled)
+ out.write("");
+ out.write(" \n");
+
+ } // end renderHere
+
+} // end class LinkItem
diff --git a/src/com/silverwrist/venice/servlets/format/menus/ServletLeftMenuItem.java b/src/com/silverwrist/venice/servlets/format/menus/ServletLeftMenuItem.java
deleted file mode 100644
index 8785b9d..0000000
--- a/src/com/silverwrist/venice/servlets/format/menus/ServletLeftMenuItem.java
+++ /dev/null
@@ -1,57 +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.menus;
-
-import org.w3c.dom.*;
-import com.silverwrist.util.*;
-import com.silverwrist.venice.servlets.format.RenderData;
-
-class ServletLeftMenuItem extends LeftMenuItem
-{
- /*--------------------------------------------------------------------------------
- * Attributes
- *--------------------------------------------------------------------------------
- */
-
- String url;
-
- /*--------------------------------------------------------------------------------
- * Constructor
- *--------------------------------------------------------------------------------
- */
-
- ServletLeftMenuItem(Element elt)
- {
- super(elt);
- DOMElementHelper h = new DOMElementHelper(elt);
- url = h.getSubElementText("servlet");
-
- } // end constructor
-
- /*--------------------------------------------------------------------------------
- * Overrides from class LeftMenuItem
- *--------------------------------------------------------------------------------
- */
-
- protected void appendURL(StringBuffer sbuf, RenderData rdat)
- {
- sbuf.append(rdat.getEncodedServletPath(url));
-
- } // end appendURL
-
-} // end class ServletLeftMenuItem
diff --git a/src/com/silverwrist/venice/servlets/format/menus/AbsoluteLeftMenuItem.java b/src/com/silverwrist/venice/servlets/format/menus/TextItem.java
similarity index 75%
rename from src/com/silverwrist/venice/servlets/format/menus/AbsoluteLeftMenuItem.java
rename to src/com/silverwrist/venice/servlets/format/menus/TextItem.java
index 22e0572..287f195 100644
--- a/src/com/silverwrist/venice/servlets/format/menus/AbsoluteLeftMenuItem.java
+++ b/src/com/silverwrist/venice/servlets/format/menus/TextItem.java
@@ -17,41 +17,41 @@
*/
package com.silverwrist.venice.servlets.format.menus;
-import org.w3c.dom.*;
-import com.silverwrist.util.*;
+import java.io.Writer;
+import java.io.IOException;
+import com.silverwrist.util.StringUtil;
+import com.silverwrist.venice.servlets.format.ComponentRender;
import com.silverwrist.venice.servlets.format.RenderData;
-class AbsoluteLeftMenuItem extends LeftMenuItem
+class TextItem implements ComponentRender
{
/*--------------------------------------------------------------------------------
* Attributes
*--------------------------------------------------------------------------------
*/
- String url;
+ private String contents;
/*--------------------------------------------------------------------------------
* Constructor
*--------------------------------------------------------------------------------
*/
- AbsoluteLeftMenuItem(Element elt)
+ TextItem(String contents)
{
- super(elt);
- DOMElementHelper h = new DOMElementHelper(elt);
- url = h.getSubElementText("absolute");
+ this.contents = StringUtil.encodeHTML(contents);
} // end constructor
/*--------------------------------------------------------------------------------
- * Overrides from class LeftMenuItem
+ * Implementations from interface ComponentRender
*--------------------------------------------------------------------------------
*/
- protected void appendURL(StringBuffer sbuf, RenderData rdat)
+ public void renderHere(Writer out, RenderData rdat) throws IOException
{
- sbuf.append(url);
+ out.write(contents);
- } // end appendURL
+ } // end renderHere
-} // end class AbsoluteLeftMenuItem
+} // end class TextItem