further improvements to module loader, implemented sysadmin module install page

This commit is contained in:
Eric J. Bowersox
2003-06-19 08:43:17 +00:00
parent f1ceac134c
commit 0f0f4a4a4e
14 changed files with 603 additions and 23 deletions

View File

@@ -0,0 +1,35 @@
// 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) 2003 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
//
// Contributor(s):
importClass(Packages.com.silverwrist.dynamo.Namespaces);
importPackage(Packages.com.silverwrist.dynamo.except);
importPackage(Packages.com.silverwrist.dynamo.iface);
importPackage(Packages.com.silverwrist.dynamo.security);
importClass(Packages.com.silverwrist.venice.VeniceNamespaces);
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);
// 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(1);
aclids[0] = srm.getGlobalAcl().getAclID();
menu = mprov.getStandardMenu(user,VeniceNamespaces.SYSTEM_PERMS_NAMESPACE,"system.admin.globals",aclids);
dynamo.scriptOutput(menu);

View File

@@ -0,0 +1,79 @@
// 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) 2003 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
//
// Contributor(s):
importPackage(java.util);
importClass(Packages.com.silverwrist.dynamo.Namespaces);
importPackage(Packages.com.silverwrist.dynamo.except);
importPackage(Packages.com.silverwrist.dynamo.iface);
importPackage(Packages.com.silverwrist.dynamo.module);
importPackage(Packages.com.silverwrist.dynamo.security);
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");
req_help = bsf.lookupBean("request_help");
user = vlib.getUser(req);
modops = cast.queryModuleOperations(req);
the_module = req_help.getParameterString("mod");
if (the_module!=null)
{ // want to install this module
except = null;
log = new SimpleMemoryLog();
try
{ // load and install the module
mod = modops.loadModule(the_module,false);
mod.install(user,log);
} // end try
catch (e)
{ // save the exception
except = e;
} // end catch
// Return the results.
rc = new VelocityView("Module Installation","sysadmin/module_install_result.vm");
rc.setParameter("module",the_module);
rc.setParameter("log",log.getLog());
if (except!=null)
rc.setParameter("except",except);
dynamo.scriptReturn(rc);
} // end if
// Get the list of all module files, and the set of installed module files.
all_mods = modops.listAllModuleNames();
install_mods = modops.listInstalledModuleNames();
// Create a list of all modules which *aren't* installed.
modlist = new ArrayList();
it = all_mods.iterator();
while (it.hasNext())
{ // check installed set, if not there, add to uninstalled list
n = it.next() + "";
if (!(install_mods.contains(n)))
modlist.add(n);
} // end while
// Return the module list.
rc = new VelocityView("Install New Modules","sysadmin/module_install.vm");
rc.setParameter("modlist",modlist);
dynamo.scriptOutput(rc);

View File

@@ -0,0 +1,35 @@
// 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) 2003 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
//
// Contributor(s):
importClass(Packages.com.silverwrist.dynamo.Namespaces);
importPackage(Packages.com.silverwrist.dynamo.except);
importPackage(Packages.com.silverwrist.dynamo.iface);
importPackage(Packages.com.silverwrist.dynamo.security);
importClass(Packages.com.silverwrist.venice.VeniceNamespaces);
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);
// 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(1);
aclids[0] = srm.getGlobalAcl().getAclID();
menu = mprov.getStandardMenu(user,VeniceNamespaces.SYSTEM_PERMS_NAMESPACE,"system.admin.module",aclids);
dynamo.scriptOutput(menu);

View File

@@ -24,7 +24,7 @@
varmap = Listing of variables in the input, with explanations; a Map (may be null)
error_message = Error message to be displayed for this form (may be null).
*#
#header2( "Edit E-Mail Message" $msgtitle )
#header2( "Edit E-Mail Message:" $msgtitle )
#if( $error_message )
<div align="center" class="formerror">#encodeHTML( $error_message ) Please try again.</div>
#end

View File

@@ -0,0 +1,37 @@
#*
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) 2003 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
Contributor(s):
*#
#*
Parameters:
modlist = List of module file names which are not yet installed.
*#
#header1( "Install New Modules" )
<p><a href="#formatURL( "SERVLET" "sysadmin/modules.js.vs" )">Return to Previous Menu</a></p>
#if ( $modlist.isEmpty() )
<p><em>There are no new modules to be installed at this time.</em></p>
#else
<p>The following modules are present on the server but have not yet been installed. Click the module's name
to install it.</p>
<div align="left"><table border="0" cellpadding="0" cellspacing="2">
#foreach( $m in $modlist )
#set( $em = "#encodeURL( $m )"
<tr><td class="content">
<a href="#formatURL( "SERVLET" "sysadmin/module_install.js.vs?mod=$em" )">#encodeHTML( $m )</a>
</td></tr>
#end
</table></div>
#end

View File

@@ -0,0 +1,39 @@
#*
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) 2003 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
Contributor(s):
*#
#*
Parameters:
module = The name of the module we were installing
except = The exception that occurred if install failed (null on success)
log = List containing log messages from the installation
*#
#header2( "Install Module:" $module )
#if( $except )
<p>The installation of module <b>#encodeHTML( $module )</b> failed. The following is the exception that was
thrown by installation:</p>
<pre>#stacktrace( $except )</pre>
#else
<p>The installation of module <b>#encodeHTML( $module )</b> was completed successfully.</p>
#end
<p>The following are the log messages generated by module installation:</p>
<table border="1" width="100%" cellpadding="3" cellspacing="0"><tr><td class="content">
#foreach( $x in $log )
#encodeHTML( $x )<br />
#end
</td></tr></table>
<p><a href="sysadmin/module_install.js.vs">Install more modules</a></p>
<p><a href="sysadmin/modules.js.vs">Return to previous menu</a></p>