*** empty log message ***
This commit is contained in:
@@ -0,0 +1,167 @@
|
||||
/*
|
||||
* 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.util.*;
|
||||
import com.silverwrist.dynamo.except.*;
|
||||
import com.silverwrist.dynamo.iface.*;
|
||||
import com.silverwrist.dynamo.security.SecurityReferenceMonitor;
|
||||
|
||||
public class MenuItemDefinition
|
||||
{
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Attributes
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
private String m_type;
|
||||
private boolean m_enable;
|
||||
private int m_indent;
|
||||
private String m_text;
|
||||
private String m_linktype;
|
||||
private String m_link;
|
||||
private String m_target;
|
||||
private String m_title;
|
||||
private String m_on_click;
|
||||
private String m_perm_namespace;
|
||||
private String m_perm_name;
|
||||
private String m_ifdef_var;
|
||||
private String m_ifndef_var;
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Constructor
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
MenuItemDefinition(String type, boolean enable, int indent, String text, String linktype, String link,
|
||||
String target, String title, String on_click, String perm_namespace, String perm_name,
|
||||
String ifdef_var, String ifndef_var)
|
||||
{
|
||||
m_type = type;
|
||||
m_enable = enable;
|
||||
m_indent = indent;
|
||||
m_text = text;
|
||||
m_linktype = linktype;
|
||||
m_link = link;
|
||||
if ((m_link!=null) && (m_linktype==null))
|
||||
m_linktype = "ABSOLUTE";
|
||||
m_target = target;
|
||||
m_title = title;
|
||||
m_on_click = on_click;
|
||||
m_perm_namespace = perm_namespace;
|
||||
m_perm_name = perm_name;
|
||||
m_ifdef_var = ifdef_var;
|
||||
m_ifndef_var = ifndef_var;
|
||||
|
||||
} // end constructor
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Internal operations
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
boolean itemAppears(DynamoUser caller, SecurityReferenceMonitor srm, int[] acl_ids) throws DatabaseException
|
||||
{
|
||||
if ((m_perm_namespace==null) && (m_perm_name==null))
|
||||
return true;
|
||||
for (int i=0; i<acl_ids.length; i++)
|
||||
{ // test each of the ACL IDs in turn
|
||||
if (srm.testPermission(acl_ids[i],caller,m_perm_namespace,m_perm_name))
|
||||
return true;
|
||||
|
||||
} // end for
|
||||
|
||||
return false;
|
||||
|
||||
} // end itemAppears
|
||||
|
||||
boolean itemDefined(Map vars)
|
||||
{
|
||||
boolean r1, r2;
|
||||
if (m_ifdef_var==null)
|
||||
r1 = true;
|
||||
else
|
||||
r1 = vars.containsKey(m_ifdef_var);
|
||||
if (m_ifndef_var==null)
|
||||
r2 = true;
|
||||
else
|
||||
r2 = !(vars.containsKey(m_ifndef_var));
|
||||
return (r1 && r2);
|
||||
|
||||
} // end itemDefined
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* External operations
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public String getItemType()
|
||||
{
|
||||
return m_type;
|
||||
|
||||
} // end getItemType
|
||||
|
||||
public boolean isEnabled()
|
||||
{
|
||||
return m_enable;
|
||||
|
||||
} // end isEnabled
|
||||
|
||||
public int getIndentLevel()
|
||||
{
|
||||
return m_indent;
|
||||
|
||||
} // end getIndentLevel
|
||||
|
||||
public String getText()
|
||||
{
|
||||
return m_text;
|
||||
|
||||
} // end getText
|
||||
|
||||
public String getLinkType()
|
||||
{
|
||||
return m_linktype;
|
||||
|
||||
} // end getLinkType
|
||||
|
||||
public String getLink()
|
||||
{
|
||||
return m_link;
|
||||
|
||||
} // end getLink
|
||||
|
||||
public String getTarget()
|
||||
{
|
||||
return m_target;
|
||||
|
||||
} // end getTarget
|
||||
|
||||
public String getTitle()
|
||||
{
|
||||
return m_title;
|
||||
|
||||
} // end getTitle
|
||||
|
||||
public String getOnClick()
|
||||
{
|
||||
return m_on_click;
|
||||
|
||||
} // end getOnClick
|
||||
|
||||
} // end class MenuItemDefinition
|
||||
Reference in New Issue
Block a user