From ce6136ab9e5bdb4d3a89784262cc1d52191db6ce Mon Sep 17 00:00:00 2001 From: "Eric J. Bowersox" Date: Mon, 16 Jun 2003 07:22:11 +0000 Subject: [PATCH] added an extra parameter to frame generation, so I can mimic the custom functionality alredy provided by the frame on Electric Minds --- .../dynamo/security/AclOperations_mysql.java | 2 +- .../venice/frame/FrameAssembler.java | 26 +++++++++++-------- .../venice/frame/FrameRendering.java | 9 ++++--- venice-data/velocity/frame.vm | 2 ++ 4 files changed, 23 insertions(+), 16 deletions(-) diff --git a/src/dynamo-framework/com/silverwrist/dynamo/security/AclOperations_mysql.java b/src/dynamo-framework/com/silverwrist/dynamo/security/AclOperations_mysql.java index 94b3e09..f2f6d3f 100644 --- a/src/dynamo-framework/com/silverwrist/dynamo/security/AclOperations_mysql.java +++ b/src/dynamo-framework/com/silverwrist/dynamo/security/AclOperations_mysql.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): */ diff --git a/src/venice-base/com/silverwrist/venice/frame/FrameAssembler.java b/src/venice-base/com/silverwrist/venice/frame/FrameAssembler.java index 45212a2..41fa3f3 100644 --- a/src/venice-base/com/silverwrist/venice/frame/FrameAssembler.java +++ b/src/venice-base/com/silverwrist/venice/frame/FrameAssembler.java @@ -297,9 +297,8 @@ public class FrameAssembler m_base_params = new BaseParams(); // create base parameter object // Get the security reference monitor. - m_srm = - (SecurityReferenceMonitor)(GetObjectUtils.getDynamoComponent(services,SecurityReferenceMonitor.class, - name_srm)); + m_srm = (SecurityReferenceMonitor)(GetObjectUtils.getDynamoComponent(services,SecurityReferenceMonitor.class, + name_srm)); // Load the menu provider. m_menu_prov = (MenuProvider)(GetObjectUtils.getDynamoComponent(services,MenuProvider.class,name_menu)); @@ -309,8 +308,7 @@ public class FrameAssembler m_shut_event = reg.registerDynamicUpdateListener(GlobalPropertyUpdateEvent.class,this); // Add an object to the standard objects available to Velocity. - VelocityRendererConfig vrcon = - (VelocityRendererConfig)(services.queryService(VelocityRendererConfig.class)); + VelocityRendererConfig vrcon = (VelocityRendererConfig)(services.queryService(VelocityRendererConfig.class)); m_shut_vr = vrcon.addStandardComponentInstance("frame",new VelocityOps()); // Register this object as a filter for output. @@ -356,12 +354,10 @@ public class FrameAssembler { // get the user RequestHelper rh = new RequestHelper(r); SessionInfo session = rh.getSession(); - DynamoUser user = (DynamoUser)(session.getObject(SessionInfoParams.NAMESPACE, - SessionInfoParams.ATTR_USER)); + DynamoUser user = (DynamoUser)(session.getObject(SessionInfoParams.NAMESPACE,SessionInfoParams.ATTR_USER)); // get the request-borne data - String location = (String)(r.getObject(SessionInfoParams.REQ_NAMESPACE, - SessionInfoParams.RATTR_LOCATION)); + String location = (String)(r.getObject(SessionInfoParams.REQ_NAMESPACE,SessionInfoParams.RATTR_LOCATION)); Boolean display_login = (Boolean)(r.getObject(SessionInfoParams.REQ_NAMESPACE, SessionInfoParams.RATTR_DISPLAY_LOGIN)); @@ -397,6 +393,7 @@ public class FrameAssembler } // end if MenuRenderObject floating_menu = null; + String floating_selector = null; if (reload) { // which menu do we load? if (menusel.equals("top")) @@ -418,14 +415,21 @@ public class FrameAssembler } // end else if + floating_selector = menusel_full; + // save the menu and menu selector into the session session.setObject(SessionInfoParams.NAMESPACE,SessionInfoParams.ATTR_MENU,floating_menu); session.setObject(SessionInfoParams.NAMESPACE,SessionInfoParams.ATTR_MENU_SELECTOR,menusel_full); } // end if - else // get the current menu from the session + else + { // get the current menu from the session floating_menu = (MenuRenderObject)(session.getObject(SessionInfoParams.NAMESPACE, SessionInfoParams.ATTR_MENU)); + floating_selector = session.getObject(SessionInfoParams.NAMESPACE, + SessionInfoParams.ATTR_MENU_SELECTOR).toString(); + + } // end else // get the footer and optionally insert line breaks String footer = (String)(m_blocks.getObject(NAMESPACE,BLOCK_FOOTER)); @@ -435,7 +439,7 @@ public class FrameAssembler // return the FrameRendering! return new FrameRendering((FramedContent)input,m_frame_template,m_base_params,user,location, - display_login,fixed_menu,floating_menu,footer); + display_login,fixed_menu,floating_menu,floating_selector,footer); } // end try catch (DatabaseException e) diff --git a/src/venice-base/com/silverwrist/venice/frame/FrameRendering.java b/src/venice-base/com/silverwrist/venice/frame/FrameRendering.java index 51d4c8b..03c97bb 100644 --- a/src/venice-base/com/silverwrist/venice/frame/FrameRendering.java +++ b/src/venice-base/com/silverwrist/venice/frame/FrameRendering.java @@ -32,9 +32,9 @@ class FrameRendering implements VelocityRenderable *-------------------------------------------------------------------------------- */ - private String m_templ; - private VelocityParamSupplier m_base_params; - private HashMap m_local_vars = new HashMap(); + private String m_templ; // template to be used + private VelocityParamSupplier m_base_params; // base variables common to all frames + private HashMap m_local_vars = new HashMap(); // local variables /*-------------------------------------------------------------------------------- * Constructor @@ -43,7 +43,7 @@ class FrameRendering implements VelocityRenderable FrameRendering(FramedContent content, String templ, VelocityParamSupplier base_params, DynamoUser user, String location, Boolean display_login, MenuRenderObject fixed_menu, MenuRenderObject floating_menu, - String footer) + String floating_selector, String footer) { m_templ = templ; m_base_params = base_params; @@ -58,6 +58,7 @@ class FrameRendering implements VelocityRenderable m_local_vars.put("display_login",display_login); m_local_vars.put("fixed_menu",fixed_menu); m_local_vars.put("floating_menu",floating_menu); + m_local_vars.put("floating_menu_selector",floating_selector); m_local_vars.put("footer_text",footer); } // end constructor diff --git a/venice-data/velocity/frame.vm b/venice-data/velocity/frame.vm index 611f285..8bf5f46 100644 --- a/venice-data/velocity/frame.vm +++ b/venice-data/velocity/frame.vm @@ -26,6 +26,7 @@ display_login = True if we should display the "Log In | Create Account" or "Log Out | Profile" links fixed_menu = The "fixed" menu floating_menu = The "floating" menu + floating_menu_selector = The string selector for the "floating" menu footer_text = The text of the page footer sitetitle = Site title (from global properties) siteurl = URL to the site @@ -117,6 +118,7 @@ #comment( "BEGIN LEFT SIDEBAR" ) + #comment( "Floating menu selector: $!floating_menu_selector" )
#render( $floating_menu )
 
#render( $fixed_menu )