added initial sysadmin menu items and dialogs, fixed a few things about dialog
operation here and there
This commit is contained in:
108
venice-data/scripts/sysadmin/email.js
Normal file
108
venice-data/scripts/sysadmin/email.js
Normal file
@@ -0,0 +1,108 @@
|
||||
// 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(Packages.com.silverwrist.util);
|
||||
importClass(Packages.com.silverwrist.dynamo.Namespaces);
|
||||
importPackage(Packages.com.silverwrist.dynamo.except);
|
||||
importPackage(Packages.com.silverwrist.dynamo.iface);
|
||||
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.frame);
|
||||
|
||||
req = bsf.lookupBean("request");
|
||||
req_help = bsf.lookupBean("request_help");
|
||||
user = vlib.getUser(req);
|
||||
vlib.setOnError(req,"sysadmin/main.js.vs");
|
||||
vlib.setOnErrorType(req,"SERVLET");
|
||||
|
||||
// Make sure we are permitted to be here.
|
||||
srm = cast.querySecurityReferenceMonitor(req_help.getRequestObject(Namespaces.DYNAMO_OBJECT_NAMESPACE,"srm"));
|
||||
acl = srm.getGlobalAcl();
|
||||
if (!( acl.testPermission(user,VeniceNamespaces.MAIL_PROPS_NAMESPACE,"set.property")
|
||||
&& acl.testPermission(user,VeniceNamespaces.MAIL_PROPS_NAMESPACE,"set.block")))
|
||||
dynamo.scriptReturn(vlib.stdErrorBox(req,"Security Error","You are not permitted to modify E-mail settings."));
|
||||
|
||||
// Get the global properties store.
|
||||
globals = vcast.getGlobalPropertiesStore(req);
|
||||
blocks = vcast.getGlobalBlocksStore(req);
|
||||
|
||||
// Create the dialog.
|
||||
loader = cast.queryDialogLoader(req);
|
||||
dlg = loader.loadDialogResource("sysadmin/email.dlg.xml");
|
||||
|
||||
my_ns = VeniceNamespaces.MAIL_PROPS_NAMESPACE; // shortcut
|
||||
|
||||
rc = null;
|
||||
if (req_help.isVerb("GET"))
|
||||
{ // Load the dialog with its initial values.
|
||||
dlg.setValue("host",globals.getObject(my_ns,"smtp.host"));
|
||||
dlg.setValue("fromaddr",globals.getObject(my_ns,"system.mail.from.addr"));
|
||||
dlg.setValue("fromname",globals.getObject(my_ns,"system.mail.from.name"));
|
||||
dlg.setValue("mailer",globals.getObject(my_ns,"mailer.name"));
|
||||
dlg.setValue("uinfo",globals.getObject(my_ns,"user.info.header"));
|
||||
dlg.setValue("disclaimer",blocks.getObject(my_ns,"user.disclaimer"));
|
||||
dlg.setValue("sig",blocks.getObject(my_ns,"signature"));
|
||||
|
||||
} // end if
|
||||
else
|
||||
{ // Load information from the dialog
|
||||
op = dlg.getClickedButton(req) + "";
|
||||
if (op=="cancel") // user cancelled - bounce back to the previous menu
|
||||
rc = new Redirect("SERVLET","sysadmin/main.js.vs");
|
||||
else
|
||||
{ // load and validate the dialog
|
||||
dlg.load(req);
|
||||
try
|
||||
{ // validate the dialog
|
||||
dlg.validate(req);
|
||||
|
||||
// set the appropriate values into the system properties
|
||||
globals.setObject(user,my_ns,"smtp.host",dlg.getValue("host"));
|
||||
globals.setObject(user,my_ns,"system.mail.from.addr",dlg.getValue("fromaddr"));
|
||||
globals.setObject(user,my_ns,"system.mail.from.name",dlg.getValue("fromname"));
|
||||
globals.setObject(user,my_ns,"mailer.name",dlg.getValue("mailer"));
|
||||
globals.setObject(user,my_ns,"user.info.header",dlg.getValue("uinfo"));
|
||||
blocks.setObject(user,my_ns,"user.disclaimer",dlg.getValue("disclaimer"));
|
||||
blocks.setObject(user,my_ns,"signature",dlg.getValue("sig"));
|
||||
|
||||
// All done - bounce back to the menu.
|
||||
rc = new Redirect("SERVLET","sysadmin/main.js.vs");
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // thrown an exception from the above process - what sort?
|
||||
etype = dynamo.exceptionType(e) + "";
|
||||
logger.error("Caught exception of type " + etype);
|
||||
if (etype.match(/ValidationException/))
|
||||
dlg.setErrorMessage(dynamo.exceptionMessage(e) + " Please try again.");
|
||||
else if (etype.match(/DatabaseException/))
|
||||
rc = new ErrorBox("Database Error",e,"SERVLET","sysadmin/main.js.vs");
|
||||
else if (etype.match(/DynamoSecurityException/))
|
||||
rc = new ErrorBox("Security Error",e,"SERVLET","sysadmin/main.js.vs");
|
||||
else
|
||||
rc = new ErrorBox("Unknown Exception",e,"SERVLET","sysadmin/main.js.vs");
|
||||
|
||||
} // end catch
|
||||
|
||||
} // end else
|
||||
|
||||
} // end else
|
||||
|
||||
if (rc==null)
|
||||
rc = new FrameDialog(dlg); // output dialog if we don't have another value
|
||||
dynamo.scriptOutput(rc);
|
||||
149
venice-data/scripts/sysadmin/frame_laf.js
Normal file
149
venice-data/scripts/sysadmin/frame_laf.js
Normal file
@@ -0,0 +1,149 @@
|
||||
// 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(Packages.com.silverwrist.util);
|
||||
importClass(Packages.com.silverwrist.dynamo.Namespaces);
|
||||
importPackage(Packages.com.silverwrist.dynamo.except);
|
||||
importPackage(Packages.com.silverwrist.dynamo.iface);
|
||||
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.frame);
|
||||
|
||||
req = bsf.lookupBean("request");
|
||||
req_help = bsf.lookupBean("request_help");
|
||||
user = vlib.getUser(req);
|
||||
vlib.setOnError(req,"sysadmin/main.js.vs");
|
||||
vlib.setOnErrorType(req,"SERVLET");
|
||||
|
||||
// Make sure we are permitted to be here.
|
||||
srm = cast.querySecurityReferenceMonitor(req_help.getRequestObject(Namespaces.DYNAMO_OBJECT_NAMESPACE,"srm"));
|
||||
acl = srm.getGlobalAcl();
|
||||
if (!( acl.testPermission(user,VeniceNamespaces.FRAME_LAF_NAMESPACE,"set.property")
|
||||
&& acl.testPermission(user,VeniceNamespaces.FRAME_LAF_NAMESPACE,"set.block")))
|
||||
dynamo.scriptReturn(vlib.stdErrorBox(req,"Security Error",
|
||||
"You are not permitted to modify frame look-and-feel settings."));
|
||||
|
||||
// Get the global properties store.
|
||||
globals = vcast.getGlobalPropertiesStore(req);
|
||||
blocks = vcast.getGlobalBlocksStore(req);
|
||||
|
||||
// Create the dialog.
|
||||
loader = cast.queryDialogLoader(req);
|
||||
dlg = loader.loadDialogResource("sysadmin/frame_laf.dlg.xml");
|
||||
|
||||
my_ns = VeniceNamespaces.FRAME_LAF_NAMESPACE; // shortcut
|
||||
|
||||
rc = null;
|
||||
if (req_help.isVerb("GET"))
|
||||
{ // Load the dialog with its initial values.
|
||||
optset = cast.toOptionSet(globals.getObject(my_ns,"optionset"));
|
||||
|
||||
dlg.setValue("sitetitle",globals.getObject(my_ns,"site.title"));
|
||||
dlg.setValue("siteurl",globals.getObject(my_ns,"site.url"));
|
||||
dlg.setValue("template",globals.getObject(my_ns,"frame.template"));
|
||||
dlg.setValue("fptitle",globals.getObject(my_ns,"frontpage.title"));
|
||||
|
||||
dlg.setValue("lbarwidth",globals.getObject(my_ns,"left.bar.width"));
|
||||
dlg.setValue("comments",cast.booleanObject(optset.get(0)));
|
||||
dlg.setValue("smarttags",cast.booleanObject(optset.get(1)));
|
||||
|
||||
dlg.setValue("logourl",globals.getObject(my_ns,"site.logo.url"));
|
||||
dlg.setValue("logourltype",globals.getObject(my_ns,"site.logo.url.type"));
|
||||
dlg.setValue("logowidth",globals.getObject(my_ns,"site.logo.width"));
|
||||
dlg.setValue("logoheight",globals.getObject(my_ns,"site.logo.height"));
|
||||
|
||||
dlg.setValue("footer",blocks.getObject(my_ns,"footer"));
|
||||
dlg.setValue("fscale",globals.getObject(my_ns,"footer.logo.scale"));
|
||||
dlg.setValue("fbreak",cast.booleanObject(optset.get(2)));
|
||||
|
||||
dlg.setValue("pgi_url",globals.getObject(my_ns,"page.icon.url"));
|
||||
dlg.setValue("pgi_urltype",globals.getObject(my_ns,"page.icon.url.type"));
|
||||
dlg.setValue("pgi_mime",globals.getObject(my_ns,"page.icon.type"));
|
||||
|
||||
dlg.setValue("fav_url",globals.getObject(my_ns,"page.favicon.url"));
|
||||
dlg.setValue("fav_urltype",globals.getObject(my_ns,"page.favicon.url.type"));
|
||||
|
||||
} // end if
|
||||
else
|
||||
{ // Load information from the dialog
|
||||
op = dlg.getClickedButton(req) + "";
|
||||
if (op=="cancel") // user cancelled - bounce back to the previous menu
|
||||
rc = new Redirect("SERVLET","sysadmin/main.js.vs");
|
||||
else
|
||||
{ // load and validate the dialog
|
||||
dlg.load(req);
|
||||
try
|
||||
{ // validate the dialog
|
||||
dlg.validate(req);
|
||||
|
||||
// set the appropriate values into the system properties
|
||||
optset = cast.toOptionSet(globals.getObject(my_ns,"optionset"));
|
||||
|
||||
globals.setObject(user,my_ns,"site.title",dlg.getValue("sitetitle"));
|
||||
globals.setObject(user,my_ns,"site.url",dlg.getValue("siteurl"));
|
||||
globals.setObject(user,my_ns,"frame.template",dlg.getValue("template"));
|
||||
globals.setObject(user,my_ns,"frontpage.title",dlg.getValue("fptitle"));
|
||||
|
||||
globals.setObject(user,my_ns,"left.bar.width",dlg.getValue("lbarwidth"));
|
||||
optset.set(0,cast.toBoolean(dlg.getValue("comments")));
|
||||
optset.set(1,cast.toBoolean(dlg.getValue("smarttags")));
|
||||
|
||||
globals.setObject(user,my_ns,"site.logo.url",dlg.getValue("logourl"));
|
||||
globals.setObject(user,my_ns,"site.logo.url.type",dlg.getValue("logourltype"));
|
||||
globals.setObject(user,my_ns,"site.logo.width",dlg.getValue("logowidth"));
|
||||
globals.setObject(user,my_ns,"site.logo.height",dlg.getValue("logoheight"));
|
||||
|
||||
blocks.setObject(user,my_ns,"footer",dlg.getValue("footer"));
|
||||
globals.setObject(user,my_ns,"footer.logo.scale",dlg.getValue("fscale"));
|
||||
optset.set(2,cast.toBoolean(dlg.getValue("fbreak")));
|
||||
|
||||
globals.setObject(user,my_ns,"page.icon.url",dlg.getValue("pgi_url"));
|
||||
globals.setObject(user,my_ns,"page.icon.url.type",dlg.getValue("pgi_urltype"));
|
||||
globals.setObject(user,my_ns,"page.icon.type",dlg.getValue("pgi_mime"));
|
||||
|
||||
globals.setObject(user,my_ns,"page.favicon.url",dlg.getValue("fav_url"));
|
||||
globals.setObject(user,my_ns,"page.favicon.url.type",dlg.getValue("fav_urltype"));
|
||||
|
||||
globals.setObject(user,my_ns,"optionset",optset);
|
||||
|
||||
// All done - bounce back to the menu.
|
||||
rc = new Redirect("SERVLET","sysadmin/main.js.vs");
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // thrown an exception from the above process - what sort?
|
||||
etype = dynamo.exceptionType(e) + "";
|
||||
logger.error("Caught exception of type " + etype);
|
||||
if (etype.match(/ValidationException/))
|
||||
dlg.setErrorMessage(dynamo.exceptionMessage(e) + " Please try again.");
|
||||
else if (etype.match(/DatabaseException/))
|
||||
rc = new ErrorBox("Database Error",e,"SERVLET","sysadmin/main.js.vs");
|
||||
else if (etype.match(/DynamoSecurityException/))
|
||||
rc = new ErrorBox("Security Error",e,"SERVLET","sysadmin/main.js.vs");
|
||||
else
|
||||
rc = new ErrorBox("Unknown Exception",e,"SERVLET","sysadmin/main.js.vs");
|
||||
|
||||
} // end catch
|
||||
|
||||
} // end else
|
||||
|
||||
} // end else
|
||||
|
||||
if (rc==null)
|
||||
rc = new FrameDialog(dlg); // output dialog if we don't have another value
|
||||
dynamo.scriptOutput(rc);
|
||||
35
venice-data/scripts/sysadmin/main.js
Normal file
35
venice-data/scripts/sysadmin/main.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",aclids);
|
||||
dynamo.scriptOutput(menu);
|
||||
101
venice-data/scripts/sysadmin/session.js
Normal file
101
venice-data/scripts/sysadmin/session.js
Normal file
@@ -0,0 +1,101 @@
|
||||
// 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(Packages.com.silverwrist.util);
|
||||
importClass(Packages.com.silverwrist.dynamo.Namespaces);
|
||||
importPackage(Packages.com.silverwrist.dynamo.except);
|
||||
importPackage(Packages.com.silverwrist.dynamo.iface);
|
||||
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.frame);
|
||||
|
||||
req = bsf.lookupBean("request");
|
||||
req_help = bsf.lookupBean("request_help");
|
||||
user = vlib.getUser(req);
|
||||
vlib.setOnError(req,"sysadmin/main.js.vs");
|
||||
vlib.setOnErrorType(req,"SERVLET");
|
||||
|
||||
// Make sure we are permitted to be here.
|
||||
srm = cast.querySecurityReferenceMonitor(req_help.getRequestObject(Namespaces.DYNAMO_OBJECT_NAMESPACE,"srm"));
|
||||
acl = srm.getGlobalAcl();
|
||||
if (!(acl.testPermission(user,VeniceNamespaces.SESSION_CONTROL_NAMESPACE,"set.property")))
|
||||
dynamo.scriptReturn(vlib.stdErrorBox(req,"Security Error","You are not permitted to modify E-mail settings."));
|
||||
|
||||
// Get the global properties store.
|
||||
globals = vcast.getGlobalPropertiesStore(req);
|
||||
blocks = vcast.getGlobalBlocksStore(req);
|
||||
|
||||
// Create the dialog.
|
||||
loader = cast.queryDialogLoader(req);
|
||||
dlg = loader.loadDialogResource("sysadmin/session.dlg.xml");
|
||||
|
||||
my_ns = VeniceNamespaces.SESSION_CONTROL_NAMESPACE; // shortcut
|
||||
|
||||
rc = null;
|
||||
if (req_help.isVerb("GET"))
|
||||
{ // load the default values into the dialog
|
||||
dlg.setValue("init",globals.getObject(my_ns,"session.init.script"));
|
||||
dlg.setValue("cookie",globals.getObject(my_ns,"login.cookie"));
|
||||
dlg.setValue("cookieage",globals.getObject(my_ns,"login.cookie.maxage"));
|
||||
dlg.setValue("recovery",globals.getObject(my_ns,"password.recovery.time"));
|
||||
|
||||
} // end if
|
||||
else
|
||||
{ // Load information from the dialog
|
||||
op = dlg.getClickedButton(req) + "";
|
||||
if (op=="cancel") // user cancelled - bounce back to the previous menu
|
||||
rc = new Redirect("SERVLET","sysadmin/main.js.vs");
|
||||
else
|
||||
{ // load and validate the dialog
|
||||
dlg.load(req);
|
||||
try
|
||||
{ // validate the dialog
|
||||
dlg.validate(req);
|
||||
|
||||
// set the appropriate values into the system properties
|
||||
globals.setObject(user,my_ns,"session.init.script",dlg.getValue("init"));
|
||||
globals.setObject(user,my_ns,"login.cookie",dlg.getValue("cookie"));
|
||||
globals.setObject(user,my_ns,"login.cookie.maxage",dlg.getValue("cookieage"));
|
||||
globals.setObject(user,my_ns,"password.recovery.time",dlg.getValue("recovery"));
|
||||
|
||||
// All done - bounce back to the menu.
|
||||
rc = new Redirect("SERVLET","sysadmin/main.js.vs");
|
||||
|
||||
} // end try
|
||||
catch (e)
|
||||
{ // thrown an exception from the above process - what sort?
|
||||
etype = dynamo.exceptionType(e) + "";
|
||||
logger.error("Caught exception of type " + etype);
|
||||
if (etype.match(/ValidationException/))
|
||||
dlg.setErrorMessage(dynamo.exceptionMessage(e) + " Please try again.");
|
||||
else if (etype.match(/DatabaseException/))
|
||||
rc = new ErrorBox("Database Error",e,"SERVLET","sysadmin/main.js.vs");
|
||||
else if (etype.match(/DynamoSecurityException/))
|
||||
rc = new ErrorBox("Security Error",e,"SERVLET","sysadmin/main.js.vs");
|
||||
else
|
||||
rc = new ErrorBox("Unknown Exception",e,"SERVLET","sysadmin/main.js.vs");
|
||||
|
||||
} // end catch
|
||||
|
||||
} // end else
|
||||
|
||||
} // end else
|
||||
|
||||
if (rc==null)
|
||||
rc = new FrameDialog(dlg); // output dialog if we don't have another value
|
||||
dynamo.scriptOutput(rc);
|
||||
Reference in New Issue
Block a user