From cbae9cdd8e7c32c328aec4ab14460b4c8ff777f5 Mon Sep 17 00:00:00 2001 From: "Eric J. Bowersox" Date: Sun, 25 May 2003 09:11:12 +0000 Subject: [PATCH] added initial sysadmin menu items and dialogs, fixed a few things about dialog operation here and there --- conf/venice-db-init-mysql.sql | 20 +- .../dynamo/dialog/CommonTextField.java | 4 +- .../silverwrist/dynamo/dialog/DialogImpl.java | 14 +- .../dynamo/dialog/DialogManager.java | 2 + .../dynamo/dialog/DialogMessages.properties | 3 +- .../dynamo/dialog/MultiLineTextField.java | 175 ++++++++++++++++++ .../dynamo/dialog/StdItemFactory.java | 2 + .../dynamo/util/BufferTextRenderControl.java | 4 - venice-data/dialogs/sysadmin/email.dlg.xml | 35 ++++ .../dialogs/sysadmin/frame_laf.dlg.xml | 41 ++-- venice-data/dialogs/sysadmin/session.dlg.xml | 32 ++++ venice-data/scripts/sysadmin/email.js | 108 +++++++++++ venice-data/scripts/sysadmin/frame_laf.js | 149 +++++++++++++++ venice-data/scripts/sysadmin/main.js | 35 ++++ venice-data/scripts/sysadmin/session.js | 101 ++++++++++ venice-data/velocity/frame.vm | 1 + venice-web/images/spacer.gif | Bin 0 -> 43 bytes 17 files changed, 698 insertions(+), 28 deletions(-) create mode 100644 src/dynamo-framework/com/silverwrist/dynamo/dialog/MultiLineTextField.java create mode 100644 venice-data/dialogs/sysadmin/email.dlg.xml create mode 100644 venice-data/dialogs/sysadmin/session.dlg.xml create mode 100644 venice-data/scripts/sysadmin/email.js create mode 100644 venice-data/scripts/sysadmin/frame_laf.js create mode 100644 venice-data/scripts/sysadmin/main.js create mode 100644 venice-data/scripts/sysadmin/session.js create mode 100644 venice-web/images/spacer.gif diff --git a/conf/venice-db-init-mysql.sql b/conf/venice-db-init-mysql.sql index 1bee98c..3a9f113 100644 --- a/conf/venice-db-init-mysql.sql +++ b/conf/venice-db-init-mysql.sql @@ -569,18 +569,28 @@ INSERT INTO imagetype (typecode, nsid, name) VALUES #### following this line is initialization of Venice-specific tables #### -# Create the "global" menu. +# Create the "global" menu. (ID #1) INSERT INTO menus (menuid, menu_nsid, menu_name, title, subtitle) VALUES (1, 1, 'fixed.menu', 'About This Site', NULL); INSERT INTO menuitems (menuid, sequence, itemtype, text, linktype, link) VALUES - (1, 0, 'TEXT', 'Documentation', 'ABSOLUTE', 'TODO' ), - (1, 1, 'TEXT', 'About Venice', 'FRAME', 'about-venice.html'), - (1, 2, 'TEXT', 'System Administration', 'ABSOLUTE', 'TODO' ); + (1, 0, 'TEXT', 'Documentation', 'ABSOLUTE', 'TODO' ), + (1, 1, 'TEXT', 'About Venice', 'FRAME', 'about-venice.html' ), + (1, 2, 'TEXT', 'System Administration', 'SERVLET', 'sysadmin/main.js.vs'); UPDATE menuitems SET enable = 0 WHERE menuid = 1 AND sequence = 0; UPDATE menuitems SET perm_nsid = 13, perm_name = 'show.admin.menu' WHERE menuid = 1 AND sequence = 2; -# Create the user profile menu. +# Create the user profile menu. (ID #2) INSERT INTO menus (menuid, menu_nsid, menu_name, title, subtitle) VALUES (2, 11, 'user.profile.menu', '', NULL); +INSERT INTO menuvars (menuid, var_name, default_val) + VALUES (2, 'target', 'top.js.vs'); INSERT INTO menuitems (menuid, sequence, itemtype, text, linktype, link) VALUES (2, 0, 'TEXT', 'Profile', 'SERVLET', 'profile.js.vs?tgt=${target}'); + +# Create the main system administration menu. (ID #3) +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'); diff --git a/src/dynamo-framework/com/silverwrist/dynamo/dialog/CommonTextField.java b/src/dynamo-framework/com/silverwrist/dynamo/dialog/CommonTextField.java index 5f9eb93..582441a 100644 --- a/src/dynamo-framework/com/silverwrist/dynamo/dialog/CommonTextField.java +++ b/src/dynamo-framework/com/silverwrist/dynamo/dialog/CommonTextField.java @@ -11,7 +11,7 @@ * * The Initial Developer of the Original Code is Eric J. Bowersox , * for Silverwrist Design Studios. Portions created by Eric J. Bowersox are - * Copyright (C) 2002 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. + * Copyright (C) 2002-03 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. * * Contributor(s): */ @@ -109,7 +109,7 @@ abstract class CommonTextField extends BaseDialogField protected boolean isNull(Object value) { - return StringUtils.isEmpty((String)value); + return ((value==null) || StringUtils.isEmpty(value.toString())); } // end isNull diff --git a/src/dynamo-framework/com/silverwrist/dynamo/dialog/DialogImpl.java b/src/dynamo-framework/com/silverwrist/dynamo/dialog/DialogImpl.java index 55ce56c..727a92c 100644 --- a/src/dynamo-framework/com/silverwrist/dynamo/dialog/DialogImpl.java +++ b/src/dynamo-framework/com/silverwrist/dynamo/dialog/DialogImpl.java @@ -580,7 +580,19 @@ class DialogImpl implements Dialog while (it.hasNext()) { // call reset on each field DialogField fld = (DialogField)(it.next()); - fld.validate(r); + try + { // perform validation + fld.validate(r); + + } // end try + catch (RuntimeException e) + { // safety in case RuntimeException is thrown + ValidationException ve = new ValidationException(DialogImpl.class,"DialogMessages","valid.except",e); + ve.setParameter(0,fld.getName()); + ve.setParameter(1,e.getMessage()); + throw ve; + + } // end catch } // end while diff --git a/src/dynamo-framework/com/silverwrist/dynamo/dialog/DialogManager.java b/src/dynamo-framework/com/silverwrist/dynamo/dialog/DialogManager.java index f4aa8a3..2b04bc3 100644 --- a/src/dynamo-framework/com/silverwrist/dynamo/dialog/DialogManager.java +++ b/src/dynamo-framework/com/silverwrist/dynamo/dialog/DialogManager.java @@ -174,9 +174,11 @@ public class DialogManager m_factory_data.put("header",fact); m_factory_data.put("hidden",fact); m_factory_data.put("int",fact); + m_factory_data.put("linktypelist",fact); m_factory_data.put("localelist",fact); m_factory_data.put("password",fact); m_factory_data.put("text",fact); + m_factory_data.put("textbox",fact); m_factory_data.put("tzlist",fact); // Get the service provider hooks interface. diff --git a/src/dynamo-framework/com/silverwrist/dynamo/dialog/DialogMessages.properties b/src/dynamo-framework/com/silverwrist/dynamo/dialog/DialogMessages.properties index bae8827..4ae9fc0 100644 --- a/src/dynamo-framework/com/silverwrist/dynamo/dialog/DialogMessages.properties +++ b/src/dynamo-framework/com/silverwrist/dynamo/dialog/DialogMessages.properties @@ -10,7 +10,7 @@ # # The Initial Developer of the Original Code is Eric J. Bowersox , # for Silverwrist Design Studios. Portions created by Eric J. Bowersox are -# Copyright (C) 2002 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. +# Copyright (C) 2002-03 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved. # # Contributor(s): # --------------------------------------------------------------------------------- @@ -29,3 +29,4 @@ bad.email=The value in the "{0}" field is not a valid E-mail address. text.notInteger=Invalid non-numeric character in the "{0}" field. int.tooSmall=The value of the "{0}" field must be greater than or equal to {1}. int.tooLarge=The value of the "{0}" field must be less than or equal to {1}. +valid.except=Exception generated while validating "{0}": {1} diff --git a/src/dynamo-framework/com/silverwrist/dynamo/dialog/MultiLineTextField.java b/src/dynamo-framework/com/silverwrist/dynamo/dialog/MultiLineTextField.java new file mode 100644 index 0000000..a24f53a --- /dev/null +++ b/src/dynamo-framework/com/silverwrist/dynamo/dialog/MultiLineTextField.java @@ -0,0 +1,175 @@ +/* + * 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.dialog; + +import java.io.*; +import java.util.*; +import org.w3c.dom.*; +import com.silverwrist.util.*; +import com.silverwrist.util.xml.*; +import com.silverwrist.dynamo.except.*; +import com.silverwrist.dynamo.iface.*; +import com.silverwrist.dynamo.util.*; + +public class MultiLineTextField extends BaseDialogField +{ + /*-------------------------------------------------------------------------------- + * Static data members + *-------------------------------------------------------------------------------- + */ + + public static final int DEFAULT_ROWS = 4; + public static final int DEFAULT_COLS = 40; + public static final int DEFAULT_MAXLENGTH = -1; + public static final String DEFAULT_WRAP = "soft"; + + /*-------------------------------------------------------------------------------- + * Attributes + *-------------------------------------------------------------------------------- + */ + + private String m_value = null; + private int m_rows; + private int m_cols; + private int m_maxlength; + private String m_wraptype; + + /*-------------------------------------------------------------------------------- + * Constructors + *-------------------------------------------------------------------------------- + */ + + public MultiLineTextField(Element elt) throws DialogException + { + super(false,elt); + XMLLoader loader = XMLLoader.get(); + try + { // load the attributes specific to a multiline field + m_rows = loader.getAttributeInt(elt,"rows",DEFAULT_ROWS); + m_cols = loader.getAttributeInt(elt,"cols",DEFAULT_COLS); + m_maxlength = loader.getAttributeInt(elt,"maxlength",DEFAULT_MAXLENGTH); + m_wraptype = loader.getAttribute(elt,"wrap",DEFAULT_WRAP); + + } // end try + catch (XMLLoadException e) + { // translate exception before returning + throw new DialogException(e); + + } // end catch + + } // end constructor + + protected MultiLineTextField(MultiLineTextField other) + { + super(other); + m_rows = other.m_rows; + m_cols = other.m_cols; + m_maxlength = other.m_maxlength; + m_wraptype = other.m_wraptype; + + } // end constructor + + /*-------------------------------------------------------------------------------- + * Overrides from class BaseDialogField + *-------------------------------------------------------------------------------- + */ + + protected boolean isNull(Object value) + { + return StringUtils.isEmpty((String)value); + + } // end isNull + + /*-------------------------------------------------------------------------------- + * Abstract implementations from class BaseDialogField + *-------------------------------------------------------------------------------- + */ + + protected void renderField(TextRenderControl control, Map render_params) + throws IOException, RenderingException + { + PrintWriter wr = control.getWriter(); + wr.write(""); + + } // end renderField + + protected void validateContents(Request r, Object data) throws ValidationException + { + if ((data!=null) && (m_maxlength>0) && (data.toString().length()>m_maxlength)) + { // this value is too long + ValidationException ve = new ValidationException(CommonTextField.class,"DialogMessages","text.tooLong"); + ve.setParameter(0,getCaption()); + ve.setParameter(1,String.valueOf(m_maxlength)); + throw ve; + + } // end if + + } // end validateContents + + public Object getValue() + { + return m_value; + + } // end getValue + + public boolean containsValue() + { + return StringUtils.isNotEmpty(m_value); + + } // end containsValue + + public void setValue(Object obj) + { + if (obj==null) + m_value = null; + else + m_value = obj.toString(); + if ((m_value!=null) && StringUtils.isEmpty(m_value)) + m_value = null; + + } // end setValue + + public void setValueFrom(Request r) + { + RequestHelper rh = new RequestHelper(r); + m_value = rh.getParameterString(getName()); + if ((m_value!=null) && StringUtils.isEmpty(m_value)) + m_value = null; + + } // end setValueFrom + + public void reset() + { + m_value = null; + + } // end reset + + public Object clone() + { + return new MultiLineTextField(this); + + } // end clone + +} // end class MultiLineTextField diff --git a/src/dynamo-framework/com/silverwrist/dynamo/dialog/StdItemFactory.java b/src/dynamo-framework/com/silverwrist/dynamo/dialog/StdItemFactory.java index 9f7f024..194f3b4 100644 --- a/src/dynamo-framework/com/silverwrist/dynamo/dialog/StdItemFactory.java +++ b/src/dynamo-framework/com/silverwrist/dynamo/dialog/StdItemFactory.java @@ -72,6 +72,8 @@ class StdItemFactory implements DialogItemFactory return new PasswordField(elt); if (tagname.equals("text")) return new TextField(elt); + if (tagname.equals("textbox")) + return new MultiLineTextField(elt); if (tagname.equals("tzlist")) return new TimeZoneListField(elt); diff --git a/src/dynamo-framework/com/silverwrist/dynamo/util/BufferTextRenderControl.java b/src/dynamo-framework/com/silverwrist/dynamo/util/BufferTextRenderControl.java index b2f3bb5..222f5f0 100644 --- a/src/dynamo-framework/com/silverwrist/dynamo/util/BufferTextRenderControl.java +++ b/src/dynamo-framework/com/silverwrist/dynamo/util/BufferTextRenderControl.java @@ -313,8 +313,6 @@ public class BufferTextRenderControl extends BaseDelegatingServiceProvider imple { if (m_type==null) m_type = type; - else - throw new RenderingException(BufferTextRenderControl.class,"UtilityMessages","buffer.setMime2X"); } // end setContentType @@ -322,8 +320,6 @@ public class BufferTextRenderControl extends BaseDelegatingServiceProvider imple { if (m_length<0) m_length = length; - else - throw new RenderingException(BufferTextRenderControl.class,"UtilityMessages","buffer.setLength2X"); } // end setContentLength diff --git a/venice-data/dialogs/sysadmin/email.dlg.xml b/venice-data/dialogs/sysadmin/email.dlg.xml new file mode 100644 index 0000000..3b8ebdb --- /dev/null +++ b/venice-data/dialogs/sysadmin/email.dlg.xml @@ -0,0 +1,35 @@ + + + + E-Mail Parameters + sysadmin/email.js.vs + + + + + + + + + + diff --git a/venice-data/dialogs/sysadmin/frame_laf.dlg.xml b/venice-data/dialogs/sysadmin/frame_laf.dlg.xml index b8a3125..a7d592b 100644 --- a/venice-data/dialogs/sysadmin/frame_laf.dlg.xml +++ b/venice-data/dialogs/sysadmin/frame_laf.dlg.xml @@ -18,35 +18,46 @@ --> Frame Look-And-Feel Parameters - TODO + sysadmin/frame_laf.js.vs +
- - - - + + + + +
- + +
This image is displayed in the upper-left portion of the frame.
- - - - + + + + + +
+ + + +
This is a small image file of any format used as a page icon by Mozilla and other browsers.
- - - + + + +
This is a Microsoft-format .ICO file used by Internet Explorer.
- + +
diff --git a/venice-data/dialogs/sysadmin/session.dlg.xml b/venice-data/dialogs/sysadmin/session.dlg.xml new file mode 100644 index 0000000..b291237 --- /dev/null +++ b/venice-data/dialogs/sysadmin/session.dlg.xml @@ -0,0 +1,32 @@ + + + + Session Parameters + sysadmin/session.js.vs + + + + + + + diff --git a/venice-data/scripts/sysadmin/email.js b/venice-data/scripts/sysadmin/email.js new file mode 100644 index 0000000..0226a65 --- /dev/null +++ b/venice-data/scripts/sysadmin/email.js @@ -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 . +// +// 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(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); diff --git a/venice-data/scripts/sysadmin/frame_laf.js b/venice-data/scripts/sysadmin/frame_laf.js new file mode 100644 index 0000000..d4d22e5 --- /dev/null +++ b/venice-data/scripts/sysadmin/frame_laf.js @@ -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 . +// +// 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(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); diff --git a/venice-data/scripts/sysadmin/main.js b/venice-data/scripts/sysadmin/main.js new file mode 100644 index 0000000..144c6ba --- /dev/null +++ b/venice-data/scripts/sysadmin/main.js @@ -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 . +// +// 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): + +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); diff --git a/venice-data/scripts/sysadmin/session.js b/venice-data/scripts/sysadmin/session.js new file mode 100644 index 0000000..2aa4bcc --- /dev/null +++ b/venice-data/scripts/sysadmin/session.js @@ -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 . +// +// 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(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); diff --git a/venice-data/velocity/frame.vm b/venice-data/velocity/frame.vm index 51b792f..98367b5 100644 --- a/venice-data/velocity/frame.vm +++ b/venice-data/velocity/frame.vm @@ -118,6 +118,7 @@
 
#render( $fixed_menu )
+ #comment( "END LEFT SIDEBAR" ) diff --git a/venice-web/images/spacer.gif b/venice-web/images/spacer.gif new file mode 100644 index 0000000000000000000000000000000000000000..5bfd67a2d6f72ac3a55cbfcea5866e841d22f5d9 GIT binary patch literal 43 mcmZ?wbhEHbWMp7uXkdT>#h)yUAf^t80Ld^gF}W}@SOWlZ0R#L1 literal 0 HcmV?d00001