diff --git a/conf/venice-db-init-mysql.sql b/conf/venice-db-init-mysql.sql index dbe6259..583c97c 100644 --- a/conf/venice-db-init-mysql.sql +++ b/conf/venice-db-init-mysql.sql @@ -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; diff --git a/src/venice-base/com/silverwrist/venice/VeniceNamespaces.java b/src/venice-base/com/silverwrist/venice/VeniceNamespaces.java index e44904f..6146f96 100644 --- a/src/venice-base/com/silverwrist/venice/VeniceNamespaces.java +++ b/src/venice-base/com/silverwrist/venice/VeniceNamespaces.java @@ -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 diff --git a/venice-data/scripts/find_categories.js b/venice-data/scripts/find_categories.js index ec4db5e..70fcd02 100644 --- a/venice-data/scripts/find_categories.js +++ b/venice-data/scripts/find_categories.js @@ -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 diff --git a/venice-data/scripts/find_communities.js b/venice-data/scripts/find_communities.js index 314e12d..58d85fa 100644 --- a/venice-data/scripts/find_communities.js +++ b/venice-data/scripts/find_communities.js @@ -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 diff --git a/venice-data/scripts/find_users.js b/venice-data/scripts/find_users.js index 2d1ef5c..45c391a 100644 --- a/venice-data/scripts/find_users.js +++ b/venice-data/scripts/find_users.js @@ -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