added content metadata processing and its first application, making the Front
Page auto-refresh
This commit is contained in:
		
							parent
							
								
									aa186601a4
								
							
						
					
					
						commit
						b437a15e73
					
				@ -68,6 +68,9 @@
 | 
			
		||||
    <!-- The maximum age of the persistent login cookie. -->
 | 
			
		||||
    <property name="login.cookie.age">31536000</property> <!-- one year -->
 | 
			
		||||
 | 
			
		||||
    <!-- The Front Page will automatically refresh if this property is set. -->
 | 
			
		||||
    <property name="top.refresh">300</property>  <!-- every five minutes -->
 | 
			
		||||
 | 
			
		||||
  </properties>
 | 
			
		||||
 | 
			
		||||
  <!-- Settings related to the outer frame. -->
 | 
			
		||||
 | 
			
		||||
@ -8,9 +8,9 @@
 | 
			
		||||
// 
 | 
			
		||||
// The Original Code is the Venice Web Communities System.
 | 
			
		||||
// 
 | 
			
		||||
// The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
 | 
			
		||||
// The Initial Developer of the Original Code is Eric J. Bowersox <erbo@ricochet.com>,
 | 
			
		||||
// for Silverwrist Design Studios.  Portions created by Eric J. Bowersox are
 | 
			
		||||
// Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios.  All Rights Reserved.
 | 
			
		||||
// Copyright (C) 2001-2004 Eric J. Bowersox/Silverwrist Design Studios.  All Rights Reserved.
 | 
			
		||||
// 
 | 
			
		||||
// Contributor(s): 
 | 
			
		||||
 | 
			
		||||
@ -54,6 +54,11 @@ try
 | 
			
		||||
  view.menuSelector = Content.MENU_SELECTOR_TOP;
 | 
			
		||||
  view.pageQID = "top";
 | 
			
		||||
 | 
			
		||||
  // set it up to auto-refresh if configured to do that
 | 
			
		||||
  ar = rinput.getConfigProperty("top.refresh");
 | 
			
		||||
  if (ar!=null)
 | 
			
		||||
    view.addHTTPMetadata("refresh",ar);
 | 
			
		||||
 | 
			
		||||
  // wrap the JSP view in our sidebox view for return
 | 
			
		||||
  rc = new SideBoxNestedView(rinput,view);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										28
									
								
								src/com/silverwrist/venice/ui/ContentMetadata.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								src/com/silverwrist/venice/ui/ContentMetadata.java
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,28 @@
 | 
			
		||||
/*
 | 
			
		||||
 * 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@ricochet.com>,
 | 
			
		||||
 * for Silverwrist Design Studios.  Portions created by Eric J. Bowersox are
 | 
			
		||||
 * Copyright (C) 2004 Eric J. Bowersox/Silverwrist Design Studios.  All Rights Reserved.
 | 
			
		||||
 * 
 | 
			
		||||
 * Contributor(s): 
 | 
			
		||||
 */
 | 
			
		||||
package com.silverwrist.venice.ui;
 | 
			
		||||
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
public interface ContentMetadata
 | 
			
		||||
{
 | 
			
		||||
  public Map getMetadata();
 | 
			
		||||
 | 
			
		||||
  public Map getHTTPMetadata();
 | 
			
		||||
 | 
			
		||||
} // end interface ContentMetadata
 | 
			
		||||
@ -9,9 +9,9 @@
 | 
			
		||||
 * 
 | 
			
		||||
 * The Original Code is the Venice Web Communities System.
 | 
			
		||||
 * 
 | 
			
		||||
 * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
 | 
			
		||||
 * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@ricochet.com>,
 | 
			
		||||
 * for Silverwrist Design Studios.  Portions created by Eric J. Bowersox are
 | 
			
		||||
 * Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios.  All Rights Reserved.
 | 
			
		||||
 * Copyright (C) 2001-2004 Eric J. Bowersox/Silverwrist Design Studios.  All Rights Reserved.
 | 
			
		||||
 * 
 | 
			
		||||
 * Contributor(s): 
 | 
			
		||||
 */
 | 
			
		||||
@ -25,4 +25,6 @@ public interface LinkTypes
 | 
			
		||||
 | 
			
		||||
  public static final int FRAME = 2;
 | 
			
		||||
 | 
			
		||||
  public static final int FULLSERVLET = 3;
 | 
			
		||||
 | 
			
		||||
} // end interface LinkTypes
 | 
			
		||||
 | 
			
		||||
@ -9,9 +9,9 @@
 | 
			
		||||
 * 
 | 
			
		||||
 * The Original Code is the Venice Web Communities System.
 | 
			
		||||
 * 
 | 
			
		||||
 * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
 | 
			
		||||
 * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@ricochet.com>,
 | 
			
		||||
 * for Silverwrist Design Studios.  Portions created by Eric J. Bowersox are
 | 
			
		||||
 * Copyright (C) 2001-02 Eric J. Bowersox/Silverwrist Design Studios.  All Rights Reserved.
 | 
			
		||||
 * Copyright (C) 2001-2004 Eric J. Bowersox/Silverwrist Design Studios.  All Rights Reserved.
 | 
			
		||||
 * 
 | 
			
		||||
 * Contributor(s): 
 | 
			
		||||
 */
 | 
			
		||||
@ -282,32 +282,32 @@ public class RootConfig implements LinkTypes, ColorSelectors
 | 
			
		||||
    // Retrieve the site logo.
 | 
			
		||||
    sect1 = loader.configGetSubSection(sect_h,"site-logo");
 | 
			
		||||
    sect1_h = new DOMElementHelper(sect1);
 | 
			
		||||
    StringBuffer tmpbuf = new StringBuffer("<IMG SRC=\"");
 | 
			
		||||
    tmpbuf.append(loader.configGetText(sect1_h)).append("\" ALT=\"").append(site_title).append("\" WIDTH=");
 | 
			
		||||
    StringBuffer tmpbuf = new StringBuffer("<img src=\"");
 | 
			
		||||
    tmpbuf.append(loader.configGetText(sect1_h)).append("\" alt=\"").append(site_title).append("\" width=\"");
 | 
			
		||||
 | 
			
		||||
    // Get the logo width.
 | 
			
		||||
    Integer itmp = sect1_h.getAttributeInt("width");
 | 
			
		||||
    if (itmp==null)
 | 
			
		||||
      itmp = new Integer(140);
 | 
			
		||||
    tmpbuf.append(itmp).append(" HEIGHT=");
 | 
			
		||||
    tmpbuf.append(itmp).append("\" height=\"");
 | 
			
		||||
 | 
			
		||||
    // Get the logo height.
 | 
			
		||||
    itmp = sect1_h.getAttributeInt("height");
 | 
			
		||||
    if (itmp==null)
 | 
			
		||||
      itmp = new Integer(80);
 | 
			
		||||
    tmpbuf.append(itmp).append(" HSPACE=");
 | 
			
		||||
    tmpbuf.append(itmp).append("\" hspace=\"");
 | 
			
		||||
 | 
			
		||||
    // Get the horizontal spacing for the logo.
 | 
			
		||||
    itmp = sect1_h.getAttributeInt("hspace");
 | 
			
		||||
    if (itmp==null)
 | 
			
		||||
      itmp = new Integer(2);
 | 
			
		||||
    tmpbuf.append(itmp).append(" VSPACE=");
 | 
			
		||||
    tmpbuf.append(itmp).append("\" vspace=\"");
 | 
			
		||||
 | 
			
		||||
    // Get the vertical spacing for the logo.
 | 
			
		||||
    itmp = sect1_h.getAttributeInt("vspace");
 | 
			
		||||
    if (itmp==null)
 | 
			
		||||
      itmp = new Integer(2);
 | 
			
		||||
    tmpbuf.append(itmp).append(" BORDER=0>");
 | 
			
		||||
    tmpbuf.append(itmp).append("\" border=\"0\" />");
 | 
			
		||||
    site_logo_img_tag = tmpbuf.toString();
 | 
			
		||||
    
 | 
			
		||||
    // Get the link URL of the logo.
 | 
			
		||||
@ -334,9 +334,9 @@ public class RootConfig implements LinkTypes, ColorSelectors
 | 
			
		||||
      itmp = new Integer(100);
 | 
			
		||||
    int tmp_width = (VENICE_IMAGE_WIDTH * itmp.intValue()) / 100;
 | 
			
		||||
    int tmp_height = (VENICE_IMAGE_HEIGHT * itmp.intValue()) / 100;
 | 
			
		||||
    venice_logo_tag = "<A HREF=\"" + VENICE_URL + "\" TARGET=\"_blank\"><IMG SRC=\"" + image_path
 | 
			
		||||
                    + VENICE_IMAGE + "\" ALT=\"" + VENICE_ALT + "\" WIDTH=" + tmp_width + " HEIGHT="
 | 
			
		||||
                    + tmp_height + " BORDER=0 HSPACE=0 VSPACE=0></A>";
 | 
			
		||||
    venice_logo_tag = "<a href=\"" + VENICE_URL + "\" target=\"_blank\"><img src=\"" + image_path
 | 
			
		||||
                    + VENICE_IMAGE + "\" alt=\"" + VENICE_ALT + "\" width=\"" + tmp_width + "\" height=\""
 | 
			
		||||
                    + tmp_height + "\" border=\"0\" hspace=\"0\" vspace=\"0\" /></a>";
 | 
			
		||||
 | 
			
		||||
    // Get the page icon and icon type, and the "favorites icon" (MS-specific).
 | 
			
		||||
    String page_icon_1 = null, page_icon_2 = null;
 | 
			
		||||
@ -344,7 +344,7 @@ public class RootConfig implements LinkTypes, ColorSelectors
 | 
			
		||||
    if (sect1!=null)
 | 
			
		||||
    { // get the URL and create the "shortcut icon" tag
 | 
			
		||||
      String url = loader.configGetText(sect1);
 | 
			
		||||
      page_icon_2 = "<LINK REL=\"SHORTCUT ICON\" HREF=\"" + url + "\">\n";
 | 
			
		||||
      page_icon_2 = "<link rel=\"SHORTCUT ICON\" href=\"" + url + "\" />\n";
 | 
			
		||||
 | 
			
		||||
    } // end if
 | 
			
		||||
 | 
			
		||||
@ -353,9 +353,9 @@ public class RootConfig implements LinkTypes, ColorSelectors
 | 
			
		||||
    { // get the URL and type, and create the page icon tag
 | 
			
		||||
      String url = loader.configGetText(sect1);
 | 
			
		||||
      String type = loader.configGetAttribute(sect1,"type");
 | 
			
		||||
      page_icon_1 = "<LINK REL=\"icon\" HREF=\"" + url + "\" TYPE=\"" + type + "\">\n";
 | 
			
		||||
      page_icon_1 = "<link rel=\"icon\" href=\"" + url + "\" type=\"" + type + "\" />\n";
 | 
			
		||||
      if (page_icon_2==null)  // fill this in for the "shortcut icon" as well
 | 
			
		||||
	page_icon_2 = "<LINK REL=\"SHORTCUT ICON\" HREF=\"" + url + "\">\n";
 | 
			
		||||
	page_icon_2 = "<link rel=\"SHORTCUT ICON\" href=\"" + url + "\" />\n";
 | 
			
		||||
 | 
			
		||||
    } // end if
 | 
			
		||||
 | 
			
		||||
@ -370,7 +370,7 @@ public class RootConfig implements LinkTypes, ColorSelectors
 | 
			
		||||
 | 
			
		||||
    // Get the default font face name.
 | 
			
		||||
    font_face = loader.configGetSubElementText(sect_h,"font");
 | 
			
		||||
    base_font = "<BASEFONT FACE=\"" + font_face + "\" SIZE=" + bf_size.intValue() + ">";
 | 
			
		||||
    base_font = "<basefont face=\"" + font_face + "\" size=\"" + bf_size.intValue() + "\" />";
 | 
			
		||||
 | 
			
		||||
    // Load the stock font sizes.
 | 
			
		||||
    sect1 = sect_h.getSubElement("font-sizes");
 | 
			
		||||
@ -406,11 +406,11 @@ public class RootConfig implements LinkTypes, ColorSelectors
 | 
			
		||||
 | 
			
		||||
    // Set up the content header array.
 | 
			
		||||
    content_hdr = new String[5];
 | 
			
		||||
    content_hdr[0] = "<SPAN CLASS=\"chead1\">" + getFontTag(CONTENT_HEADER,"header") + "<B>";
 | 
			
		||||
    content_hdr[1] = "</B></FONT></SPAN>";
 | 
			
		||||
    content_hdr[2] = "  <SPAN CLASS=\"chead2\">" + getFontTag(CONTENT_HEADER,"subhead") + "<B>";
 | 
			
		||||
    content_hdr[3] = "</B></FONT></SPAN>";
 | 
			
		||||
    content_hdr[4] = "<HR ALIGN=LEFT SIZE=2 WIDTH=\"90%\" NOSHADE>\n";
 | 
			
		||||
    content_hdr[0] = "<span class=\"chead1\">" + getFontTag(CONTENT_HEADER,"header") + "<b>";
 | 
			
		||||
    content_hdr[1] = "</b></font></span>";
 | 
			
		||||
    content_hdr[2] = "  <span class=\"chead2\">" + getFontTag(CONTENT_HEADER,"subhead") + "<b>";
 | 
			
		||||
    content_hdr[3] = "</b></font></span>";
 | 
			
		||||
    content_hdr[4] = "<hr align=\"left\" size=\"2\" width=\"90%\" noshade=\"noshade\" />\n";
 | 
			
		||||
 | 
			
		||||
    // Get the "HTML Comments" flag.
 | 
			
		||||
    html_comments = sect_h.hasChildElement("html-comments");
 | 
			
		||||
@ -652,16 +652,16 @@ public class RootConfig implements LinkTypes, ColorSelectors
 | 
			
		||||
 | 
			
		||||
  public final String getFontTag(int colorsel, int size)
 | 
			
		||||
  {
 | 
			
		||||
    return "<FONT FACE=\"" + font_face + "\" COLOR=\"" + colors.getColor(colorsel) + "\" SIZE=" + size + ">";
 | 
			
		||||
    return "<font face=\"" + font_face + "\" color=\"" + colors.getColor(colorsel) + "\" size=\"" + size + "\">";
 | 
			
		||||
 | 
			
		||||
  } // end getFontTag
 | 
			
		||||
 | 
			
		||||
  public final String getFontTag(String color, int size)
 | 
			
		||||
  {
 | 
			
		||||
    StringBuffer rc = new StringBuffer("<FONT FACE=\"");
 | 
			
		||||
    rc.append(font_face).append("\" SIZE=").append(size);
 | 
			
		||||
    StringBuffer rc = new StringBuffer("<font face=\"");
 | 
			
		||||
    rc.append(font_face).append("\" size=\"").append(size).append("\"");
 | 
			
		||||
    if (color!=null)
 | 
			
		||||
      rc.append(" COLOR=\"").append(colors.getColor(color)).append("\"");
 | 
			
		||||
      rc.append(" color=\"").append(colors.getColor(color)).append("\"");
 | 
			
		||||
    rc.append('>');
 | 
			
		||||
    return rc.toString();
 | 
			
		||||
 | 
			
		||||
@ -669,10 +669,10 @@ public class RootConfig implements LinkTypes, ColorSelectors
 | 
			
		||||
 | 
			
		||||
  public final String getFontTag(int colorsel, String size)
 | 
			
		||||
  {
 | 
			
		||||
    StringBuffer rc = new StringBuffer("<FONT FACE=\"");
 | 
			
		||||
    rc.append(font_face).append("\" COLOR=\"").append(colors.getColor(colorsel)).append('\"');
 | 
			
		||||
    StringBuffer rc = new StringBuffer("<font face=\"");
 | 
			
		||||
    rc.append(font_face).append("\" color=\"").append(colors.getColor(colorsel)).append('\"');
 | 
			
		||||
    if (size!=null)
 | 
			
		||||
      rc.append(" SIZE=\"").append(mapFontSize(size)).append('\"');
 | 
			
		||||
      rc.append(" size=\"").append(mapFontSize(size)).append('\"');
 | 
			
		||||
    rc.append('>');
 | 
			
		||||
    return rc.toString();
 | 
			
		||||
 | 
			
		||||
@ -680,12 +680,12 @@ public class RootConfig implements LinkTypes, ColorSelectors
 | 
			
		||||
 | 
			
		||||
  public final String getFontTag(String color, String size)
 | 
			
		||||
  {
 | 
			
		||||
    StringBuffer rc = new StringBuffer("<FONT FACE=\"");
 | 
			
		||||
    StringBuffer rc = new StringBuffer("<font face=\"");
 | 
			
		||||
    rc.append(font_face).append("\"");
 | 
			
		||||
    if (color!=null)
 | 
			
		||||
      rc.append(" COLOR=\"").append(colors.getColor(color)).append("\"");
 | 
			
		||||
      rc.append(" color=\"").append(colors.getColor(color)).append("\"");
 | 
			
		||||
    if (size!=null)
 | 
			
		||||
      rc.append(" SIZE=\"").append(mapFontSize(size)).append('\"');
 | 
			
		||||
      rc.append(" size=\"").append(mapFontSize(size)).append('\"');
 | 
			
		||||
    rc.append('>');
 | 
			
		||||
    return rc.toString();
 | 
			
		||||
 | 
			
		||||
@ -858,6 +858,7 @@ public class RootConfig implements LinkTypes, ColorSelectors
 | 
			
		||||
    m.put("absolute",new Integer(ABSOLUTE));
 | 
			
		||||
    m.put("servlet",new Integer(SERVLET));
 | 
			
		||||
    m.put("frame",new Integer(FRAME));
 | 
			
		||||
    m.put("fullservlet",new Integer(FULLSERVLET));
 | 
			
		||||
    link_types = Collections.unmodifiableMap(m);
 | 
			
		||||
 | 
			
		||||
  } // end static initializer
 | 
			
		||||
 | 
			
		||||
@ -8,9 +8,9 @@
 | 
			
		||||
#  
 | 
			
		||||
# The Original Code is the Venice Web Communities System.
 | 
			
		||||
# 
 | 
			
		||||
# The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
 | 
			
		||||
# The Initial Developer of the Original Code is Eric J. Bowersox <erbo@ricochet.com>,
 | 
			
		||||
# for Silverwrist Design Studios.  Portions created by Eric J. Bowersox are
 | 
			
		||||
# Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios.  All Rights Reserved.
 | 
			
		||||
# Copyright (C) 2001-2004 Eric J. Bowersox/Silverwrist Design Studios.  All Rights Reserved.
 | 
			
		||||
# 
 | 
			
		||||
# Contributor(s): 
 | 
			
		||||
# -------------------------------------------------------------------------------------
 | 
			
		||||
@ -18,3 +18,4 @@
 | 
			
		||||
session.init=session_init.js
 | 
			
		||||
login.cookie=VeniceAuth
 | 
			
		||||
login.cookie.age=31536000
 | 
			
		||||
# no default for top.refresh
 | 
			
		||||
 | 
			
		||||
@ -50,12 +50,27 @@ public class RequestImpl implements RequestInput
 | 
			
		||||
 | 
			
		||||
  class OutputImpl implements RequestOutput
 | 
			
		||||
  {
 | 
			
		||||
    /*====================================================================
 | 
			
		||||
     * Attributes
 | 
			
		||||
     *====================================================================
 | 
			
		||||
     */
 | 
			
		||||
 | 
			
		||||
    private Writer wr = null;
 | 
			
		||||
 | 
			
		||||
    /*====================================================================
 | 
			
		||||
     * Constructor
 | 
			
		||||
     *====================================================================
 | 
			
		||||
     */
 | 
			
		||||
 | 
			
		||||
    OutputImpl()
 | 
			
		||||
    { // do nothing
 | 
			
		||||
    } // end constructor
 | 
			
		||||
 | 
			
		||||
    /*====================================================================
 | 
			
		||||
     * Implementations from interface ServiceProvider
 | 
			
		||||
     *====================================================================
 | 
			
		||||
     */
 | 
			
		||||
 | 
			
		||||
    public Object queryService(Class klass)
 | 
			
		||||
    {
 | 
			
		||||
      if (klass==HTMLRendering.class)
 | 
			
		||||
@ -70,6 +85,11 @@ public class RequestImpl implements RequestInput
 | 
			
		||||
 | 
			
		||||
    } // end queryService
 | 
			
		||||
 | 
			
		||||
    /*====================================================================
 | 
			
		||||
     * Implementations from interface RequestOutput
 | 
			
		||||
     *====================================================================
 | 
			
		||||
     */
 | 
			
		||||
 | 
			
		||||
    public Writer getWriter() throws IOException
 | 
			
		||||
    {
 | 
			
		||||
      if (wr==null)
 | 
			
		||||
@ -237,17 +257,51 @@ public class RequestImpl implements RequestInput
 | 
			
		||||
    {
 | 
			
		||||
      HTMLRendering html = (HTMLRendering)(RequestImpl.this.queryService(HTMLRendering.class));
 | 
			
		||||
 | 
			
		||||
      out.write("<HEAD>\n<TITLE>" + config.getPageTitle(c.getPageTitle(this)) + "</TITLE>\n"
 | 
			
		||||
      out.write("<head>\n<title>" + config.getPageTitle(c.getPageTitle(this)) + "</title>\n"
 | 
			
		||||
		+ config.getBaseFontTag() + "\n");
 | 
			
		||||
      if (config.usingStyleSheet())
 | 
			
		||||
	out.write("<LINK REL=\"stylesheet\" HREF=\"" + html.formatURL("stylesheet",html.SERVLET)
 | 
			
		||||
		  + "\" TYPE=\"text/css\">\n");
 | 
			
		||||
	out.write("<link rel=\"stylesheet\" href=\"" + html.formatURL("stylesheet",html.SERVLET)
 | 
			
		||||
		  + "\" type=\"text/css\" />\n");
 | 
			
		||||
      String tmp = config.getPageIconTags();
 | 
			
		||||
      if (tmp!=null)
 | 
			
		||||
	out.write(tmp);
 | 
			
		||||
      if (!(config.useSmartTags()))
 | 
			
		||||
	out.write("<META NAME=\"MSSmartTagsPreventParsing\" CONTENT=\"TRUE\">\n");
 | 
			
		||||
      out.write("</HEAD>\n");
 | 
			
		||||
	out.write("<meta name=\"MSSmartTagsPreventParsing\" content=\"TRUE\" />\n");
 | 
			
		||||
      if (c instanceof ContentMetadata)
 | 
			
		||||
      { // look for additional metadata on the content
 | 
			
		||||
	ContentMetadata cm = (ContentMetadata)c;
 | 
			
		||||
	Map meta = cm.getMetadata();
 | 
			
		||||
	if (meta==null)
 | 
			
		||||
	  meta = Collections.EMPTY_MAP;
 | 
			
		||||
	Iterator it;
 | 
			
		||||
	for (it=meta.entrySet().iterator(); it.hasNext(); )
 | 
			
		||||
	{ // write the metadata
 | 
			
		||||
	  Map.Entry ntry = (Map.Entry)(it.next());
 | 
			
		||||
	  out.write("<meta name=\"");
 | 
			
		||||
	  out.write(ntry.getKey().toString());
 | 
			
		||||
	  out.write("\" content=\"");
 | 
			
		||||
	  out.write(ntry.getValue().toString());
 | 
			
		||||
	  out.write("\" />\n");
 | 
			
		||||
 | 
			
		||||
	} // end for
 | 
			
		||||
 | 
			
		||||
	meta = cm.getHTTPMetadata();
 | 
			
		||||
	if (meta==null)
 | 
			
		||||
	  meta = Collections.EMPTY_MAP;
 | 
			
		||||
	for (it=meta.entrySet().iterator(); it.hasNext(); )
 | 
			
		||||
	{ // write the metadata
 | 
			
		||||
	  Map.Entry ntry = (Map.Entry)(it.next());
 | 
			
		||||
	  out.write("<meta http-equiv=\"");
 | 
			
		||||
	  out.write(ntry.getKey().toString());
 | 
			
		||||
	  out.write("\" content=\"");
 | 
			
		||||
	  out.write(ntry.getValue().toString());
 | 
			
		||||
	  out.write("\" />\n");
 | 
			
		||||
 | 
			
		||||
	} // end for
 | 
			
		||||
 | 
			
		||||
      } // end if
 | 
			
		||||
 | 
			
		||||
      out.write("</head>\n");
 | 
			
		||||
 | 
			
		||||
    } // end writeFrameHead
 | 
			
		||||
    
 | 
			
		||||
@ -265,10 +319,10 @@ public class RequestImpl implements RequestInput
 | 
			
		||||
 | 
			
		||||
      String href = config.getSiteLogoLink();
 | 
			
		||||
      if (href!=null)
 | 
			
		||||
	out.write("<A HREF=\"" + html.formatURL(href,config.getSiteLogoLinkType()) + "\">");
 | 
			
		||||
	out.write("<a href=\"" + html.formatURL(href,config.getSiteLogoLinkType()) + "\">");
 | 
			
		||||
      out.write(config.getSiteLogoImageTag());
 | 
			
		||||
      if (href!=null)
 | 
			
		||||
	out.write("</A>");
 | 
			
		||||
	out.write("</a>");
 | 
			
		||||
 | 
			
		||||
    } // end writeSiteImageTag
 | 
			
		||||
 | 
			
		||||
@ -317,10 +371,20 @@ public class RequestImpl implements RequestInput
 | 
			
		||||
 | 
			
		||||
  class ExecImpl implements RequestExec
 | 
			
		||||
  {
 | 
			
		||||
    /*====================================================================
 | 
			
		||||
     * Constructor
 | 
			
		||||
     *====================================================================
 | 
			
		||||
     */
 | 
			
		||||
 | 
			
		||||
    ExecImpl()
 | 
			
		||||
    { // do nothing
 | 
			
		||||
    } // end constructor
 | 
			
		||||
 | 
			
		||||
    /*====================================================================
 | 
			
		||||
     * Implementations from interface RequestExec
 | 
			
		||||
     *====================================================================
 | 
			
		||||
     */
 | 
			
		||||
 | 
			
		||||
    public void error(int code) throws IOException
 | 
			
		||||
    {
 | 
			
		||||
      flushCookies();
 | 
			
		||||
@ -454,7 +518,7 @@ public class RequestImpl implements RequestInput
 | 
			
		||||
   */
 | 
			
		||||
 | 
			
		||||
  private static Logger logger = Logger.getLogger(RequestImpl.class);
 | 
			
		||||
  private static int serial_gen = 1;
 | 
			
		||||
  private static int s_serial_gen = 1;
 | 
			
		||||
 | 
			
		||||
  private static final String APP_ATTRIBUTE_STEM = "com.silverwrist.venice.ui.variables.";
 | 
			
		||||
 | 
			
		||||
@ -468,7 +532,7 @@ public class RequestImpl implements RequestInput
 | 
			
		||||
   *--------------------------------------------------------------------------------
 | 
			
		||||
   */
 | 
			
		||||
 | 
			
		||||
  private int serial;                                    // serial number of this request
 | 
			
		||||
  private int m_serial;                                  // serial number of this request
 | 
			
		||||
  private ServletContext ctxt;                           // the servlet context
 | 
			
		||||
  private HttpServletRequest request;                    // the servlet request data
 | 
			
		||||
  private HttpServletResponse response;                  // the servlet response data
 | 
			
		||||
@ -508,7 +572,7 @@ public class RequestImpl implements RequestInput
 | 
			
		||||
 | 
			
		||||
    synchronized (RequestImpl.class)
 | 
			
		||||
    { // add serial number
 | 
			
		||||
      this.serial = serial_gen++;
 | 
			
		||||
      m_serial = s_serial_gen++;
 | 
			
		||||
 | 
			
		||||
    } // end synchronized block
 | 
			
		||||
 | 
			
		||||
@ -751,14 +815,18 @@ public class RequestImpl implements RequestInput
 | 
			
		||||
   * "http://venice.example.org/venice/foobar".
 | 
			
		||||
   *
 | 
			
		||||
   * @param spath Servlet path to be expanded.
 | 
			
		||||
   * @param encode <code>true</code> to encode the servlet path first, <code>false</code> to not do so.
 | 
			
		||||
   * @return The fully-expanded servlet path.
 | 
			
		||||
   */
 | 
			
		||||
  final String expandServletPath(String spath)
 | 
			
		||||
  final String expandServletPath(String spath, boolean encode)
 | 
			
		||||
  {
 | 
			
		||||
    StringBuffer buf = new StringBuffer("http://");
 | 
			
		||||
    buf.append(request.getServerName());
 | 
			
		||||
    if (request.getServerPort()!=80)
 | 
			
		||||
      buf.append(':').append(request.getServerPort());
 | 
			
		||||
    if (encode)
 | 
			
		||||
      buf.append(encodeServletPath(spath));
 | 
			
		||||
    else
 | 
			
		||||
      buf.append(request.getContextPath()).append('/').append(spath);
 | 
			
		||||
    return buf.toString();
 | 
			
		||||
 | 
			
		||||
@ -772,7 +840,7 @@ public class RequestImpl implements RequestInput
 | 
			
		||||
  public String toString()
 | 
			
		||||
  {
 | 
			
		||||
    StringBuffer buf = new StringBuffer("{RequestImpl #");
 | 
			
		||||
    buf.append(serial).append("from [").append(request.getRemoteAddr()).append("] for ");
 | 
			
		||||
    buf.append(m_serial).append("from [").append(request.getRemoteAddr()).append("] for ");
 | 
			
		||||
    buf.append(request.getServletPath()).append("}");
 | 
			
		||||
    return buf.toString();
 | 
			
		||||
 | 
			
		||||
@ -2000,6 +2068,8 @@ class HTMLRenderingImpl implements HTMLRendering
 | 
			
		||||
      return req.encodeServletPath(url);
 | 
			
		||||
    else if (type==FRAME)
 | 
			
		||||
      return req.encodeServletPath("frame/" + url);
 | 
			
		||||
    else if (type==FULLSERVLET)
 | 
			
		||||
      return req.expandServletPath(url,true);
 | 
			
		||||
    else
 | 
			
		||||
      throw new IndexOutOfBoundsException("invalid format type index for formatURL");
 | 
			
		||||
 | 
			
		||||
@ -2102,13 +2172,13 @@ class HTMLRenderingImpl implements HTMLRendering
 | 
			
		||||
 | 
			
		||||
  public String getUserPhotoTag(String url, Dimension size)
 | 
			
		||||
  {
 | 
			
		||||
    StringBuffer buf = new StringBuffer("<IMG SRC=\"");
 | 
			
		||||
    StringBuffer buf = new StringBuffer("<img src=\"");
 | 
			
		||||
    if (StringUtil.isStringEmpty(url))
 | 
			
		||||
      buf.append(config.getBlankPhoto());
 | 
			
		||||
    else
 | 
			
		||||
      buf.append(url);
 | 
			
		||||
    buf.append("\" ALT=\"\" ALIGN=LEFT BORDER=0 WIDTH=").append(size.width).append(" HEIGHT=");
 | 
			
		||||
    buf.append(size.height).append(">");
 | 
			
		||||
    buf.append("\" alt=\"\" align=\"left\" border=\"0\" width=\"").append(size.width).append("\" height=\"");
 | 
			
		||||
    buf.append(size.height).append("\" />");
 | 
			
		||||
    return buf.toString();
 | 
			
		||||
 | 
			
		||||
  } // end getUserPhotoTag
 | 
			
		||||
@ -2160,21 +2230,21 @@ class HTMLRenderingImpl implements HTMLRendering
 | 
			
		||||
 | 
			
		||||
  public String getCommunityLogoTag(String url)
 | 
			
		||||
  {
 | 
			
		||||
    StringBuffer buf = new StringBuffer("<IMG SRC=\"");
 | 
			
		||||
    StringBuffer buf = new StringBuffer("<img src=\"");
 | 
			
		||||
    if (StringUtil.isStringEmpty(url))
 | 
			
		||||
      buf.append(this.getImagePath("sig_other.jpg"));
 | 
			
		||||
    else
 | 
			
		||||
      buf.append(url);
 | 
			
		||||
    Dimension sz = req.getEngine().getCommunityLogoSize();
 | 
			
		||||
    buf.append("\" ALT=\"\" BORDER=0 WIDTH=").append(sz.width).append(" HEIGHT=").append(sz.height);
 | 
			
		||||
    buf.append(">");
 | 
			
		||||
    buf.append("\" alt=\"\" border=\"0\" width=\"").append(sz.width).append("\" height=\"").append(sz.height);
 | 
			
		||||
    buf.append("\" />");
 | 
			
		||||
    return buf.toString();
 | 
			
		||||
 | 
			
		||||
  } // end getCommunityLogoTag
 | 
			
		||||
 | 
			
		||||
  public String expandServletPath(String spath)
 | 
			
		||||
  {
 | 
			
		||||
    return req.expandServletPath(spath);
 | 
			
		||||
    return req.expandServletPath(spath,false);
 | 
			
		||||
 | 
			
		||||
  } // end expandServletPath
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -9,35 +9,36 @@
 | 
			
		||||
 * 
 | 
			
		||||
 * The Original Code is the Venice Web Communities System.
 | 
			
		||||
 * 
 | 
			
		||||
 * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
 | 
			
		||||
 * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@ricochet.com>,
 | 
			
		||||
 * for Silverwrist Design Studios.  Portions created by Eric J. Bowersox are
 | 
			
		||||
 * Copyright (C) 2001-02 Eric J. Bowersox/Silverwrist Design Studios.  All Rights Reserved.
 | 
			
		||||
 * Copyright (C) 2001-2004 Eric J. Bowersox/Silverwrist Design Studios.  All Rights Reserved.
 | 
			
		||||
 * 
 | 
			
		||||
 * Contributor(s): 
 | 
			
		||||
 */
 | 
			
		||||
package com.silverwrist.venice.ui.view;
 | 
			
		||||
 | 
			
		||||
import java.util.Date;
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.*;
 | 
			
		||||
import javax.servlet.*;
 | 
			
		||||
import com.silverwrist.venice.core.CommunityContext;
 | 
			
		||||
import com.silverwrist.venice.ui.*;
 | 
			
		||||
import com.silverwrist.venice.ui.helpers.HTMLRendering;
 | 
			
		||||
import com.silverwrist.venice.ui.servlet.RequestImpl;
 | 
			
		||||
 | 
			
		||||
public class JSPView implements ContentJSP
 | 
			
		||||
public class JSPView implements ContentJSP, ContentMetadata
 | 
			
		||||
{
 | 
			
		||||
  /*--------------------------------------------------------------------------------
 | 
			
		||||
   * Attributes
 | 
			
		||||
   *--------------------------------------------------------------------------------
 | 
			
		||||
   */
 | 
			
		||||
 | 
			
		||||
  private int menu_sel = MENU_SELECTOR_NOCHANGE;
 | 
			
		||||
  private String title;
 | 
			
		||||
  private String qid = null;
 | 
			
		||||
  private String jsp_name;
 | 
			
		||||
  private RequestInput rinput = null;
 | 
			
		||||
  private HTMLRendering html = null;
 | 
			
		||||
  private int m_menu_sel = MENU_SELECTOR_NOCHANGE;   // menu selector output by this code
 | 
			
		||||
  private String m_title;                            // page title
 | 
			
		||||
  private String m_qid = null;                       // page Quick ID
 | 
			
		||||
  private String m_jsp_name;                         // name of JSP page to forward to
 | 
			
		||||
  private RequestInput m_rinput = null;              // input request used by inner code
 | 
			
		||||
  private HTMLRendering m_html = null;               // HTML rendering helper
 | 
			
		||||
  private HashMap m_metadata = null;                 // collection of metadata to output
 | 
			
		||||
  private HashMap m_http_metadata = null;            // collection of HTTP metadata to output
 | 
			
		||||
 | 
			
		||||
  /*--------------------------------------------------------------------------------
 | 
			
		||||
   * Constructor
 | 
			
		||||
@ -46,8 +47,8 @@ public class JSPView implements ContentJSP
 | 
			
		||||
 | 
			
		||||
  public JSPView(String title, String jsp_name)
 | 
			
		||||
  {
 | 
			
		||||
    this.title = title;
 | 
			
		||||
    this.jsp_name = jsp_name;
 | 
			
		||||
    m_title = title;
 | 
			
		||||
    m_jsp_name = jsp_name;
 | 
			
		||||
 | 
			
		||||
  } // end constructor
 | 
			
		||||
 | 
			
		||||
@ -64,19 +65,19 @@ public class JSPView implements ContentJSP
 | 
			
		||||
 | 
			
		||||
  public int getMenuSelector()
 | 
			
		||||
  {
 | 
			
		||||
    return menu_sel;
 | 
			
		||||
    return m_menu_sel;
 | 
			
		||||
 | 
			
		||||
  } // end getMenuSelector
 | 
			
		||||
 | 
			
		||||
  public String getPageTitle(RequestOutput ro)
 | 
			
		||||
  {
 | 
			
		||||
    return title;
 | 
			
		||||
    return m_title;
 | 
			
		||||
 | 
			
		||||
  } // end getPageTitle
 | 
			
		||||
 | 
			
		||||
  public String getPageQID()
 | 
			
		||||
  {
 | 
			
		||||
    return qid;
 | 
			
		||||
    return m_qid;
 | 
			
		||||
 | 
			
		||||
  } // end getPageQID
 | 
			
		||||
 | 
			
		||||
@ -87,24 +88,47 @@ public class JSPView implements ContentJSP
 | 
			
		||||
 | 
			
		||||
  public String getJSPName()
 | 
			
		||||
  {
 | 
			
		||||
    return jsp_name;
 | 
			
		||||
    return m_jsp_name;
 | 
			
		||||
 | 
			
		||||
  } // end getJSPName
 | 
			
		||||
 | 
			
		||||
  public void initialize(RequestInput req)
 | 
			
		||||
  {
 | 
			
		||||
    rinput = req;
 | 
			
		||||
    html = (HTMLRendering)(req.queryService(HTMLRendering.class));
 | 
			
		||||
    m_rinput = req;
 | 
			
		||||
    m_html = (HTMLRendering)(req.queryService(HTMLRendering.class));
 | 
			
		||||
 | 
			
		||||
  } // end initialize
 | 
			
		||||
 | 
			
		||||
  public void terminate(RequestInput req)
 | 
			
		||||
  {
 | 
			
		||||
    rinput = null;
 | 
			
		||||
    html = null;
 | 
			
		||||
    m_rinput = null;
 | 
			
		||||
    m_html = null;
 | 
			
		||||
 | 
			
		||||
  } // end terminate
 | 
			
		||||
 | 
			
		||||
  /*--------------------------------------------------------------------------------
 | 
			
		||||
   * Implementations from interface ContentMetadata
 | 
			
		||||
   *--------------------------------------------------------------------------------
 | 
			
		||||
   */
 | 
			
		||||
 | 
			
		||||
  public Map getMetadata()
 | 
			
		||||
  {
 | 
			
		||||
    if (m_metadata==null)
 | 
			
		||||
      return Collections.EMPTY_MAP;
 | 
			
		||||
    else
 | 
			
		||||
      return Collections.unmodifiableMap(m_metadata);
 | 
			
		||||
 | 
			
		||||
  } // end getMetadata
 | 
			
		||||
 | 
			
		||||
  public Map getHTTPMetadata()
 | 
			
		||||
  {
 | 
			
		||||
    if (m_http_metadata==null)
 | 
			
		||||
      return Collections.EMPTY_MAP;
 | 
			
		||||
    else
 | 
			
		||||
      return Collections.unmodifiableMap(m_http_metadata);
 | 
			
		||||
 | 
			
		||||
  } // end getHTTPMetadata
 | 
			
		||||
 | 
			
		||||
  /*--------------------------------------------------------------------------------
 | 
			
		||||
   * External operations
 | 
			
		||||
   *--------------------------------------------------------------------------------
 | 
			
		||||
@ -112,39 +136,59 @@ public class JSPView implements ContentJSP
 | 
			
		||||
 | 
			
		||||
  public final void setMenuSelector(int sel)
 | 
			
		||||
  {
 | 
			
		||||
    if (rinput==null)
 | 
			
		||||
      menu_sel = sel;
 | 
			
		||||
    if (m_rinput==null)
 | 
			
		||||
      m_menu_sel = sel;
 | 
			
		||||
 | 
			
		||||
  } // end setMenuSelector
 | 
			
		||||
 | 
			
		||||
  public final void setPageQID(String s)
 | 
			
		||||
  {
 | 
			
		||||
    if (rinput==null)
 | 
			
		||||
      qid = s;
 | 
			
		||||
    if (m_rinput==null)
 | 
			
		||||
      m_qid = s;
 | 
			
		||||
 | 
			
		||||
  } // end setPageQID
 | 
			
		||||
 | 
			
		||||
  public final void addMetadata(String name, String value)
 | 
			
		||||
  {
 | 
			
		||||
    if (m_rinput!=null)
 | 
			
		||||
      return;
 | 
			
		||||
    if (m_metadata==null)
 | 
			
		||||
      m_metadata = new HashMap();
 | 
			
		||||
    m_metadata.put(name,value);
 | 
			
		||||
 | 
			
		||||
  } // end addMetadata
 | 
			
		||||
 | 
			
		||||
  public final void addHTTPMetadata(String name, String value)
 | 
			
		||||
  {
 | 
			
		||||
    if (m_rinput!=null)
 | 
			
		||||
      return;
 | 
			
		||||
    if (m_http_metadata==null)
 | 
			
		||||
      m_http_metadata = new HashMap();
 | 
			
		||||
    m_http_metadata.put(name,value);
 | 
			
		||||
 | 
			
		||||
  } // end addHTTPMetadata
 | 
			
		||||
 | 
			
		||||
  public final Object getRequestAttribute(String s)
 | 
			
		||||
  {
 | 
			
		||||
    return ((rinput==null) ? null : rinput.getRequestAttribute(s));
 | 
			
		||||
    return ((m_rinput==null) ? null : m_rinput.getRequestAttribute(s));
 | 
			
		||||
 | 
			
		||||
  } // end getRequestAttribute
 | 
			
		||||
 | 
			
		||||
  public final String formatDate(Date date)
 | 
			
		||||
  {
 | 
			
		||||
    return ((html==null) ? null : html.formatDate(date));
 | 
			
		||||
    return ((m_html==null) ? null : m_html.formatDate(date));
 | 
			
		||||
 | 
			
		||||
  } // end formatDate
 | 
			
		||||
 | 
			
		||||
  public final CommunityContext getCommunity()
 | 
			
		||||
  {
 | 
			
		||||
    return ((rinput==null) ? null : rinput.getCommunity());
 | 
			
		||||
    return ((m_rinput==null) ? null : m_rinput.getCommunity());
 | 
			
		||||
 | 
			
		||||
  } // end getCommunity
 | 
			
		||||
 | 
			
		||||
  public final String getActivityString(Date date)
 | 
			
		||||
  {
 | 
			
		||||
    return ((html==null) ? null : html.getActivityString(date));
 | 
			
		||||
    return ((m_html==null) ? null : m_html.getActivityString(date));
 | 
			
		||||
 | 
			
		||||
  } // end getActivityString
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -9,32 +9,32 @@
 | 
			
		||||
 * 
 | 
			
		||||
 * The Original Code is the Venice Web Communities System.
 | 
			
		||||
 * 
 | 
			
		||||
 * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
 | 
			
		||||
 * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@ricochet.com>,
 | 
			
		||||
 * for Silverwrist Design Studios.  Portions created by Eric J. Bowersox are
 | 
			
		||||
 * Copyright (C) 2002 Eric J. Bowersox/Silverwrist Design Studios.  All Rights Reserved.
 | 
			
		||||
 * Copyright (C) 2002-2004 Eric J. Bowersox/Silverwrist Design Studios.  All Rights Reserved.
 | 
			
		||||
 * 
 | 
			
		||||
 * Contributor(s): 
 | 
			
		||||
 */
 | 
			
		||||
package com.silverwrist.venice.ui.view;
 | 
			
		||||
 | 
			
		||||
import java.util.Date;
 | 
			
		||||
import java.util.*;
 | 
			
		||||
import javax.servlet.*;
 | 
			
		||||
import com.silverwrist.venice.core.CommunityContext;
 | 
			
		||||
import com.silverwrist.venice.ui.*;
 | 
			
		||||
import com.silverwrist.venice.ui.helpers.HTMLRendering;
 | 
			
		||||
import com.silverwrist.venice.ui.servlet.RequestImpl;
 | 
			
		||||
 | 
			
		||||
public class NestedJSPView implements ContentJSP
 | 
			
		||||
public class NestedJSPView implements ContentJSP, ContentMetadata
 | 
			
		||||
{
 | 
			
		||||
  /*--------------------------------------------------------------------------------
 | 
			
		||||
   * Attributes
 | 
			
		||||
   *--------------------------------------------------------------------------------
 | 
			
		||||
   */
 | 
			
		||||
 | 
			
		||||
  private Content outer;
 | 
			
		||||
  private String jspname;
 | 
			
		||||
  private RequestInput rinput = null;
 | 
			
		||||
  private HTMLRendering html = null;
 | 
			
		||||
  private Content m_outer;               // outer content being rendered
 | 
			
		||||
  private String m_jspname;              // JSP template to be rendered
 | 
			
		||||
  private RequestInput m_rinput = null;  // RequestInput object for use by internal code
 | 
			
		||||
  private HTMLRendering m_html = null;   // HTML rendering helper
 | 
			
		||||
 | 
			
		||||
  /*--------------------------------------------------------------------------------
 | 
			
		||||
   * Constructor
 | 
			
		||||
@ -43,8 +43,8 @@ public class NestedJSPView implements ContentJSP
 | 
			
		||||
 | 
			
		||||
  public NestedJSPView(Content outer, String jspname)
 | 
			
		||||
  {
 | 
			
		||||
    this.outer = outer;
 | 
			
		||||
    this.jspname = jspname;
 | 
			
		||||
    m_outer = outer;
 | 
			
		||||
    m_jspname = jspname;
 | 
			
		||||
 | 
			
		||||
  } // end constructor
 | 
			
		||||
 | 
			
		||||
@ -55,25 +55,25 @@ public class NestedJSPView implements ContentJSP
 | 
			
		||||
 | 
			
		||||
  public boolean needFrame()
 | 
			
		||||
  {
 | 
			
		||||
    return outer.needFrame();
 | 
			
		||||
    return m_outer.needFrame();
 | 
			
		||||
 | 
			
		||||
  } // end needFrame
 | 
			
		||||
 | 
			
		||||
  public int getMenuSelector()
 | 
			
		||||
  {
 | 
			
		||||
    return outer.getMenuSelector();
 | 
			
		||||
    return m_outer.getMenuSelector();
 | 
			
		||||
 | 
			
		||||
  } // end getMenuSelector
 | 
			
		||||
 | 
			
		||||
  public String getPageTitle(RequestOutput ro)
 | 
			
		||||
  {
 | 
			
		||||
    return outer.getPageTitle(ro);
 | 
			
		||||
    return m_outer.getPageTitle(ro);
 | 
			
		||||
 | 
			
		||||
  } // end getPageTitle
 | 
			
		||||
 | 
			
		||||
  public String getPageQID()
 | 
			
		||||
  {
 | 
			
		||||
    return outer.getPageQID();
 | 
			
		||||
    return m_outer.getPageQID();
 | 
			
		||||
 | 
			
		||||
  } // end getPageQID
 | 
			
		||||
 | 
			
		||||
@ -84,24 +84,47 @@ public class NestedJSPView implements ContentJSP
 | 
			
		||||
 | 
			
		||||
  public String getJSPName()
 | 
			
		||||
  {
 | 
			
		||||
    return jspname;
 | 
			
		||||
    return m_jspname;
 | 
			
		||||
 | 
			
		||||
  } // end getJSPName
 | 
			
		||||
 | 
			
		||||
  public void initialize(RequestInput req)
 | 
			
		||||
  {
 | 
			
		||||
    rinput = req;
 | 
			
		||||
    html = (HTMLRendering)(req.queryService(HTMLRendering.class));
 | 
			
		||||
    m_rinput = req;
 | 
			
		||||
    m_html = (HTMLRendering)(req.queryService(HTMLRendering.class));
 | 
			
		||||
 | 
			
		||||
  } // end initialize
 | 
			
		||||
 | 
			
		||||
  public void terminate(RequestInput req)
 | 
			
		||||
  {
 | 
			
		||||
    rinput = null;
 | 
			
		||||
    html = null;
 | 
			
		||||
    m_rinput = null;
 | 
			
		||||
    m_html = null;
 | 
			
		||||
 | 
			
		||||
  } // end terminate
 | 
			
		||||
 | 
			
		||||
  /*--------------------------------------------------------------------------------
 | 
			
		||||
   * Implementations from interface ContentMetadata
 | 
			
		||||
   *--------------------------------------------------------------------------------
 | 
			
		||||
   */
 | 
			
		||||
 | 
			
		||||
  public Map getMetadata()
 | 
			
		||||
  {
 | 
			
		||||
    if (m_outer instanceof ContentMetadata)
 | 
			
		||||
      return ((ContentMetadata)m_outer).getMetadata();
 | 
			
		||||
    else
 | 
			
		||||
      return Collections.EMPTY_MAP;
 | 
			
		||||
 | 
			
		||||
  } // end getMetadata
 | 
			
		||||
 | 
			
		||||
  public Map getHTTPMetadata()
 | 
			
		||||
  {
 | 
			
		||||
    if (m_outer instanceof ContentMetadata)
 | 
			
		||||
      return ((ContentMetadata)m_outer).getHTTPMetadata();
 | 
			
		||||
    else
 | 
			
		||||
      return Collections.EMPTY_MAP;
 | 
			
		||||
 | 
			
		||||
  } // end getHTTPMetadata
 | 
			
		||||
  
 | 
			
		||||
  /*--------------------------------------------------------------------------------
 | 
			
		||||
   * External operations
 | 
			
		||||
   *--------------------------------------------------------------------------------
 | 
			
		||||
@ -109,31 +132,31 @@ public class NestedJSPView implements ContentJSP
 | 
			
		||||
 | 
			
		||||
  public final Content getOuterView()
 | 
			
		||||
  {
 | 
			
		||||
    return outer;
 | 
			
		||||
    return m_outer;
 | 
			
		||||
 | 
			
		||||
  } // end getOuterView
 | 
			
		||||
 | 
			
		||||
  public final Object getRequestAttribute(String s)
 | 
			
		||||
  {
 | 
			
		||||
    return ((rinput==null) ? null : rinput.getRequestAttribute(s));
 | 
			
		||||
    return ((m_rinput==null) ? null : m_rinput.getRequestAttribute(s));
 | 
			
		||||
 | 
			
		||||
  } // end getRequestAttribute
 | 
			
		||||
 | 
			
		||||
  public final String formatDate(Date date)
 | 
			
		||||
  {
 | 
			
		||||
    return ((html==null) ? null : html.formatDate(date));
 | 
			
		||||
    return ((m_html==null) ? null : m_html.formatDate(date));
 | 
			
		||||
 | 
			
		||||
  } // end formatDate
 | 
			
		||||
 | 
			
		||||
  public final CommunityContext getCommunity()
 | 
			
		||||
  {
 | 
			
		||||
    return ((rinput==null) ? null : rinput.getCommunity());
 | 
			
		||||
    return ((m_rinput==null) ? null : m_rinput.getCommunity());
 | 
			
		||||
 | 
			
		||||
  } // end getCommunity
 | 
			
		||||
 | 
			
		||||
  public final String getActivityString(Date date)
 | 
			
		||||
  {
 | 
			
		||||
    return ((html==null) ? null : html.getActivityString(date));
 | 
			
		||||
    return ((m_html==null) ? null : m_html.getActivityString(date));
 | 
			
		||||
 | 
			
		||||
  } // end getActivityString
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -9,95 +9,119 @@
 | 
			
		||||
 * 
 | 
			
		||||
 * The Original Code is the Venice Web Communities System.
 | 
			
		||||
 * 
 | 
			
		||||
 * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
 | 
			
		||||
 * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@ricochet.com>,
 | 
			
		||||
 * for Silverwrist Design Studios.  Portions created by Eric J. Bowersox are
 | 
			
		||||
 * Copyright (C) 2001-02 Eric J. Bowersox/Silverwrist Design Studios.  All Rights Reserved.
 | 
			
		||||
 * Copyright (C) 2001-2004 Eric J. Bowersox/Silverwrist Design Studios.  All Rights Reserved.
 | 
			
		||||
 * 
 | 
			
		||||
 * Contributor(s): 
 | 
			
		||||
 */
 | 
			
		||||
package com.silverwrist.venice.ui.view;
 | 
			
		||||
 | 
			
		||||
import java.io.IOException;
 | 
			
		||||
import java.util.Collections;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
import javax.servlet.ServletException;
 | 
			
		||||
import com.silverwrist.venice.core.UserContext;
 | 
			
		||||
import com.silverwrist.venice.except.*;
 | 
			
		||||
import com.silverwrist.venice.ui.*;
 | 
			
		||||
import com.silverwrist.venice.ui.helpers.HTMLRendering;
 | 
			
		||||
 | 
			
		||||
public class SideBoxNestedView implements ContentDirect
 | 
			
		||||
public class SideBoxNestedView implements ContentDirect, ContentMetadata
 | 
			
		||||
{
 | 
			
		||||
  private Content inner;
 | 
			
		||||
  private Content[] sideboxes;
 | 
			
		||||
  private boolean do_configure;
 | 
			
		||||
  /*--------------------------------------------------------------------------------
 | 
			
		||||
   * Attributes
 | 
			
		||||
   *--------------------------------------------------------------------------------
 | 
			
		||||
   */
 | 
			
		||||
 | 
			
		||||
  private Content m_inner;         // the inner content object to be displayed
 | 
			
		||||
  private Content[] m_sideboxes;   // the sideboxes to be displayed
 | 
			
		||||
  private boolean m_configure;     // display the sidebox Configure button?
 | 
			
		||||
 | 
			
		||||
  /*--------------------------------------------------------------------------------
 | 
			
		||||
   * Constructor
 | 
			
		||||
   *--------------------------------------------------------------------------------
 | 
			
		||||
   */
 | 
			
		||||
 | 
			
		||||
  public SideBoxNestedView(RequestInput ri, Content inner) throws AccessError, DataException
 | 
			
		||||
  {
 | 
			
		||||
    this.inner = inner;
 | 
			
		||||
    this.sideboxes = ri.getSideBoxes();
 | 
			
		||||
    this.do_configure = ri.getUser().isLoggedIn();
 | 
			
		||||
    m_inner = inner;
 | 
			
		||||
    m_sideboxes = ri.getSideBoxes();
 | 
			
		||||
    m_configure = ri.getUser().isLoggedIn();
 | 
			
		||||
 | 
			
		||||
  } // end constructor
 | 
			
		||||
 | 
			
		||||
  /*--------------------------------------------------------------------------------
 | 
			
		||||
   * Implementations from interface Content
 | 
			
		||||
   *--------------------------------------------------------------------------------
 | 
			
		||||
   */
 | 
			
		||||
 | 
			
		||||
  public boolean needFrame()
 | 
			
		||||
  {
 | 
			
		||||
    return inner.needFrame();
 | 
			
		||||
    return m_inner.needFrame();
 | 
			
		||||
 | 
			
		||||
  } // end needFrame
 | 
			
		||||
 | 
			
		||||
  public int getMenuSelector()
 | 
			
		||||
  {
 | 
			
		||||
    return inner.getMenuSelector();
 | 
			
		||||
    return m_inner.getMenuSelector();
 | 
			
		||||
 | 
			
		||||
  } // end getMenuSelector
 | 
			
		||||
 | 
			
		||||
  public String getPageTitle(RequestOutput ro)
 | 
			
		||||
  {
 | 
			
		||||
    return inner.getPageTitle(ro);
 | 
			
		||||
    return m_inner.getPageTitle(ro);
 | 
			
		||||
 | 
			
		||||
  } // end getPageTitle
 | 
			
		||||
 | 
			
		||||
  public String getPageQID()
 | 
			
		||||
  {
 | 
			
		||||
    return inner.getPageQID();
 | 
			
		||||
    return m_inner.getPageQID();
 | 
			
		||||
 | 
			
		||||
  } // end getPageQID
 | 
			
		||||
 | 
			
		||||
  /*--------------------------------------------------------------------------------
 | 
			
		||||
   * Implementations from interface ContentDirect
 | 
			
		||||
   *--------------------------------------------------------------------------------
 | 
			
		||||
   */
 | 
			
		||||
 | 
			
		||||
  public void render(RequestOutput out) throws IOException
 | 
			
		||||
  {
 | 
			
		||||
    HTMLRendering html = (HTMLRendering)(out.queryService(HTMLRendering.class));
 | 
			
		||||
 | 
			
		||||
    try
 | 
			
		||||
    { // Write out the start of the content structure.
 | 
			
		||||
      out.write("<TABLE BORDER=0 ALIGN=CENTER WIDTH=\"100%\" CELLPADDING=4 CELLSPACING=0><TR VALIGN=TOP>\n"
 | 
			
		||||
		+ "<TD ALIGN=LEFT>\n");
 | 
			
		||||
      out.write("<table border=\"0\" align=\"center\" width=\"100%\" cellpadding=\"4\" cellspacing=\"0\">\n"
 | 
			
		||||
		+ "<tr valign=\"top\"><td align=\"left\">\n");
 | 
			
		||||
 | 
			
		||||
      // Write out the inner content.
 | 
			
		||||
      out.output(inner);
 | 
			
		||||
      out.output(m_inner);
 | 
			
		||||
 | 
			
		||||
      out.write("</TD>\n<TD ALIGN=CENTER WIDTH=210>\n");  // break to the sidebox column
 | 
			
		||||
      out.write("</td>\n<td align=\"center\" width=\"210\"><table border=\"0\" cellpadding=\"0\" "
 | 
			
		||||
		+ "cellspacing=\"0\">\n");  // break to the sidebox column
 | 
			
		||||
 | 
			
		||||
      for (int i=0; i<sideboxes.length; i++)
 | 
			
		||||
      for (int i=0; i<m_sideboxes.length; i++)
 | 
			
		||||
      { // draw in the outer framework of the current sidebox
 | 
			
		||||
	out.write("<TABLE ALIGN=CENTER WIDTH=200 BORDER=0 CELLPADDING=2 CELLSPACING=0><TR VALIGN=MIDDLE "
 | 
			
		||||
		  + "BGCOLOR=\"" + html.getColor(html.SIDEBOX_TITLE_BACKGROUND)
 | 
			
		||||
		  + "\"><TD ALIGN=LEFT CLASS=\"sideboxtop\">\n"
 | 
			
		||||
		  + html.getFontTag(html.SIDEBOX_TITLE_FOREGROUND,"sidebox-title") + "<B>"
 | 
			
		||||
		  + sideboxes[i].getPageTitle(out) + "</B></FONT>\n</TD></TR><TR VALIGN=TOP BGCOLOR=\""
 | 
			
		||||
		  + html.getColor(html.SIDEBOX_CONTENT_BACKGROUND) + "\"><TD ALIGN=LEFT CLASS=\"sidebox\">\n");
 | 
			
		||||
	out.write("<tr valign=\"top\"><td align=\"center\"><table align=\"center\" width=\"200\" border=\"0\" "
 | 
			
		||||
		  + "cellpadding=\"2\" cellspacing=\"0\">\n<tr valign=\"middle\" bgcolor=\""
 | 
			
		||||
		  + html.getColor(html.SIDEBOX_TITLE_BACKGROUND) + "\"><td align=\"left\" class=\"sideboxtop\">"
 | 
			
		||||
		  + html.getFontTag(html.SIDEBOX_TITLE_FOREGROUND,"sidebox-title") + "<b>"
 | 
			
		||||
		  + m_sideboxes[i].getPageTitle(out) + "</b></font></td></tr>\n<tr valign=\"top\" bgcolor=\""
 | 
			
		||||
		  + html.getColor(html.SIDEBOX_CONTENT_BACKGROUND) + "\"><td align=\"left\" class=\"sidebox\">\n");
 | 
			
		||||
 | 
			
		||||
	out.output(sideboxes[i]);    // output the sidebox content
 | 
			
		||||
	out.output(m_sideboxes[i]);    // output the sidebox content
 | 
			
		||||
 | 
			
		||||
	// close up the framework of this sidebox
 | 
			
		||||
	out.write("</TD></TR></TABLE><P>\n");
 | 
			
		||||
	out.write("</td></tr></table></td></tr><tr><td> </td></tr>\n");
 | 
			
		||||
 | 
			
		||||
      } // end for
 | 
			
		||||
 | 
			
		||||
      if (do_configure) // write the Configure button below the sideboxes
 | 
			
		||||
	out.write("<A HREF=\"" + html.formatURL("usr/sidebox.js.vs",html.SERVLET) + "\">"
 | 
			
		||||
		  + html.getButtonVisual("configure") + "</A>\n");
 | 
			
		||||
      if (m_configure) // write the Configure button below the sideboxes
 | 
			
		||||
	out.write("<tr valign=\"middle\"><td align=\"center\"><a href=\""
 | 
			
		||||
		  + html.formatURL("usr/sidebox.js.vs",html.SERVLET) + "\">" + html.getButtonVisual("configure")
 | 
			
		||||
		  + "</a></td></tr>\n");
 | 
			
		||||
 | 
			
		||||
      // Finish up.
 | 
			
		||||
      out.write("</TD>\n</TR></TABLE>");
 | 
			
		||||
      out.write("</table></td>\n</tr></table>");
 | 
			
		||||
 | 
			
		||||
    } // end try
 | 
			
		||||
    catch (ServletException se)
 | 
			
		||||
@ -108,4 +132,27 @@ public class SideBoxNestedView implements ContentDirect
 | 
			
		||||
 | 
			
		||||
  } // end render
 | 
			
		||||
 | 
			
		||||
  /*--------------------------------------------------------------------------------
 | 
			
		||||
   * Implementations from interface ContentMetadata
 | 
			
		||||
   *--------------------------------------------------------------------------------
 | 
			
		||||
   */
 | 
			
		||||
 | 
			
		||||
  public Map getMetadata()
 | 
			
		||||
  {
 | 
			
		||||
    if (m_inner instanceof ContentMetadata)
 | 
			
		||||
      return ((ContentMetadata)m_inner).getMetadata();
 | 
			
		||||
    else
 | 
			
		||||
      return Collections.EMPTY_MAP;
 | 
			
		||||
 | 
			
		||||
  } // end getMetadata
 | 
			
		||||
 | 
			
		||||
  public Map getHTTPMetadata()
 | 
			
		||||
  {
 | 
			
		||||
    if (m_inner instanceof ContentMetadata)
 | 
			
		||||
      return ((ContentMetadata)m_inner).getHTTPMetadata();
 | 
			
		||||
    else
 | 
			
		||||
      return Collections.EMPTY_MAP;
 | 
			
		||||
 | 
			
		||||
  } // end getHTTPMetadata
 | 
			
		||||
 | 
			
		||||
} // end class SideBoxNestedView
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user