diff --git a/conf/venice-db-init-mysql.sql b/conf/venice-db-init-mysql.sql index 07a7846..2cd86bf 100644 --- a/conf/venice-db-init-mysql.sql +++ b/conf/venice-db-init-mysql.sql @@ -1368,12 +1368,12 @@ INSERT INTO menuvars (menuid, var_name, default_val) VALUES (5, 'cid', NULL), (5, 'name', NULL); INSERT INTO menuitems (menuid, sequence, itemtype, text, linktype, link) VALUES - (5, 0, 'TEXT', 'Home Page', 'SERVLET', 'community/${alias}'), - (5, 60000, 'TEXT', 'Members', 'SERVLET', 'TODO' ), - (5, 60100, 'TEXT', 'Profile', 'SERVLET', 'TODO' ), - (5, 60200, 'TEXT', 'Administration', 'SERVLET', 'TODO' ), - (5, 60300, 'SEPARATOR', NULL, NULL, NULL ), - (5, 60400, 'TEXT', 'Unjoin', 'SERVLET', 'TODO' ); + (5, 0, 'TEXT', 'Home Page', 'SERVLET', 'community/${alias}' ), + (5, 60000, 'TEXT', 'Members', 'SERVLET', 'TODO' ), + (5, 60100, 'TEXT', 'Profile', 'SERVLET', 'TODO' ), + (5, 60200, 'TEXT', 'Administration', 'SERVLET', 'comm/admin/main.js.vs?cc=${cid}'), + (5, 60300, 'SEPARATOR', NULL, NULL, NULL ), + (5, 60400, 'TEXT', 'Unjoin', 'SERVLET', 'TODO' ); UPDATE menuitems SET perm_nsid = 16, perm_name = 'administration' WHERE menuid = 5 AND sequence = 60200; UPDATE menuitems SET perm_nsid = 14, perm_name = 'unjoin' WHERE menuid = 5 AND sequence = 60300; UPDATE menuitems SET perm_nsid = 14, perm_name = 'unjoin' WHERE menuid = 5 AND sequence = 60400; @@ -1391,7 +1391,8 @@ UPDATE menuitems SET enable = 0 WHERE menuid = 6 AND sequence = 100; INSERT INTO menus (menuid, menu_nsid, menu_name, title, subtitle) VALUES (7, 16, 'admin.menu', 'Community Administration:', '${name}'); INSERT INTO menuvars (menuid, var_name, default_val) VALUES - (7, 'name', NULL); + (7, 'name', NULL), + (7, 'cid', NULL); INSERT INTO menuitems (menuid, sequence, itemtype, text, linktype, link, perm_nsid, perm_name) VALUES (7, 0, 'TEXT', 'Edit Community Profile', 'SERVLET', 'TODO', 15, 'set.property'); diff --git a/src/venice-base/com/silverwrist/venice/script/LibraryVenice.java b/src/venice-base/com/silverwrist/venice/script/LibraryVenice.java index 2109273..5baf6e6 100644 --- a/src/venice-base/com/silverwrist/venice/script/LibraryVenice.java +++ b/src/venice-base/com/silverwrist/venice/script/LibraryVenice.java @@ -95,23 +95,23 @@ public class LibraryVenice private final int getCommunityParameter(Request req) throws ValidationException { Map pmap = req.getParameters(); - String cparam = StringUtils.stringize(pmap.get("cid")); + String[] cparam = (String[])(pmap.get("cid")); if (cparam==null) - cparam = StringUtils.stringize(pmap.get("cc")); + cparam = (String[])(pmap.get("cc")); if (cparam==null) - cparam = StringUtils.stringize(pmap.get("sig")); + cparam = (String[])(pmap.get("sig")); if (cparam==null) return -1; // completely not-specified try { // get the community ID - return Integer.parseInt(cparam.trim()); + return Integer.parseInt(cparam[0].trim()); } // end try catch (NumberFormatException e) { // couldn't be parsed as an integer - damn! ValidationException ve = new ValidationException(LibraryVenice.class,"LibraryMessages","invalid.cid",e); - ve.setParameter(0,cparam); + ve.setParameter(0,cparam[0]); throw ve; } // end catch diff --git a/venice-data/scripts/comm/admin/main.js b/venice-data/scripts/comm/admin/main.js new file mode 100644 index 0000000..789e753 --- /dev/null +++ b/venice-data/scripts/comm/admin/main.js @@ -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 . +// +// 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 , +// 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): + +importPackage(java.lang); +importClass(Packages.com.silverwrist.dynamo.Namespaces); +importPackage(Packages.com.silverwrist.dynamo.except); +importPackage(Packages.com.silverwrist.dynamo.iface); +importPackage(Packages.com.silverwrist.venice.iface); +importPackage(Packages.com.silverwrist.venice.menu); + +req = bsf.lookupBean("request"); +req_help = bsf.lookupBean("request_help"); +user = vlib.getUser(req); +comm = vlib.getCommunity(req); + +// Get the menu provider and the menu. +mprov = vcast.queryMenuProvider(req_help.getRequestObject(Namespaces.DYNAMO_OBJECT_NAMESPACE,"venice-menus")); +srm = cast.querySecurityReferenceMonitor(req_help.getRequestObject(Namespaces.DYNAMO_OBJECT_NAMESPACE,"srm")); +aclids = cast.newIntArray(2); +aclids[0] = comm.getAcl().getAclID(); +aclids[1] = srm.getGlobalAcl().getAclID(); +menu = mprov.getStandardMenu(user,VeniceNamespaces.COMMUNITY_GLOBALS_NAMESPACE,"admin.menu",aclids); +menu.setVariable("name",comm.getName()); +menu.setVariable("cid",String.valueOf(comm.getCID())); +dynamo.scriptOutput(menu); diff --git a/venice-data/scripts/find_categories.js b/venice-data/scripts/find_categories.js index 70fcd02..4704287 100644 --- a/venice-data/scripts/find_categories.js +++ b/venice-data/scripts/find_categories.js @@ -81,6 +81,7 @@ if (rhelp.isVerb("POST")) if (rc==null) { // create the VelocityView for the output rc = new VelocityView("Find Categories","find_categories.vm"); + rc.menuSelector = "top"; rc.setParameter("mode",mode.getName()); rc.setParameter("term",term.toString()); rc.setParameter("ofs",cast.toIntegerObject(ofs)); diff --git a/venice-data/scripts/find_communities.js b/venice-data/scripts/find_communities.js index 58d85fa..11f81d2 100644 --- a/venice-data/scripts/find_communities.js +++ b/venice-data/scripts/find_communities.js @@ -129,6 +129,7 @@ else if (use_categories) if (rc==null) { // create the VelocityView for the output rc = new VelocityView("Find Communities","find_communities.vm"); + rc.menuSelector = "top"; rc.setParameter("field",field.getName()); rc.setParameter("mode",mode.getName()); rc.setParameter("term",term.toString()); diff --git a/venice-data/scripts/find_users.js b/venice-data/scripts/find_users.js index 45c391a..ed0cab3 100644 --- a/venice-data/scripts/find_users.js +++ b/venice-data/scripts/find_users.js @@ -84,6 +84,7 @@ if (rhelp.isVerb("POST")) if (rc==null) { // create the VelocityView for the output rc = new VelocityView("Find Users","find_users.vm"); + rc.menuSelector = "top"; rc.setParameter("field",field.getName()); rc.setParameter("mode",mode.getName()); rc.setParameter("term",term.toString());