added profile "inline" menus as a way of extending the user profile display
This commit is contained in:
parent
470b7cc47e
commit
f933e4f88c
|
@ -571,3 +571,8 @@ INSERT INTO menuitems (menuid, sequence, itemtype, text, linktype, link) VALUES
|
||||||
(1, 1, 'TEXT', 'About Venice', 'FRAME', 'about-venice.html');
|
(1, 1, 'TEXT', 'About Venice', 'FRAME', 'about-venice.html');
|
||||||
UPDATE menuitems SET enable = 0 WHERE menuid = 1 AND sequence = 0;
|
UPDATE menuitems SET enable = 0 WHERE menuid = 1 AND sequence = 0;
|
||||||
|
|
||||||
|
# Create the user profile menu.
|
||||||
|
INSERT INTO menus (menuid, menu_nsid, menu_name, title, subtitle)
|
||||||
|
VALUES (2, 11, 'user.profile.menu', '', NULL);
|
||||||
|
INSERT INTO menuitems (menuid, sequence, itemtype, text, linktype, link) VALUES
|
||||||
|
(2, 0, 'TEXT', 'Profile', 'SERVLET', 'profile.js.vs?tgt=${target}');
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
*
|
*
|
||||||
* 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@silcom.com>,
|
||||||
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
|
* 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-03 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Contributor(s):
|
* Contributor(s):
|
||||||
*/
|
*/
|
||||||
|
@ -164,6 +164,8 @@ class DialogImpl implements Dialog
|
||||||
private String m_error_message = null;
|
private String m_error_message = null;
|
||||||
private Map m_default_render_params;
|
private Map m_default_render_params;
|
||||||
private HashMap m_render_params;
|
private HashMap m_render_params;
|
||||||
|
private Object m_upper_content = null;
|
||||||
|
private Object m_lower_content = null;
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------------
|
/*--------------------------------------------------------------------------------
|
||||||
* Constructors
|
* Constructors
|
||||||
|
@ -384,6 +386,10 @@ class DialogImpl implements Dialog
|
||||||
// Get the content header and render it.
|
// Get the content header and render it.
|
||||||
control.renderSubObject(m_plaf.getContentHeader(m_title,m_subtitle));
|
control.renderSubObject(m_plaf.getContentHeader(m_title,m_subtitle));
|
||||||
|
|
||||||
|
// Render the "upper content" object, if any.
|
||||||
|
if (m_upper_content!=null)
|
||||||
|
control.renderSubObject(m_upper_content);
|
||||||
|
|
||||||
// Write the error message.
|
// Write the error message.
|
||||||
if (m_error_message!=null)
|
if (m_error_message!=null)
|
||||||
wr.write("<p align=\"center\" class=\"content\" style=\"color: red; font-weight: bold;\">\n"
|
wr.write("<p align=\"center\" class=\"content\" style=\"color: red; font-weight: bold;\">\n"
|
||||||
|
@ -453,6 +459,10 @@ class DialogImpl implements Dialog
|
||||||
|
|
||||||
wr.write("</div></form>\n");
|
wr.write("</div></form>\n");
|
||||||
|
|
||||||
|
// Render the "lower content" object, if any.
|
||||||
|
if (m_lower_content!=null)
|
||||||
|
control.renderSubObject(m_lower_content);
|
||||||
|
|
||||||
} // end render
|
} // end render
|
||||||
|
|
||||||
public void reset()
|
public void reset()
|
||||||
|
@ -640,4 +650,16 @@ class DialogImpl implements Dialog
|
||||||
|
|
||||||
} // end setRenderParam
|
} // end setRenderParam
|
||||||
|
|
||||||
|
public synchronized void setUpperContentObject(Object o)
|
||||||
|
{
|
||||||
|
m_upper_content = o;
|
||||||
|
|
||||||
|
} // end setUpperContentObject
|
||||||
|
|
||||||
|
public synchronized void setLowerContentObject(Object o)
|
||||||
|
{
|
||||||
|
m_lower_content = o;
|
||||||
|
|
||||||
|
} // end setLowerContentObject
|
||||||
|
|
||||||
} // end class DialogImpl
|
} // end class DialogImpl
|
||||||
|
|
|
@ -27,7 +27,7 @@ import com.silverwrist.dynamo.iface.*;
|
||||||
import com.silverwrist.dynamo.util.*;
|
import com.silverwrist.dynamo.util.*;
|
||||||
|
|
||||||
public class DialogManager
|
public class DialogManager
|
||||||
implements NamedObject, ComponentInitialize, ComponentShutdown, DialogFactoryConfig, DialogLoader
|
implements NamedObject, ComponentInitialize, ComponentShutdown, DialogFactoryConfig, DialogLoader, TextRenderer
|
||||||
{
|
{
|
||||||
/*--------------------------------------------------------------------------------
|
/*--------------------------------------------------------------------------------
|
||||||
* Internal class implementing the dialog item factory
|
* Internal class implementing the dialog item factory
|
||||||
|
@ -83,6 +83,7 @@ public class DialogManager
|
||||||
private Hashtable m_factory_data = new Hashtable();
|
private Hashtable m_factory_data = new Hashtable();
|
||||||
private ComponentShutdown m_shut_init;
|
private ComponentShutdown m_shut_init;
|
||||||
private ComponentShutdown m_shut_runtime;
|
private ComponentShutdown m_shut_runtime;
|
||||||
|
private ComponentShutdown m_shut_render;
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------------
|
/*--------------------------------------------------------------------------------
|
||||||
* Constructor
|
* Constructor
|
||||||
|
@ -190,6 +191,10 @@ public class DialogManager
|
||||||
ssp = new SingletonServiceProvider("DialogManager",DialogLoader.class,(DialogLoader)this);
|
ssp = new SingletonServiceProvider("DialogManager",DialogLoader.class,(DialogLoader)this);
|
||||||
m_shut_runtime = hooker.hookRuntimeServiceProvider(ssp);
|
m_shut_runtime = hooker.hookRuntimeServiceProvider(ssp);
|
||||||
|
|
||||||
|
// Register this object as a renderer for dialogs.
|
||||||
|
RendererRegistration rr = (RendererRegistration)(services.queryService(RendererRegistration.class));
|
||||||
|
m_shut_render = rr.registerRenderer(Dialog.class,this);
|
||||||
|
|
||||||
} // end initialize
|
} // end initialize
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------------
|
/*--------------------------------------------------------------------------------
|
||||||
|
@ -199,6 +204,8 @@ public class DialogManager
|
||||||
|
|
||||||
public void shutdown()
|
public void shutdown()
|
||||||
{
|
{
|
||||||
|
m_shut_render.shutdown();
|
||||||
|
m_shut_render = null;
|
||||||
m_shut_runtime.shutdown();
|
m_shut_runtime.shutdown();
|
||||||
m_shut_runtime = null;
|
m_shut_runtime = null;
|
||||||
m_shut_init.shutdown();
|
m_shut_init.shutdown();
|
||||||
|
@ -297,4 +304,15 @@ public class DialogManager
|
||||||
|
|
||||||
} // end loadDialogResource
|
} // end loadDialogResource
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------------------
|
||||||
|
* Implementations from interface TextRenderer
|
||||||
|
*--------------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
public void render(Object obj, TextRenderControl control) throws IOException, RenderingException
|
||||||
|
{
|
||||||
|
((Dialog)obj).render(control);
|
||||||
|
|
||||||
|
} // end render
|
||||||
|
|
||||||
} // end class DialogManager
|
} // end class DialogManager
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
*
|
*
|
||||||
* 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@silcom.com>,
|
||||||
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
|
* 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-03 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Contributor(s):
|
* Contributor(s):
|
||||||
*/
|
*/
|
||||||
|
@ -61,4 +61,8 @@ public interface Dialog extends Cloneable, NamedObject
|
||||||
|
|
||||||
public void setRenderParam(String name, String value);
|
public void setRenderParam(String name, String value);
|
||||||
|
|
||||||
|
public void setUpperContentObject(Object o);
|
||||||
|
|
||||||
|
public void setLowerContentObject(Object o);
|
||||||
|
|
||||||
} // end interface Dialog
|
} // end interface Dialog
|
||||||
|
|
|
@ -77,6 +77,12 @@ public class LibraryCast
|
||||||
|
|
||||||
} // end booleanObject
|
} // end booleanObject
|
||||||
|
|
||||||
|
public final int[] newIntArray(int size)
|
||||||
|
{
|
||||||
|
return new int[size];
|
||||||
|
|
||||||
|
} // end newIntArray
|
||||||
|
|
||||||
public final ChainParameterInput queryChainParameterInput(Object obj)
|
public final ChainParameterInput queryChainParameterInput(Object obj)
|
||||||
{
|
{
|
||||||
return (ChainParameterInput)query(obj,ChainParameterInput.class);
|
return (ChainParameterInput)query(obj,ChainParameterInput.class);
|
||||||
|
|
|
@ -31,6 +31,8 @@ public class FrameDialog implements FramedContent, SelfRenderable
|
||||||
private Dialog m_dialog;
|
private Dialog m_dialog;
|
||||||
private String m_menu_sel = null;
|
private String m_menu_sel = null;
|
||||||
private String m_qid = null;
|
private String m_qid = null;
|
||||||
|
private Object m_content_above = null;
|
||||||
|
private Object m_content_below = null;
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------------
|
/*--------------------------------------------------------------------------------
|
||||||
* Constructors
|
* Constructors
|
||||||
|
@ -50,6 +52,23 @@ public class FrameDialog implements FramedContent, SelfRenderable
|
||||||
|
|
||||||
} // end constructor
|
} // end constructor
|
||||||
|
|
||||||
|
public FrameDialog(Dialog dialog, Object above, Object below)
|
||||||
|
{
|
||||||
|
m_dialog = dialog;
|
||||||
|
m_content_above = above;
|
||||||
|
m_content_below = below;
|
||||||
|
|
||||||
|
} // end constructor
|
||||||
|
|
||||||
|
public FrameDialog(Dialog dialog, String menu_sel, Object above, Object below)
|
||||||
|
{
|
||||||
|
m_dialog = dialog;
|
||||||
|
m_menu_sel = menu_sel;
|
||||||
|
m_content_above = above;
|
||||||
|
m_content_below = below;
|
||||||
|
|
||||||
|
} // end constructor
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------------
|
/*--------------------------------------------------------------------------------
|
||||||
* Implementations from interface FramedContent
|
* Implementations from interface FramedContent
|
||||||
*--------------------------------------------------------------------------------
|
*--------------------------------------------------------------------------------
|
||||||
|
@ -85,7 +104,12 @@ public class FrameDialog implements FramedContent, SelfRenderable
|
||||||
|
|
||||||
public void render(SelfRenderControl control) throws IOException, RenderingException
|
public void render(SelfRenderControl control) throws IOException, RenderingException
|
||||||
{
|
{
|
||||||
m_dialog.render(control.getTextRender());
|
TextRenderControl ctl = control.getTextRender();
|
||||||
|
if (m_content_above!=null)
|
||||||
|
ctl.renderSubObject(m_content_above);
|
||||||
|
m_dialog.render(ctl);
|
||||||
|
if (m_content_below!=null)
|
||||||
|
ctl.renderSubObject(m_content_below);
|
||||||
|
|
||||||
} // end render
|
} // end render
|
||||||
|
|
||||||
|
@ -106,4 +130,28 @@ public class FrameDialog implements FramedContent, SelfRenderable
|
||||||
|
|
||||||
} // end setPageQID
|
} // end setPageQID
|
||||||
|
|
||||||
|
public Object getContentAbove()
|
||||||
|
{
|
||||||
|
return m_content_above;
|
||||||
|
|
||||||
|
} // end getContentAbove
|
||||||
|
|
||||||
|
public void setContentAbove(Object obj)
|
||||||
|
{
|
||||||
|
m_content_above = obj;
|
||||||
|
|
||||||
|
} // end setContentAbove
|
||||||
|
|
||||||
|
public Object getContentBelow()
|
||||||
|
{
|
||||||
|
return m_content_below;
|
||||||
|
|
||||||
|
} // end getContentBelow
|
||||||
|
|
||||||
|
public void setContentBelow(Object obj)
|
||||||
|
{
|
||||||
|
m_content_below = obj;
|
||||||
|
|
||||||
|
} // end setContentBelow
|
||||||
|
|
||||||
} // end class FrameDialog
|
} // end class FrameDialog
|
||||||
|
|
|
@ -28,4 +28,7 @@ public interface MenuProvider
|
||||||
public MenuRenderObject getLeftMenu(DynamoUser caller, String namespace, String name, int[] acl_ids)
|
public MenuRenderObject getLeftMenu(DynamoUser caller, String namespace, String name, int[] acl_ids)
|
||||||
throws DatabaseException;
|
throws DatabaseException;
|
||||||
|
|
||||||
|
public MenuRenderObject getInlineMenu(DynamoUser caller, String namespace, String name, int[] acl_ids)
|
||||||
|
throws DatabaseException;
|
||||||
|
|
||||||
} // end interface MenuProvider
|
} // end interface MenuProvider
|
||||||
|
|
|
@ -19,6 +19,10 @@ package com.silverwrist.venice.iface;
|
||||||
|
|
||||||
public interface MenuRenderObject
|
public interface MenuRenderObject
|
||||||
{
|
{
|
||||||
|
public int getItemCount();
|
||||||
|
|
||||||
public void setVariable(String name, String value);
|
public void setVariable(String name, String value);
|
||||||
|
|
||||||
|
public void setSelectedIndex(int index);
|
||||||
|
|
||||||
} // end interface MenuRenderObject
|
} // end interface MenuRenderObject
|
||||||
|
|
|
@ -0,0 +1,285 @@
|
||||||
|
/*
|
||||||
|
* 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) 2003 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Contributor(s):
|
||||||
|
*/
|
||||||
|
package com.silverwrist.venice.menu;
|
||||||
|
|
||||||
|
import java.io.*;
|
||||||
|
import java.util.*;
|
||||||
|
import com.silverwrist.util.*;
|
||||||
|
import com.silverwrist.dynamo.except.*;
|
||||||
|
import com.silverwrist.dynamo.iface.*;
|
||||||
|
import com.silverwrist.dynamo.security.SecurityReferenceMonitor;
|
||||||
|
import com.silverwrist.venice.iface.*;
|
||||||
|
|
||||||
|
class InlineMenuRendering implements MenuRenderObject, SelfRenderable
|
||||||
|
{
|
||||||
|
/*--------------------------------------------------------------------------------
|
||||||
|
* Attributes
|
||||||
|
*--------------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
private MenuDefinition m_menudef;
|
||||||
|
private boolean[] m_showitem;
|
||||||
|
private HashMap m_local_vars;
|
||||||
|
private int m_selected_index = -1;
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------------------
|
||||||
|
* Constructor
|
||||||
|
*--------------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
InlineMenuRendering(DynamoUser caller, MenuDefinition def, SecurityReferenceMonitor srm, int[] acl_ids)
|
||||||
|
throws DatabaseException
|
||||||
|
{
|
||||||
|
m_menudef = def;
|
||||||
|
int count = def.getItemCount();
|
||||||
|
m_showitem = new boolean[count];
|
||||||
|
for (int i=0; i<count; i++)
|
||||||
|
{ // get the "show item" flags
|
||||||
|
MenuItemDefinition item = def.getItem(i);
|
||||||
|
m_showitem[i] = item.itemAppears(caller,srm,acl_ids);
|
||||||
|
|
||||||
|
} // end for
|
||||||
|
|
||||||
|
m_local_vars = new HashMap(def.getVarDefaults());
|
||||||
|
|
||||||
|
} // end constructor
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------------------
|
||||||
|
* Internal operations
|
||||||
|
*--------------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
private final void renderTextItem(TextRenderControl control, MenuItemDefinition item, boolean selected)
|
||||||
|
throws IOException, RenderingException
|
||||||
|
{
|
||||||
|
PrintWriter wr = control.getWriter();
|
||||||
|
wr.write("<li");
|
||||||
|
if (selected)
|
||||||
|
wr.write(" class=\"down\"");
|
||||||
|
wr.write('>');
|
||||||
|
if (selected)
|
||||||
|
wr.write("<b>");
|
||||||
|
else if (item.isEnabled() && (item.getLink()!=null))
|
||||||
|
{ // write the link
|
||||||
|
URLRewriter rewriter = (URLRewriter)(control.queryService(URLRewriter.class));
|
||||||
|
wr.write("<a href=\""
|
||||||
|
+ rewriter.rewriteURL(item.getLinkType(),
|
||||||
|
StringUtils.replaceAllVariables(item.getLink(),m_local_vars)) + "\"");
|
||||||
|
String s = item.getTarget();
|
||||||
|
if (s!=null)
|
||||||
|
wr.write(" target=\"" + s + "\"");
|
||||||
|
s = item.getTitle();
|
||||||
|
if (s!=null)
|
||||||
|
wr.write(" title=\"" + s + "\"");
|
||||||
|
s = item.getOnClick();
|
||||||
|
if (s!=null)
|
||||||
|
wr.write(" onClick=\"" + s + "\"");
|
||||||
|
wr.write('>');
|
||||||
|
|
||||||
|
} // end if
|
||||||
|
else // just disable the text
|
||||||
|
wr.write("<span style=\"color: silver;\">");
|
||||||
|
wr.write(StringUtils.encodeHTML(StringUtils.replaceAllVariables(item.getText(),m_local_vars)));
|
||||||
|
if (selected)
|
||||||
|
wr.write("</b>");
|
||||||
|
else if (item.isEnabled())
|
||||||
|
wr.write("</a>");
|
||||||
|
else
|
||||||
|
wr.write("</span>");
|
||||||
|
wr.write("</li>\n");
|
||||||
|
|
||||||
|
} // end renderTextItem
|
||||||
|
|
||||||
|
private final void renderHeaderItem(TextRenderControl control, MenuItemDefinition item, boolean selected)
|
||||||
|
throws IOException, RenderingException
|
||||||
|
{
|
||||||
|
PrintWriter wr = control.getWriter();
|
||||||
|
wr.write("<li");
|
||||||
|
if (selected)
|
||||||
|
wr.write(" class=\"down\"");
|
||||||
|
wr.write("><b>");
|
||||||
|
if (!selected)
|
||||||
|
{ // write the sequence beginning
|
||||||
|
if (item.isEnabled() && (item.getLink()!=null))
|
||||||
|
{ // write the link
|
||||||
|
URLRewriter rewriter = (URLRewriter)(control.queryService(URLRewriter.class));
|
||||||
|
wr.write("<a href=\""
|
||||||
|
+ rewriter.rewriteURL(item.getLinkType(),
|
||||||
|
StringUtils.replaceAllVariables(item.getLink(),m_local_vars)) + "\"");
|
||||||
|
String s = item.getTarget();
|
||||||
|
if (s!=null)
|
||||||
|
wr.write(" target=\"" + s + "\"");
|
||||||
|
s = item.getTitle();
|
||||||
|
if (s!=null)
|
||||||
|
wr.write(" title=\"" + s + "\"");
|
||||||
|
s = item.getOnClick();
|
||||||
|
if (s!=null)
|
||||||
|
wr.write(" onClick=\"" + s + "\"");
|
||||||
|
wr.write('>');
|
||||||
|
|
||||||
|
} // end if
|
||||||
|
else // just disable the text
|
||||||
|
wr.write("<span style=\"color: silver;\">");
|
||||||
|
|
||||||
|
} // end if
|
||||||
|
|
||||||
|
wr.write(StringUtils.encodeHTML(StringUtils.replaceAllVariables(item.getText(),m_local_vars)));
|
||||||
|
if (!selected)
|
||||||
|
{ // write the sequence end
|
||||||
|
if (item.isEnabled())
|
||||||
|
wr.write("</a>");
|
||||||
|
else
|
||||||
|
wr.write("</span>");
|
||||||
|
|
||||||
|
} // end if
|
||||||
|
|
||||||
|
wr.write("</b></li>\n");
|
||||||
|
|
||||||
|
} // end renderHeaderItem
|
||||||
|
|
||||||
|
private final void renderImageItem(TextRenderControl control, MenuItemDefinition item, boolean selected)
|
||||||
|
throws IOException, RenderingException
|
||||||
|
{
|
||||||
|
URLRewriter rewriter = (URLRewriter)(control.queryService(URLRewriter.class));
|
||||||
|
String s;
|
||||||
|
PrintWriter wr = control.getWriter();
|
||||||
|
wr.write("<li");
|
||||||
|
if (selected)
|
||||||
|
wr.write(" class=\"down\"");
|
||||||
|
wr.write('>');
|
||||||
|
if (!selected)
|
||||||
|
{ // write the opening sequence
|
||||||
|
if (item.isEnabled() && (item.getLink()!=null))
|
||||||
|
{ // write the link
|
||||||
|
wr.write("<a href=\""
|
||||||
|
+ rewriter.rewriteURL(item.getLinkType(),
|
||||||
|
StringUtils.replaceAllVariables(item.getLink(),m_local_vars)) + "\"");
|
||||||
|
s = item.getTarget();
|
||||||
|
if (s!=null)
|
||||||
|
wr.write(" target=\"" + s + "\"");
|
||||||
|
s = item.getTitle();
|
||||||
|
if (s!=null)
|
||||||
|
wr.write(" title=\"" + s + "\"");
|
||||||
|
s = item.getOnClick();
|
||||||
|
if (s!=null)
|
||||||
|
wr.write(" onClick=\"" + s + "\"");
|
||||||
|
wr.write('>');
|
||||||
|
|
||||||
|
} // end if
|
||||||
|
else // just disable the text
|
||||||
|
wr.write("<span style=\"color: silver;\">");
|
||||||
|
|
||||||
|
} // end if
|
||||||
|
|
||||||
|
String[] data = StringUtils.split(item.getText(),",",4);
|
||||||
|
wr.write("<img src=\"" + rewriter.rewriteURL(data[2],StringUtils.replaceAllVariables(data[3],m_local_vars))
|
||||||
|
+ "\"");
|
||||||
|
s = item.getTitle();
|
||||||
|
if (s==null)
|
||||||
|
wr.write(" alt=\"\"");
|
||||||
|
else
|
||||||
|
wr.write(" alt=\"" + s + "\" title=\"" + s + "\"");
|
||||||
|
wr.write(" width=\"" + data[0] + "\" height=\"" + data[1] + "\" border=\"0\" />");
|
||||||
|
if (!selected)
|
||||||
|
{ // write the closing sequence
|
||||||
|
if (item.isEnabled())
|
||||||
|
wr.write("</a>");
|
||||||
|
else
|
||||||
|
wr.write("</span>");
|
||||||
|
|
||||||
|
} // end if
|
||||||
|
|
||||||
|
wr.write("</li>\n");
|
||||||
|
|
||||||
|
} // end renderImageItem
|
||||||
|
|
||||||
|
private final void renderSeparatorItem(TextRenderControl control, MenuItemDefinition item)
|
||||||
|
throws IOException, RenderingException
|
||||||
|
{
|
||||||
|
PrintWriter wr = control.getWriter();
|
||||||
|
wr.write("<li class=\"separator\"> </li>");
|
||||||
|
|
||||||
|
} // end renderSeparatorItem
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------------------
|
||||||
|
* Implementations from interface MenuRenderObject
|
||||||
|
*--------------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
public int getItemCount()
|
||||||
|
{
|
||||||
|
return m_menudef.getItemCount();
|
||||||
|
|
||||||
|
} // end getItemCount
|
||||||
|
|
||||||
|
public void setVariable(String name, String value)
|
||||||
|
{
|
||||||
|
if (m_menudef.isVariable(name))
|
||||||
|
m_local_vars.put(name,value);
|
||||||
|
|
||||||
|
} // end setVariable
|
||||||
|
|
||||||
|
public void setSelectedIndex(int index)
|
||||||
|
{
|
||||||
|
m_selected_index = index;
|
||||||
|
|
||||||
|
} // end setSelectedIndex
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------------------
|
||||||
|
* Implementations from interface SelfRenderable
|
||||||
|
*--------------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
public void render(SelfRenderControl control) throws IOException, RenderingException
|
||||||
|
{
|
||||||
|
TextRenderControl tctrl = control.getTextRender();
|
||||||
|
PrintWriter wr = tctrl.getWriter();
|
||||||
|
wr.write("<div class=\"imenu\"><ul>\n");
|
||||||
|
if (StringUtils.isNotEmpty(m_menudef.getTitle()))
|
||||||
|
{ // write the title and subtitle
|
||||||
|
wr.write("<li class=\"separator\"><b>" + StringUtils.encodeHTML(m_menudef.getTitle()) + "</b>");
|
||||||
|
if (m_menudef.getSubtitle()!=null)
|
||||||
|
wr.write(" " + StringUtils.encodeHTML(m_menudef.getSubtitle()));
|
||||||
|
wr.write(":</li>\n");
|
||||||
|
|
||||||
|
} // end if
|
||||||
|
|
||||||
|
for (int i=0; i<m_showitem.length; i++)
|
||||||
|
{ // render each menu item in turn
|
||||||
|
MenuItemDefinition item = m_menudef.getItem(i);
|
||||||
|
if (m_showitem[i] && item.itemDefined(m_local_vars))
|
||||||
|
{ // render this item
|
||||||
|
String s = item.getItemType();
|
||||||
|
if (s.equalsIgnoreCase("TEXT"))
|
||||||
|
renderTextItem(tctrl,item,(i==m_selected_index));
|
||||||
|
else if (s.equalsIgnoreCase("HEADER"))
|
||||||
|
renderHeaderItem(tctrl,item,(i==m_selected_index));
|
||||||
|
else if (s.equalsIgnoreCase("IMAGE"))
|
||||||
|
renderImageItem(tctrl,item,(i==m_selected_index));
|
||||||
|
else if (s.equalsIgnoreCase("SEPARATOR"))
|
||||||
|
renderSeparatorItem(tctrl,item);
|
||||||
|
|
||||||
|
} // end if
|
||||||
|
|
||||||
|
} // end for
|
||||||
|
|
||||||
|
wr.write("</ul></div>\n");
|
||||||
|
|
||||||
|
} // end render
|
||||||
|
|
||||||
|
} // end class InlineMenuRendering
|
|
@ -35,6 +35,7 @@ class LeftMenuRendering implements MenuRenderObject, SelfRenderable
|
||||||
private MenuDefinition m_menudef;
|
private MenuDefinition m_menudef;
|
||||||
private boolean[] m_showitem;
|
private boolean[] m_showitem;
|
||||||
private HashMap m_local_vars;
|
private HashMap m_local_vars;
|
||||||
|
private int m_selected_index = -1;
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------------
|
/*--------------------------------------------------------------------------------
|
||||||
* Constructor
|
* Constructor
|
||||||
|
@ -63,13 +64,15 @@ class LeftMenuRendering implements MenuRenderObject, SelfRenderable
|
||||||
*--------------------------------------------------------------------------------
|
*--------------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private final void renderTextItem(TextRenderControl control, MenuItemDefinition item)
|
private final void renderTextItem(TextRenderControl control, MenuItemDefinition item, boolean selected)
|
||||||
throws IOException, RenderingException
|
throws IOException, RenderingException
|
||||||
{
|
{
|
||||||
PrintWriter wr = control.getWriter();
|
PrintWriter wr = control.getWriter();
|
||||||
for (int i=0; i<item.getIndentLevel(); i++)
|
for (int i=0; i<item.getIndentLevel(); i++)
|
||||||
wr.write(" ");
|
wr.write(" ");
|
||||||
if (item.isEnabled() && (item.getLink()!=null))
|
if (selected)
|
||||||
|
wr.write("<b>");
|
||||||
|
else if (item.isEnabled() && (item.getLink()!=null))
|
||||||
{ // write the link
|
{ // write the link
|
||||||
URLRewriter rewriter = (URLRewriter)(control.queryService(URLRewriter.class));
|
URLRewriter rewriter = (URLRewriter)(control.queryService(URLRewriter.class));
|
||||||
wr.write("<a href=\""
|
wr.write("<a href=\""
|
||||||
|
@ -90,7 +93,9 @@ class LeftMenuRendering implements MenuRenderObject, SelfRenderable
|
||||||
else // just disable the text
|
else // just disable the text
|
||||||
wr.write("<span style=\"color: silver;\">");
|
wr.write("<span style=\"color: silver;\">");
|
||||||
wr.write(StringUtils.encodeHTML(StringUtils.replaceAllVariables(item.getText(),m_local_vars)));
|
wr.write(StringUtils.encodeHTML(StringUtils.replaceAllVariables(item.getText(),m_local_vars)));
|
||||||
if (item.isEnabled())
|
if (selected)
|
||||||
|
wr.write("</b>");
|
||||||
|
else if (item.isEnabled())
|
||||||
wr.write("</a>");
|
wr.write("</a>");
|
||||||
else
|
else
|
||||||
wr.write("</span>");
|
wr.write("</span>");
|
||||||
|
@ -98,13 +103,15 @@ class LeftMenuRendering implements MenuRenderObject, SelfRenderable
|
||||||
|
|
||||||
} // end renderTextItem
|
} // end renderTextItem
|
||||||
|
|
||||||
private final void renderHeaderItem(TextRenderControl control, MenuItemDefinition item)
|
private final void renderHeaderItem(TextRenderControl control, MenuItemDefinition item, boolean selected)
|
||||||
throws IOException, RenderingException
|
throws IOException, RenderingException
|
||||||
{
|
{
|
||||||
PrintWriter wr = control.getWriter();
|
PrintWriter wr = control.getWriter();
|
||||||
for (int i=0; i<item.getIndentLevel(); i++)
|
for (int i=0; i<item.getIndentLevel(); i++)
|
||||||
wr.write(" ");
|
wr.write(" ");
|
||||||
wr.write("<b>");
|
wr.write("<b>");
|
||||||
|
if (!selected)
|
||||||
|
{ // write the opening sequence
|
||||||
if (item.isEnabled() && (item.getLink()!=null))
|
if (item.isEnabled() && (item.getLink()!=null))
|
||||||
{ // write the link
|
{ // write the link
|
||||||
URLRewriter rewriter = (URLRewriter)(control.queryService(URLRewriter.class));
|
URLRewriter rewriter = (URLRewriter)(control.queryService(URLRewriter.class));
|
||||||
|
@ -125,16 +132,24 @@ class LeftMenuRendering implements MenuRenderObject, SelfRenderable
|
||||||
} // end if
|
} // end if
|
||||||
else // just disable the text
|
else // just disable the text
|
||||||
wr.write("<span style=\"color: silver;\">");
|
wr.write("<span style=\"color: silver;\">");
|
||||||
|
|
||||||
|
} // end if
|
||||||
|
|
||||||
wr.write(StringUtils.encodeHTML(StringUtils.replaceAllVariables(item.getText(),m_local_vars)));
|
wr.write(StringUtils.encodeHTML(StringUtils.replaceAllVariables(item.getText(),m_local_vars)));
|
||||||
|
if (!selected)
|
||||||
|
{ // write the closing sequence
|
||||||
if (item.isEnabled())
|
if (item.isEnabled())
|
||||||
wr.write("</a>");
|
wr.write("</a>");
|
||||||
else
|
else
|
||||||
wr.write("</span>");
|
wr.write("</span>");
|
||||||
|
|
||||||
|
} // end if
|
||||||
|
|
||||||
wr.write("</b><br />\n");
|
wr.write("</b><br />\n");
|
||||||
|
|
||||||
} // end renderHeaderItem
|
} // end renderHeaderItem
|
||||||
|
|
||||||
private final void renderImageItem(TextRenderControl control, MenuItemDefinition item)
|
private final void renderImageItem(TextRenderControl control, MenuItemDefinition item, boolean selected)
|
||||||
throws IOException, RenderingException
|
throws IOException, RenderingException
|
||||||
{
|
{
|
||||||
URLRewriter rewriter = (URLRewriter)(control.queryService(URLRewriter.class));
|
URLRewriter rewriter = (URLRewriter)(control.queryService(URLRewriter.class));
|
||||||
|
@ -142,6 +157,8 @@ class LeftMenuRendering implements MenuRenderObject, SelfRenderable
|
||||||
PrintWriter wr = control.getWriter();
|
PrintWriter wr = control.getWriter();
|
||||||
for (int i=0; i<item.getIndentLevel(); i++)
|
for (int i=0; i<item.getIndentLevel(); i++)
|
||||||
wr.write(" ");
|
wr.write(" ");
|
||||||
|
if (!selected)
|
||||||
|
{ // write the opening sequence
|
||||||
if (item.isEnabled() && (item.getLink()!=null))
|
if (item.isEnabled() && (item.getLink()!=null))
|
||||||
{ // write the link
|
{ // write the link
|
||||||
wr.write("<a href=\""
|
wr.write("<a href=\""
|
||||||
|
@ -161,6 +178,9 @@ class LeftMenuRendering implements MenuRenderObject, SelfRenderable
|
||||||
} // end if
|
} // end if
|
||||||
else // just disable the text
|
else // just disable the text
|
||||||
wr.write("<span style=\"color: silver;\">");
|
wr.write("<span style=\"color: silver;\">");
|
||||||
|
|
||||||
|
} // end if
|
||||||
|
|
||||||
String[] data = StringUtils.split(item.getText(),",",4);
|
String[] data = StringUtils.split(item.getText(),",",4);
|
||||||
wr.write("<img src=\"" + rewriter.rewriteURL(data[2],StringUtils.replaceAllVariables(data[3],m_local_vars))
|
wr.write("<img src=\"" + rewriter.rewriteURL(data[2],StringUtils.replaceAllVariables(data[3],m_local_vars))
|
||||||
+ "\"");
|
+ "\"");
|
||||||
|
@ -170,10 +190,15 @@ class LeftMenuRendering implements MenuRenderObject, SelfRenderable
|
||||||
else
|
else
|
||||||
wr.write(" alt=\"" + s + "\" title=\"" + s + "\"");
|
wr.write(" alt=\"" + s + "\" title=\"" + s + "\"");
|
||||||
wr.write(" width=\"" + data[0] + "\" height=\"" + data[1] + "\" border=\"0\" />");
|
wr.write(" width=\"" + data[0] + "\" height=\"" + data[1] + "\" border=\"0\" />");
|
||||||
|
if (!selected)
|
||||||
|
{ // write the closing sequence
|
||||||
if (item.isEnabled())
|
if (item.isEnabled())
|
||||||
wr.write("</a>");
|
wr.write("</a>");
|
||||||
else
|
else
|
||||||
wr.write("</span>");
|
wr.write("</span>");
|
||||||
|
|
||||||
|
} // end if
|
||||||
|
|
||||||
wr.write("<br />\n");
|
wr.write("<br />\n");
|
||||||
|
|
||||||
} // end renderImageItem
|
} // end renderImageItem
|
||||||
|
@ -191,6 +216,12 @@ class LeftMenuRendering implements MenuRenderObject, SelfRenderable
|
||||||
*--------------------------------------------------------------------------------
|
*--------------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
public int getItemCount()
|
||||||
|
{
|
||||||
|
return m_menudef.getItemCount();
|
||||||
|
|
||||||
|
} // end getItemCount
|
||||||
|
|
||||||
public void setVariable(String name, String value)
|
public void setVariable(String name, String value)
|
||||||
{
|
{
|
||||||
if (m_menudef.isVariable(name))
|
if (m_menudef.isVariable(name))
|
||||||
|
@ -198,6 +229,12 @@ class LeftMenuRendering implements MenuRenderObject, SelfRenderable
|
||||||
|
|
||||||
} // end setVariable
|
} // end setVariable
|
||||||
|
|
||||||
|
public void setSelectedIndex(int index)
|
||||||
|
{
|
||||||
|
m_selected_index = index;
|
||||||
|
|
||||||
|
} // end setSelectedIndex
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------------
|
/*--------------------------------------------------------------------------------
|
||||||
* Implementations from interface SelfRenderable
|
* Implementations from interface SelfRenderable
|
||||||
*--------------------------------------------------------------------------------
|
*--------------------------------------------------------------------------------
|
||||||
|
@ -222,12 +259,12 @@ class LeftMenuRendering implements MenuRenderObject, SelfRenderable
|
||||||
{ // render this item
|
{ // render this item
|
||||||
String s = item.getItemType();
|
String s = item.getItemType();
|
||||||
if (s.equalsIgnoreCase("TEXT"))
|
if (s.equalsIgnoreCase("TEXT"))
|
||||||
renderTextItem(tctrl,item);
|
renderTextItem(tctrl,item,(m_selected_index==i));
|
||||||
if (s.equalsIgnoreCase("HEADER"))
|
else if (s.equalsIgnoreCase("HEADER"))
|
||||||
renderHeaderItem(tctrl,item);
|
renderHeaderItem(tctrl,item,(m_selected_index==i));
|
||||||
if (s.equalsIgnoreCase("IMAGE"))
|
else if (s.equalsIgnoreCase("IMAGE"))
|
||||||
renderImageItem(tctrl,item);
|
renderImageItem(tctrl,item,(m_selected_index==i));
|
||||||
if (s.equalsIgnoreCase("SEPARATOR"))
|
else if (s.equalsIgnoreCase("SEPARATOR"))
|
||||||
renderSeparatorItem(tctrl,item);
|
renderSeparatorItem(tctrl,item);
|
||||||
|
|
||||||
} // end if
|
} // end if
|
||||||
|
|
|
@ -185,4 +185,20 @@ public class MenuManager implements NamedObject, ComponentInitialize, ComponentS
|
||||||
|
|
||||||
} // end getLeftMenu
|
} // end getLeftMenu
|
||||||
|
|
||||||
|
public MenuRenderObject getInlineMenu(DynamoUser caller, String namespace, String name, int[] acl_ids)
|
||||||
|
throws DatabaseException
|
||||||
|
{
|
||||||
|
QualifiedNameKey key = new QualifiedNameKey(namespace,name);
|
||||||
|
MenuDefinition mdef = (MenuDefinition)(m_menudef_cache.get(key));
|
||||||
|
if (mdef==null)
|
||||||
|
{ // get it and add it to the cache
|
||||||
|
mdef = m_ops.getMenu(namespace,name);
|
||||||
|
m_menudef_cache.put(key,mdef);
|
||||||
|
|
||||||
|
} // end if
|
||||||
|
|
||||||
|
return new InlineMenuRendering(caller,mdef,m_srm,acl_ids);
|
||||||
|
|
||||||
|
} // end getInlineMenu
|
||||||
|
|
||||||
} // end class MenuManager
|
} // end class MenuManager
|
||||||
|
|
|
@ -38,6 +38,7 @@ class StandardMenuRendering implements MenuRenderObject, SelfRenderable, FramedC
|
||||||
private boolean[] m_showitem;
|
private boolean[] m_showitem;
|
||||||
private HashMap m_local_vars;
|
private HashMap m_local_vars;
|
||||||
private ContentBlock m_bullet = null;
|
private ContentBlock m_bullet = null;
|
||||||
|
private int m_selected_index = -1;
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------------
|
/*--------------------------------------------------------------------------------
|
||||||
* Constructor
|
* Constructor
|
||||||
|
@ -66,7 +67,7 @@ class StandardMenuRendering implements MenuRenderObject, SelfRenderable, FramedC
|
||||||
*--------------------------------------------------------------------------------
|
*--------------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private final void renderTextItem(TextRenderControl control, MenuItemDefinition item)
|
private final void renderTextItem(TextRenderControl control, MenuItemDefinition item, boolean selected)
|
||||||
throws IOException, RenderingException
|
throws IOException, RenderingException
|
||||||
{
|
{
|
||||||
PrintWriter wr = control.getWriter();
|
PrintWriter wr = control.getWriter();
|
||||||
|
@ -74,7 +75,9 @@ class StandardMenuRendering implements MenuRenderObject, SelfRenderable, FramedC
|
||||||
wr.write(" ");
|
wr.write(" ");
|
||||||
control.renderSubObject(m_bullet);
|
control.renderSubObject(m_bullet);
|
||||||
wr.write(" ");
|
wr.write(" ");
|
||||||
if (item.isEnabled() && (item.getLink()!=null))
|
if (selected)
|
||||||
|
wr.write("<span class=\"selectedItem\">");
|
||||||
|
else if (item.isEnabled() && (item.getLink()!=null))
|
||||||
{ // write the link
|
{ // write the link
|
||||||
URLRewriter rewriter = (URLRewriter)(control.queryService(URLRewriter.class));
|
URLRewriter rewriter = (URLRewriter)(control.queryService(URLRewriter.class));
|
||||||
wr.write("<a href=\""
|
wr.write("<a href=\""
|
||||||
|
@ -95,7 +98,9 @@ class StandardMenuRendering implements MenuRenderObject, SelfRenderable, FramedC
|
||||||
else // just disable the text
|
else // just disable the text
|
||||||
wr.write("<span style=\"color: silver;\">");
|
wr.write("<span style=\"color: silver;\">");
|
||||||
wr.write(StringUtils.encodeHTML(StringUtils.replaceAllVariables(item.getText(),m_local_vars)));
|
wr.write(StringUtils.encodeHTML(StringUtils.replaceAllVariables(item.getText(),m_local_vars)));
|
||||||
if (item.isEnabled())
|
if (selected)
|
||||||
|
wr.write("</span>");
|
||||||
|
else if (item.isEnabled())
|
||||||
wr.write("</a>");
|
wr.write("</a>");
|
||||||
else
|
else
|
||||||
wr.write("</span>");
|
wr.write("</span>");
|
||||||
|
@ -103,14 +108,16 @@ class StandardMenuRendering implements MenuRenderObject, SelfRenderable, FramedC
|
||||||
|
|
||||||
} // end renderTextItem
|
} // end renderTextItem
|
||||||
|
|
||||||
private final void renderHeaderItem(TextRenderControl control, MenuItemDefinition item)
|
private final void renderHeaderItem(TextRenderControl control, MenuItemDefinition item, boolean selected)
|
||||||
throws IOException, RenderingException
|
throws IOException, RenderingException
|
||||||
{
|
{
|
||||||
PrintWriter wr = control.getWriter();
|
PrintWriter wr = control.getWriter();
|
||||||
for (int i=0; i<item.getIndentLevel(); i++)
|
for (int i=0; i<item.getIndentLevel(); i++)
|
||||||
wr.write(" ");
|
wr.write(" ");
|
||||||
wr.write("<span style=\"font-weight: bold; text-decoration: underline;\">");
|
wr.write("<span style=\"font-weight: bold; text-decoration: underline;\">");
|
||||||
if (item.isEnabled() && (item.getLink()!=null))
|
if (selected)
|
||||||
|
wr.write("<span class=\"selectedItem\">");
|
||||||
|
else if (item.isEnabled() && (item.getLink()!=null))
|
||||||
{ // write the link
|
{ // write the link
|
||||||
URLRewriter rewriter = (URLRewriter)(control.queryService(URLRewriter.class));
|
URLRewriter rewriter = (URLRewriter)(control.queryService(URLRewriter.class));
|
||||||
wr.write("<a href=\""
|
wr.write("<a href=\""
|
||||||
|
@ -131,7 +138,9 @@ class StandardMenuRendering implements MenuRenderObject, SelfRenderable, FramedC
|
||||||
else // just disable the text
|
else // just disable the text
|
||||||
wr.write("<span style=\"color: silver;\">");
|
wr.write("<span style=\"color: silver;\">");
|
||||||
wr.write(StringUtils.encodeHTML(StringUtils.replaceAllVariables(item.getText(),m_local_vars)));
|
wr.write(StringUtils.encodeHTML(StringUtils.replaceAllVariables(item.getText(),m_local_vars)));
|
||||||
if (item.isEnabled())
|
if (selected)
|
||||||
|
wr.write("</span>");
|
||||||
|
else if (item.isEnabled())
|
||||||
wr.write("</a>");
|
wr.write("</a>");
|
||||||
else
|
else
|
||||||
wr.write("</span>");
|
wr.write("</span>");
|
||||||
|
@ -139,7 +148,7 @@ class StandardMenuRendering implements MenuRenderObject, SelfRenderable, FramedC
|
||||||
|
|
||||||
} // end renderHeaderItem
|
} // end renderHeaderItem
|
||||||
|
|
||||||
private final void renderImageItem(TextRenderControl control, MenuItemDefinition item)
|
private final void renderImageItem(TextRenderControl control, MenuItemDefinition item, boolean selected)
|
||||||
throws IOException, RenderingException
|
throws IOException, RenderingException
|
||||||
{
|
{
|
||||||
URLRewriter rewriter = (URLRewriter)(control.queryService(URLRewriter.class));
|
URLRewriter rewriter = (URLRewriter)(control.queryService(URLRewriter.class));
|
||||||
|
@ -147,7 +156,9 @@ class StandardMenuRendering implements MenuRenderObject, SelfRenderable, FramedC
|
||||||
PrintWriter wr = control.getWriter();
|
PrintWriter wr = control.getWriter();
|
||||||
for (int i=0; i<item.getIndentLevel(); i++)
|
for (int i=0; i<item.getIndentLevel(); i++)
|
||||||
wr.write(" ");
|
wr.write(" ");
|
||||||
if (item.isEnabled() && (item.getLink()!=null))
|
if (selected)
|
||||||
|
wr.write("<span class=\"selectedItem\">");
|
||||||
|
else if (item.isEnabled() && (item.getLink()!=null))
|
||||||
{ // write the link
|
{ // write the link
|
||||||
wr.write("<a href=\""
|
wr.write("<a href=\""
|
||||||
+ rewriter.rewriteURL(item.getLinkType(),
|
+ rewriter.rewriteURL(item.getLinkType(),
|
||||||
|
@ -175,7 +186,9 @@ class StandardMenuRendering implements MenuRenderObject, SelfRenderable, FramedC
|
||||||
else
|
else
|
||||||
wr.write(" alt=\"" + s + "\" title=\"" + s + "\"");
|
wr.write(" alt=\"" + s + "\" title=\"" + s + "\"");
|
||||||
wr.write(" width=\"" + data[0] + "\" height=\"" + data[1] + "\" border=\"0\" />");
|
wr.write(" width=\"" + data[0] + "\" height=\"" + data[1] + "\" border=\"0\" />");
|
||||||
if (item.isEnabled())
|
if (selected)
|
||||||
|
wr.write("</span>");
|
||||||
|
else if (item.isEnabled())
|
||||||
wr.write("</a>");
|
wr.write("</a>");
|
||||||
else
|
else
|
||||||
wr.write("</span>");
|
wr.write("</span>");
|
||||||
|
@ -196,6 +209,12 @@ class StandardMenuRendering implements MenuRenderObject, SelfRenderable, FramedC
|
||||||
*--------------------------------------------------------------------------------
|
*--------------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
public int getItemCount()
|
||||||
|
{
|
||||||
|
return m_menudef.getItemCount();
|
||||||
|
|
||||||
|
} // end getItemCount
|
||||||
|
|
||||||
public void setVariable(String name, String value)
|
public void setVariable(String name, String value)
|
||||||
{
|
{
|
||||||
if (m_menudef.isVariable(name))
|
if (m_menudef.isVariable(name))
|
||||||
|
@ -203,6 +222,12 @@ class StandardMenuRendering implements MenuRenderObject, SelfRenderable, FramedC
|
||||||
|
|
||||||
} // end setVariable
|
} // end setVariable
|
||||||
|
|
||||||
|
public void setSelectedIndex(int index)
|
||||||
|
{
|
||||||
|
m_selected_index = index;
|
||||||
|
|
||||||
|
} // end setSelectedIndex
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------------
|
/*--------------------------------------------------------------------------------
|
||||||
* Implementations from interface SelfRenderable
|
* Implementations from interface SelfRenderable
|
||||||
*--------------------------------------------------------------------------------
|
*--------------------------------------------------------------------------------
|
||||||
|
@ -248,12 +273,12 @@ class StandardMenuRendering implements MenuRenderObject, SelfRenderable, FramedC
|
||||||
{ // render this item
|
{ // render this item
|
||||||
s = item.getItemType();
|
s = item.getItemType();
|
||||||
if (s.equalsIgnoreCase("TEXT"))
|
if (s.equalsIgnoreCase("TEXT"))
|
||||||
renderTextItem(tctl,item);
|
renderTextItem(tctl,item,(m_selected_index==i));
|
||||||
if (s.equalsIgnoreCase("HEADER"))
|
else if (s.equalsIgnoreCase("HEADER"))
|
||||||
renderHeaderItem(tctl,item);
|
renderHeaderItem(tctl,item,(m_selected_index==i));
|
||||||
if (s.equalsIgnoreCase("IMAGE"))
|
else if (s.equalsIgnoreCase("IMAGE"))
|
||||||
renderImageItem(tctl,item);
|
renderImageItem(tctl,item,(m_selected_index==i));
|
||||||
if (s.equalsIgnoreCase("SEPARATOR"))
|
else if (s.equalsIgnoreCase("SEPARATOR"))
|
||||||
renderSeparatorItem(tctl,item);
|
renderSeparatorItem(tctl,item);
|
||||||
|
|
||||||
} // end if
|
} // end if
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
*
|
*
|
||||||
* 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@silcom.com>,
|
||||||
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
|
* 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-03 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Contributor(s):
|
* Contributor(s):
|
||||||
*/
|
*/
|
||||||
|
@ -92,6 +92,12 @@ public class LibraryVeniceCast
|
||||||
|
|
||||||
} // end queryContentBlockProvider
|
} // end queryContentBlockProvider
|
||||||
|
|
||||||
|
public final MenuProvider queryMenuProvider(Object obj)
|
||||||
|
{
|
||||||
|
return (MenuProvider)query(obj,MenuProvider.class);
|
||||||
|
|
||||||
|
} // end queryMenuProvider
|
||||||
|
|
||||||
public final RenderImage queryRenderImage(Object obj)
|
public final RenderImage queryRenderImage(Object obj)
|
||||||
{
|
{
|
||||||
return (RenderImage)query(obj,RenderImage.class);
|
return (RenderImage)query(obj,RenderImage.class);
|
||||||
|
|
|
@ -48,6 +48,18 @@ if (user.isAnonymous())
|
||||||
loader = cast.queryDialogLoader(req);
|
loader = cast.queryDialogLoader(req);
|
||||||
dlg = loader.loadDialogResource("user_profile.dlg.xml");
|
dlg = loader.loadDialogResource("user_profile.dlg.xml");
|
||||||
|
|
||||||
|
// Load the profile menu.
|
||||||
|
mprov = vcast.queryMenuProvider(req_help.getRequestObject(Namespaces.DYNAMO_OBJECT_NAMESPACE,"venice-menus"));
|
||||||
|
menu = mprov.getInlineMenu(user,VeniceNamespaces.USER_PROFILE_NAMESPACE,"user.profile.menu",cast.newIntArray(0));
|
||||||
|
if (menu.getItemCount()>1)
|
||||||
|
{ // set up the menu properly
|
||||||
|
menu.setVariable("target",stringutils.encodeURL(target));
|
||||||
|
menu.setSelectedIndex(0);
|
||||||
|
|
||||||
|
} // end if
|
||||||
|
else // don't display the menu
|
||||||
|
menu = null;
|
||||||
|
|
||||||
if (req_help.isVerb("GET"))
|
if (req_help.isVerb("GET"))
|
||||||
{ // Get the privacy settings and admin flags.
|
{ // Get the privacy settings and admin flags.
|
||||||
priv = cast.toOptionSet(user.getObject(VeniceNamespaces.USER_PROFILE_NAMESPACE,"privacy"));
|
priv = cast.toOptionSet(user.getObject(VeniceNamespaces.USER_PROFILE_NAMESPACE,"privacy"));
|
||||||
|
@ -113,7 +125,7 @@ if (req_help.isVerb("GET"))
|
||||||
dlg.setRenderParam("rtgt",stringutils.encodeURL(target));
|
dlg.setRenderParam("rtgt",stringutils.encodeURL(target));
|
||||||
vlib.setLocation(req,target);
|
vlib.setLocation(req,target);
|
||||||
vlib.setDisplayLogin(req,false);
|
vlib.setDisplayLogin(req,false);
|
||||||
dynamo.scriptReturn(new FrameDialog(dlg));
|
dynamo.scriptReturn(new FrameDialog(dlg,menu,null));
|
||||||
|
|
||||||
} // end if
|
} // end if
|
||||||
|
|
||||||
|
@ -164,7 +176,7 @@ catch (e)
|
||||||
dlg.setRenderParam("rtgt",stringutils.encodeURL(target));
|
dlg.setRenderParam("rtgt",stringutils.encodeURL(target));
|
||||||
vlib.setLocation(req,target);
|
vlib.setLocation(req,target);
|
||||||
vlib.setDisplayLogin(req,false);
|
vlib.setDisplayLogin(req,false);
|
||||||
dynamo.scriptReturn(new FrameDialog(dlg));
|
dynamo.scriptReturn(new FrameDialog(dlg,menu,null));
|
||||||
|
|
||||||
} // end catch
|
} // end catch
|
||||||
|
|
||||||
|
|
|
@ -93,3 +93,41 @@ html>body span.chdrsubtitle {
|
||||||
html>body td.errorhead, html>body td.errorbody {
|
html>body td.errorhead, html>body td.errorbody {
|
||||||
font-size: medium;
|
font-size: medium;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
## these are styles for inline menu lists
|
||||||
|
div.imenu {
|
||||||
|
padding: 5px;
|
||||||
|
border: 1px solid #000;
|
||||||
|
margin-bottom: 25px;
|
||||||
|
background-color: #6666cc;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.imenu ul {
|
||||||
|
margin-left: 0;
|
||||||
|
padding-left: 0;
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.imenu ul li {
|
||||||
|
margin-left: 0;
|
||||||
|
margin-bottom: 0;
|
||||||
|
padding: 2px 15px 5px;
|
||||||
|
border: 1px solid #000;
|
||||||
|
list-style: none;
|
||||||
|
display: inline;
|
||||||
|
background-color: #9999ff;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.imenu ul li.down {
|
||||||
|
border-bottom: 1px solid #fff;
|
||||||
|
list-style: none;
|
||||||
|
display: inline;
|
||||||
|
background-color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.imenu ul li.separator {
|
||||||
|
border: none;
|
||||||
|
list-style: none;
|
||||||
|
display: inline;
|
||||||
|
background-color: #6666cc;
|
||||||
|
}
|
||||||
|
|
|
@ -97,3 +97,8 @@ td.errorbody {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.selectedItem {
|
||||||
|
color: #3333aa;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user