with one switch, a system administrator can now disable the category support
(no searching for categories, no getting communities by category, no category display on community profile, no changing a community's category)
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) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
* Copyright (C) 2001-02 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
@@ -33,6 +33,7 @@ public final class GlobalProperties
|
||||
private int audit_records_per_page;
|
||||
private int community_create_level;
|
||||
private boolean display_post_pictures;
|
||||
private boolean disable_categories;
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Constructor
|
||||
@@ -50,6 +51,7 @@ public final class GlobalProperties
|
||||
audit_records_per_page = 100;
|
||||
community_create_level = 1000; // this is actually the "normal user" security level
|
||||
display_post_pictures = false;
|
||||
disable_categories = false;
|
||||
|
||||
} // end constructor
|
||||
|
||||
@@ -166,4 +168,16 @@ public final class GlobalProperties
|
||||
|
||||
} // end setDisplayPostPictures
|
||||
|
||||
public final boolean getDisableCategories()
|
||||
{
|
||||
return disable_categories;
|
||||
|
||||
} // end getDisableCategories
|
||||
|
||||
public final void setDisableCategories(boolean b)
|
||||
{
|
||||
disable_categories = b;
|
||||
|
||||
} // end setDisableCategories
|
||||
|
||||
} // end class GlobalProperties
|
||||
|
||||
@@ -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) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
* Copyright (C) 2001-02 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
@@ -89,4 +89,6 @@ public interface VeniceEngine extends SearchMode, ServiceGroup
|
||||
|
||||
public abstract SecurityInfo getSecurityInfo();
|
||||
|
||||
public abstract boolean useCategories();
|
||||
|
||||
} // end interface VeniceEngine
|
||||
|
||||
@@ -334,6 +334,8 @@ class CommunityUserContextImpl implements CommunityContext, CommunityBackend
|
||||
|
||||
public int getCategoryID()
|
||||
{
|
||||
if (env.getEngine().getParamBoolean(EngineBackend.BP_NOCATEGORIES))
|
||||
return 0;
|
||||
CommunityData d = getDataNE();
|
||||
if (d!=null)
|
||||
return d.getCategoryID();
|
||||
@@ -344,6 +346,8 @@ class CommunityUserContextImpl implements CommunityContext, CommunityBackend
|
||||
|
||||
public CategoryDescriptor getCategory() throws DataException
|
||||
{
|
||||
if (env.getEngine().getParamBoolean(EngineBackend.BP_NOCATEGORIES))
|
||||
throw new DataException("The category system has been disabled on this site.");
|
||||
if (deleted)
|
||||
throw new DataException("This community has been deleted.");
|
||||
return new CategoryDescriptorImpl(env,getData().getCategoryID(),
|
||||
@@ -571,6 +575,8 @@ class CommunityUserContextImpl implements CommunityContext, CommunityBackend
|
||||
|
||||
public void setCategoryID(int catid) throws DataException, AccessError
|
||||
{
|
||||
if (env.getEngine().getParamBoolean(EngineBackend.BP_NOCATEGORIES))
|
||||
throw new DataException("The category system has been disabled on this site.");
|
||||
getData().testMembership(level,is_member);
|
||||
if (!(getData().canModifyCommunityProfile(level)))
|
||||
{ // this user can't modify the community feature set
|
||||
|
||||
@@ -865,12 +865,16 @@ class UserContextImpl implements UserContext, UserBackend
|
||||
|
||||
public List getRootCategoryList() throws DataException
|
||||
{
|
||||
if (env.getEngine().getParamBoolean(EngineBackend.BP_NOCATEGORIES))
|
||||
throw new DataException("The category system has been disabled on this site.");
|
||||
return CategoryDescriptorImpl.getTopLevelCategoryList(env,env.testPermission(EnvUser.PERM_SHOWHIDDENCATS));
|
||||
|
||||
} // end getRootCategoryList
|
||||
|
||||
public CategoryDescriptor getCategoryDescriptor(int catid) throws DataException
|
||||
{
|
||||
if (env.getEngine().getParamBoolean(EngineBackend.BP_NOCATEGORIES))
|
||||
throw new DataException("The category system has been disabled on this site.");
|
||||
return new CategoryDescriptorImpl(env,catid,!(env.testPermission(EnvUser.PERM_SHOWHIDDENCATS)));
|
||||
|
||||
} // end getCategoryDescriptor
|
||||
@@ -890,30 +894,40 @@ class UserContextImpl implements UserContext, UserBackend
|
||||
|
||||
public List getCommunitiesInCategory(int catid, int offset, int count) throws DataException
|
||||
{
|
||||
if (env.getEngine().getParamBoolean(EngineBackend.BP_NOCATEGORIES))
|
||||
throw new DataException("The category system has been disabled on this site.");
|
||||
return CommunityUserContextImpl.getCommunitiesInCategory(env,catid,offset,count);
|
||||
|
||||
} // end getCommunitiesInCategory
|
||||
|
||||
public List getCommunitiesInCategory(CategoryDescriptor cat, int offset, int count) throws DataException
|
||||
{
|
||||
if (env.getEngine().getParamBoolean(EngineBackend.BP_NOCATEGORIES))
|
||||
throw new DataException("The category system has been disabled on this site.");
|
||||
return CommunityUserContextImpl.getCommunitiesInCategory(env,cat.getLinkedCategoryID(),offset,count);
|
||||
|
||||
} // end getCommunitiesInCategory
|
||||
|
||||
public int getNumCommunitiesInCategory(int catid) throws DataException
|
||||
{
|
||||
if (env.getEngine().getParamBoolean(EngineBackend.BP_NOCATEGORIES))
|
||||
throw new DataException("The category system has been disabled on this site.");
|
||||
return CommunityUserContextImpl.getNumCommunitiesInCategory(env,catid);
|
||||
|
||||
} // end getNumCommunitiessInCategory
|
||||
|
||||
public int getNumCommunitiesInCategory(CategoryDescriptor cat) throws DataException
|
||||
{
|
||||
if (env.getEngine().getParamBoolean(EngineBackend.BP_NOCATEGORIES))
|
||||
throw new DataException("The category system has been disabled on this site.");
|
||||
return CommunityUserContextImpl.getNumCommunitiesInCategory(env,cat.getLinkedCategoryID());
|
||||
|
||||
} // end getNumCommunitiesInCategory
|
||||
|
||||
public List searchForCategories(int mode, String term, int offset, int count) throws DataException
|
||||
{
|
||||
if (env.getEngine().getParamBoolean(EngineBackend.BP_NOCATEGORIES))
|
||||
throw new DataException("The category system has been disabled on this site.");
|
||||
return CategoryDescriptorImpl.searchForCategories(env,env.testPermission(EnvUser.PERM_SHOWHIDDENCATS),
|
||||
env.testPermission(EnvUser.PERM_SEARCHHIDDENCATS),mode,
|
||||
term,offset,count);
|
||||
@@ -922,6 +936,8 @@ class UserContextImpl implements UserContext, UserBackend
|
||||
|
||||
public int getSearchCategoryCount(int mode, String term) throws DataException
|
||||
{
|
||||
if (env.getEngine().getParamBoolean(EngineBackend.BP_NOCATEGORIES))
|
||||
throw new DataException("The category system has been disabled on this site.");
|
||||
return CategoryDescriptorImpl.getSearchCategoryCount(env,env.testPermission(EnvUser.PERM_SHOWHIDDENCATS),
|
||||
env.testPermission(EnvUser.PERM_SEARCHHIDDENCATS),
|
||||
mode,term);
|
||||
|
||||
@@ -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) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
* Copyright (C) 2001-02 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
@@ -441,6 +441,7 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
|
||||
rc.setAuditRecordsPerPage(gp_ints[IP_NUMAUDITRECSPERPAGE]);
|
||||
rc.setCommunityCreateLevel(gp_ints[IP_CREATECOMMUNITYLVL]);
|
||||
rc.setDisplayPostPictures(global_flags.get(BP_POSTPICTURES));
|
||||
rc.setDisableCategories(global_flags.get(BP_NOCATEGORIES));
|
||||
return rc;
|
||||
|
||||
} // end createProperties
|
||||
@@ -450,6 +451,8 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
|
||||
BitSet rc = new BitSet();
|
||||
if (global_flags.assign(BP_POSTPICTURES,props.getDisplayPostPictures()))
|
||||
rc.set(PROP_FLAGS);
|
||||
if (global_flags.assign(BP_NOCATEGORIES,props.getDisableCategories()))
|
||||
rc.set(PROP_FLAGS);
|
||||
if (gp_ints[IP_POSTSPERPAGE]!=props.getPostsPerPage())
|
||||
{ // record variable change
|
||||
gp_ints[IP_POSTSPERPAGE] = props.getPostsPerPage();
|
||||
@@ -1085,6 +1088,8 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
|
||||
checkInitialized();
|
||||
if (catid==-1)
|
||||
return true; // valid by definition, it means "Top"
|
||||
if (global_flags.get(BP_NOCATEGORIES))
|
||||
return (catid==0); // EJB 1/16/2001 - if categories are disabled, the only valid one is "unclassified"
|
||||
Connection conn = null;
|
||||
|
||||
try
|
||||
@@ -1477,6 +1482,12 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
|
||||
|
||||
} // end getSecurityInfo
|
||||
|
||||
public boolean useCategories()
|
||||
{
|
||||
return !(global_flags.get(BP_NOCATEGORIES));
|
||||
|
||||
} // end useCategories
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Implementations from interface EngineBackend
|
||||
*--------------------------------------------------------------------------------
|
||||
|
||||
@@ -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) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
* Copyright (C) 2001-02 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
@@ -51,6 +51,7 @@ public interface EngineBackend
|
||||
|
||||
// Boolean parameter indexes
|
||||
public static final int BP_POSTPICTURES = 0;
|
||||
public static final int BP_NOCATEGORIES = 1;
|
||||
|
||||
// role parameter indexes
|
||||
public static final int ROLEP_CREATECOMMUNITY = 0;
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* 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) 2002 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
package com.silverwrist.venice.ui.jsp;
|
||||
|
||||
import javax.servlet.jsp.*;
|
||||
import javax.servlet.jsp.tagext.*;
|
||||
import com.silverwrist.venice.core.*;
|
||||
import com.silverwrist.venice.ui.*;
|
||||
|
||||
public class GlobalCategoriesDisabledTag extends VeniceTagSupport
|
||||
{
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Overrides from class TagSupport
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public int doStartTag() throws JspException
|
||||
{
|
||||
return (getRequestInput().getEngine().useCategories() ? SKIP_BODY : EVAL_BODY_INCLUDE);
|
||||
|
||||
} // end doStartTag
|
||||
|
||||
} // end class GlobalCategoriesDisabledTag
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* 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) 2002 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
package com.silverwrist.venice.ui.jsp;
|
||||
|
||||
import javax.servlet.jsp.*;
|
||||
import javax.servlet.jsp.tagext.*;
|
||||
import com.silverwrist.venice.core.*;
|
||||
import com.silverwrist.venice.ui.*;
|
||||
|
||||
public class GlobalCategoriesEnabledTag extends VeniceTagSupport
|
||||
{
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Overrides from class TagSupport
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public int doStartTag() throws JspException
|
||||
{
|
||||
return (getRequestInput().getEngine().useCategories() ? EVAL_BODY_INCLUDE : SKIP_BODY);
|
||||
|
||||
} // end doStartTag
|
||||
|
||||
} // end class GlobalCategoriesEnabledTag
|
||||
@@ -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) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
* Copyright (C) 2001-02 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
@@ -70,6 +70,12 @@ public class CommunityMenu implements MenuComponent, ColorSelectors, LinkTypes
|
||||
*/
|
||||
|
||||
public void render(RequestOutput out, Writer wr) throws IOException
|
||||
{
|
||||
this.render(out,wr,Collections.EMPTY_SET);
|
||||
|
||||
} // end render
|
||||
|
||||
public void render(RequestOutput out, Writer wr, Set defines) throws IOException
|
||||
{
|
||||
if (wr==null)
|
||||
wr = out.getWriter();
|
||||
@@ -86,7 +92,7 @@ public class CommunityMenu implements MenuComponent, ColorSelectors, LinkTypes
|
||||
while (it.hasNext())
|
||||
{ // display each menu item in turn
|
||||
MenuComponent mc = (MenuComponent)(it.next());
|
||||
mc.render(out,wr);
|
||||
mc.render(out,wr,defines);
|
||||
|
||||
} // end while
|
||||
|
||||
@@ -100,6 +106,12 @@ public class CommunityMenu implements MenuComponent, ColorSelectors, LinkTypes
|
||||
} // end render
|
||||
|
||||
public void renderOnLeft(RequestOutput out, Writer wr) throws IOException
|
||||
{
|
||||
this.renderOnLeft(out,wr,Collections.EMPTY_SET);
|
||||
|
||||
} // end renderOnLeft
|
||||
|
||||
public void renderOnLeft(RequestOutput out, Writer wr, Set defines) throws IOException
|
||||
{
|
||||
if (wr==null)
|
||||
wr = out.getWriter();
|
||||
@@ -114,7 +126,7 @@ public class CommunityMenu implements MenuComponent, ColorSelectors, LinkTypes
|
||||
while (it.hasNext())
|
||||
{ // display each menu item in turn
|
||||
MenuComponent mc = (MenuComponent)(it.next());
|
||||
mc.renderOnLeft(out,wr);
|
||||
mc.renderOnLeft(out,wr,defines);
|
||||
|
||||
} // end while
|
||||
|
||||
|
||||
@@ -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) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
* Copyright (C) 2001-02 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
@@ -19,6 +19,7 @@ package com.silverwrist.venice.ui.menus;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import java.util.Set;
|
||||
import org.w3c.dom.*;
|
||||
import com.silverwrist.util.DOMElementHelper;
|
||||
import com.silverwrist.venice.ui.RequestOutput;
|
||||
@@ -50,21 +51,33 @@ class HeaderItem implements MenuComponent
|
||||
*/
|
||||
|
||||
public void render(RequestOutput out, Writer wr) throws IOException
|
||||
{
|
||||
this.render(out,wr,java.util.Collections.EMPTY_SET);
|
||||
|
||||
} // end render
|
||||
|
||||
public void render(RequestOutput out, Writer wr, Set defines) throws IOException
|
||||
{
|
||||
if (wr==null)
|
||||
wr = out.getWriter();
|
||||
wr.write("<FONT SIZE=+1><B>");
|
||||
subitem.render(out,wr);
|
||||
subitem.render(out,wr,defines);
|
||||
wr.write("</B></FONT><BR>\n");
|
||||
|
||||
} // end render
|
||||
|
||||
public void renderOnLeft(RequestOutput out, Writer wr) throws IOException
|
||||
{
|
||||
this.renderOnLeft(out,wr,java.util.Collections.EMPTY_SET);
|
||||
|
||||
} // end renderOnLeft
|
||||
|
||||
public void renderOnLeft(RequestOutput out, Writer wr, Set defines) throws IOException
|
||||
{
|
||||
if (wr==null)
|
||||
wr = out.getWriter();
|
||||
wr.write("<B>");
|
||||
subitem.renderOnLeft(out,wr);
|
||||
subitem.renderOnLeft(out,wr,defines);
|
||||
wr.write("</B><BR>\n");
|
||||
|
||||
} // end renderOnLeft
|
||||
|
||||
@@ -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) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
* Copyright (C) 2001-02 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
@@ -19,6 +19,7 @@ package com.silverwrist.venice.ui.menus;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import java.util.Set;
|
||||
import org.w3c.dom.*;
|
||||
import com.silverwrist.util.DOMElementHelper;
|
||||
import com.silverwrist.venice.except.ConfigException;
|
||||
@@ -72,6 +73,12 @@ class ImageItem implements MenuComponent
|
||||
*/
|
||||
|
||||
public void render(RequestOutput out, Writer wr) throws IOException
|
||||
{
|
||||
this.render(out,wr,java.util.Collections.EMPTY_SET);
|
||||
|
||||
} // end render
|
||||
|
||||
public void render(RequestOutput out, Writer wr, Set defines) throws IOException
|
||||
{
|
||||
if (wr==null)
|
||||
wr = out.getWriter();
|
||||
@@ -94,7 +101,13 @@ class ImageItem implements MenuComponent
|
||||
|
||||
public void renderOnLeft(RequestOutput out, Writer wr) throws IOException
|
||||
{
|
||||
this.render(out,wr);
|
||||
this.render(out,wr,java.util.Collections.EMPTY_SET);
|
||||
|
||||
} // end renderOnLeft
|
||||
|
||||
public void renderOnLeft(RequestOutput out, Writer wr, Set defines) throws IOException
|
||||
{
|
||||
this.render(out,wr,defines);
|
||||
|
||||
} // end renderOnLeft
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ package com.silverwrist.venice.ui.menus;
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import org.apache.log4j.*;
|
||||
import org.w3c.dom.*;
|
||||
import com.silverwrist.util.*;
|
||||
@@ -48,6 +49,8 @@ class LinkItem implements MenuComponent, ColorSelectors, LinkTypes
|
||||
private String target = null; // target window for the link
|
||||
private String title = null; // title (tooltip) for the link
|
||||
private String on_click = null; // onClick JavaScript for the link
|
||||
private String ifdef_sym = null; // include only if defined
|
||||
private String ifndef_sym = null; // include only if NOT defined
|
||||
private int indent = 0; // how many spaces do we indent this link?
|
||||
private MenuComponent contents; // what does this link contain? (image vs. text)
|
||||
|
||||
@@ -87,6 +90,12 @@ class LinkItem implements MenuComponent, ColorSelectors, LinkTypes
|
||||
if (h.hasAttribute("onClick"))
|
||||
on_click = elt.getAttribute("onClick");
|
||||
|
||||
// load the "ifdef" and "ifndef" symbols
|
||||
if (h.hasAttribute("ifdef"))
|
||||
ifdef_sym = elt.getAttribute("ifdef");
|
||||
if (h.hasAttribute("ifndef"))
|
||||
ifndef_sym = elt.getAttribute("ifndef");
|
||||
|
||||
// load the "disabled" attribute
|
||||
if (h.hasAttribute("disabled"))
|
||||
enabled = false;
|
||||
@@ -120,6 +129,8 @@ class LinkItem implements MenuComponent, ColorSelectors, LinkTypes
|
||||
this.target = other.target;
|
||||
this.title = other.title;
|
||||
this.on_click = StringUtil.replaceAllVariables(other.on_click,vars);
|
||||
this.ifdef_sym = other.ifdef_sym;
|
||||
this.ifndef_sym = other.ifndef_sym;
|
||||
this.indent = other.indent;
|
||||
this.contents = other.contents;
|
||||
|
||||
@@ -132,6 +143,16 @@ class LinkItem implements MenuComponent, ColorSelectors, LinkTypes
|
||||
|
||||
public void render(RequestOutput out, Writer wr) throws IOException
|
||||
{
|
||||
this.render(out,wr,java.util.Collections.EMPTY_SET);
|
||||
|
||||
} // end render
|
||||
|
||||
public void render(RequestOutput out, Writer wr, Set defines) throws IOException
|
||||
{
|
||||
if ((ifdef_sym!=null) && !(defines.contains(ifdef_sym)))
|
||||
return;
|
||||
if ((ifndef_sym!=null) && defines.contains(ifndef_sym))
|
||||
return;
|
||||
if (wr==null)
|
||||
wr = out.getWriter();
|
||||
for (int i=0; i<indent; i++)
|
||||
@@ -152,7 +173,7 @@ class LinkItem implements MenuComponent, ColorSelectors, LinkTypes
|
||||
} // end if
|
||||
else // just disable the color
|
||||
wr.write(out.getFontTag(CONTENT_DISABLED,null));
|
||||
contents.render(out,wr);
|
||||
contents.render(out,wr,defines);
|
||||
if (enabled)
|
||||
wr.write("</A>");
|
||||
else
|
||||
@@ -163,6 +184,16 @@ class LinkItem implements MenuComponent, ColorSelectors, LinkTypes
|
||||
|
||||
public void renderOnLeft(RequestOutput out, Writer wr) throws IOException
|
||||
{
|
||||
this.renderOnLeft(out,wr,java.util.Collections.EMPTY_SET);
|
||||
|
||||
} // end renderOnLeft
|
||||
|
||||
public void renderOnLeft(RequestOutput out, Writer wr, Set defines) throws IOException
|
||||
{
|
||||
if ((ifdef_sym!=null) && !(defines.contains(ifdef_sym)))
|
||||
return;
|
||||
if ((ifndef_sym!=null) && defines.contains(ifndef_sym))
|
||||
return;
|
||||
if (wr==null)
|
||||
wr = out.getWriter();
|
||||
for (int i=0; i<indent; i++)
|
||||
@@ -181,7 +212,7 @@ class LinkItem implements MenuComponent, ColorSelectors, LinkTypes
|
||||
} // end if
|
||||
else
|
||||
wr.write(out.getFontTag(CONTENT_DISABLED,null));
|
||||
contents.renderOnLeft(out,wr);
|
||||
contents.renderOnLeft(out,wr,defines);
|
||||
wr.write("</FONT>");
|
||||
if (enabled)
|
||||
wr.write("</A>");
|
||||
|
||||
@@ -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) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
* Copyright (C) 2001-02 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
@@ -137,6 +137,12 @@ public class Menu implements MenuComponent, ColorSelectors
|
||||
*/
|
||||
|
||||
public void render(RequestOutput out, Writer wr) throws IOException
|
||||
{
|
||||
this.render(out,wr,Collections.EMPTY_SET);
|
||||
|
||||
} // end render
|
||||
|
||||
public void render(RequestOutput out, Writer wr, Set defines) throws IOException
|
||||
{
|
||||
if (title!=null)
|
||||
{ // write the header
|
||||
@@ -160,7 +166,7 @@ public class Menu implements MenuComponent, ColorSelectors
|
||||
while (it.hasNext())
|
||||
{ // render each menu item in turn
|
||||
MenuComponent mc = (MenuComponent)(it.next());
|
||||
mc.render(out,wr);
|
||||
mc.render(out,wr,defines);
|
||||
|
||||
} // end while
|
||||
|
||||
@@ -176,6 +182,12 @@ public class Menu implements MenuComponent, ColorSelectors
|
||||
} // end render
|
||||
|
||||
public void renderOnLeft(RequestOutput out, Writer wr) throws IOException
|
||||
{
|
||||
this.renderOnLeft(out,wr,Collections.EMPTY_SET);
|
||||
|
||||
} // end renderOnLeft
|
||||
|
||||
public void renderOnLeft(RequestOutput out, Writer wr, Set defines) throws IOException
|
||||
{
|
||||
if (wr==null)
|
||||
wr = out.getWriter();
|
||||
@@ -191,7 +203,7 @@ public class Menu implements MenuComponent, ColorSelectors
|
||||
while (it.hasNext())
|
||||
{ // render each menu item in turn
|
||||
MenuComponent mc = (MenuComponent)(it.next());
|
||||
mc.renderOnLeft(out,wr);
|
||||
mc.renderOnLeft(out,wr,defines);
|
||||
|
||||
} // end while
|
||||
|
||||
|
||||
@@ -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) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
* Copyright (C) 2001-02 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
@@ -19,14 +19,19 @@ package com.silverwrist.venice.ui.menus;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import java.util.Set;
|
||||
import com.silverwrist.venice.ui.RequestOutput;
|
||||
|
||||
public interface MenuComponent
|
||||
{
|
||||
public abstract void render(RequestOutput out, Writer wr) throws IOException;
|
||||
|
||||
public abstract void render(RequestOutput out, Writer wr, Set defines) throws IOException;
|
||||
|
||||
public abstract void renderOnLeft(RequestOutput out, Writer wr) throws IOException;
|
||||
|
||||
public abstract void renderOnLeft(RequestOutput out, Writer wr, Set defines) throws IOException;
|
||||
|
||||
public abstract String getTitle(RequestOutput out);
|
||||
|
||||
} // end interface MenuComponent
|
||||
|
||||
@@ -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) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
* Copyright (C) 2001-02 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
@@ -19,6 +19,7 @@ package com.silverwrist.venice.ui.menus;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import java.util.Set;
|
||||
import com.silverwrist.venice.ui.RequestOutput;
|
||||
|
||||
class SeparatorItem implements MenuComponent
|
||||
@@ -54,9 +55,15 @@ class SeparatorItem implements MenuComponent
|
||||
*/
|
||||
|
||||
public void render(RequestOutput out, Writer wr) throws IOException
|
||||
{
|
||||
this.render(out,wr,java.util.Collections.EMPTY_SET);
|
||||
|
||||
} // end render
|
||||
|
||||
public void render(RequestOutput out, Writer wr, Set defines) throws IOException
|
||||
{
|
||||
if (subitem!=null)
|
||||
subitem.render(out,wr);
|
||||
subitem.render(out,wr,defines);
|
||||
if (wr==null)
|
||||
wr = out.getWriter();
|
||||
wr.write("<BR>\n");
|
||||
@@ -64,9 +71,15 @@ class SeparatorItem implements MenuComponent
|
||||
} // end render
|
||||
|
||||
public void renderOnLeft(RequestOutput out, Writer wr) throws IOException
|
||||
{
|
||||
this.renderOnLeft(out,wr,java.util.Collections.EMPTY_SET);
|
||||
|
||||
} // end renderOnLeft
|
||||
|
||||
public void renderOnLeft(RequestOutput out, Writer wr, Set defines) throws IOException
|
||||
{
|
||||
if (subitem!=null)
|
||||
subitem.renderOnLeft(out,wr);
|
||||
subitem.renderOnLeft(out,wr,defines);
|
||||
if (wr==null)
|
||||
wr = out.getWriter();
|
||||
wr.write("<BR>\n");
|
||||
|
||||
@@ -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) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
* Copyright (C) 2001-02 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
@@ -19,6 +19,7 @@ package com.silverwrist.venice.ui.menus;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import java.util.Set;
|
||||
import com.silverwrist.util.StringUtil;
|
||||
import com.silverwrist.venice.ui.RequestOutput;
|
||||
|
||||
@@ -48,6 +49,12 @@ class TextItem implements MenuComponent
|
||||
*/
|
||||
|
||||
public void render(RequestOutput out, Writer wr) throws IOException
|
||||
{
|
||||
this.render(out,wr,java.util.Collections.EMPTY_SET);
|
||||
|
||||
} // end render
|
||||
|
||||
public void render(RequestOutput out, Writer wr, Set defines) throws IOException
|
||||
{
|
||||
if (wr==null)
|
||||
out.write(contents);
|
||||
@@ -58,10 +65,13 @@ class TextItem implements MenuComponent
|
||||
|
||||
public void renderOnLeft(RequestOutput out, Writer wr) throws IOException
|
||||
{
|
||||
if (wr==null)
|
||||
out.write(contents);
|
||||
else
|
||||
wr.write(contents);
|
||||
this.render(out,wr,java.util.Collections.EMPTY_SET);
|
||||
|
||||
} // end renderOnLeft
|
||||
|
||||
public void renderOnLeft(RequestOutput out, Writer wr, Set defines) throws IOException
|
||||
{
|
||||
this.render(out,wr,defines);
|
||||
|
||||
} // end renderOnLeft
|
||||
|
||||
|
||||
@@ -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) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
* Copyright (C) 2001-02 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
@@ -33,6 +33,7 @@ public class MenuView implements ContentDirect
|
||||
private int menu_selector = MENU_SELECTOR_NOCHANGE;
|
||||
private String qid = null;
|
||||
private MenuComponent component;
|
||||
private Set defines = Collections.EMPTY_SET;
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Constructor
|
||||
@@ -81,7 +82,7 @@ public class MenuView implements ContentDirect
|
||||
|
||||
public void render(RequestOutput out) throws IOException
|
||||
{
|
||||
component.render(out,null);
|
||||
component.render(out,null,defines);
|
||||
|
||||
} // end render
|
||||
|
||||
@@ -102,4 +103,12 @@ public class MenuView implements ContentDirect
|
||||
|
||||
} // end setPageQID
|
||||
|
||||
public final void define(String symbol)
|
||||
{
|
||||
if (defines==Collections.EMPTY_SET)
|
||||
defines = new HashSet();
|
||||
defines.add(symbol);
|
||||
|
||||
} // end define
|
||||
|
||||
} // end class MenuView
|
||||
|
||||
Reference in New Issue
Block a user