added an extra parameter to frame generation, so I can mimic the custom

functionality alredy provided by the frame on Electric Minds
This commit is contained in:
Eric J. Bowersox 2003-06-16 07:22:11 +00:00
parent 821a0be3eb
commit ce6136ab9e
4 changed files with 23 additions and 16 deletions

View File

@ -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):
*/ */

View File

@ -297,8 +297,7 @@ public class FrameAssembler
m_base_params = new BaseParams(); // create base parameter object m_base_params = new BaseParams(); // create base parameter object
// Get the security reference monitor. // Get the security reference monitor.
m_srm = m_srm = (SecurityReferenceMonitor)(GetObjectUtils.getDynamoComponent(services,SecurityReferenceMonitor.class,
(SecurityReferenceMonitor)(GetObjectUtils.getDynamoComponent(services,SecurityReferenceMonitor.class,
name_srm)); name_srm));
// Load the menu provider. // Load the menu provider.
m_menu_prov = (MenuProvider)(GetObjectUtils.getDynamoComponent(services,MenuProvider.class,name_menu)); 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); m_shut_event = reg.registerDynamicUpdateListener(GlobalPropertyUpdateEvent.class,this);
// Add an object to the standard objects available to Velocity. // Add an object to the standard objects available to Velocity.
VelocityRendererConfig vrcon = VelocityRendererConfig vrcon = (VelocityRendererConfig)(services.queryService(VelocityRendererConfig.class));
(VelocityRendererConfig)(services.queryService(VelocityRendererConfig.class));
m_shut_vr = vrcon.addStandardComponentInstance("frame",new VelocityOps()); m_shut_vr = vrcon.addStandardComponentInstance("frame",new VelocityOps());
// Register this object as a filter for output. // Register this object as a filter for output.
@ -356,12 +354,10 @@ public class FrameAssembler
{ // get the user { // get the user
RequestHelper rh = new RequestHelper(r); RequestHelper rh = new RequestHelper(r);
SessionInfo session = rh.getSession(); SessionInfo session = rh.getSession();
DynamoUser user = (DynamoUser)(session.getObject(SessionInfoParams.NAMESPACE, DynamoUser user = (DynamoUser)(session.getObject(SessionInfoParams.NAMESPACE,SessionInfoParams.ATTR_USER));
SessionInfoParams.ATTR_USER));
// get the request-borne data // get the request-borne data
String location = (String)(r.getObject(SessionInfoParams.REQ_NAMESPACE, String location = (String)(r.getObject(SessionInfoParams.REQ_NAMESPACE,SessionInfoParams.RATTR_LOCATION));
SessionInfoParams.RATTR_LOCATION));
Boolean display_login = (Boolean)(r.getObject(SessionInfoParams.REQ_NAMESPACE, Boolean display_login = (Boolean)(r.getObject(SessionInfoParams.REQ_NAMESPACE,
SessionInfoParams.RATTR_DISPLAY_LOGIN)); SessionInfoParams.RATTR_DISPLAY_LOGIN));
@ -397,6 +393,7 @@ public class FrameAssembler
} // end if } // end if
MenuRenderObject floating_menu = null; MenuRenderObject floating_menu = null;
String floating_selector = null;
if (reload) if (reload)
{ // which menu do we load? { // which menu do we load?
if (menusel.equals("top")) if (menusel.equals("top"))
@ -418,14 +415,21 @@ public class FrameAssembler
} // end else if } // end else if
floating_selector = menusel_full;
// save the menu and menu selector into the session // 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,floating_menu);
session.setObject(SessionInfoParams.NAMESPACE,SessionInfoParams.ATTR_MENU_SELECTOR,menusel_full); session.setObject(SessionInfoParams.NAMESPACE,SessionInfoParams.ATTR_MENU_SELECTOR,menusel_full);
} // end if } // 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, floating_menu = (MenuRenderObject)(session.getObject(SessionInfoParams.NAMESPACE,
SessionInfoParams.ATTR_MENU)); SessionInfoParams.ATTR_MENU));
floating_selector = session.getObject(SessionInfoParams.NAMESPACE,
SessionInfoParams.ATTR_MENU_SELECTOR).toString();
} // end else
// get the footer and optionally insert line breaks // get the footer and optionally insert line breaks
String footer = (String)(m_blocks.getObject(NAMESPACE,BLOCK_FOOTER)); String footer = (String)(m_blocks.getObject(NAMESPACE,BLOCK_FOOTER));
@ -435,7 +439,7 @@ public class FrameAssembler
// return the FrameRendering! // return the FrameRendering!
return new FrameRendering((FramedContent)input,m_frame_template,m_base_params,user,location, 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 } // end try
catch (DatabaseException e) catch (DatabaseException e)

View File

@ -32,9 +32,9 @@ class FrameRendering implements VelocityRenderable
*-------------------------------------------------------------------------------- *--------------------------------------------------------------------------------
*/ */
private String m_templ; private String m_templ; // template to be used
private VelocityParamSupplier m_base_params; private VelocityParamSupplier m_base_params; // base variables common to all frames
private HashMap m_local_vars = new HashMap(); private HashMap m_local_vars = new HashMap(); // local variables
/*-------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------
* Constructor * Constructor
@ -43,7 +43,7 @@ class FrameRendering implements VelocityRenderable
FrameRendering(FramedContent content, String templ, VelocityParamSupplier base_params, DynamoUser user, FrameRendering(FramedContent content, String templ, VelocityParamSupplier base_params, DynamoUser user,
String location, Boolean display_login, MenuRenderObject fixed_menu, MenuRenderObject floating_menu, String location, Boolean display_login, MenuRenderObject fixed_menu, MenuRenderObject floating_menu,
String footer) String floating_selector, String footer)
{ {
m_templ = templ; m_templ = templ;
m_base_params = base_params; 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("display_login",display_login);
m_local_vars.put("fixed_menu",fixed_menu); m_local_vars.put("fixed_menu",fixed_menu);
m_local_vars.put("floating_menu",floating_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); m_local_vars.put("footer_text",footer);
} // end constructor } // end constructor

View File

@ -26,6 +26,7 @@
display_login = True if we should display the "Log In | Create Account" or "Log Out | Profile" links display_login = True if we should display the "Log In | Create Account" or "Log Out | Profile" links
fixed_menu = The "fixed" menu fixed_menu = The "fixed" menu
floating_menu = The "floating" menu floating_menu = The "floating" menu
floating_menu_selector = The string selector for the "floating" menu
footer_text = The text of the page footer footer_text = The text of the page footer
sitetitle = Site title (from global properties) sitetitle = Site title (from global properties)
siteurl = URL to the site siteurl = URL to the site
@ -117,6 +118,7 @@
<tr valign="top"> <tr valign="top">
<td align="left" width="$lbar_width" rowspan="2" class="frameleft"> <td align="left" width="$lbar_width" rowspan="2" class="frameleft">
#comment( "BEGIN LEFT SIDEBAR" ) #comment( "BEGIN LEFT SIDEBAR" )
#comment( "Floating menu selector: $!floating_menu_selector" )
<div class="frameleft">#render( $floating_menu )</div> <div class="frameleft">#render( $floating_menu )</div>
<div>&nbsp;</div> <div>&nbsp;</div>
<div class="frameleft">#render( $fixed_menu )</div> <div class="frameleft">#render( $fixed_menu )</div>