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:
Eric J. Bowersox 2002-01-16 21:17:05 +00:00
parent e3717ca62c
commit f24456e0a2
25 changed files with 465 additions and 123 deletions

View File

@ -12,7 +12,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):
-->
@ -341,8 +341,8 @@ Text of this agreement is TBD.
<title>Community Administration:</title>
<subtitle>${name}</subtitle>
<link href="comm/profile.js.vs?cc=${cid}" type="servlet">Community Profile</link>
<link href="comm/category.js.vs?cc=${cid}" type="servlet">Set Community Category</link>
<link href="TODO?cc=${cid}" type="servlet">Set Community Services</link>
<link href="comm/category.js.vs?cc=${cid}" ifdef="USECAT" type="servlet">Set Community Category</link>
<link href="TODO?cc=${cid}" disabled="true" type="servlet">Set Community Services</link>
<link href="comm/set_member.js.vs?cc=${cid}" type="servlet">Membership Control</link>
<link href="comm/email.js.vs?cc=${cid}" type="servlet">E-Mail To All Members</link>
<link href="comm/audit.js.vs?cc=${cid}" type="servlet">Display Audit Records</link>
@ -353,7 +353,7 @@ Text of this agreement is TBD.
<menudef id="system.admin">
<title>System Administration</title>
<link href="sysadmin/global.js.vs" type="servlet">Edit Global Properties</link>
<link href="TODO" type="servlet">View/Edit Banned Users</link>
<link href="TODO" disabled="true" type="servlet">View/Edit Banned Users</link>
<link href="sysadmin/find_user.js.vs" type="servlet">User Account Management</link>
<link href="sysadmin/audit.js.vs" type="servlet">System Audit Logs</link>
<link href="sysadmin/import.js.vs" type="servlet">Import User Accounts</link>
@ -584,6 +584,7 @@ the community's host, or via an invitation e-mail message. Please enter it in th
<rolelist name="create_lvl" capt="Security level required to create a new community" required="true"/>
<header capt="Community Properties"/>
<int name="comm_mbrs" capt="Number of community members to display per page" min="10" max="100"/>
<checkbox name="no_cats" capt="Disable community categorization system"/>
<header capt="Conferencing Properties"/>
<int name="posts_page" capt="Maximum number of posts to display per page" min="5" max="100"/>
<int name="old_posts" capt='Number of "old" posts to display at top of page' min="1" max="5"/>

View File

@ -15,7 +15,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):
-->
@ -209,6 +209,11 @@
<taglib-location>/WEB-INF/tlds/frame-taglib.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/tlds/global</taglib-uri>
<taglib-location>/WEB-INF/tlds/global-taglib.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/tlds/user</taglib-uri>
<taglib-location>/WEB-INF/tlds/user-taglib.tld</taglib-location>

View File

@ -10,7 +10,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):
@ -43,4 +43,6 @@ menu = rinput.getMenu("community.admin",vars);
// build a view around it and return it
rc = new MenuView(menu);
rc.menuSelector = Content.MENU_SELECTOR_COMMUNITY;
if (rinput.engine.useCategories())
rc.define("USECAT");
vlib.output(rc);

View File

@ -10,7 +10,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):
@ -35,6 +35,13 @@ if (rinput.hasParameter("disp"))
} // end if
if ((disp==FindView.FD_CATEGORIES) && !(rinput.engine.useCategories()))
{ // the display parameter is not correct
vlib.output(new ErrorBox(null,"Invalid display parameter.","top.js.vs"));
vlib.done();
} // end if
// save off the session attribute
rinput.setSessionAttribute(FindView.DISPLAY_PARAM_ATTRIBUTE,new java.lang.Integer(disp));
@ -107,9 +114,14 @@ try
if (disp==FindView.FD_COMMUNITIES)
{ // load the category ID and field parameters
if (rinput.engine.useCategories())
{ // don't try to get the category unless we support such a thing
catid = rinput.getParameterInt("cat",-1);
if (!(rinput.engine.isValidCategoryID(catid)))
throw new ValidationException("The category ID parameter is not valid.");
} // end if
x = rinput.getParameterInt("field",SearchMode.FIELD_COMMUNITY_NAME);
if ((x!=SearchMode.FIELD_COMMUNITY_NAME) && (x!=SearchMode.FIELD_COMMUNITY_SYNOPSIS))
throw new ValidationException("The search field parameter is not valid.");
@ -153,7 +165,7 @@ try
// run the actual search!
if (disp==FindView.FD_COMMUNITIES)
{ // need to work it differently if there's a category ID
if (catid>=0)
if (rinput.engine.useCategories() && (catid>=0))
{ // set up the category
view.category = rinput.user.getCategoryDescriptor(catid);
if (view.category.categoryID>=0)

View File

@ -10,7 +10,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):
@ -52,6 +52,8 @@ if ("GET"==rinput.verb)
dlg.setValue("conf_mbrs",props.conferenceMembersPerPage);
if (props.displayPostPictures)
dlg.setValue("pic_in_post",1);
if (props.disableCategories)
dlg.setValue("no_cats",1);
rc = dlg;
@ -100,6 +102,7 @@ if (op=="update")
props.oldPostsAtTop = dlg.getValue("old_posts").intValue();
props.conferenceMembersPerPage = dlg.getValue("conf_mbrs").intValue();
props.displayPostPictures = dlg.getValue("pic_in_post").booleanValue();
props.disableCategories = dlg.getValue("no_cats").booleanValue();
adm.properties = props;
// done - bounce back to the menu

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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);

View File

@ -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
*--------------------------------------------------------------------------------

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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>");

View File

@ -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

View File

@ -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

View File

@ -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");

View File

@ -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

View File

@ -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

46
tlds/global-taglib.tld Normal file
View File

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!--
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):
-->
<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN"
"http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">
<taglib>
<!-- after this the default space is
"http://java.sun.com/j2ee/dtds/jsptaglibrary_1_2.dtd" -->
<tlibversion>0.1</tlibversion>
<jspversion>1.1</jspversion>
<shortname>global</shortname>
<uri></uri>
<info>Tag library used to access various global elements.</info>
<tag>
<name>categories_enabled</name>
<tagclass>com.silverwrist.venice.ui.jsp.GlobalCategoriesEnabledTag</tagclass>
<info>Includes its content if categories are enabled in the engine.</info>
<bodycontent>JSP</bodycontent>
</tag>
<tag>
<name>categories_disabled</name>
<tagclass>com.silverwrist.venice.ui.jsp.GlobalCategoriesDisabledTag</tagclass>
<info>Includes its content if categories are disabled in the engine.</info>
<bodycontent>JSP</bodycontent>
</tag>
</taglib>

View File

@ -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):
--%>
@ -20,6 +20,7 @@
<%@ page import = "com.silverwrist.venice.ui.view.FindView" %>
<%@ page import = "com.silverwrist.venice.ui.view.JSPView" %>
<%@ taglib uri="/tlds/util" prefix="util" %>
<%@ taglib uri="/tlds/global" prefix="global" %>
<%@ taglib uri="/tlds/user" prefix="user" %>
<%@ taglib uri="/tlds/community" prefix="comm" %>
<%
@ -66,17 +67,23 @@
</util:font></TD>
<TD ALIGN=LEFT CLASS="content"><util:font color="content.fg" size="content">
<comm:is_public><B><U>Public Community</U></B><BR></comm:is_public>
<comm:is_private><B><U>Private Community</U></B><BR></comm:is_private>
<comm:is_public><B><U>Public Community</U></B></comm:is_public>
<comm:is_private><B><U>Private Community</U></B></comm:is_private>
<global:categories_enabled>
<BR>
<B>Category:</B>
<% CategoryDescriptor cat = (CategoryDescriptor)(view.getRequestAttribute("category")); %>
<% for (int i=0; i<cat.getNumLevels(); i++) { %>
<% if (i>0) { %>: <% } %>
<util:xlink>
<util:href type="servlet">find.js.vs?disp=<%= FindView.FD_COMMUNITIES %>&cat=<%= cat.getIDAtLevel(i) %></util:href>
<util:href type="servlet">
find.js.vs?disp=<%= FindView.FD_COMMUNITIES %>&cat=<%= cat.getIDAtLevel(i) %>
</util:href>
<util:text><util:escape><%= cat.getTitleAtLevel(i) %></util:escape></util:text>
</util:xlink>
<% } // end for %><P>
<% } // end for %>
</global:categories_enabled>
<P>
<EM><util:escape><comm:synopsis/></util:escape></EM><P>
<% UserProfile prof = (UserProfile)(view.getRequestAttribute("host.profile")); %>

View File

@ -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):
--%>
@ -20,8 +20,10 @@
<%@ page import = "com.silverwrist.venice.core.*" %>
<%@ page import = "com.silverwrist.venice.ui.view.FindView" %>
<%@ taglib uri="/tlds/util" prefix="util" %>
<%@ taglib uri="/tlds/global" prefix="global" %>
<%
FindView data = FindView.get(request);
CategoryDescriptor cat = null;
%>
<util:comment>Find page</util:comment>
<util:menuheader caption="Find:">
@ -47,6 +49,7 @@
<util:text>Users</util:text>
</util:menuheaderitem>
<% } // end if %>
<global:categories_enabled>
<% if (data.testDisplayMode(FindView.FD_CATEGORIES)) { %>
<util:menuheaderitem selected="true">
<util:href type="servlet">find.js.vs?disp=<%= FindView.FD_CATEGORIES %></util:href>
@ -58,6 +61,7 @@
<util:text>Categories</util:text>
</util:menuheaderitem>
<% } // end if %>
</global:categories_enabled>
<% if (data.testDisplayMode(FindView.FD_POSTS)) { %>
<util:menuheaderitem selected="true">
<util:href type="servlet">find.js.vs?disp=<%= FindView.FD_POSTS %></util:href>
@ -113,11 +117,17 @@
</SELECT><BR>
</util:font>
<% } else if (data.testDisplayMode(FindView.FD_CATEGORIES)) { %>
<global:categories_enabled>
<util:comment>Find Categories form</util:comment>
<util:font color="content.fg" size="content-heading"><B>Find Categories:</B></util:font>
<util:font color="content.fg" size="content">
Display all categories whose name&nbsp;&nbsp;
</util:font>
</global:categories_enabled>
<global:categories_disabled>
<%-- shouldn't get here --%>
<H1><FONT COLOR="red">Display parameter invalid!</FONT></H1>
</global:categories_disabled>
<% } else { %>
<%-- shouldn't get here --%>
<H1><FONT COLOR="red">Display parameter invalid!</FONT></H1>
@ -141,7 +151,8 @@
</DIV></util:form>
<%-- Display the current category --%>
<% CategoryDescriptor cat = data.getCategory(); %>
<global:categories_enabled>
<% cat = data.getCategory(); %>
<% if (cat!=null) { %>
<util:comment>Display Category Name</util:comment>
<HR><util:font color="content.fg" size="subhead">
@ -157,7 +168,9 @@
<% if (i<(cat.getNumLevels()-1)) { %>
:
<util:xlink>
<util:href type="servlet">find.js.vs?disp=<%= FindView.FD_COMMUNITIES %>&cat=<%= cat.getIDAtLevel(i) %></util:href>
<util:href type="servlet">
find.js.vs?disp=<%= FindView.FD_COMMUNITIES %>&cat=<%= cat.getIDAtLevel(i) %>
</util:href>
<util:text><util:escape><%= cat.getTitleAtLevel(i) %></util:escape></util:text>
</util:xlink>
<% } else { %>
@ -180,8 +193,12 @@
<TD ALIGN=LEFT CLASS="content"><util:font color="content.fg" size="content">
<% CategoryDescriptor c = (CategoryDescriptor)(it.next()); %>
<B><util:xlink>
<util:href type="servlet">find.js.vs?disp=<%= FindView.FD_COMMUNITIES %>&cat=<%= c.getLinkedCategoryID() %></util:href>
<util:text><util:escape><%= c.getTitleAtLevel(c.getNumLevels()-1) %></util:escape></util:text>
<util:href type="servlet">
find.js.vs?disp=<%= FindView.FD_COMMUNITIES %>&cat=<%= c.getLinkedCategoryID() %>
</util:href>
<util:text>
<util:escape><%= c.getTitleAtLevel(c.getNumLevels()-1) %></util:escape>
</util:text>
</util:xlink>
<% if (c.isSymbolicLink()) { %><EM>@</EM><% } %>
</util:font></TD>
@ -191,6 +208,7 @@
<% } // end if (displaying subcategory list) %>
</util:font>
<% } // end if (category specified) %>
</global:categories_enabled>
<%-- Display the search results --%>
<% List results = data.getResults(); %>
@ -332,11 +350,15 @@
<BR><EM><util:escape><%= uf.getDescription() %></util:escape></EM>
<% } // end if %>
<% } else if (data.testDisplayMode(FindView.FD_CATEGORIES)) { %>
<global:categories_enabled>
<% CategoryDescriptor cd = (CategoryDescriptor)item; %>
<util:xlink>
<util:href type="servlet">find.js.vs?disp=<%= FindView.FD_COMMUNITIES %>&cat=<%= cd.getLinkedCategoryID() %></util:href>
<util:href type="servlet">
find.js.vs?disp=<%= FindView.FD_COMMUNITIES %>&cat=<%= cd.getLinkedCategoryID() %>
</util:href>
<util:text><util:escape><%= cd.toString() %></util:escape></util:text>
</util:xlink>
</global:categories_enabled>
<% } // end if %>
</util:font></TD>
<% } // end if %>