diff --git a/build.xml b/build.xml index 4223e65..bcbd14d 100644 --- a/build.xml +++ b/build.xml @@ -318,6 +318,10 @@ + + + + + diff --git a/resources/conferencing-module/scripts/conferences.js b/resources/conferencing-module/scripts/conferences.js new file mode 100644 index 0000000..0284967 --- /dev/null +++ b/resources/conferencing-module/scripts/conferences.js @@ -0,0 +1,33 @@ +// 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.iface); +importPackage(Packages.com.silverwrist.dynamo.util); +importClass(Packages.com.silverwrist.venice.VeniceNamespaces); +importPackage(Packages.com.silverwrist.venice.content); +importPackage(Packages.com.silverwrist.venice.iface); + +req = bsf.lookupBean("request"); // get request +rhelp = bsf.lookupBean("request_help"); // get request helper +user = vlib.getUser(req); // get user +comm = vlib.getCommunity(req); // get community + +// Create the view. +rc = new VelocityView("Conference List: " + comm.name,"conf/conferences.vm"); +rc.setParameter("community",comm); +dynamo.scriptOutput(rc); diff --git a/resources/conferencing-module/velocity/conferences.vm b/resources/conferencing-module/velocity/conferences.vm new file mode 100644 index 0000000..b81670c --- /dev/null +++ b/resources/conferencing-module/velocity/conferences.vm @@ -0,0 +1,27 @@ +#* + 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): +*# +#* + Parameters: + community = The community we're getting the conferences of. +*# +#header2( "Conference List:" $community.Name ) +## TEMPORARY +

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore +magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo +consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. +Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

diff --git a/src/conferencing-module/com/silverwrist/venice/conf/module/ModuleMain.java b/src/conferencing-module/com/silverwrist/venice/conf/module/ModuleMain.java index 23ab861..e3e9dd9 100644 --- a/src/conferencing-module/com/silverwrist/venice/conf/module/ModuleMain.java +++ b/src/conferencing-module/com/silverwrist/venice/conf/module/ModuleMain.java @@ -23,6 +23,7 @@ import com.silverwrist.dynamo.except.*; import com.silverwrist.dynamo.iface.*; import com.silverwrist.dynamo.util.*; import com.silverwrist.venice.community.CommunityServiceInstall; +import com.silverwrist.venice.util.*; import com.silverwrist.venice.conf.ConfNamespaces; import com.silverwrist.venice.conf.iface.UseCount; @@ -39,6 +40,7 @@ public class ModuleMain implements ModuleFunctions, UseCount private static final QualifiedNameKey NAME = new QualifiedNameKey(ConfNamespaces.CONFERENCING_NAMESPACE,"Venice.conferencing"); + private static final String RESOURCES = "com.silverwrist.venice.conf.module.ModuleMessages"; /*-------------------------------------------------------------------------------- * Attributes @@ -48,6 +50,8 @@ public class ModuleMain implements ModuleFunctions, UseCount private int m_usecount = 0; private ModuleSite m_site = null; private Controller m_controller = null; + private ComponentShutdown m_res1; + private ComponentShutdown m_res2; /*-------------------------------------------------------------------------------- * Constructor @@ -71,7 +75,7 @@ public class ModuleMain implements ModuleFunctions, UseCount public String getDescription() { - ResourceBundle b = ResourceBundle.getBundle("com.silverwrist.venice.conf.module.ModuleMessages"); + ResourceBundle b = ResourceBundle.getBundle(RESOURCES); return b.getString("description"); } // end getDescription @@ -80,10 +84,28 @@ public class ModuleMain implements ModuleFunctions, UseCount { m_site = site; + try + { // Mount the resource provider into the resource tree. + ResourceProvider module_res = site.getResourceProvider(); + ResourceProviderManager resmgr = (ResourceProviderManager)(services.queryService(ResourceProviderManager.class)); + m_res1 = resmgr.mountResourceProvider("/scripts/conf",new PrefixResourceProvider(module_res,"/scripts")); + m_res2 = resmgr.mountResourceProvider("/velocity/conf",new PrefixResourceProvider(module_res,"/velocity")); + + } // end try + catch (ConfigException e) + { // translate the ConfigException into a ModuleException + throw new ModuleException(e); + + } // end catch + } // end initialize public void shutdown() { + m_res1.shutdown(); + m_res1 = null; + m_res2.shutdown(); + m_res2 = null; m_site = null; m_controller = null; m_usecount = 0; @@ -111,6 +133,33 @@ public class ModuleMain implements ModuleFunctions, UseCount } // end synchronized block + ResourceBundle bun = ResourceBundle.getBundle(RESOURCES); + + try + { // Install our community menu options. + CommunityMenuInstaller comm_menu = new CommunityMenuInstaller(services); + comm_menu.installCommunityServiceEntry((DynamoUser)installer,bun.getString("comm.menu.prompt"),"SERVLET", + "conf/conferences.js.vs?cc=${cid}",SHORTVAR); + log.info("Installed conferencing option to community left menu"); + + } // end try + catch (DatabaseException de) + { // database error + log.error("Caught database error while installing menus",de); + ModuleException me = new ModuleException(ModuleMain.class,"ModuleMessages","install.cmenu.fail",de); + me.setParameter(0,de.getMessage()); + throw me; + + } // end catch + catch (DynamoSecurityException dse) + { // security error + log.error("Caught security error while installing menus",dse); + ModuleException me = new ModuleException(ModuleMain.class,"ModuleMessages","install.cmenu.fail",dse); + me.setParameter(0,dse.getMessage()); + throw me; + + } // end catch + try { // Install our community service. CommunityServiceInstall csi = (CommunityServiceInstall)(services.queryService(CommunityServiceInstall.class)); @@ -149,6 +198,30 @@ public class ModuleMain implements ModuleFunctions, UseCount } // end catch + try + { // uninstall the community menus + CommunityMenuInstaller comm_menu = new CommunityMenuInstaller(services); + comm_menu.removeCommunityServiceEntry((DynamoUser)uninstaller,"conf/conferences.js.vs",SHORTVAR); + log.info("Removed conferencing option from community left menu"); + + } // end try + catch (DatabaseException de) + { // database error + log.error("Caught database error while uninstalling menus",de); + ModuleException me = new ModuleException(ModuleMain.class,"ModuleMessages","uninstall.cmenu.fail",de); + me.setParameter(0,de.getMessage()); + throw me; + + } // end catch + catch (DynamoSecurityException dse) + { // security error + log.error("Caught security error while uninstalling menus",dse); + ModuleException me = new ModuleException(ModuleMain.class,"ModuleMessages","uninstall.cmenu.fail",dse); + me.setParameter(0,dse.getMessage()); + throw me; + + } // end catch + } // end uninstall public DynamicObject getProvidedObject(String namespace, String name) throws ModuleException diff --git a/src/conferencing-module/com/silverwrist/venice/conf/module/ModuleMessages.properties b/src/conferencing-module/com/silverwrist/venice/conf/module/ModuleMessages.properties index b4775ad..cc537af 100644 --- a/src/conferencing-module/com/silverwrist/venice/conf/module/ModuleMessages.properties +++ b/src/conferencing-module/com/silverwrist/venice/conf/module/ModuleMessages.properties @@ -16,5 +16,8 @@ # --------------------------------------------------------------------------------- # This file has been localized for the en_US locale description=Venice Conferencing System +comm.menu.prompt=Conferences install.service.fail=Failed to install community service object: {0} uninstall.service.fail=Failed to uninstall community service object: {0} +install.cmenu.fail=Failed to install community menu items: {0} +uninstall.cmenu.fail=Failed to uninstall community menu items: {0} diff --git a/src/dynamo-framework/com/silverwrist/dynamo/except/ModuleException.java b/src/dynamo-framework/com/silverwrist/dynamo/except/ModuleException.java index 73a28cb..090bff8 100644 --- a/src/dynamo-framework/com/silverwrist/dynamo/except/ModuleException.java +++ b/src/dynamo-framework/com/silverwrist/dynamo/except/ModuleException.java @@ -55,4 +55,10 @@ public class ModuleException extends ExternalException } // end constructor + public ModuleException(ConfigException e) + { + super(e); + + } // end constructor + } // end class ModuleException diff --git a/src/dynamo-framework/com/silverwrist/dynamo/util/PrefixResourceProvider.java b/src/dynamo-framework/com/silverwrist/dynamo/util/PrefixResourceProvider.java new file mode 100644 index 0000000..44a2969 --- /dev/null +++ b/src/dynamo-framework/com/silverwrist/dynamo/util/PrefixResourceProvider.java @@ -0,0 +1,64 @@ +/* + * 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): + */ +package com.silverwrist.dynamo.util; + +import java.io.*; +import com.silverwrist.dynamo.iface.*; + +public class PrefixResourceProvider implements ResourceProvider +{ + /*-------------------------------------------------------------------------------- + * Attributes + *-------------------------------------------------------------------------------- + */ + + private ResourceProvider m_inner; + private String m_prefix; + + /*-------------------------------------------------------------------------------- + * Constructor + *-------------------------------------------------------------------------------- + */ + + public PrefixResourceProvider(ResourceProvider inner, String prefix) + { + m_inner = inner; + m_prefix = prefix; + while ((m_prefix.length()>0) && m_prefix.endsWith("/")) + m_prefix = m_prefix.substring(0,m_prefix.length()-1); + + } // end constructor + + /*-------------------------------------------------------------------------------- + * Implementations from interface ResourceProvider + *-------------------------------------------------------------------------------- + */ + + public InputStream getResource(String resource_path) throws IOException + { + return m_inner.getResource(m_prefix + resource_path); + + } // end getResource + + public long getResourceModTime(String resource_path) + { + return m_inner.getResourceModTime(m_prefix + resource_path); + + } // end getResourceModTime + +} // end class PrefixResourceProvider diff --git a/src/venice-base/com/silverwrist/venice/util/CommunityMenuInstaller.java b/src/venice-base/com/silverwrist/venice/util/CommunityMenuInstaller.java index 9c2c8ab..a922469 100644 --- a/src/venice-base/com/silverwrist/venice/util/CommunityMenuInstaller.java +++ b/src/venice-base/com/silverwrist/venice/util/CommunityMenuInstaller.java @@ -43,7 +43,7 @@ public class CommunityMenuInstaller *-------------------------------------------------------------------------------- */ - CommunityMenuInstaller(ServiceProvider services) + public CommunityMenuInstaller(ServiceProvider services) { m_provider = (MenuProvider)(services.queryService(MenuProvider.class)); diff --git a/src/venice-base/com/silverwrist/venice/util/SystemAdminMenuInstaller.java b/src/venice-base/com/silverwrist/venice/util/SystemAdminMenuInstaller.java index 1d6b464..15cbf81 100644 --- a/src/venice-base/com/silverwrist/venice/util/SystemAdminMenuInstaller.java +++ b/src/venice-base/com/silverwrist/venice/util/SystemAdminMenuInstaller.java @@ -43,7 +43,7 @@ public class SystemAdminMenuInstaller *-------------------------------------------------------------------------------- */ - SystemAdminMenuInstaller(ServiceProvider services) + public SystemAdminMenuInstaller(ServiceProvider services) { m_provider = (MenuProvider)(services.queryService(MenuProvider.class));