further improvements to module loader, implemented sysadmin module install page
This commit is contained in:
parent
f1ceac134c
commit
0f0f4a4a4e
|
@ -839,6 +839,8 @@ INSERT INTO acedata (aceid, perm_nsid, perm_name) VALUES
|
|||
(3, 12, 'set.property' ),
|
||||
(3, 12, 'set.block' ),
|
||||
(3, 13, 'show.admin.menu' ),
|
||||
(3, 13, 'install.modules' ),
|
||||
(3, 13, 'uninstall.modules' ),
|
||||
(3, 14, 'see.member.community.lists'),
|
||||
(3, 14, 'community.directory.all' ),
|
||||
(3, 14, 'community.search.all' ),
|
||||
|
@ -1371,18 +1373,8 @@ INSERT INTO menuitems (menuid, sequence, itemtype, text, linktype, link) VALUES
|
|||
INSERT INTO menus (menuid, menu_nsid, menu_name, title, subtitle)
|
||||
VALUES (3, 13, 'system.admin', 'System Administration', NULL);
|
||||
INSERT INTO menuitems (menuid, sequence, itemtype, text, linktype, link, perm_nsid, perm_name) VALUES
|
||||
(3, 0, 'TEXT', 'Set Frame Look-And-Feel Parameters', 'SERVLET', 'sysadmin/frame_laf.js.vs', 1,
|
||||
'set.property'),
|
||||
(3, 1, 'TEXT', 'Set E-Mail Parameters', 'SERVLET', 'sysadmin/email.js.vs', 5,
|
||||
'set.property'),
|
||||
(3, 2, 'TEXT', 'Set Session Parameters', 'SERVLET', 'sysadmin/session.js.vs', 7,
|
||||
'set.property'),
|
||||
(3, 3, 'TEXT', 'Edit Confirmation E-Mail Message', 'SERVLET', 'sysadmin/confirm_email.js.vs', 12,
|
||||
'set.property'),
|
||||
(3, 4, 'TEXT', 'Edit Password Changed E-Mail Message', 'SERVLET', 'sysadmin/pwchange_email.js.vs', 12,
|
||||
'set.property'),
|
||||
(3, 5, 'TEXT', 'Edit Password Reminder E-Mail Message', 'SERVLET', 'sysadmin/pwremind_email.js.vs', 12,
|
||||
'set.property');
|
||||
(3, 0, 'TEXT', 'Edit System Globals', 'SERVLET', 'sysadmin/globals.js.vs', NULL, NULL),
|
||||
(3, 1, 'TEXT', 'Manage Modules', 'SERVLET', 'sysadmin/modules.js.vs', NULL, NULL);
|
||||
|
||||
# Create the find submenu. (ID #4)
|
||||
INSERT INTO menus (menuid, menu_nsid, menu_name, title, subtitle)
|
||||
|
@ -1433,6 +1425,39 @@ INSERT INTO menuvars (menuid, var_name, default_val) VALUES
|
|||
INSERT INTO menuitems (menuid, sequence, itemtype, text, linktype, link, perm_nsid, perm_name) VALUES
|
||||
(7, 0, 'TEXT', 'Edit Community Profile', 'SERVLET', 'comm/admin/profile.js.vs?cc=${cid}', 15, 'set.property');
|
||||
|
||||
# Create the sysadmin globals menu. (ID #8)
|
||||
INSERT INTO menus (menuid, menu_nsid, menu_name, title, subtitle)
|
||||
VALUES (8, 13, 'system.admin.globals', 'Edit System Globals', NULL);
|
||||
INSERT INTO menuitems (menuid, sequence, itemtype, text, linktype, link, perm_nsid, perm_name) VALUES
|
||||
(8, 0, 'TEXT', 'Return to Previous Menu', 'SERVLET', 'sysadmin/main.js.vs', NULL,
|
||||
NULL ),
|
||||
(8, 1, 'TEXT', 'Set Frame Look-And-Feel Parameters', 'SERVLET', 'sysadmin/frame_laf.js.vs', 1,
|
||||
'set.property'),
|
||||
(8, 2, 'TEXT', 'Set E-Mail Parameters', 'SERVLET', 'sysadmin/email.js.vs', 5,
|
||||
'set.property'),
|
||||
(8, 3, 'TEXT', 'Set Session Parameters', 'SERVLET', 'sysadmin/session.js.vs', 7,
|
||||
'set.property'),
|
||||
(8, 4, 'TEXT', 'Edit Confirmation E-Mail Message', 'SERVLET', 'sysadmin/confirm_email.js.vs', 12,
|
||||
'set.property'),
|
||||
(8, 5, 'TEXT', 'Edit Password Changed E-Mail Message', 'SERVLET', 'sysadmin/pwchange_email.js.vs', 12,
|
||||
'set.property'),
|
||||
(8, 6, 'TEXT', 'Edit Password Reminder E-Mail Message', 'SERVLET', 'sysadmin/pwremind_email.js.vs', 12,
|
||||
'set.property');
|
||||
|
||||
INSERT INTO menus (menuid, menu_nsid, menu_name, title, subtitle)
|
||||
VALUES (9, 13, 'system.admin.module', 'Manage Modules', NULL);
|
||||
INSERT INTO menuitems (menuid, sequence, itemtype, text, linktype, link, perm_nsid, perm_name) VALUES
|
||||
(9, 0, 'TEXT', 'Return to Previous Menu', 'SERVLET', 'sysadmin/main.js.vs', NULL,
|
||||
NULL ),
|
||||
(9, 1, 'TEXT', 'Install New Modules', 'SERVLET', 'sysadmin/module_install.js.vs', 13,
|
||||
'install.modules' ),
|
||||
(9, 2, 'TEXT', 'Uninstall Modules', 'SERVLET', 'sysadmin/TODO', 13,
|
||||
'uninstall.modules'),
|
||||
(9, 100, 'MARKER', 'begin-module-sysadmin', NULL, NULL, NULL,
|
||||
NULL ),
|
||||
(9, 65000, 'MARKER', 'end-module-sysadmin', NULL, NULL, NULL,
|
||||
NULL );
|
||||
|
||||
# Create the sideboxes tables.
|
||||
INSERT INTO sbox_master (sbid, sb_nsid, sb_name, type_nsid, type_name, descr) VALUES
|
||||
(1, 19, 'community.list', 19, 'community.list', 'Community Membership List'),
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* 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):
|
||||
*/
|
||||
package com.silverwrist.dynamo.iface;
|
||||
|
||||
public interface DynamoLog
|
||||
{
|
||||
public void debug(Object message);
|
||||
|
||||
public void debug(Object message, Throwable t);
|
||||
|
||||
public void error(Object message);
|
||||
|
||||
public void error(Object message, Throwable t);
|
||||
|
||||
public void fatal(Object message);
|
||||
|
||||
public void fatal(Object message, Throwable t);
|
||||
|
||||
public void info(Object message);
|
||||
|
||||
public void info(Object message, Throwable t);
|
||||
|
||||
public void warn(Object message);
|
||||
|
||||
public void warn(Object message, Throwable t);
|
||||
|
||||
} // end interface DynamoLog
|
|
@ -26,9 +26,9 @@ public interface Module
|
|||
{
|
||||
public QualifiedNameKey getModuleID();
|
||||
|
||||
public void install(Principal installer) throws DatabaseException, ModuleException;
|
||||
public void install(Principal installer, DynamoLog log) throws DatabaseException, ModuleException;
|
||||
|
||||
public void uninstall(Principal uninstaller) throws DatabaseException, ModuleException;
|
||||
public void uninstall(Principal uninstaller, DynamoLog log) throws DatabaseException, ModuleException;
|
||||
|
||||
public DynamicObject getProvidedObject(String namespace, String name) throws ModuleException;
|
||||
|
||||
|
|
|
@ -33,9 +33,11 @@ public interface ModuleFunctions
|
|||
|
||||
public boolean canInstall(ServiceProvider services, Principal installer);
|
||||
|
||||
public void install(ModuleSite site, ServiceProvider services, Principal installer) throws ModuleException;
|
||||
public void install(ModuleSite site, ServiceProvider services, Principal installer, DynamoLog log)
|
||||
throws ModuleException;
|
||||
|
||||
public void uninstall(ModuleSite site, ServiceProvider services, Principal uninstaller) throws ModuleException;
|
||||
public void uninstall(ModuleSite site, ServiceProvider services, Principal uninstaller, DynamoLog log)
|
||||
throws ModuleException;
|
||||
|
||||
public DynamicObject getProvidedObject(String namespace, String name) throws ModuleException;
|
||||
|
||||
|
|
|
@ -284,7 +284,7 @@ class ModuleLoader extends URLClassLoader implements Module
|
|||
|
||||
} // end getModuleID
|
||||
|
||||
public synchronized void install(Principal installer) throws DatabaseException, ModuleException
|
||||
public synchronized void install(Principal installer, DynamoLog log) throws DatabaseException, ModuleException
|
||||
{
|
||||
if (m_ops.isModuleInstalled(m_filename))
|
||||
return; // already installed
|
||||
|
@ -305,8 +305,11 @@ class ModuleLoader extends URLClassLoader implements Module
|
|||
|
||||
} // end if
|
||||
|
||||
if (log==null)
|
||||
log = NullLog.get();
|
||||
|
||||
ModuleSite s = new Site();
|
||||
m_modfuncs.install(s,m_install_svcs,installer);
|
||||
m_modfuncs.install(s,m_install_svcs,installer,log);
|
||||
QualifiedNameKey name = m_modfuncs.getModuleID();
|
||||
m_ops.markInstalled(m_filename,m_nscache.namespaceNameToId(name.getNamespace()),name.getName());
|
||||
m_modfuncs.initialize(s,m_install_svcs);
|
||||
|
@ -314,7 +317,7 @@ class ModuleLoader extends URLClassLoader implements Module
|
|||
|
||||
} // end install
|
||||
|
||||
public synchronized void uninstall(Principal uninstaller) throws DatabaseException, ModuleException
|
||||
public synchronized void uninstall(Principal uninstaller, DynamoLog log) throws DatabaseException, ModuleException
|
||||
{
|
||||
if (!(m_ops.isModuleInstalled(m_filename)))
|
||||
return; // already uninstalled
|
||||
|
@ -334,7 +337,10 @@ class ModuleLoader extends URLClassLoader implements Module
|
|||
|
||||
} // end if
|
||||
|
||||
m_modfuncs.uninstall(new Site(),m_install_svcs,uninstaller);
|
||||
if (log==null)
|
||||
log = NullLog.get();
|
||||
|
||||
m_modfuncs.uninstall(new Site(),m_install_svcs,uninstaller,log);
|
||||
m_ops.unmarkInstalled(m_filename);
|
||||
|
||||
} // end uninstall
|
||||
|
|
|
@ -0,0 +1,98 @@
|
|||
/*
|
||||
* 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):
|
||||
*/
|
||||
package com.silverwrist.dynamo.util;
|
||||
|
||||
import com.silverwrist.dynamo.iface.*;
|
||||
|
||||
public class NullLog implements DynamoLog
|
||||
{
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Static data members
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
private static NullLog _self = null;
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Constructor
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
private NullLog()
|
||||
{ // do nothing
|
||||
} // end constructor
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Implementations from interface DynamoLog
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public void debug(Object message)
|
||||
{ // no implementation
|
||||
} // end debug
|
||||
|
||||
public void debug(Object message, Throwable t)
|
||||
{ // no implementation
|
||||
} // end debug
|
||||
|
||||
public void error(Object message)
|
||||
{ // no implementation
|
||||
} // end error
|
||||
|
||||
public void error(Object message, Throwable t)
|
||||
{ // no implementation
|
||||
} // end error
|
||||
|
||||
public void fatal(Object message)
|
||||
{ // no implementation
|
||||
} // end fatal
|
||||
|
||||
public void fatal(Object message, Throwable t)
|
||||
{ // no implementation
|
||||
} // end fatal
|
||||
|
||||
public void info(Object message)
|
||||
{ // no implementation
|
||||
} // end info
|
||||
|
||||
public void info(Object message, Throwable t)
|
||||
{ // no implementation
|
||||
} // end info
|
||||
|
||||
public void warn(Object message)
|
||||
{ // no implementation
|
||||
} // end warn
|
||||
|
||||
public void warn(Object message, Throwable t)
|
||||
{ // no implementation
|
||||
} // end warn
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* External static operations
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public static synchronized DynamoLog get()
|
||||
{
|
||||
if (_self==null)
|
||||
_self = new NullLog();
|
||||
return _self;
|
||||
|
||||
} // end get
|
||||
|
||||
} // end class NullLog
|
|
@ -0,0 +1,180 @@
|
|||
/*
|
||||
* 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):
|
||||
*/
|
||||
package com.silverwrist.dynamo.util;
|
||||
|
||||
import java.io.*;
|
||||
import java.text.*;
|
||||
import java.util.*;
|
||||
import com.silverwrist.util.*;
|
||||
import com.silverwrist.dynamo.iface.*;
|
||||
|
||||
public class SimpleMemoryLog implements DynamoLog
|
||||
{
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Static data members
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
private static DateFormat s_fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
private static final String S_DEBUG = "DEBUG";
|
||||
private static final String S_ERROR = "ERROR";
|
||||
private static final String S_FATAL = "FATAL";
|
||||
private static final String S_INFO = "INFO ";
|
||||
private static final String S_WARN = "WARN ";
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Attributes
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
private LinkedList m_scroll = new LinkedList();
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Constructor
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public SimpleMemoryLog()
|
||||
{ // do nothing
|
||||
} // end constructor
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Internal operations
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
private final void output(String s)
|
||||
{
|
||||
if (s==null)
|
||||
return;
|
||||
String[] lines = StringUtils.split(s,"\r\n");
|
||||
for (int i=0; i<lines.length; i++)
|
||||
m_scroll.addLast(lines[i]);
|
||||
|
||||
} // end output
|
||||
|
||||
private final void stackTrace(Throwable t)
|
||||
{
|
||||
if (t==null)
|
||||
return;
|
||||
StringWriter wr = new StringWriter();
|
||||
PrintWriter pwr = new PrintWriter(wr);
|
||||
t.printStackTrace(pwr);
|
||||
pwr.flush();
|
||||
output(wr.toString());
|
||||
|
||||
} // end stackTrace
|
||||
|
||||
private final void doMessage(String level, Object data)
|
||||
{
|
||||
StringBuffer buf = new StringBuffer(s_fmt.format(new java.util.Date()));
|
||||
buf.append(" ").append(level).append(" ").append(data);
|
||||
output(buf.toString());
|
||||
|
||||
} // end doMessage
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Implementations from interface DynamoLog
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public void debug(Object message)
|
||||
{
|
||||
doMessage(S_DEBUG,message);
|
||||
|
||||
} // end debug
|
||||
|
||||
public void debug(Object message, Throwable t)
|
||||
{
|
||||
doMessage(S_DEBUG,message);
|
||||
stackTrace(t);
|
||||
|
||||
} // end debug
|
||||
|
||||
public void error(Object message)
|
||||
{
|
||||
doMessage(S_ERROR,message);
|
||||
|
||||
} // end error
|
||||
|
||||
public void error(Object message, Throwable t)
|
||||
{
|
||||
doMessage(S_ERROR,message);
|
||||
stackTrace(t);
|
||||
|
||||
} // end error
|
||||
|
||||
public void fatal(Object message)
|
||||
{
|
||||
doMessage(S_FATAL,message);
|
||||
|
||||
} // end fatal
|
||||
|
||||
public void fatal(Object message, Throwable t)
|
||||
{
|
||||
doMessage(S_FATAL,message);
|
||||
stackTrace(t);
|
||||
|
||||
} // end fatal
|
||||
|
||||
public void info(Object message)
|
||||
{
|
||||
doMessage(S_INFO,message);
|
||||
|
||||
} // end info
|
||||
|
||||
public void info(Object message, Throwable t)
|
||||
{
|
||||
doMessage(S_INFO,message);
|
||||
stackTrace(t);
|
||||
|
||||
} // end info
|
||||
|
||||
public void warn(Object message)
|
||||
{
|
||||
doMessage(S_WARN,message);
|
||||
|
||||
} // end warn
|
||||
|
||||
public void warn(Object message, Throwable t)
|
||||
{
|
||||
doMessage(S_WARN,message);
|
||||
stackTrace(t);
|
||||
|
||||
} // end warn
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* External operations
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public List getLog()
|
||||
{
|
||||
ArrayList rc = new ArrayList(m_scroll);
|
||||
return Collections.unmodifiableList(rc);
|
||||
|
||||
} // end getLog
|
||||
|
||||
public void clear()
|
||||
{
|
||||
m_scroll.clear();
|
||||
|
||||
} // end clear
|
||||
|
||||
} // end class SimpleMemoryLog
|
|
@ -88,12 +88,14 @@ public class Main implements ModuleFunctions
|
|||
|
||||
} // end canInstall
|
||||
|
||||
public void install(ModuleSite site, ServiceProvider services, Principal installer) throws ModuleException
|
||||
public void install(ModuleSite site, ServiceProvider services, Principal installer, DynamoLog log)
|
||||
throws ModuleException
|
||||
{
|
||||
// module does not need installation
|
||||
} // end install
|
||||
|
||||
public void uninstall(ModuleSite site, ServiceProvider services, Principal uninstaller) throws ModuleException
|
||||
public void uninstall(ModuleSite site, ServiceProvider services, Principal uninstaller, DynamoLog log)
|
||||
throws ModuleException
|
||||
{
|
||||
// module does not need uninstallation
|
||||
} // end uninstall
|
||||
|
|
35
venice-data/scripts/sysadmin/globals.js
Normal file
35
venice-data/scripts/sysadmin/globals.js
Normal 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);
|
79
venice-data/scripts/sysadmin/module_install.js
Normal file
79
venice-data/scripts/sysadmin/module_install.js
Normal 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);
|
35
venice-data/scripts/sysadmin/modules.js
Normal file
35
venice-data/scripts/sysadmin/modules.js
Normal 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);
|
|
@ -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
|
||||
|
|
37
venice-data/velocity/sysadmin/module_install.vm
Normal file
37
venice-data/velocity/sysadmin/module_install.vm
Normal 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
|
39
venice-data/velocity/sysadmin/module_install_result.vm
Normal file
39
venice-data/velocity/sysadmin/module_install_result.vm
Normal 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>
|
Loading…
Reference in New Issue
Block a user