diff --git a/conf/venice-db-init-mysql.sql b/conf/venice-db-init-mysql.sql index 6b2668d..0bd0598 100644 --- a/conf/venice-db-init-mysql.sql +++ b/conf/venice-db-init-mysql.sql @@ -571,3 +571,8 @@ INSERT INTO menuitems (menuid, sequence, itemtype, text, linktype, link) VALUES (1, 1, 'TEXT', 'About Venice', 'FRAME', 'about-venice.html'); 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}'); diff --git a/src/dynamo-framework/com/silverwrist/dynamo/dialog/DialogImpl.java b/src/dynamo-framework/com/silverwrist/dynamo/dialog/DialogImpl.java index 0a70ec2..55ce56c 100644 --- a/src/dynamo-framework/com/silverwrist/dynamo/dialog/DialogImpl.java +++ b/src/dynamo-framework/com/silverwrist/dynamo/dialog/DialogImpl.java @@ -11,7 +11,7 @@ * * The Initial Developer of the Original Code is Eric J. Bowersox , * 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): */ @@ -164,6 +164,8 @@ class DialogImpl implements Dialog private String m_error_message = null; private Map m_default_render_params; private HashMap m_render_params; + private Object m_upper_content = null; + private Object m_lower_content = null; /*-------------------------------------------------------------------------------- * Constructors @@ -384,6 +386,10 @@ class DialogImpl implements Dialog // Get the content header and render it. 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. if (m_error_message!=null) wr.write("

\n" @@ -453,6 +459,10 @@ class DialogImpl implements Dialog wr.write("\n"); + // Render the "lower content" object, if any. + if (m_lower_content!=null) + control.renderSubObject(m_lower_content); + } // end render public void reset() @@ -640,4 +650,16 @@ class DialogImpl implements Dialog } // 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 diff --git a/src/dynamo-framework/com/silverwrist/dynamo/dialog/DialogManager.java b/src/dynamo-framework/com/silverwrist/dynamo/dialog/DialogManager.java index 19cf0cf..f4aa8a3 100644 --- a/src/dynamo-framework/com/silverwrist/dynamo/dialog/DialogManager.java +++ b/src/dynamo-framework/com/silverwrist/dynamo/dialog/DialogManager.java @@ -27,7 +27,7 @@ import com.silverwrist.dynamo.iface.*; import com.silverwrist.dynamo.util.*; public class DialogManager - implements NamedObject, ComponentInitialize, ComponentShutdown, DialogFactoryConfig, DialogLoader + implements NamedObject, ComponentInitialize, ComponentShutdown, DialogFactoryConfig, DialogLoader, TextRenderer { /*-------------------------------------------------------------------------------- * Internal class implementing the dialog item factory @@ -83,6 +83,7 @@ public class DialogManager private Hashtable m_factory_data = new Hashtable(); private ComponentShutdown m_shut_init; private ComponentShutdown m_shut_runtime; + private ComponentShutdown m_shut_render; /*-------------------------------------------------------------------------------- * Constructor @@ -190,6 +191,10 @@ public class DialogManager ssp = new SingletonServiceProvider("DialogManager",DialogLoader.class,(DialogLoader)this); 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 /*-------------------------------------------------------------------------------- @@ -199,6 +204,8 @@ public class DialogManager public void shutdown() { + m_shut_render.shutdown(); + m_shut_render = null; m_shut_runtime.shutdown(); m_shut_runtime = null; m_shut_init.shutdown(); @@ -297,4 +304,15 @@ public class DialogManager } // 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 diff --git a/src/dynamo-framework/com/silverwrist/dynamo/iface/Dialog.java b/src/dynamo-framework/com/silverwrist/dynamo/iface/Dialog.java index 8e7057a..80de974 100644 --- a/src/dynamo-framework/com/silverwrist/dynamo/iface/Dialog.java +++ b/src/dynamo-framework/com/silverwrist/dynamo/iface/Dialog.java @@ -11,7 +11,7 @@ * * The Initial Developer of the Original Code is Eric J. Bowersox , * 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): */ @@ -61,4 +61,8 @@ public interface Dialog extends Cloneable, NamedObject public void setRenderParam(String name, String value); + public void setUpperContentObject(Object o); + + public void setLowerContentObject(Object o); + } // end interface Dialog diff --git a/src/dynamo-framework/com/silverwrist/dynamo/script/LibraryCast.java b/src/dynamo-framework/com/silverwrist/dynamo/script/LibraryCast.java index de7d024..5ac6acd 100644 --- a/src/dynamo-framework/com/silverwrist/dynamo/script/LibraryCast.java +++ b/src/dynamo-framework/com/silverwrist/dynamo/script/LibraryCast.java @@ -77,6 +77,12 @@ public class LibraryCast } // end booleanObject + public final int[] newIntArray(int size) + { + return new int[size]; + + } // end newIntArray + public final ChainParameterInput queryChainParameterInput(Object obj) { return (ChainParameterInput)query(obj,ChainParameterInput.class); diff --git a/src/venice-base/com/silverwrist/venice/frame/FrameDialog.java b/src/venice-base/com/silverwrist/venice/frame/FrameDialog.java index 2ec0739..93a70a5 100644 --- a/src/venice-base/com/silverwrist/venice/frame/FrameDialog.java +++ b/src/venice-base/com/silverwrist/venice/frame/FrameDialog.java @@ -31,6 +31,8 @@ public class FrameDialog implements FramedContent, SelfRenderable private Dialog m_dialog; private String m_menu_sel = null; private String m_qid = null; + private Object m_content_above = null; + private Object m_content_below = null; /*-------------------------------------------------------------------------------- * Constructors @@ -50,6 +52,23 @@ public class FrameDialog implements FramedContent, SelfRenderable } // 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 *-------------------------------------------------------------------------------- @@ -85,7 +104,12 @@ public class FrameDialog implements FramedContent, SelfRenderable 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 @@ -106,4 +130,28 @@ public class FrameDialog implements FramedContent, SelfRenderable } // 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 diff --git a/src/venice-base/com/silverwrist/venice/iface/MenuProvider.java b/src/venice-base/com/silverwrist/venice/iface/MenuProvider.java index c1101d8..431993a 100644 --- a/src/venice-base/com/silverwrist/venice/iface/MenuProvider.java +++ b/src/venice-base/com/silverwrist/venice/iface/MenuProvider.java @@ -28,4 +28,7 @@ public interface MenuProvider public MenuRenderObject getLeftMenu(DynamoUser caller, String namespace, String name, int[] acl_ids) throws DatabaseException; + public MenuRenderObject getInlineMenu(DynamoUser caller, String namespace, String name, int[] acl_ids) + throws DatabaseException; + } // end interface MenuProvider diff --git a/src/venice-base/com/silverwrist/venice/iface/MenuRenderObject.java b/src/venice-base/com/silverwrist/venice/iface/MenuRenderObject.java index 04861da..876dc10 100644 --- a/src/venice-base/com/silverwrist/venice/iface/MenuRenderObject.java +++ b/src/venice-base/com/silverwrist/venice/iface/MenuRenderObject.java @@ -19,6 +19,10 @@ package com.silverwrist.venice.iface; public interface MenuRenderObject { + public int getItemCount(); + public void setVariable(String name, String value); + public void setSelectedIndex(int index); + } // end interface MenuRenderObject diff --git a/src/venice-base/com/silverwrist/venice/menu/InlineMenuRendering.java b/src/venice-base/com/silverwrist/venice/menu/InlineMenuRendering.java new file mode 100644 index 0000000..1b21065 --- /dev/null +++ b/src/venice-base/com/silverwrist/venice/menu/InlineMenuRendering.java @@ -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 . + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT + * WARRANTY OF ANY KIND, either express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Original Code is the Venice Web Communities System. + * + * The Initial Developer of the Original Code is Eric J. Bowersox , + * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are + * Copyright (C) 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'); + if (selected) + wr.write(""); + else if (item.isEnabled() && (item.getLink()!=null)) + { // write the link + URLRewriter rewriter = (URLRewriter)(control.queryService(URLRewriter.class)); + wr.write("'); + + } // end if + else // just disable the text + wr.write(""); + wr.write(StringUtils.encodeHTML(StringUtils.replaceAllVariables(item.getText(),m_local_vars))); + if (selected) + wr.write(""); + else if (item.isEnabled()) + wr.write(""); + else + wr.write(""); + wr.write("\n"); + + } // end renderTextItem + + private final void renderHeaderItem(TextRenderControl control, MenuItemDefinition item, boolean selected) + throws IOException, RenderingException + { + PrintWriter wr = control.getWriter(); + wr.write(""); + if (!selected) + { // write the sequence beginning + if (item.isEnabled() && (item.getLink()!=null)) + { // write the link + URLRewriter rewriter = (URLRewriter)(control.queryService(URLRewriter.class)); + wr.write("'); + + } // end if + else // just disable the text + wr.write(""); + + } // end if + + wr.write(StringUtils.encodeHTML(StringUtils.replaceAllVariables(item.getText(),m_local_vars))); + if (!selected) + { // write the sequence end + if (item.isEnabled()) + wr.write(""); + else + wr.write(""); + + } // end if + + wr.write("\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("'); + if (!selected) + { // write the opening sequence + if (item.isEnabled() && (item.getLink()!=null)) + { // write the link + wr.write("'); + + } // end if + else // just disable the text + wr.write(""); + + } // end if + + String[] data = StringUtils.split(item.getText(),",",4); + wr.write("\"\"");"); + if (!selected) + { // write the closing sequence + if (item.isEnabled()) + wr.write(""); + else + wr.write(""); + + } // end if + + wr.write("\n"); + + } // end renderImageItem + + private final void renderSeparatorItem(TextRenderControl control, MenuItemDefinition item) + throws IOException, RenderingException + { + PrintWriter wr = control.getWriter(); + wr.write("

  •   
  • "); + + } // 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("
    \n"); + + } // end render + +} // end class InlineMenuRendering diff --git a/src/venice-base/com/silverwrist/venice/menu/LeftMenuRendering.java b/src/venice-base/com/silverwrist/venice/menu/LeftMenuRendering.java index db0daca..b3505ef 100644 --- a/src/venice-base/com/silverwrist/venice/menu/LeftMenuRendering.java +++ b/src/venice-base/com/silverwrist/venice/menu/LeftMenuRendering.java @@ -35,6 +35,7 @@ class LeftMenuRendering implements MenuRenderObject, SelfRenderable private MenuDefinition m_menudef; private boolean[] m_showitem; private HashMap m_local_vars; + private int m_selected_index = -1; /*-------------------------------------------------------------------------------- * 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 { PrintWriter wr = control.getWriter(); for (int i=0; i"); + else if (item.isEnabled() && (item.getLink()!=null)) { // write the link URLRewriter rewriter = (URLRewriter)(control.queryService(URLRewriter.class)); wr.write(""); wr.write(StringUtils.encodeHTML(StringUtils.replaceAllVariables(item.getText(),m_local_vars))); - if (item.isEnabled()) + if (selected) + wr.write(""); + else if (item.isEnabled()) wr.write(""); else wr.write(""); @@ -98,43 +103,53 @@ class LeftMenuRendering implements MenuRenderObject, SelfRenderable } // end renderTextItem - private final void renderHeaderItem(TextRenderControl control, MenuItemDefinition item) + private final void renderHeaderItem(TextRenderControl control, MenuItemDefinition item, boolean selected) throws IOException, RenderingException { PrintWriter wr = control.getWriter(); for (int i=0; i"); - if (item.isEnabled() && (item.getLink()!=null)) - { // write the link - URLRewriter rewriter = (URLRewriter)(control.queryService(URLRewriter.class)); - wr.write(""); + if (!selected) + { // write the opening sequence + if (item.isEnabled() && (item.getLink()!=null)) + { // write the link + URLRewriter rewriter = (URLRewriter)(control.queryService(URLRewriter.class)); + wr.write(""); + + } // end if + else // just disable the text + wr.write(""); } // end if - else // just disable the text - wr.write(""); + wr.write(StringUtils.encodeHTML(StringUtils.replaceAllVariables(item.getText(),m_local_vars))); - if (item.isEnabled()) - wr.write(""); - else - wr.write(""); + if (!selected) + { // write the closing sequence + if (item.isEnabled()) + wr.write(""); + else + wr.write(""); + + } // end if + wr.write("
    \n"); } // end renderHeaderItem - private final void renderImageItem(TextRenderControl control, MenuItemDefinition item) + private final void renderImageItem(TextRenderControl control, MenuItemDefinition item, boolean selected) throws IOException, RenderingException { URLRewriter rewriter = (URLRewriter)(control.queryService(URLRewriter.class)); @@ -142,25 +157,30 @@ class LeftMenuRendering implements MenuRenderObject, SelfRenderable PrintWriter wr = control.getWriter(); for (int i=0; i"); + if (!selected) + { // write the opening sequence + if (item.isEnabled() && (item.getLink()!=null)) + { // write the link + wr.write(""); + + } // end if + else // just disable the text + wr.write(""); } // end if - else // just disable the text - wr.write(""); + String[] data = StringUtils.split(item.getText(),",",4); wr.write("\"""); - if (item.isEnabled()) - wr.write(""); - else - wr.write(""); + if (!selected) + { // write the closing sequence + if (item.isEnabled()) + wr.write(""); + else + wr.write(""); + + } // end if + wr.write("
    \n"); } // 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) { if (m_menudef.isVariable(name)) @@ -198,6 +229,12 @@ class LeftMenuRendering implements MenuRenderObject, SelfRenderable } // end setVariable + public void setSelectedIndex(int index) + { + m_selected_index = index; + + } // end setSelectedIndex + /*-------------------------------------------------------------------------------- * Implementations from interface SelfRenderable *-------------------------------------------------------------------------------- @@ -222,12 +259,12 @@ class LeftMenuRendering implements MenuRenderObject, SelfRenderable { // render this item String s = item.getItemType(); if (s.equalsIgnoreCase("TEXT")) - renderTextItem(tctrl,item); - if (s.equalsIgnoreCase("HEADER")) - renderHeaderItem(tctrl,item); - if (s.equalsIgnoreCase("IMAGE")) - renderImageItem(tctrl,item); - if (s.equalsIgnoreCase("SEPARATOR")) + renderTextItem(tctrl,item,(m_selected_index==i)); + else if (s.equalsIgnoreCase("HEADER")) + renderHeaderItem(tctrl,item,(m_selected_index==i)); + else if (s.equalsIgnoreCase("IMAGE")) + renderImageItem(tctrl,item,(m_selected_index==i)); + else if (s.equalsIgnoreCase("SEPARATOR")) renderSeparatorItem(tctrl,item); } // end if diff --git a/src/venice-base/com/silverwrist/venice/menu/MenuManager.java b/src/venice-base/com/silverwrist/venice/menu/MenuManager.java index ebf1de9..392ce71 100644 --- a/src/venice-base/com/silverwrist/venice/menu/MenuManager.java +++ b/src/venice-base/com/silverwrist/venice/menu/MenuManager.java @@ -185,4 +185,20 @@ public class MenuManager implements NamedObject, ComponentInitialize, ComponentS } // 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 diff --git a/src/venice-base/com/silverwrist/venice/menu/StandardMenuRendering.java b/src/venice-base/com/silverwrist/venice/menu/StandardMenuRendering.java index 80ebce2..2059aa6 100644 --- a/src/venice-base/com/silverwrist/venice/menu/StandardMenuRendering.java +++ b/src/venice-base/com/silverwrist/venice/menu/StandardMenuRendering.java @@ -38,6 +38,7 @@ class StandardMenuRendering implements MenuRenderObject, SelfRenderable, FramedC private boolean[] m_showitem; private HashMap m_local_vars; private ContentBlock m_bullet = null; + private int m_selected_index = -1; /*-------------------------------------------------------------------------------- * 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 { PrintWriter wr = control.getWriter(); @@ -74,7 +75,9 @@ class StandardMenuRendering implements MenuRenderObject, SelfRenderable, FramedC wr.write("    "); control.renderSubObject(m_bullet); wr.write(" "); - if (item.isEnabled() && (item.getLink()!=null)) + if (selected) + wr.write(""); + else if (item.isEnabled() && (item.getLink()!=null)) { // write the link URLRewriter rewriter = (URLRewriter)(control.queryService(URLRewriter.class)); wr.write(""); wr.write(StringUtils.encodeHTML(StringUtils.replaceAllVariables(item.getText(),m_local_vars))); - if (item.isEnabled()) + if (selected) + wr.write(""); + else if (item.isEnabled()) wr.write(""); else wr.write(""); @@ -103,14 +108,16 @@ class StandardMenuRendering implements MenuRenderObject, SelfRenderable, FramedC } // end renderTextItem - private final void renderHeaderItem(TextRenderControl control, MenuItemDefinition item) + private final void renderHeaderItem(TextRenderControl control, MenuItemDefinition item, boolean selected) throws IOException, RenderingException { PrintWriter wr = control.getWriter(); for (int i=0; i"); - if (item.isEnabled() && (item.getLink()!=null)) + if (selected) + wr.write(""); + else if (item.isEnabled() && (item.getLink()!=null)) { // write the link URLRewriter rewriter = (URLRewriter)(control.queryService(URLRewriter.class)); wr.write(""); wr.write(StringUtils.encodeHTML(StringUtils.replaceAllVariables(item.getText(),m_local_vars))); - if (item.isEnabled()) + if (selected) + wr.write(""); + else if (item.isEnabled()) wr.write(""); else wr.write(""); @@ -139,7 +148,7 @@ class StandardMenuRendering implements MenuRenderObject, SelfRenderable, FramedC } // end renderHeaderItem - private final void renderImageItem(TextRenderControl control, MenuItemDefinition item) + private final void renderImageItem(TextRenderControl control, MenuItemDefinition item, boolean selected) throws IOException, RenderingException { URLRewriter rewriter = (URLRewriter)(control.queryService(URLRewriter.class)); @@ -147,7 +156,9 @@ class StandardMenuRendering implements MenuRenderObject, SelfRenderable, FramedC PrintWriter wr = control.getWriter(); for (int i=0; i"); + else if (item.isEnabled() && (item.getLink()!=null)) { // write the link wr.write(""); - if (item.isEnabled()) + if (selected) + wr.write(""); + else if (item.isEnabled()) wr.write(""); else wr.write(""); @@ -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) { if (m_menudef.isVariable(name)) @@ -203,6 +222,12 @@ class StandardMenuRendering implements MenuRenderObject, SelfRenderable, FramedC } // end setVariable + public void setSelectedIndex(int index) + { + m_selected_index = index; + + } // end setSelectedIndex + /*-------------------------------------------------------------------------------- * Implementations from interface SelfRenderable *-------------------------------------------------------------------------------- @@ -248,12 +273,12 @@ class StandardMenuRendering implements MenuRenderObject, SelfRenderable, FramedC { // render this item s = item.getItemType(); if (s.equalsIgnoreCase("TEXT")) - renderTextItem(tctl,item); - if (s.equalsIgnoreCase("HEADER")) - renderHeaderItem(tctl,item); - if (s.equalsIgnoreCase("IMAGE")) - renderImageItem(tctl,item); - if (s.equalsIgnoreCase("SEPARATOR")) + renderTextItem(tctl,item,(m_selected_index==i)); + else if (s.equalsIgnoreCase("HEADER")) + renderHeaderItem(tctl,item,(m_selected_index==i)); + else if (s.equalsIgnoreCase("IMAGE")) + renderImageItem(tctl,item,(m_selected_index==i)); + else if (s.equalsIgnoreCase("SEPARATOR")) renderSeparatorItem(tctl,item); } // end if diff --git a/src/venice-base/com/silverwrist/venice/script/LibraryVeniceCast.java b/src/venice-base/com/silverwrist/venice/script/LibraryVeniceCast.java index 1e75ed3..db3773d 100644 --- a/src/venice-base/com/silverwrist/venice/script/LibraryVeniceCast.java +++ b/src/venice-base/com/silverwrist/venice/script/LibraryVeniceCast.java @@ -11,7 +11,7 @@ * * The Initial Developer of the Original Code is Eric J. Bowersox , * 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): */ @@ -92,6 +92,12 @@ public class LibraryVeniceCast } // end queryContentBlockProvider + public final MenuProvider queryMenuProvider(Object obj) + { + return (MenuProvider)query(obj,MenuProvider.class); + + } // end queryMenuProvider + public final RenderImage queryRenderImage(Object obj) { return (RenderImage)query(obj,RenderImage.class); diff --git a/venice-data/scripts/profile.js b/venice-data/scripts/profile.js index ced7d20..5237ece 100644 --- a/venice-data/scripts/profile.js +++ b/venice-data/scripts/profile.js @@ -48,6 +48,18 @@ if (user.isAnonymous()) loader = cast.queryDialogLoader(req); 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")) { // Get the privacy settings and admin flags. 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)); vlib.setLocation(req,target); vlib.setDisplayLogin(req,false); - dynamo.scriptReturn(new FrameDialog(dlg)); + dynamo.scriptReturn(new FrameDialog(dlg,menu,null)); } // end if @@ -164,7 +176,7 @@ catch (e) dlg.setRenderParam("rtgt",stringutils.encodeURL(target)); vlib.setLocation(req,target); vlib.setDisplayLogin(req,false); - dynamo.scriptReturn(new FrameDialog(dlg)); + dynamo.scriptReturn(new FrameDialog(dlg,menu,null)); } // end catch diff --git a/venice-data/velocity/stylesheets/adv_base.vm b/venice-data/velocity/stylesheets/adv_base.vm index a378e39..bef03da 100644 --- a/venice-data/velocity/stylesheets/adv_base.vm +++ b/venice-data/velocity/stylesheets/adv_base.vm @@ -93,3 +93,41 @@ html>body span.chdrsubtitle { html>body td.errorhead, html>body td.errorbody { 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; + } diff --git a/venice-data/velocity/stylesheets/normal_base.vm b/venice-data/velocity/stylesheets/normal_base.vm index 6eab800..5b60fd2 100644 --- a/venice-data/velocity/stylesheets/normal_base.vm +++ b/venice-data/velocity/stylesheets/normal_base.vm @@ -97,3 +97,8 @@ td.errorbody { text-align: center; font-size: 15px; } + +.selectedItem { + color: #3333aa; + font-weight: bold; + }