added sidebox view, prep for sysadmin menu stuff
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
*
|
||||
* 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) 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):
|
||||
*/
|
||||
@@ -34,9 +34,6 @@ public interface VeniceNamespaces
|
||||
public static final String CONTENT_LAF_NAMESPACE =
|
||||
"http://www.silverwrist.com/NS/venice/2002/12/28/content.look.and.feel";
|
||||
|
||||
// public static final String VENICE_OBJECT_NAMESPACE =
|
||||
// "http://www.silverwrist.com/NS/venice/2002/12/28/venice.objects";
|
||||
|
||||
public static final String REQUEST_INFO_NAMESPACE =
|
||||
"http://www.silverwrist.com/NS/venice/2002/12/29/request.info";
|
||||
|
||||
@@ -58,4 +55,7 @@ public interface VeniceNamespaces
|
||||
public static final String MAIL_MESSAGES_NAMESPACE =
|
||||
"http://www.silverwrist.com/NS/venice/2003/01/03/system.mail.messages";
|
||||
|
||||
public static final String SYSTEM_PERMS_NAMESPACE =
|
||||
"http://www.silverwrist.com/NS/venice/2003/05/24/system.permissions";
|
||||
|
||||
} // end interface VeniceNamespaces
|
||||
|
||||
287
src/venice-base/com/silverwrist/venice/content/SideboxView.java
Normal file
287
src/venice-base/com/silverwrist/venice/content/SideboxView.java
Normal file
@@ -0,0 +1,287 @@
|
||||
/*
|
||||
* 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.content;
|
||||
|
||||
import java.util.*;
|
||||
import com.silverwrist.dynamo.iface.*;
|
||||
import com.silverwrist.dynamo.except.*;
|
||||
import com.silverwrist.dynamo.velocity.VelocityRenderable;
|
||||
import com.silverwrist.venice.frame.FramedContent;
|
||||
import com.silverwrist.venice.iface.Sidebox;
|
||||
|
||||
public class SideboxView implements FramedContent, VelocityRenderable
|
||||
{
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Static data members
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public static final int DEFAULT_WIDTH = 200;
|
||||
public static final int DEFAULT_MARGIN = 5;
|
||||
|
||||
private static final List MY_PARAMETERS;
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Attributes
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
private Object m_content; // page content (to left of sideboxes)
|
||||
private List m_sideboxes; // list of sideboxes
|
||||
private String m_configure_url = null; // configure URL
|
||||
private String m_configure_url_type = null; // configure URL type
|
||||
private int m_width = DEFAULT_WIDTH; // width of sideboxes
|
||||
private int m_margin = DEFAULT_MARGIN; // sidebox margins
|
||||
private String m_local_menu_selector = null; // local menu selector
|
||||
private String m_local_title = null; // local title
|
||||
private String m_local_qid = null; // local QID
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Constructors
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public SideboxView(Object content)
|
||||
{
|
||||
m_content = content;
|
||||
m_sideboxes = new ArrayList();
|
||||
|
||||
} // end constructor
|
||||
|
||||
public SideboxView(Object content, Collection sideboxes)
|
||||
{
|
||||
m_content = content;
|
||||
m_sideboxes = new ArrayList();
|
||||
addSideboxes(sideboxes);
|
||||
|
||||
} // end constructor
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Implementations from interface FramedContent
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public String getMenuSelector()
|
||||
{
|
||||
if (m_local_menu_selector!=null)
|
||||
return m_local_menu_selector;
|
||||
if (m_content instanceof FramedContent)
|
||||
return ((FramedContent)m_content).getMenuSelector();
|
||||
else
|
||||
return null;
|
||||
|
||||
} // end getMenuSelector
|
||||
|
||||
public String getPageTitle()
|
||||
{
|
||||
if (m_local_title!=null)
|
||||
return m_local_title;
|
||||
if (m_content instanceof FramedContent)
|
||||
return ((FramedContent)m_content).getPageTitle();
|
||||
else
|
||||
return "SideboxView";
|
||||
|
||||
} // end getPageTitle
|
||||
|
||||
public String getPageQID()
|
||||
{
|
||||
if (m_local_qid!=null)
|
||||
return m_local_qid;
|
||||
if (m_content instanceof FramedContent)
|
||||
return ((FramedContent)m_content).getPageQID();
|
||||
else
|
||||
return null;
|
||||
|
||||
} // end getPageQID
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Implementations from interface VelocityParamSupplier
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public Object getParameter(String key)
|
||||
{
|
||||
if (key.equals("content"))
|
||||
return m_content;
|
||||
else if (key.equals("sideboxes"))
|
||||
return Collections.unmodifiableList(m_sideboxes);
|
||||
else if (key.equals("config_URL"))
|
||||
return m_configure_url;
|
||||
else if (key.equals("config_type"))
|
||||
return m_configure_url_type;
|
||||
else if (key.equals("width"))
|
||||
return new Integer(m_width);
|
||||
else if (key.equals("margins"))
|
||||
return new Integer(m_margin);
|
||||
else
|
||||
return null;
|
||||
|
||||
} // end getParameter
|
||||
|
||||
public Collection getParameterNames()
|
||||
{
|
||||
return MY_PARAMETERS;
|
||||
|
||||
} // end getParameterNames
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Implementations from interface VelocityRenderable
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public String getMimeType()
|
||||
{
|
||||
return "text/html";
|
||||
|
||||
} // end getMimeType
|
||||
|
||||
public String getTemplateName()
|
||||
{
|
||||
return "common/sideboxview.vm";
|
||||
|
||||
} // end getTemplateName
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* External operations
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public void setMenuSelector(String s)
|
||||
{
|
||||
m_local_menu_selector = s;
|
||||
|
||||
} // end setMenuSelector
|
||||
|
||||
public void setPageTitle(String s)
|
||||
{
|
||||
m_local_title = s;
|
||||
|
||||
} // end setPageTitle
|
||||
|
||||
public void setPageQID(String s)
|
||||
{
|
||||
m_local_qid = s;
|
||||
|
||||
} // end setPageQID
|
||||
|
||||
public Object getContent()
|
||||
{
|
||||
return m_content;
|
||||
|
||||
} // end getContent
|
||||
|
||||
public void setContent(Object obj)
|
||||
{
|
||||
m_content = obj;
|
||||
|
||||
} // end setContent
|
||||
|
||||
public void addSidebox(Sidebox box)
|
||||
{
|
||||
m_sideboxes.add(box);
|
||||
|
||||
} // end addSidebox
|
||||
|
||||
public void addSideboxes(Collection coll)
|
||||
{
|
||||
Iterator it = coll.iterator();
|
||||
while (it.hasNext())
|
||||
{ // add only Sidebox instances to the list
|
||||
Object obj = it.next();
|
||||
if (obj instanceof Sidebox)
|
||||
m_sideboxes.add(obj);
|
||||
|
||||
} // end while
|
||||
|
||||
} // end addSideboxes
|
||||
|
||||
public void setSideboxes(Collection coll)
|
||||
{
|
||||
m_sideboxes.clear();
|
||||
addSideboxes(coll);
|
||||
|
||||
} // end setSideboxes
|
||||
|
||||
public String getConfigureURL()
|
||||
{
|
||||
return m_configure_url;
|
||||
|
||||
} // end getConfigureURL
|
||||
|
||||
public void setConfigureURL(String s)
|
||||
{
|
||||
m_configure_url = s;
|
||||
|
||||
} // end setConfigureURL
|
||||
|
||||
public String getConfigureURLType()
|
||||
{
|
||||
return m_configure_url_type;
|
||||
|
||||
} // end getConfigureURLType
|
||||
|
||||
public void setConfigureURLType(String s)
|
||||
{
|
||||
m_configure_url_type = s;
|
||||
|
||||
} // end setConfigureURLType
|
||||
|
||||
public int getWidth()
|
||||
{
|
||||
return m_width;
|
||||
|
||||
} // end getWidth
|
||||
|
||||
public void setWidth(int w)
|
||||
{
|
||||
m_width = w;
|
||||
|
||||
} // end setWidth
|
||||
|
||||
public int getMargin()
|
||||
{
|
||||
return m_margin;
|
||||
|
||||
} // end getMargin
|
||||
|
||||
public void setMargin(int m)
|
||||
{
|
||||
m_margin = m;
|
||||
|
||||
} // end setMargin
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Static initializer
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static
|
||||
{
|
||||
ArrayList tmp = new ArrayList();
|
||||
tmp.add("content");
|
||||
tmp.add("sideboxes");
|
||||
tmp.add("config_URL");
|
||||
tmp.add("config_type");
|
||||
tmp.add("width");
|
||||
tmp.add("margins");
|
||||
tmp.trimToSize();
|
||||
MY_PARAMETERS = Collections.unmodifiableList(tmp);
|
||||
|
||||
} // end static initializer
|
||||
|
||||
} // end class SideboxView
|
||||
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
* 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.content;
|
||||
|
||||
import com.silverwrist.venice.iface.Sidebox;
|
||||
|
||||
public class StringSidebox implements Sidebox
|
||||
{
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Attributes
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
private String m_title;
|
||||
private String m_data;
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Constructors
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public StringSidebox(String data)
|
||||
{
|
||||
m_title = "Sidebox";
|
||||
m_data = data;
|
||||
|
||||
} // end constructor
|
||||
|
||||
public StringSidebox(String data, String title)
|
||||
{
|
||||
m_title = title;
|
||||
m_data = data;
|
||||
|
||||
} // end constructor
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Overrides from class Object
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return m_data;
|
||||
|
||||
} // end toString
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Implementations from interface Sidebox
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public String getSideboxTitle()
|
||||
{
|
||||
return m_title;
|
||||
|
||||
} // end getSideboxTitle
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* External operations
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public void setSideboxTitle(String s)
|
||||
{
|
||||
m_title = s;
|
||||
|
||||
} // end setSideboxTitle
|
||||
|
||||
public String getData()
|
||||
{
|
||||
return m_data;
|
||||
|
||||
} // end getData
|
||||
|
||||
public void setData(String s)
|
||||
{
|
||||
m_data = s;
|
||||
|
||||
} // end setData
|
||||
|
||||
} // end class StringSidebox
|
||||
@@ -11,7 +11,7 @@
|
||||
*
|
||||
* 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) 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):
|
||||
*/
|
||||
@@ -27,6 +27,7 @@ import com.silverwrist.dynamo.RequestType;
|
||||
import com.silverwrist.dynamo.event.*;
|
||||
import com.silverwrist.dynamo.except.*;
|
||||
import com.silverwrist.dynamo.iface.*;
|
||||
import com.silverwrist.dynamo.security.SecurityReferenceMonitor;
|
||||
import com.silverwrist.dynamo.util.*;
|
||||
import com.silverwrist.dynamo.velocity.VelocityParamSupplier;
|
||||
import com.silverwrist.dynamo.velocity.VelocityRendererConfig;
|
||||
@@ -114,8 +115,6 @@ public class FrameAssembler
|
||||
|
||||
private static final Pattern PAT_LINEBREAK = Pattern.compile("\\r*\\n");
|
||||
|
||||
private static final int[] NO_ACLS = new int[0];
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Attributes
|
||||
*--------------------------------------------------------------------------------
|
||||
@@ -124,6 +123,7 @@ public class FrameAssembler
|
||||
private String m_name; // this object's name
|
||||
private ObjectProvider m_props; // global properties
|
||||
private ObjectProvider m_blocks; // global blocks
|
||||
private SecurityReferenceMonitor m_srm; // security reference monitor
|
||||
private MenuProvider m_menu_prov; // menu provider
|
||||
private String m_frame_template; // frame template parameter
|
||||
private HashMap m_globals = new HashMap(); // globals fed to Velocity
|
||||
@@ -227,7 +227,7 @@ public class FrameAssembler
|
||||
logger.info("FrameAssembler initializing");
|
||||
|
||||
XMLLoader loader = XMLLoader.get();
|
||||
String gprops = null, name_menu = null;
|
||||
String gprops = null, name_srm = null, name_menu = null;
|
||||
try
|
||||
{ // verify the right node name
|
||||
loader.verifyNodeName(config_root,"object");
|
||||
@@ -242,6 +242,7 @@ public class FrameAssembler
|
||||
|
||||
// get the name of the menu manager
|
||||
foo = loader.getSubElement(config_root_h,"providers");
|
||||
name_srm = loader.getAttribute(foo,"security");
|
||||
name_menu = loader.getAttribute(foo,"menu");
|
||||
|
||||
} // end try
|
||||
@@ -285,6 +286,10 @@ 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));
|
||||
// Load the menu provider.
|
||||
m_menu_prov = (MenuProvider)(GetObjectUtils.getDynamoComponent(services,MenuProvider.class,name_menu));
|
||||
|
||||
@@ -350,9 +355,11 @@ public class FrameAssembler
|
||||
Boolean display_login = (Boolean)(r.getObject(SessionInfoParams.REQ_NAMESPACE,
|
||||
SessionInfoParams.RATTR_DISPLAY_LOGIN));
|
||||
|
||||
// get the menus
|
||||
// get the fixed menu
|
||||
int[] acls = new int[1];
|
||||
acls[0] = m_srm.getGlobalAcl().getAclID();
|
||||
MenuRenderObject fixed_menu = m_menu_prov.getLeftMenu(user,VeniceNamespaces.FRAME_LAF_NAMESPACE,
|
||||
"fixed.menu",NO_ACLS);
|
||||
"fixed.menu",acls);
|
||||
|
||||
// get the footer and optionally insert line breaks
|
||||
String footer = (String)(m_blocks.getObject(NAMESPACE,BLOCK_FOOTER));
|
||||
@@ -433,6 +440,8 @@ public class FrameAssembler
|
||||
tmp2.put(PARAM_FAVICON_URL,String.class);
|
||||
tmp.put(PARAM_FAVICON_URL_TYPE,"favicon_ltyp");
|
||||
tmp2.put(PARAM_FAVICON_URL_TYPE,String.class);
|
||||
tmp.put(PARAM_LEFT_BAR_WIDTH,"lbar_width");
|
||||
tmp2.put(PARAM_LEFT_BAR_WIDTH,Integer.class);
|
||||
PROP_TO_VELOCITY = Collections.unmodifiableMap(tmp);
|
||||
PROP_TO_TYPE = Collections.unmodifiableMap(tmp2);
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
*
|
||||
* 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) 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):
|
||||
*/
|
||||
@@ -51,6 +51,8 @@ public interface FrameParameters
|
||||
|
||||
public static final String PARAM_FAVICON_URL_TYPE = "page.favicon.url.type";
|
||||
|
||||
public static final String PARAM_LEFT_BAR_WIDTH = "left.bar.width";
|
||||
|
||||
public static final String BLOCK_FOOTER = "footer";
|
||||
|
||||
public static final int OPT_COMMENTS = 0;
|
||||
|
||||
24
src/venice-base/com/silverwrist/venice/iface/Sidebox.java
Normal file
24
src/venice-base/com/silverwrist/venice/iface/Sidebox.java
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* 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.iface;
|
||||
|
||||
public interface Sidebox
|
||||
{
|
||||
public String getSideboxTitle();
|
||||
|
||||
} // end interface Sidebox
|
||||
Reference in New Issue
Block a user