first round of NRPA changes:
- added color customization in render-config.xml - added ability to scale size of Venice logo in footer - added ability to customize size of site logo, as well as add a hyperlink - moved to use of LOG4J 1.1.3, LOG4J now installed in Venice lib directory instead of in JRE extensions directory (only Java extensions should go in JRE extensions directory) - close to requiring JAXP 1.1 (will still work with 1.0 though)
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
* WARRANTY OF ANY KIND, either express or implied. See the License for the specific
|
||||
* language governing rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is the Venice Web Community System.
|
||||
* The Original Code is the Venice Web Communities System.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
|
||||
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
|
||||
@@ -21,19 +21,28 @@ import org.w3c.dom.*;
|
||||
|
||||
public class DOMElementHelper
|
||||
{
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Attributes
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
private Element elt; // element housed by this helper class
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Constructor
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public DOMElementHelper(Element elt)
|
||||
{
|
||||
this.elt = elt;
|
||||
|
||||
} // end constructor
|
||||
|
||||
protected void finalize()
|
||||
{
|
||||
elt = null;
|
||||
|
||||
} // end finalize
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Internal static operations
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
private static String getTextOfElement(Element e)
|
||||
{
|
||||
@@ -64,6 +73,11 @@ public class DOMElementHelper
|
||||
|
||||
} // end getTextOfElement
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* External operations
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public Element getElement()
|
||||
{
|
||||
return elt;
|
||||
@@ -110,6 +124,24 @@ public class DOMElementHelper
|
||||
|
||||
} // end hasChildElement
|
||||
|
||||
public Integer getAttributeInt(String name)
|
||||
{
|
||||
String tmp = elt.getAttribute(name);
|
||||
if (StringUtil.isStringEmpty(tmp))
|
||||
return null;
|
||||
try
|
||||
{ // convert to an Integer
|
||||
return new Integer(tmp);
|
||||
|
||||
} // end try
|
||||
catch (NumberFormatException nfe)
|
||||
{ // return a null value on error
|
||||
return null;
|
||||
|
||||
} // end catch
|
||||
|
||||
} // end getAttributeInt
|
||||
|
||||
} // end DOMElementHelper
|
||||
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ import java.util.*;
|
||||
import com.silverwrist.util.StringUtil;
|
||||
import com.silverwrist.venice.core.*;
|
||||
|
||||
public class AuditDataViewer implements ContentRender
|
||||
public class AuditDataViewer implements ContentRender, ColorSelectors
|
||||
{
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Attributes
|
||||
@@ -85,10 +85,10 @@ public class AuditDataViewer implements ContentRender
|
||||
rdat.writeContentHeader(out,title,null);
|
||||
|
||||
// Write the informational and navigational table
|
||||
out.write("<TABLE WIDTH=\"100%\" BORDER=0><TR VALIGN=MIDDLE><TD ALIGN=LEFT>" + rdat.getStdFontTag(null,2));
|
||||
out.write("\nDisplaying records <B>" + (offset+1) + "</B> to <B>" + last_index + "</B> of <B>"
|
||||
+ total_count + "</B>\n");
|
||||
out.write("</FONT></TD><TD ALIGN=RIGHT>\n");
|
||||
out.write("<TABLE WIDTH=\"100%\" BORDER=0><TR VALIGN=MIDDLE><TD ALIGN=LEFT>"
|
||||
+ rdat.getStdFontTag(CONTENT_FOREGROUND,2) + "\nDisplaying records <B>" + (offset+1)
|
||||
+ "</B> to <B>" + last_index + "</B> of <B>" + total_count + "</B>\n"
|
||||
+ "</FONT></TD><TD ALIGN=RIGHT>\n");
|
||||
if (prev_url==null)
|
||||
out.write("<IMG SRC=\"" + rdat.getFullImagePath("bn_transparent.gif")
|
||||
+ "\" ALT=\"\" WIDTH=80 HEIGHT=24 BORDER=0>\n");
|
||||
@@ -107,7 +107,7 @@ public class AuditDataViewer implements ContentRender
|
||||
out.write("\n</TD></TR></TABLE>\n");
|
||||
|
||||
// Start writing the table containing the actual audit records.
|
||||
String tb_font = rdat.getStdFontTag(null,2);
|
||||
String tb_font = rdat.getStdFontTag(CONTENT_FOREGROUND,2);
|
||||
out.write("<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=3>\n");
|
||||
out.write("<TR>\n<TH ALIGN=LEFT NOWRAP>" + tb_font + "<B>Date/Time</B></FONT></TH>\n");
|
||||
out.write("<TH ALIGN=LEFT NOWRAP>" + tb_font + "<B>Description</B></FONT></TH>\n");
|
||||
|
||||
@@ -22,7 +22,7 @@ import java.io.IOException;
|
||||
import com.silverwrist.util.StringUtil;
|
||||
import com.silverwrist.venice.ValidationException;
|
||||
|
||||
public abstract class CDBaseFormField implements CDFormField
|
||||
public abstract class CDBaseFormField implements CDFormField, ColorSelectors
|
||||
{
|
||||
private String name;
|
||||
private String caption;
|
||||
@@ -67,17 +67,15 @@ public abstract class CDBaseFormField implements CDFormField
|
||||
|
||||
public void renderHere(Writer out, RenderData rdat) throws IOException
|
||||
{
|
||||
out.write("<TR VALIGN=MIDDLE>\n<TD ALIGN=RIGHT>");
|
||||
if (!enabled)
|
||||
out.write("<FONT COLOR=\"silver\">");
|
||||
out.write(StringUtil.encodeHTML(caption));
|
||||
out.write("<TR VALIGN=MIDDLE>\n<TD ALIGN=RIGHT><FONT COLOR=\""
|
||||
+ rdat.getStdColor(enabled ? CONTENT_FOREGROUND : CONTENT_DISABLED) + "\">"
|
||||
+ StringUtil.encodeHTML(caption));
|
||||
if (caption2!=null)
|
||||
out.write(" " + StringUtil.encodeHTML(caption2));
|
||||
if (!enabled)
|
||||
out.write("</FONT>");
|
||||
out.write(":</FONT>");
|
||||
if (required)
|
||||
out.write(rdat.getRequiredBullet());
|
||||
out.write(":</TD>\n<TD ALIGN=LEFT>");
|
||||
out.write("</TD>\n<TD ALIGN=LEFT>");
|
||||
renderActualField(out,rdat);
|
||||
out.write("</TD>\n</TR>\n");
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ import java.io.IOException;
|
||||
import com.silverwrist.util.StringUtil;
|
||||
import com.silverwrist.venice.ValidationException;
|
||||
|
||||
public abstract class CDBaseFormFieldReverse implements CDFormField
|
||||
public abstract class CDBaseFormFieldReverse implements CDFormField, ColorSelectors
|
||||
{
|
||||
private String name;
|
||||
private String caption;
|
||||
@@ -69,14 +69,12 @@ public abstract class CDBaseFormFieldReverse implements CDFormField
|
||||
{
|
||||
out.write("<TR VALIGN=MIDDLE>\n<TD ALIGN=RIGHT>");
|
||||
renderActualField(out,rdat);
|
||||
out.write("</TD>\n<TD ALIGN=LEFT>");
|
||||
if (!enabled)
|
||||
out.write("<FONT COLOR=\"silver\">");
|
||||
out.write(StringUtil.encodeHTML(caption));
|
||||
out.write("</TD>\n<TD ALIGN=LEFT><FONT COLOR=\""
|
||||
+ rdat.getStdColor(enabled ? CONTENT_FOREGROUND : CONTENT_DISABLED) + "\">"
|
||||
+ StringUtil.encodeHTML(caption));
|
||||
if (caption2!=null)
|
||||
out.write(" " + StringUtil.encodeHTML(caption2));
|
||||
if (!enabled)
|
||||
out.write("</FONT>");
|
||||
out.write("</FONT>");
|
||||
if (required)
|
||||
out.write(rdat.getRequiredBullet());
|
||||
out.write("</TD>\n</TR>\n");
|
||||
|
||||
@@ -23,7 +23,7 @@ import javax.servlet.ServletRequest;
|
||||
import com.silverwrist.util.StringUtil;
|
||||
import com.silverwrist.venice.ValidationException;
|
||||
|
||||
public class CDFormCategoryHeader implements CDFormField
|
||||
public class CDFormCategoryHeader implements CDFormField, ColorSelectors
|
||||
{
|
||||
private String caption;
|
||||
private String rtext;
|
||||
@@ -55,25 +55,14 @@ public class CDFormCategoryHeader implements CDFormField
|
||||
|
||||
public void renderHere(Writer out, RenderData rdat) throws IOException
|
||||
{
|
||||
out.write("<TR VALIGN=MIDDLE><TD ALIGN=RIGHT>");
|
||||
if (!enabled)
|
||||
out.write("<FONT COLOR=\"silver\">");
|
||||
out.write("<B>" + StringUtil.encodeHTML(caption) + ":</B>");
|
||||
if (!enabled)
|
||||
out.write("</FONT>");
|
||||
out.write("</TD><TD ALIGN=LEFT>");
|
||||
out.write("<TR VALIGN=MIDDLE><TD ALIGN=RIGHT><FONT COLOR=\""
|
||||
+ rdat.getStdColor(enabled ? CONTENT_FOREGROUND : CONTENT_DISABLED) + "\"><B>"
|
||||
+ StringUtil.encodeHTML(caption) + ":</B></FONT></TD><TD ALIGN=LEFT>");
|
||||
if (rtext==null)
|
||||
out.write(" ");
|
||||
else
|
||||
{ // display in the correct state
|
||||
if (!enabled)
|
||||
out.write("<FONT COLOR=\"silver\">");
|
||||
out.write(StringUtil.encodeHTML(rtext));
|
||||
if (!enabled)
|
||||
out.write("</FONT>");
|
||||
|
||||
} // end else
|
||||
|
||||
else // display in the correct state
|
||||
out.write("<FONT COLOR=\"" + rdat.getStdColor(enabled ? CONTENT_FOREGROUND : CONTENT_DISABLED) + "\">"
|
||||
+ StringUtil.encodeHTML(rtext) + "</FONT>");
|
||||
out.write("</TD></TR>\n");
|
||||
|
||||
} // end renderHere
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
||||
* (the "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at <http://www.mozilla.org/MPL/>.
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
|
||||
* WARRANTY OF ANY KIND, either express or implied. See the License for the specific
|
||||
* language governing rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is the Venice Web Communities System.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
|
||||
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
|
||||
* Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
package com.silverwrist.venice.servlets.format;
|
||||
|
||||
public interface ColorSelectors
|
||||
{
|
||||
public static final int FRAME_BACKGROUND = 0;
|
||||
|
||||
public static final int TITLE_BACKGROUND = 1;
|
||||
|
||||
public static final int TITLE_FOREGROUND = 2;
|
||||
|
||||
public static final int TITLE_LINK = 3;
|
||||
|
||||
public static final int LEFT_BACKGROUND = 4;
|
||||
|
||||
public static final int LEFT_FOREGROUND = 5;
|
||||
|
||||
public static final int CONTENT_BACKGROUND = 6;
|
||||
|
||||
public static final int CONTENT_FOREGROUND = 7;
|
||||
|
||||
public static final int CONTENT_HEADER = 8;
|
||||
|
||||
public static final int CONTENT_DISABLED = 9;
|
||||
|
||||
public static final int CONTENT_ERROR = 10;
|
||||
|
||||
public static final int SIDEBOX_TITLE_BACKGROUND = 11;
|
||||
|
||||
public static final int SIDEBOX_TITLE_FOREGROUND = 12;
|
||||
|
||||
public static final int SIDEBOX_CONTENT_BACKGROUND = 13;
|
||||
|
||||
public static final int SIDEBOX_CONTENT_FOREGROUND = 14;
|
||||
|
||||
public static final int CONFIRM_TITLE_BACKGROUND = 15;
|
||||
|
||||
public static final int CONFIRM_TITLE_FOREGROUND = 16;
|
||||
|
||||
public static final int ERROR_TITLE_BACKGROUND = 17;
|
||||
|
||||
public static final int ERROR_TITLE_FOREGROUND = 18;
|
||||
|
||||
} // end class ColorSelectors
|
||||
@@ -24,7 +24,7 @@ import javax.servlet.*;
|
||||
import javax.servlet.http.*;
|
||||
import com.silverwrist.util.StringUtil;
|
||||
|
||||
public class ConfirmBox implements ContentRender
|
||||
public class ConfirmBox implements ContentRender, ColorSelectors
|
||||
{
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Static data members
|
||||
@@ -111,10 +111,11 @@ public class ConfirmBox implements ContentRender
|
||||
public void renderHere(Writer out, RenderData rdat) throws IOException
|
||||
{
|
||||
out.write("<P><TABLE ALIGN=CENTER WIDTH=\"70%\" BORDER=1 CELLPADDING=2 CELLSPACING=1>");
|
||||
out.write("<TR VALIGN=MIDDLE><TD ALIGN=CENTER BGCOLOR=\"#006600\">\n");
|
||||
out.write(rdat.getStdFontTag("white",3) + StringUtil.encodeHTML(title) + "</FONT>\n");
|
||||
out.write("<TR VALIGN=MIDDLE><TD ALIGN=CENTER BGCOLOR=\"" + rdat.getStdColor(CONFIRM_TITLE_BACKGROUND)
|
||||
+ "\">\n");
|
||||
out.write(rdat.getStdFontTag(CONFIRM_TITLE_FOREGROUND,3) + StringUtil.encodeHTML(title) + "</FONT>\n");
|
||||
out.write("</TD></TR><TR VALIGN=MIDDLE><TD ALIGN=CENTER>\n");
|
||||
out.write(rdat.getStdFontTag(null,3) + "<P>" + StringUtil.encodeHTML(message) + "<P>\n");
|
||||
out.write(rdat.getStdFontTag(CONTENT_FOREGROUND,3) + "<P>" + StringUtil.encodeHTML(message) + "<P>\n");
|
||||
out.write("<A HREF=\"" + rdat.getEncodedServletPath(confirm_url) + "\">");
|
||||
out.write("<IMG SRC=\"" + rdat.getFullImagePath("bn_yes.gif")
|
||||
+ "\" ALT=\"Yes\" WIDTH=80 HEIGHT=24 BORDER=0></A> \n");
|
||||
|
||||
@@ -24,7 +24,7 @@ import javax.servlet.ServletRequest;
|
||||
import com.silverwrist.util.StringUtil;
|
||||
import com.silverwrist.venice.ValidationException;
|
||||
|
||||
public class ContentDialog implements Cloneable, ContentRender
|
||||
public class ContentDialog implements Cloneable, ContentRender, ColorSelectors
|
||||
{
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Attributes
|
||||
@@ -148,7 +148,7 @@ public class ContentDialog implements Cloneable, ContentRender
|
||||
if (error_message!=null)
|
||||
{ // print the error message
|
||||
out.write("<TABLE BORDER=0 ALIGN=CENTER CELLPADDING=6 CELLSPACING=0><TR VALIGN=TOP>"
|
||||
+ "<TD ALIGN=CENTER>\n" + rdat.getStdFontTag("#660000",3) + "<B>");
|
||||
+ "<TD ALIGN=CENTER>\n" + rdat.getStdFontTag(CONTENT_ERROR,3) + "<B>");
|
||||
out.write(StringUtil.encodeHTML(error_message));
|
||||
out.write("</B></FONT>\n</TD></TR></TABLE>\n");
|
||||
|
||||
@@ -156,7 +156,7 @@ public class ContentDialog implements Cloneable, ContentRender
|
||||
|
||||
// Output the start of the form
|
||||
out.write("<FORM NAME=\"" + formname + "\" METHOD=POST ACTION=\"");
|
||||
out.write(rdat.getEncodedServletPath(action) + "\">" + rdat.getStdFontTag(null,2) + "\n");
|
||||
out.write(rdat.getEncodedServletPath(action) + "\">" + rdat.getStdFontTag(CONTENT_FOREGROUND,2) + "\n");
|
||||
|
||||
enum = hidden_fields.keys();
|
||||
while (enum.hasMoreElements())
|
||||
|
||||
@@ -22,7 +22,7 @@ import java.io.Writer;
|
||||
import java.io.IOException;
|
||||
import com.silverwrist.util.StringUtil;
|
||||
|
||||
public class ContentMenuPanel implements Cloneable, ContentRender
|
||||
public class ContentMenuPanel implements Cloneable, ContentRender, ColorSelectors
|
||||
{
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Internal class for storing content items
|
||||
@@ -127,7 +127,7 @@ public class ContentMenuPanel implements Cloneable, ContentRender
|
||||
out.write("<TR VALIGN=MIDDLE>\n<TD ALIGN=CENTER WIDTH=14><IMG SRC=\""
|
||||
+ rdat.getFullImagePath("purple-ball.gif")
|
||||
+ "\" ALT=\"*\" WIDTH=14 HEIGHT=14 BORDER=0></TD>\n<TD ALIGN=LEFT>");
|
||||
out.write(rdat.getStdFontTag(null,2));
|
||||
out.write(rdat.getStdFontTag(CONTENT_FOREGROUND,2));
|
||||
ContentMenuPanelItem item = (ContentMenuPanelItem)(it.next());
|
||||
item.renderHere(out,rdat,params);
|
||||
out.write("</FONT></TD>\n</TR>\n");
|
||||
|
||||
@@ -22,7 +22,7 @@ import java.io.IOException;
|
||||
import com.silverwrist.util.StringUtil;
|
||||
import com.silverwrist.venice.servlets.VeniceServletResult;
|
||||
|
||||
public class ErrorBox extends VeniceServletResult implements ContentRender
|
||||
public class ErrorBox extends VeniceServletResult implements ContentRender, ColorSelectors
|
||||
{
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Attributes
|
||||
@@ -69,10 +69,11 @@ public class ErrorBox extends VeniceServletResult implements ContentRender
|
||||
public void renderHere(Writer out, RenderData rdat) throws IOException
|
||||
{
|
||||
out.write("<P><TABLE ALIGN=CENTER WIDTH=\"70%\" BORDER=1 CELLPADDING=2 CELLSPACING=1>");
|
||||
out.write("<TR VALIGN=MIDDLE><TD ALIGN=CENTER BGCOLOR=\"#660000\">\n");
|
||||
out.write(rdat.getStdFontTag("white",3) + StringUtil.encodeHTML(title) + "</FONT>\n");
|
||||
out.write("<TR VALIGN=MIDDLE><TD ALIGN=CENTER BGCOLOR=\"" + rdat.getStdColor(ERROR_TITLE_BACKGROUND)
|
||||
+ "\">\n");
|
||||
out.write(rdat.getStdFontTag(ERROR_TITLE_FOREGROUND,3) + StringUtil.encodeHTML(title) + "</FONT>\n");
|
||||
out.write("</TD></TR><TR VALIGN=MIDDLE><TD ALIGN=CENTER>\n");
|
||||
out.write(rdat.getStdFontTag(null,3) + "<P>" + StringUtil.encodeHTML(message) + "<P>\n");
|
||||
out.write(rdat.getStdFontTag(CONTENT_FOREGROUND,3) + "<P>" + StringUtil.encodeHTML(message) + "<P>\n");
|
||||
if (back==null)
|
||||
out.write("Use your browser's <B>Back</B> button to go back.\n");
|
||||
else
|
||||
|
||||
@@ -33,7 +33,7 @@ import com.silverwrist.venice.core.UserContext;
|
||||
import com.silverwrist.venice.servlets.Variables;
|
||||
import com.silverwrist.venice.servlets.format.menus.LeftMenu;
|
||||
|
||||
public class RenderConfig
|
||||
public class RenderConfig implements ColorSelectors
|
||||
{
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Static data values
|
||||
@@ -45,6 +45,8 @@ public class RenderConfig
|
||||
|
||||
private static Category logger = Category.getInstance(RenderConfig.class.getName());
|
||||
|
||||
private static Map colornames_map;
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Attributes
|
||||
*--------------------------------------------------------------------------------
|
||||
@@ -59,8 +61,13 @@ public class RenderConfig
|
||||
private String image_url;
|
||||
private String static_url;
|
||||
private String site_logo;
|
||||
private int site_logo_width = 140;
|
||||
private int site_logo_height = 80;
|
||||
private String site_logo_linkURL = null;
|
||||
private HashMap stock_messages;
|
||||
private HashMap menus;
|
||||
private String[] colors_array;
|
||||
private int footer_logo_scale;
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Constructor
|
||||
@@ -125,6 +132,49 @@ public class RenderConfig
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Font face: " + font_face);
|
||||
|
||||
Element colors_sect = render_sect_h.getSubElement("colors");
|
||||
if (colors_sect==null)
|
||||
{ // no <colors/> tag - bail out now!
|
||||
logger.fatal("<rendering/> section has no <colors/> element");
|
||||
throw new ConfigException("no <colors/> found in <rendering/> section",render_sect);
|
||||
|
||||
} // end if
|
||||
|
||||
colors_array = new String[colornames_map.size()];
|
||||
int i;
|
||||
NodeList colors_nlist = colors_sect.getChildNodes();
|
||||
for (i=0; i<colors_nlist.getLength(); i++)
|
||||
{ // look at all subelements and map their names to color selectors
|
||||
Node foo = colors_nlist.item(i);
|
||||
if (foo.getNodeType()==Node.ELEMENT_NODE)
|
||||
{ // map the element name to a color selector
|
||||
Integer csel = (Integer)(colornames_map.get(foo.getNodeName()));
|
||||
if (csel!=null)
|
||||
{ // load the specified color into the colors array
|
||||
DOMElementHelper foo_h = new DOMElementHelper((Element)foo);
|
||||
colors_array[csel.intValue()] = foo_h.getElementText();
|
||||
|
||||
} // end if
|
||||
|
||||
} // end if
|
||||
|
||||
} // end for
|
||||
|
||||
try
|
||||
{ // load in the footer logo scale
|
||||
String tmp = render_sect_h.getSubElementText("footer-logo-scale");
|
||||
if (tmp==null)
|
||||
footer_logo_scale = 100;
|
||||
else
|
||||
footer_logo_scale = Integer.parseInt(tmp.trim());
|
||||
|
||||
} // end try
|
||||
catch (NumberFormatException nfe)
|
||||
{ // just default on serious error
|
||||
footer_logo_scale = 100;
|
||||
|
||||
} // end catch
|
||||
|
||||
Element paths_sect = root_h.getSubElement("paths");
|
||||
if (paths_sect==null)
|
||||
{ // no <paths/> section - bail out now!
|
||||
@@ -156,16 +206,38 @@ public class RenderConfig
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Static files path: " + static_url);
|
||||
|
||||
site_logo = paths_sect_h.getSubElementText("site-logo");
|
||||
if (site_logo==null)
|
||||
{ // no <image/> tag - bail out now!
|
||||
Element site_logo_elt = paths_sect_h.getSubElement("site-logo");
|
||||
if (site_logo_elt==null)
|
||||
{ // no <site-logo/> tag - bail out now!
|
||||
logger.fatal("<paths/> section has no <site-logo/> element");
|
||||
throw new ConfigException("no <site-logo/> found in <paths/> section",paths_sect);
|
||||
|
||||
} // end if
|
||||
|
||||
DOMElementHelper site_logo_h = new DOMElementHelper(site_logo_elt);
|
||||
site_logo = site_logo_h.getElementText();
|
||||
if (site_logo==null)
|
||||
{ // no site logo specified - bail out now!
|
||||
logger.fatal("<paths/> section has no site logo element");
|
||||
throw new ConfigException("no site logo found in <paths/> section",paths_sect);
|
||||
|
||||
} // end if
|
||||
|
||||
// get logo width and height
|
||||
Integer fooint = site_logo_h.getAttributeInt("width");
|
||||
if (fooint!=null)
|
||||
site_logo_width = fooint.intValue();
|
||||
fooint = site_logo_h.getAttributeInt("height");
|
||||
if (fooint!=null)
|
||||
site_logo_height = fooint.intValue();
|
||||
|
||||
// get logo link URL
|
||||
String tmp = site_logo_elt.getAttribute("href");
|
||||
if (!(StringUtil.isStringEmpty(tmp)))
|
||||
site_logo_linkURL = tmp;
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Site logo: " + image_url);
|
||||
logger.debug("Site logo: " + site_logo);
|
||||
|
||||
Element msg_sect = root_h.getSubElement("messages");
|
||||
if (msg_sect==null)
|
||||
@@ -178,7 +250,6 @@ public class RenderConfig
|
||||
// Initialize the stock messages list.
|
||||
stock_messages = new HashMap();
|
||||
NodeList msg_nodes = msg_sect.getChildNodes();
|
||||
int i;
|
||||
for (i=0; i<msg_nodes.getLength(); i++)
|
||||
{ // examine all subnodes to add them to the message text
|
||||
Node msgn = msg_nodes.item(i);
|
||||
@@ -361,13 +432,18 @@ public class RenderConfig
|
||||
String getSiteImageTag(int hspace, int vspace)
|
||||
{
|
||||
StringBuffer buf = new StringBuffer();
|
||||
if (site_logo_linkURL!=null)
|
||||
buf.append("<A HREF=\"").append(site_logo_linkURL).append("\">");
|
||||
buf.append("<IMG SRC=\"").append(site_logo).append("\" ALT=\"").append(site_title);
|
||||
buf.append("\" WIDTH=140 HEIGHT=80 BORDER=0");
|
||||
buf.append("\" WIDTH=").append(site_logo_width).append(" HEIGHT=").append(site_logo_height);
|
||||
buf.append(" BORDER=0");
|
||||
if (hspace>0)
|
||||
buf.append(" HSPACE=").append(hspace);
|
||||
if (vspace>0)
|
||||
buf.append(" VSPACE=").append(vspace);
|
||||
buf.append('>');
|
||||
if (site_logo_linkURL!=null)
|
||||
buf.append("</A>");
|
||||
return buf.toString();
|
||||
|
||||
} // end getSiteImageTag
|
||||
@@ -383,6 +459,14 @@ public class RenderConfig
|
||||
|
||||
} // end getStdFontTag
|
||||
|
||||
String getStdFontTag(int selector, int size)
|
||||
{
|
||||
if ((selector<0) || (selector>=colors_array.length))
|
||||
throw new IndexOutOfBoundsException("getStdColor(): invalid color selector value");
|
||||
return getStdFontTag(colors_array[selector],size);
|
||||
|
||||
} // end getStdFontTag
|
||||
|
||||
String getStdBaseFontTag(int size)
|
||||
{
|
||||
StringBuffer buf = new StringBuffer("<BASEFONT FACE=\"");
|
||||
@@ -401,10 +485,11 @@ public class RenderConfig
|
||||
|
||||
void writeContentHeader(Writer out, String primary, String secondary) throws IOException
|
||||
{
|
||||
out.write(getStdFontTag("#3333AA",5) + "<B>" + StringUtil.encodeHTML(primary) + "</B></FONT>");
|
||||
out.write(getStdFontTag(colors_array[CONTENT_HEADER],5) + "<B>" + StringUtil.encodeHTML(primary)
|
||||
+ "</B></FONT>");
|
||||
if (secondary!=null)
|
||||
out.write(" " + getStdFontTag("#3333AA",3) + "<B>" + StringUtil.encodeHTML(secondary)
|
||||
+ "</B></FONT>");
|
||||
out.write(" " + getStdFontTag(colors_array[CONTENT_HEADER],3) + "<B>"
|
||||
+ StringUtil.encodeHTML(secondary) + "</B></FONT>");
|
||||
out.write("<HR ALIGN=LEFT SIZE=2 WIDTH=\"90%\" NOSHADE>\n");
|
||||
|
||||
} // end writeContentHeader
|
||||
@@ -422,6 +507,20 @@ public class RenderConfig
|
||||
|
||||
} // end writeStockMessage
|
||||
|
||||
String getStdColor(int selector)
|
||||
{
|
||||
if ((selector<0) || (selector>=colors_array.length))
|
||||
throw new IndexOutOfBoundsException("getStdColor(): invalid color selector value");
|
||||
return colors_array[selector];
|
||||
|
||||
} // end getStdColor
|
||||
|
||||
int scaleFooterLogo(int param)
|
||||
{
|
||||
return (param * footer_logo_scale) / 100;
|
||||
|
||||
} // end scaleFooterLogo
|
||||
|
||||
public LeftMenu getLeftMenu(String identifier)
|
||||
{
|
||||
return (LeftMenu)(menus.get(identifier));
|
||||
@@ -475,4 +574,35 @@ public class RenderConfig
|
||||
|
||||
} // end createRenderData
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Static initializer
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static
|
||||
{ // Initialize the mapping of color names from render-config.xml to color selector IDs.
|
||||
HashMap m = new HashMap();
|
||||
m.put("frame-bg",new Integer(FRAME_BACKGROUND));
|
||||
m.put("title-bg",new Integer(TITLE_BACKGROUND));
|
||||
m.put("title-fg",new Integer(TITLE_FOREGROUND));
|
||||
m.put("title-link",new Integer(TITLE_LINK));
|
||||
m.put("left-bg",new Integer(LEFT_BACKGROUND));
|
||||
m.put("left-fg",new Integer(LEFT_FOREGROUND));
|
||||
m.put("content-bg",new Integer(CONTENT_BACKGROUND));
|
||||
m.put("content-fg",new Integer(CONTENT_FOREGROUND));
|
||||
m.put("content-hdr",new Integer(CONTENT_HEADER));
|
||||
m.put("content-disabled",new Integer(CONTENT_DISABLED));
|
||||
m.put("content-error",new Integer(CONTENT_ERROR));
|
||||
m.put("sidebox-title-bg",new Integer(SIDEBOX_TITLE_BACKGROUND));
|
||||
m.put("sidebox-title-fg",new Integer(SIDEBOX_TITLE_FOREGROUND));
|
||||
m.put("sidebox-content-bg",new Integer(SIDEBOX_CONTENT_BACKGROUND));
|
||||
m.put("sidebox-content-fg",new Integer(SIDEBOX_CONTENT_FOREGROUND));
|
||||
m.put("confirm-title-bg",new Integer(CONFIRM_TITLE_BACKGROUND));
|
||||
m.put("confirm-title-fg",new Integer(CONFIRM_TITLE_FOREGROUND));
|
||||
m.put("error-title-bg",new Integer(ERROR_TITLE_BACKGROUND));
|
||||
m.put("error-title-fg",new Integer(ERROR_TITLE_FOREGROUND));
|
||||
colornames_map = Collections.unmodifiableMap(m);
|
||||
|
||||
} // end static initializer
|
||||
|
||||
} // end class RenderConfig
|
||||
|
||||
@@ -211,6 +211,12 @@ public class RenderData
|
||||
|
||||
} // end getStdFontTag
|
||||
|
||||
public String getStdFontTag(int selector, int size)
|
||||
{
|
||||
return rconf.getStdFontTag(selector,size);
|
||||
|
||||
} // end getStdFontTag
|
||||
|
||||
public String getStdBaseFontTag(int size)
|
||||
{
|
||||
return rconf.getStdBaseFontTag(size);
|
||||
@@ -280,6 +286,18 @@ public class RenderData
|
||||
|
||||
} // end writeStockMessage
|
||||
|
||||
public String getStdColor(int selector)
|
||||
{
|
||||
return rconf.getStdColor(selector);
|
||||
|
||||
} // end getStdColor
|
||||
|
||||
public int scaleFooterLogo(int param)
|
||||
{
|
||||
return rconf.scaleFooterLogo(param);
|
||||
|
||||
} // end scaleFooterLogo
|
||||
|
||||
public LeftMenu getLeftMenu(String identifier)
|
||||
{
|
||||
return rconf.getLeftMenu(identifier);
|
||||
|
||||
@@ -22,7 +22,7 @@ import java.util.*;
|
||||
import com.silverwrist.util.StringUtil;
|
||||
import com.silverwrist.venice.core.*;
|
||||
|
||||
public class SideBoxConferences implements ContentRender
|
||||
public class SideBoxConferences implements ContentRender, ColorSelectors
|
||||
{
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Attributes
|
||||
@@ -65,7 +65,6 @@ public class SideBoxConferences implements ContentRender
|
||||
|
||||
public void renderHere(Writer out, RenderData rdat) throws IOException
|
||||
{
|
||||
out.write(rdat.getStdFontTag(null,2) + "\n");
|
||||
if (hotlist.size()>0)
|
||||
{ // display the list of conferences
|
||||
out.write("<TABLE ALIGN=CENTER BORDER=0 CELLPADDING=0 CELLSPACING=2>\n");
|
||||
@@ -78,7 +77,7 @@ public class SideBoxConferences implements ContentRender
|
||||
out.write("<TR VALIGN=MIDDLE>\n<TD ALIGN=CENTER WIDTH=14><IMG SRC=\""
|
||||
+ rdat.getFullImagePath("purple-ball.gif")
|
||||
+ "\" ALT=\"*\" WIDTH=14 HEIGHT=14 BORDER=0></TD>\n");
|
||||
out.write("<TD ALIGN=LEFT>\n" + rdat.getStdFontTag(null,2) + "<B><A HREF=\""
|
||||
out.write("<TD ALIGN=LEFT>\n" + rdat.getStdFontTag(SIDEBOX_CONTENT_FOREGROUND,2) + "<B><A HREF=\""
|
||||
+ rdat.getEncodedServletPath(href) + "\">" + StringUtil.encodeHTML(conf.getName())
|
||||
+ "</A></B> (" + StringUtil.encodeHTML(conf.getEnclosingSIG().getName()) + ")</FONT>\n");
|
||||
if (conf.anyUnread())
|
||||
@@ -93,11 +92,12 @@ public class SideBoxConferences implements ContentRender
|
||||
|
||||
} // end if
|
||||
else
|
||||
out.write(rdat.getStdFontTag(null,2) + "<EM>You have no conferences in your hotlist.</EM></FONT>\n");
|
||||
out.write(rdat.getStdFontTag(SIDEBOX_CONTENT_FOREGROUND,2)
|
||||
+ "<EM>You have no conferences in your hotlist.</EM></FONT>\n");
|
||||
|
||||
if (uc.isLoggedIn())
|
||||
{ // write the link at the end
|
||||
out.write("<P>" + rdat.getStdFontTag(null,1) + "<B>[ <A HREF=\""
|
||||
out.write("<P>" + rdat.getStdFontTag(SIDEBOX_CONTENT_FOREGROUND,1) + "<B>[ <A HREF=\""
|
||||
+ rdat.getEncodedServletPath("settings?cmd=H") + "\">Manage</A> ]</B></FONT>");
|
||||
|
||||
} // end if
|
||||
|
||||
@@ -22,7 +22,7 @@ import java.util.*;
|
||||
import com.silverwrist.util.StringUtil;
|
||||
import com.silverwrist.venice.core.*;
|
||||
|
||||
public class SideBoxSIGs implements ContentRender
|
||||
public class SideBoxSIGs implements ContentRender, ColorSelectors
|
||||
{
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Attributes
|
||||
@@ -65,7 +65,6 @@ public class SideBoxSIGs implements ContentRender
|
||||
|
||||
public void renderHere(Writer out, RenderData rdat) throws IOException
|
||||
{
|
||||
out.write(rdat.getStdFontTag(null,2) + "\n");
|
||||
if (sig_list.size()>0)
|
||||
{ // display the list of available SIGs
|
||||
out.write("<TABLE ALIGN=CENTER BORDER=0 CELLPADDING=0 CELLSPACING=2>\n");
|
||||
@@ -76,7 +75,7 @@ public class SideBoxSIGs implements ContentRender
|
||||
out.write("<TR VALIGN=MIDDLE>\n<TD ALIGN=CENTER WIDTH=14><IMG SRC=\""
|
||||
+ rdat.getFullImagePath("purple-ball.gif")
|
||||
+ "\" ALT=\"*\" WIDTH=14 HEIGHT=14 BORDER=0></TD>\n");
|
||||
out.write("<TD ALIGN=LEFT>\n" + rdat.getStdFontTag(null,2) + "<B><A HREF=\""
|
||||
out.write("<TD ALIGN=LEFT>\n" + rdat.getStdFontTag(SIDEBOX_CONTENT_FOREGROUND,2) + "<B><A HREF=\""
|
||||
+ rdat.getEncodedServletPath("sig/" + sig.getAlias()) + "\">"
|
||||
+ StringUtil.encodeHTML(sig.getName()) + "</A></B></FONT>\n");
|
||||
if (sig.isAdmin())
|
||||
@@ -90,13 +89,15 @@ public class SideBoxSIGs implements ContentRender
|
||||
|
||||
} // end if
|
||||
else
|
||||
out.write(rdat.getStdFontTag(null,2) + "<EM>You are not a member of any SIGs.</EM></FONT>\n");
|
||||
out.write(rdat.getStdFontTag(SIDEBOX_CONTENT_FOREGROUND,2)
|
||||
+ "<EM>You are not a member of any SIGs.</EM></FONT>\n");
|
||||
|
||||
if (uc.isLoggedIn())
|
||||
{ // write the two links at the end
|
||||
out.write("<P>" + rdat.getStdFontTag(null,1) + "<B>[ <A HREF=\""
|
||||
out.write("<P>" + rdat.getStdFontTag(SIDEBOX_CONTENT_FOREGROUND,1) + "<B>[ <A HREF=\""
|
||||
+ rdat.getEncodedServletPath("settings?cmd=S") + "\">Manage</A> | <A HREF=\""
|
||||
+ rdat.getEncodedServletPath("sigops?cmd=C") + "\">Create New</A> ]</B></FONT>");
|
||||
|
||||
} // end if
|
||||
|
||||
} // end renderHere
|
||||
|
||||
@@ -24,7 +24,7 @@ import com.silverwrist.util.StringUtil;
|
||||
import com.silverwrist.venice.htmlcheck.*;
|
||||
import com.silverwrist.venice.core.*;
|
||||
|
||||
public class TextMessageDialog implements ContentRender
|
||||
public class TextMessageDialog implements ContentRender, ColorSelectors
|
||||
{
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Static data members
|
||||
@@ -128,7 +128,7 @@ public class TextMessageDialog implements ContentRender
|
||||
public void renderHere(Writer out, RenderData rdat) throws IOException
|
||||
{
|
||||
rdat.writeContentHeader(out,title,null);
|
||||
out.write(rdat.getStdFontTag(null,2));
|
||||
out.write(rdat.getStdFontTag(CONTENT_FOREGROUND,2));
|
||||
out.write("\n");
|
||||
out.write(text);
|
||||
out.write("</FONT><P>\n<DIV ALIGN=\"center\">\n");
|
||||
|
||||
@@ -25,7 +25,7 @@ import javax.servlet.http.*;
|
||||
import com.silverwrist.util.StringUtil;
|
||||
import com.silverwrist.venice.core.*;
|
||||
|
||||
public class TopDisplay implements ContentRender
|
||||
public class TopDisplay implements ContentRender, ColorSelectors
|
||||
{
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Static data values
|
||||
@@ -188,10 +188,12 @@ public class TopDisplay implements ContentRender
|
||||
for (int i=0; i<sideboxes.length; i++)
|
||||
{ // draw in the outer framework of the sidebox
|
||||
out.write("<TABLE ALIGN=CENTER WIDTH=200 BORDER=0 CELLPADDING=2 CELLSPACING=0>"
|
||||
+ "<TR VALIGN=MIDDLE BGCOLOR=\"#6666CC\"><TD ALIGN=LEFT>\n");
|
||||
out.write(rdat.getStdFontTag("white",3) + "<B>" + StringUtil.encodeHTML(sideboxes[i].getPageTitle(rdat))
|
||||
+ "</B></FONT>\n");
|
||||
out.write("</TD></TR><TR VALIGN=TOP BGCOLOR=\"#9999FF\"><TD ALIGN=LEFT>\n");
|
||||
+ "<TR VALIGN=MIDDLE BGCOLOR=\"" + rdat.getStdColor(SIDEBOX_TITLE_BACKGROUND)
|
||||
+ "\"><TD ALIGN=LEFT>\n");
|
||||
out.write(rdat.getStdFontTag(SIDEBOX_TITLE_FOREGROUND,3) + "<B>"
|
||||
+ StringUtil.encodeHTML(sideboxes[i].getPageTitle(rdat)) + "</B></FONT>\n");
|
||||
out.write("</TD></TR><TR VALIGN=TOP BGCOLOR=\"" + rdat.getStdColor(SIDEBOX_CONTENT_BACKGROUND)
|
||||
+ "\"><TD ALIGN=LEFT>\n");
|
||||
|
||||
// Fill in the sidebox by calling down to the base.
|
||||
if (sideboxes[i] instanceof ContentRender)
|
||||
@@ -214,7 +216,7 @@ public class TopDisplay implements ContentRender
|
||||
} // end try
|
||||
catch (ServletException se)
|
||||
{ // since we can't throw ServletException, we throw IOException
|
||||
out.write(rdat.getStdFontTag(null,2) + "<EM>failure rendering class "
|
||||
out.write(rdat.getStdFontTag(SIDEBOX_CONTENT_FOREGROUND,2) + "<EM>failure rendering class "
|
||||
+ sideboxes[i].getClass().getName() + ": " + StringUtil.encodeHTML(se.getMessage())
|
||||
+ "</EM></FONT>\n");
|
||||
out.flush();
|
||||
@@ -225,7 +227,7 @@ public class TopDisplay implements ContentRender
|
||||
|
||||
} // end else if
|
||||
else // this is bogus - just display a little error here
|
||||
out.write(rdat.getStdFontTag(null,2) + "<EM>cannot display sidebox of class: "
|
||||
out.write(rdat.getStdFontTag(SIDEBOX_CONTENT_FOREGROUND,2) + "<EM>cannot display sidebox of class: "
|
||||
+ sideboxes[i].getClass().getName() + "</EM></FONT>\n");
|
||||
|
||||
// close up the framework of this sidebox
|
||||
|
||||
Reference in New Issue
Block a user