added the global "enable use of categories" flag

This commit is contained in:
Eric J. Bowersox 2003-05-31 05:01:48 +00:00
parent b1d1f8e381
commit 15035c2fe6
5 changed files with 27 additions and 4 deletions

View File

@ -338,7 +338,8 @@ INSERT INTO namespaces (nsid, namespace) VALUES
(12, 'http://www.silverwrist.com/NS/venice/2003/01/03/system.mail.messages' ),
(13, 'http://www.silverwrist.com/NS/venice/2003/05/24/system.permissions' ),
(14, 'http://www.silverwrist.com/NS/venice/2003/05/28/community.permissions'),
(15, 'http://www.silverwrist.com/NS/venice/2003/05/29/community.profile' );
(15, 'http://www.silverwrist.com/NS/venice/2003/05/29/community.profile' ),
(16, 'http://www.silverwrist.com/NS/venice/2003/05/30/community.globals' );
# Initial global properties setup
INSERT INTO globalprop (nsid, prop_name, prop_value) VALUES
@ -419,7 +420,8 @@ INSERT INTO globalprop (nsid, prop_name, prop_value) VALUES
(12, 'reminder.message.title', '!Venice Password Reminder Message' ),
(15, 'rules', '!Please treat one another with courtesy and respect.'),
(15, 'language', '_LANG:en-US' ),
(15, 'country', '_CTRY:US' );
(15, 'country', '_CTRY:US' ),
(16, 'options', '_OS:A' );
# Initial global blocks setup
INSERT INTO globalblock (nsid, block_name, block) VALUES
@ -1129,7 +1131,10 @@ INSERT INTO menuitems (menuid, sequence, itemtype, text, linktype, link, perm_ns
# Create the find submenu. (ID #4)
INSERT INTO menus (menuid, menu_nsid, menu_name, title, subtitle)
VALUES (4, 6, 'find.menu', 'Find', NULL);
INSERT INTO menuvars (menuid, var_name, default_val)
VALUES (4, 'use_categories', NULL);
INSERT INTO menuitems (menuid, sequence, itemtype, text, linktype, link) VALUES
(4, 0, 'TEXT', 'Communities', 'SERVLET', 'find_communities.js.vs'),
(4, 1, 'TEXT', 'Users', 'SERVLET', 'find_users.js.vs' ),
(4, 2, 'TEXT', 'Categories', 'SERVLET', 'find_categories.js.vs' );
UPDATE menuitems SET ifdef_var = 'use_categories' WHERE menuid = 4 AND sequence = 2;

View File

@ -64,4 +64,7 @@ public interface VeniceNamespaces
public static final String COMMUNITY_PROFILE_NAMESPACE =
"http://www.silverwrist.com/NS/venice/2003/05/29/community.profile";
public static final String COMMUNITY_GLOBALS_NAMESPACE =
"http://www.silverwrist.com/NS/venice/2003/05/30/community.globals";
} // end interface VeniceNamespaces

View File

@ -94,6 +94,10 @@ if (rc==null)
menu = mprov.getInlineMenu(user,VeniceNamespaces.CONTENT_LAF_NAMESPACE,"find.menu",cast.newIntArray(0));
ndx = menu.getItemContainingLinkText("find_categories.js.vs");
menu.setSelectedIndex(ndx);
globals = vcast.getGlobalPropertiesStore(req);
opts = cast.toOptionSet(globals.getObject(VeniceNamespaces.COMMUNITY_GLOBALS_NAMESPACE,"options"));
if (opts.get(0))
menu.setVariable("use_categories",Boolean.TRUE);
rc.setParameter("menu",menu);
} // end if

View File

@ -36,6 +36,11 @@ session.setObject("/find.js.vs","last.visited","find_communities.js.vs");
// Get the user's configured page size.
pagesize = cast.toInteger(user.getObject(VeniceNamespaces.USER_SETTINGS_NAMESPACE,"search.result.count"));
// Get the "use categories" flag.
globals = vcast.getGlobalPropertiesStore(req);
opts = cast.toOptionSet(globals.getObject(VeniceNamespaces.COMMUNITY_GLOBALS_NAMESPACE,"options"));
use_categories = opts.get(0);
field = CommunitySearchField.NAME;
mode = SearchMode.PREFIX;
term = "";
@ -53,7 +58,7 @@ if (rhelp.isVerb("POST"))
ofs = rhelp.getParameterInt("ofs",0);
fcount = rhelp.getParameterInt("fcount",-1);
if (rhelp.hasParameter("cat"))
if (use_categories && rhelp.hasParameter("cat"))
{ // get the current category
catsvc = vcast.queryCategoryService(rhelp.getRequestObject(Namespaces.DYNAMO_OBJECT_NAMESPACE,"categories"));
category = catsvc.getCategory(rhelp.getParameterInt("cat",-1));
@ -100,7 +105,7 @@ if (rhelp.isVerb("POST"))
} // end catch
} // end if
else
else if (use_categories)
{ // get the category we're loading
catsvc = vcast.queryCategoryService(rhelp.getRequestObject(Namespaces.DYNAMO_OBJECT_NAMESPACE,"categories"));
commsvc = vcast.queryCommunityService(rhelp.getRequestObject(Namespaces.DYNAMO_OBJECT_NAMESPACE,"communities"));
@ -140,6 +145,8 @@ if (rc==null)
menu = mprov.getInlineMenu(user,VeniceNamespaces.CONTENT_LAF_NAMESPACE,"find.menu",cast.newIntArray(0));
ndx = menu.getItemContainingLinkText("find_communities.js.vs");
menu.setSelectedIndex(ndx);
if (use_categories)
menu.setVariable("use_categories",Boolean.TRUE);
rc.setParameter("menu",menu);
} // end if

View File

@ -98,6 +98,10 @@ if (rc==null)
menu = mprov.getInlineMenu(user,VeniceNamespaces.CONTENT_LAF_NAMESPACE,"find.menu",cast.newIntArray(0));
ndx = menu.getItemContainingLinkText("find_users.js.vs");
menu.setSelectedIndex(ndx);
globals = vcast.getGlobalPropertiesStore(req);
opts = cast.toOptionSet(globals.getObject(VeniceNamespaces.COMMUNITY_GLOBALS_NAMESPACE,"options"));
if (opts.get(0))
menu.setVariable("use_categories",Boolean.TRUE);
rc.setParameter("menu",menu);
} // end if