added initial sysadmin menu items and dialogs, fixed a few things about dialog

operation here and there
This commit is contained in:
Eric J. Bowersox 2003-05-25 09:11:12 +00:00
parent 0c7f518f3e
commit cbae9cdd8e
17 changed files with 698 additions and 28 deletions

View File

@ -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');

View File

@ -11,7 +11,7 @@
*
* 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) 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

View File

@ -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

View File

@ -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.

View File

@ -10,7 +10,7 @@
#
# 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) 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}

View File

@ -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 <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.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("<textarea class=\"content\" name=\"" + getName() + "\" rows=\"" + m_rows + "\" cols=\"" + m_cols
+ "\" wrap = \"" + m_wraptype + "\"");
if (!isEnabled())
wr.write(" disabled=\"disabled\"");
wr.write(">");
if (m_value!=null)
wr.write(StringUtils.encodeHTML(m_value));
wr.write("</textarea>");
} // 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

View File

@ -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);

View File

@ -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

View File

@ -0,0 +1,35 @@
<?xml version="1.0"?>
<!--
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):
-->
<dialog name="email_props" defaultbutton="update">
<title>E-Mail Parameters</title>
<action>sysadmin/email.js.vs</action>
<text name="host" caption="SMTP host" required="true" size="32" maxlength="254"/>
<text name="fromaddr" caption="Mail sender address" required="true" size="32" maxlength="254"/>
<text name="fromname" caption="Mail sender name" required="true" size="32" maxlength="254"/>
<text name="mailer" caption="X-Mailer name" required="true" size="32" maxlength="254"/>
<text name="uinfo" caption="Header name for user info" required="true" size="32" maxlength="254"/>
<textbox name="disclaimer" caption="User disclaimer header lines" required="true" rows="4" cols="60"
maxlength="65535" wrap="soft"/>
<textbox name="sig" caption="Automatic E-mail signature" required="true" rows="4" cols="60" maxlength="65535"
wrap="soft"/>
<button name="update"/>
<button name="cancel"/>
</dialog>

View File

@ -18,35 +18,46 @@
-->
<dialog name="frame_laf" defaultbutton="update">
<title>Frame Look-And-Feel Parameters</title>
<action>TODO</action>
<action>sysadmin/frame_laf.js.vs</action>
<header name="bas_hdr" caption="Basic Information"/>
<text name="sitetitle" caption="Site Title" required="true" size="32" maxlength="254"/>
<text name="siteurl" caption="Site Base URL" required="true" size="32" maxlength="254"/>
<text name="template" caption="Frame Template Resource" required="true" size="32" maxlength="254"
caption2="(Do NOT change this unless you know what you are doing!)"/>
<text name="fptitle" caption="Front Page Title" required="true" size="32" maxlength="254"/>
<text name="sitetitle" caption="Site title" required="true" size="32" maxlength="254"/>
<text name="siteurl" caption="Site base URL" required="true" size="32" maxlength="254"/>
<text name="template" caption="Frame template resource" required="true" size="32" maxlength="254"
caption2="(Do NOT change this unless you know what you're doing!)"/>
<text name="fptitle" caption="Front page title" required="true" size="32" maxlength="254"/>
<header name="lay_hdr" caption="Layout Information"/>
<int name="lbarwidth" caption="Left Frame Bar Width" caption2="(in pixels)" required="true" min="1" max="512"/>
<int name="lbarwidth" caption="Left frame bar width" caption2="(in pixels)" required="true" min="1" max="512"/>
<checkbox name="comments" caption="Display optional HTML comments"/>
<checkbox name="smarttags" caption="Allow Microsoft Smart Tags to display on pages" caption2="(not recommended)"/>
<header name="logo_hdr" caption="Site Logo">
This image is displayed in the upper-left portion of the frame.
</header>
<text name="logourl" caption="Site Logo URL" required="true" size="32" maxlength="254"/>
<linktypelist name="logourltype" caption="Site Logo URL Type" required="true"/>
<int name="logowidth" caption="Site Logo Width" caption2="(in pixels)" required="true" min="1" max="1024"/>
<int name="logoheight" caption="Site Logo Height" caption2="(in pixels)" required="true" min="1" max="1024"/>
<text name="logourl" caption="Site logo URL" required="true" size="32" maxlength="254"/>
<linktypelist name="logourltype" caption="Site logo URL type" required="true"/>
<int name="logowidth" caption="Site logo width" caption2="(in pixels)" required="true" min="1" max="1024"/>
<int name="logoheight" caption="Site logo height" caption2="(in pixels)" required="true" min="1" max="1024"/>
<header name="foot_hdr" caption="Page Footer"/>
<textbox name="footer" caption="Page footer text" required="true" rows="4" cols="60" maxlength="65535" wrap="soft"/>
<int name="fscale" caption="Footer image scaling" caption2="(in percent)" required="true" min="1" max="100"/>
<checkbox name="fbreak" caption="Add linebreaks to footer text"/>
<header name="icon_hdr" caption="Page Icon">
This is a small image file of any format used as a page icon by Mozilla and other browsers.
</header>
<text name="pgi_url" caption="Page Icon URL" size="32" maxlength="254"/>
<linktypelist name="pgi_urltype" caption="Page Icon URL Type"/>
<text name="pgi_mime" caption="Page Icon MIME Type" size="32" maxlength="254"/>
<text name="pgi_url" caption="Page icon URL" size="32" maxlength="254"/>
<linktypelist name="pgi_urltype" caption="Page icon URL type"/>
<text name="pgi_mime" caption="Page icon MIME type" size="32" maxlength="254"/>
<header name="fav_hdr" caption="Page FavIcon">
This is a Microsoft-format .ICO file used by Internet Explorer.
</header>
<text name="fav_url" caption="FavIcon URL" size="32" maxlength="254"/>
<linktypelist name="fav_urltype" caption="FavIcon URL Type"/>
<linktypelist name="fav_urltype" caption="FavIcon URL type"/>
<button name="update"/>
<button name="cancel"/>
</dialog>

View File

@ -0,0 +1,32 @@
<?xml version="1.0"?>
<!--
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):
-->
<dialog name="session_props" defaultbutton="update">
<title>Session Parameters</title>
<action>sysadmin/session.js.vs</action>
<text name="init" caption="Session initialization script resource" required="true" size="64" maxlength="254"
caption2="(Do NOT change this unless you know what you're doing!)"/>
<text name="cookie" caption="Login cookie name" required="true" size="64" maxlength="254"/>
<int name="cookieage" caption="Maximum login cookie age" caption2="(in days)" required="true" min="1" max="1825"/>
<int name="recovery" caption="Maximum password recovery time" caption2="(in minutes)" required="true"
min="5" max="1440"/>
<button name="update"/>
<button name="cancel"/>
</dialog>

View 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);

View 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);

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",aclids);
dynamo.scriptOutput(menu);

View 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);

View File

@ -118,6 +118,7 @@
</div>
<div>&nbsp;</div>
<div class="frameleft">#render( $fixed_menu )</div>
<img src="#formatURL( "IMAGE" "spacer.gif" )" width="$lbar_width" height="1" border="0" />
#comment( "END LEFT SIDEBAR" )
</td>

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 B