diff --git a/build.xml b/build.xml
index e2e0d91..4d10be9 100644
--- a/build.xml
+++ b/build.xml
@@ -109,6 +109,9 @@
+
-
+
+
@@ -158,6 +163,12 @@
+
+
+
+
diff --git a/conf/venice-db-init-mysql.sql b/conf/venice-db-init-mysql.sql
index 2cd86bf..4000e0c 100644
--- a/conf/venice-db-init-mysql.sql
+++ b/conf/venice-db-init-mysql.sql
@@ -1394,7 +1394,7 @@ INSERT INTO menuvars (menuid, var_name, default_val) VALUES
(7, 'name', NULL),
(7, 'cid', NULL);
INSERT INTO menuitems (menuid, sequence, itemtype, text, linktype, link, perm_nsid, perm_name) VALUES
- (7, 0, 'TEXT', 'Edit Community Profile', 'SERVLET', 'TODO', 15, 'set.property');
+ (7, 0, 'TEXT', 'Edit Community Profile', 'SERVLET', 'comm/admin/profile.js.vs?cc=${cid}', 15, 'set.property');
# Create the sideboxes tables.
INSERT INTO sbox_master (sbid, sb_nsid, sb_name, type_nsid, type_name, descr) VALUES
diff --git a/src/dynamo-framework/com/silverwrist/dynamo/dialog/DialogManager.java b/src/dynamo-framework/com/silverwrist/dynamo/dialog/DialogManager.java
index 2b04bc3..cb1aab6 100644
--- a/src/dynamo-framework/com/silverwrist/dynamo/dialog/DialogManager.java
+++ b/src/dynamo-framework/com/silverwrist/dynamo/dialog/DialogManager.java
@@ -174,7 +174,9 @@ 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("languagelist",fact);
m_factory_data.put("linktypelist",fact);
+ m_factory_data.put("list",fact);
m_factory_data.put("localelist",fact);
m_factory_data.put("password",fact);
m_factory_data.put("text",fact);
diff --git a/src/dynamo-framework/com/silverwrist/dynamo/dialog/DialogMessages.properties b/src/dynamo-framework/com/silverwrist/dynamo/dialog/DialogMessages.properties
index 4ae9fc0..59ad794 100644
--- a/src/dynamo-framework/com/silverwrist/dynamo/dialog/DialogMessages.properties
+++ b/src/dynamo-framework/com/silverwrist/dynamo/dialog/DialogMessages.properties
@@ -30,3 +30,5 @@ 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}
+picklist.choices=Error parsing the pick list choices for field "{0}": {1}.
+picklist.noChoice=No choices present for static pick list "{0}."
diff --git a/src/dynamo-framework/com/silverwrist/dynamo/dialog/LanguageListField.java b/src/dynamo-framework/com/silverwrist/dynamo/dialog/LanguageListField.java
new file mode 100644
index 0000000..6638a93
--- /dev/null
+++ b/src/dynamo-framework/com/silverwrist/dynamo/dialog/LanguageListField.java
@@ -0,0 +1,123 @@
+/*
+ * 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.util.*;
+import org.w3c.dom.Element;
+import com.silverwrist.util.*;
+import com.silverwrist.dynamo.except.DialogException;
+
+class LanguageListField extends PickListField
+{
+ /*--------------------------------------------------------------------------------
+ * Static data members
+ *--------------------------------------------------------------------------------
+ */
+
+ private static Language UNKNOWN_LANGUAGE = International.get().getLanguageForCode("i-default");
+
+ /*--------------------------------------------------------------------------------
+ * Constructors
+ *--------------------------------------------------------------------------------
+ */
+
+ LanguageListField(Element elt) throws DialogException
+ {
+ super(elt);
+
+ } // end constructor
+
+ protected LanguageListField(LanguageListField other)
+ {
+ super(other);
+
+ } // end constructor
+
+ /*--------------------------------------------------------------------------------
+ * Abstract implementations from class BaseDialogField
+ *--------------------------------------------------------------------------------
+ */
+
+ public Object clone()
+ {
+ return new LanguageListField(this);
+
+ } // end clone
+
+ /*--------------------------------------------------------------------------------
+ * Overrides from class BaseDialogField
+ *--------------------------------------------------------------------------------
+ */
+
+ protected boolean isNull(Object value)
+ {
+ return ((value==null) || UNKNOWN_LANGUAGE.equals(value));
+
+ } // end isNull
+
+ /*--------------------------------------------------------------------------------
+ * Abstract implementations from class PickListField
+ *--------------------------------------------------------------------------------
+ */
+
+ protected Iterator getChoices()
+ {
+ return International.get().getLanguageList().iterator();
+
+ } // end getChoices
+
+ protected String getChoiceName(Object choice)
+ {
+ return ((Language)choice).getCode();
+
+ } // end getChoiceName
+
+ protected String getChoiceDisplay(Object choice)
+ {
+ return ((Language)choice).getName();
+
+ } // end getChoiceDisplay
+
+ protected Object getChoiceForName(String name)
+ {
+ return International.get().getLanguageForCode(name);
+
+ } // end getChoiceForName
+
+ protected boolean isValidChoice(Object choice)
+ {
+ if (!(choice instanceof Language))
+ return false;
+ Language x = International.get().getLanguageForCode(((Language)choice).getCode());
+ return x.equals(choice);
+
+ } // end isValidChoice
+
+ /*--------------------------------------------------------------------------------
+ * Overrides from class PickListField
+ *--------------------------------------------------------------------------------
+ */
+
+ public boolean containsValue()
+ {
+ Object v = getValue();
+ return ((v!=null) && !UNKNOWN_LANGUAGE.equals(v));
+
+ } // end containsValue
+
+} // end class LanguageListField
diff --git a/src/dynamo-framework/com/silverwrist/dynamo/dialog/StaticPickListField.java b/src/dynamo-framework/com/silverwrist/dynamo/dialog/StaticPickListField.java
new file mode 100644
index 0000000..11f9879
--- /dev/null
+++ b/src/dynamo-framework/com/silverwrist/dynamo/dialog/StaticPickListField.java
@@ -0,0 +1,138 @@
+/*
+ * 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.util.*;
+import org.w3c.dom.*;
+import com.silverwrist.util.xml.*;
+import com.silverwrist.dynamo.except.DialogException;
+
+class StaticPickListField extends PickListField
+{
+ /*--------------------------------------------------------------------------------
+ * Attributes
+ *--------------------------------------------------------------------------------
+ */
+
+ private List m_choices; // our list of choices
+ private Map m_name_map; // mapping from names to text
+
+ /*--------------------------------------------------------------------------------
+ * Constructors
+ *--------------------------------------------------------------------------------
+ */
+
+ StaticPickListField(Element elt) throws DialogException
+ {
+ super(elt);
+ XMLLoader loader = XMLLoader.get();
+ try
+ { // get the sub-elements of the main element
+ List l = loader.getMatchingSubElements(elt,"choice");
+ Iterator it = l.iterator();
+ ArrayList choice_list = new ArrayList();
+ HashMap choice_map = new HashMap();
+ while (it.hasNext())
+ { // load the various choices
+ Element n = (Element)(it.next());
+ String name = loader.getAttribute(n,"id");
+ String value = loader.getText(n);
+ choice_list.add(name);
+ choice_map.put(name,value);
+
+ } // end while
+
+ if (choice_list.isEmpty())
+ { // no choices specified - throw an error!
+ DialogException de = new DialogException(StaticPickListField.class,"DialogMessages","picklist.noChoice");
+ de.setParameter(0,super.getName());
+ throw de;
+
+ } // end if
+
+ choice_list.trimToSize();
+ m_choices = Collections.unmodifiableList(choice_list);
+ m_name_map = Collections.unmodifiableMap(choice_map);
+
+ } // end try
+ catch (XMLLoadException e)
+ { // XML load failure - throw an error
+ DialogException de = new DialogException(StaticPickListField.class,"DialogMessages","picklist.choices",e);
+ de.setParameter(0,super.getName());
+ de.setParameter(1,e.getMessage());
+ throw de;
+
+ } // end catch
+
+ } // end constructor
+
+ protected StaticPickListField(StaticPickListField other)
+ {
+ super(other);
+ m_choices = other.m_choices;
+ m_name_map = other.m_name_map;
+
+ } // end constructor
+
+ /*--------------------------------------------------------------------------------
+ * Abstract implementations from class BaseDialogField
+ *--------------------------------------------------------------------------------
+ */
+
+ public Object clone()
+ {
+ return new StaticPickListField(this);
+
+ } // end clone
+
+ /*--------------------------------------------------------------------------------
+ * Abstract implementations from class PickListField
+ *--------------------------------------------------------------------------------
+ */
+
+ protected Iterator getChoices()
+ {
+ return m_choices.iterator();
+
+ } // end getChoices
+
+ protected String getChoiceName(Object choice)
+ {
+ return choice.toString();
+
+ } // end getChoiceName
+
+ protected String getChoiceDisplay(Object choice)
+ {
+ return m_name_map.get(choice).toString();
+
+ } // end getChoiceDisplay
+
+ protected Object getChoiceForName(String name)
+ {
+ return m_name_map.containsKey(name) ? name : null;
+
+ } // end getChoiceForName
+
+ protected boolean isValidChoice(Object choice)
+ {
+ return (choice!=null) && m_name_map.containsKey(choice);
+
+ } // end isValidChoice
+
+} // end class StaticPickListField
diff --git a/src/dynamo-framework/com/silverwrist/dynamo/dialog/StdItemFactory.java b/src/dynamo-framework/com/silverwrist/dynamo/dialog/StdItemFactory.java
index 194f3b4..7e40a47 100644
--- a/src/dynamo-framework/com/silverwrist/dynamo/dialog/StdItemFactory.java
+++ b/src/dynamo-framework/com/silverwrist/dynamo/dialog/StdItemFactory.java
@@ -64,8 +64,12 @@ class StdItemFactory implements DialogItemFactory
return new HiddenField(elt);
if (tagname.equals("int"))
return new IntegerField(elt);
+ if (tagname.equals("languagelist"))
+ return new LanguageListField(elt);
if (tagname.equals("linktypelist"))
return new LinkTypeField(elt);
+ if (tagname.equals("list"))
+ return new StaticPickListField(elt);
if (tagname.equals("localelist"))
return new LocaleListField(elt);
if (tagname.equals("password"))
diff --git a/venice-data/dialogs/comm/community_profile.dlg.xml b/venice-data/dialogs/comm/community_profile.dlg.xml
new file mode 100644
index 0000000..50d9c5e
--- /dev/null
+++ b/venice-data/dialogs/comm/community_profile.dlg.xml
@@ -0,0 +1,57 @@
+
+
+
\ No newline at end of file
diff --git a/venice-data/dialogs/user_profile.dlg.xml b/venice-data/dialogs/user_profile.dlg.xml
index 31dedee..d17de2a 100644
--- a/venice-data/dialogs/user_profile.dlg.xml
+++ b/venice-data/dialogs/user_profile.dlg.xml
@@ -27,7 +27,7 @@
-
+
@@ -37,9 +37,9 @@
-
-
-
+
+
+
@@ -55,12 +55,12 @@
-
+
-
+
-
+
diff --git a/venice-data/scripts/comm/admin/main.js b/venice-data/scripts/comm/admin/main.js
index 789e753..33874d7 100644
--- a/venice-data/scripts/comm/admin/main.js
+++ b/venice-data/scripts/comm/admin/main.js
@@ -34,5 +34,5 @@ aclids[0] = comm.getAcl().getAclID();
aclids[1] = srm.getGlobalAcl().getAclID();
menu = mprov.getStandardMenu(user,VeniceNamespaces.COMMUNITY_GLOBALS_NAMESPACE,"admin.menu",aclids);
menu.setVariable("name",comm.getName());
-menu.setVariable("cid",String.valueOf(comm.getCID()));
+menu.setVariable("cid",comm.getCID() + "");
dynamo.scriptOutput(menu);
diff --git a/venice-data/scripts/comm/admin/profile.js b/venice-data/scripts/comm/admin/profile.js
new file mode 100644
index 0000000..bc3fd3e
--- /dev/null
+++ b/venice-data/scripts/comm/admin/profile.js
@@ -0,0 +1,146 @@
+// 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(java.lang);
+importClass(Packages.com.silverwrist.dynamo.Namespaces);
+importPackage(Packages.com.silverwrist.dynamo.except);
+importPackage(Packages.com.silverwrist.dynamo.iface);
+importPackage(Packages.com.silverwrist.dynamo.util);
+importClass(Packages.com.silverwrist.venice.CommunityVisibility);
+importClass(Packages.com.silverwrist.venice.VeniceNamespaces);
+importPackage(Packages.com.silverwrist.venice.frame);
+importPackage(Packages.com.silverwrist.venice.iface);
+
+req = bsf.lookupBean("request");
+req_help = bsf.lookupBean("request_help");
+user = vlib.getUser(req);
+comm = vlib.getCommunity(req);
+
+// Make sure we are permitted to be here.
+acl = comm.getAcl();
+if (!( acl.testPermission(user,VeniceNamespaces.COMMUNITY_PROFILE_NAMESPACE,"set.property")
+ && acl.testPermission(user,VeniceNamespaces.COMMUNITY_PERMS_NAMESPACE,"grant.revoke.access")
+ && acl.testPermission(user,VeniceNamespaces.COMMUNITY_PROFILE_NAMESPACE,"set.visibility")
+ && acl.testPermission(user,VeniceNamespaces.COMMUNITY_PROFILE_NAMESPACE,"set.name")
+ && acl.testPermission(user,VeniceNamespaces.COMMUNITY_PROFILE_NAMESPACE,"set.alias")))
+ dynamo.scriptReturn(vlib.stdErrorBox(req,"Security Error",
+ "You are not permitted to modify this community's profile."));
+
+// Create the dialog.
+loader = cast.queryDialogLoader(req);
+dlg = loader.loadDialogResource("comm/community_profile.dlg.xml");
+
+return_URL = "comm/admin/main.js.vs?cc=" + comm.getCID(); // shortcut
+
+rc = null;
+if (req_help.isVerb("GET"))
+{ // Load the dialog with its initial values.
+ dlg.setValue("cc",comm.getCID() + "");
+
+ dlg.setValue("name",comm.getName());
+ dlg.setValue("alias",comm.getAlias());
+ dlg.setValue("synopsis",PropertyUtils.getPropertyNoErr(comm,VeniceNamespaces.COMMUNITY_PROFILE_NAMESPACE,
+ "synopsis"));
+ dlg.setValue("rules",PropertyUtils.getPropertyNoErr(comm,VeniceNamespaces.COMMUNITY_PROFILE_NAMESPACE,"rules"));
+ dlg.setValue("language",comm.getObject(VeniceNamespaces.COMMUNITY_PROFILE_NAMESPACE,"language"));
+ dlg.setValue("url",PropertyUtils.getPropertyNoErr(comm,VeniceNamespaces.COMMUNITY_PROFILE_NAMESPACE,"url.homepage"));
+ // TODO: set community logo here
+
+ dlg.setValue("company",PropertyUtils.getPropertyNoErr(comm,VeniceNamespaces.COMMUNITY_PROFILE_NAMESPACE,
+ "company.name"));
+ dlg.setValue("addr1",PropertyUtils.getPropertyNoErr(comm,VeniceNamespaces.COMMUNITY_PROFILE_NAMESPACE,"address.1"));
+ dlg.setValue("addr2",PropertyUtils.getPropertyNoErr(comm,VeniceNamespaces.COMMUNITY_PROFILE_NAMESPACE,"address.2"));
+ dlg.setValue("loc",PropertyUtils.getPropertyNoErr(comm,VeniceNamespaces.COMMUNITY_PROFILE_NAMESPACE,"locality"));
+ dlg.setValue("reg",PropertyUtils.getPropertyNoErr(comm,VeniceNamespaces.COMMUNITY_PROFILE_NAMESPACE,"region"));
+ dlg.setValue("pcode",comm.getObject(VeniceNamespaces.COMMUNITY_PROFILE_NAMESPACE,"postal.code"));
+ dlg.setValue("country",comm.getObject(VeniceNamespaces.COMMUNITY_PROFILE_NAMESPACE,"country"));
+
+ dlg.setValue("comtype","0"); // TODO: replace with something real
+ dlg.setValue("joinkey",""); // TODO: replace with something real
+ dlg.setValue("visibility",comm.getVisibility().getName());
+
+} // 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",return_URL);
+ else
+ { // load and validate the dialog
+ dlg.load(req);
+ try
+ { // validate the dialog
+ dlg.validate(req);
+
+ // set the appropriate values into the community properties
+ comm.setName(user,dlg.getValue("name"));
+ comm.setAlias(user,dlg.getValue("alias"));
+ PropertyUtils.setOrRemove(comm,user,VeniceNamespaces.COMMUNITY_PROFILE_NAMESPACE,"synopsis",
+ dlg.getValue("synopsis"));
+ PropertyUtils.setOrRemove(comm,user,VeniceNamespaces.COMMUNITY_PROFILE_NAMESPACE,"rules",dlg.getValue("rules"));
+ comm.setObject(user,VeniceNamespaces.COMMUNITY_PROFILE_NAMESPACE,"language",dlg.getValue("language"));
+ PropertyUtils.setOrRemove(comm,user,VeniceNamespaces.COMMUNITY_PROFILE_NAMESPACE,"url.homepage",
+ dlg.getValue("url"));
+ // TODO: deal with community logo
+
+ PropertyUtils.setOrRemove(comm,user,VeniceNamespaces.COMMUNITY_PROFILE_NAMESPACE,"company.name",
+ dlg.getValue("company"));
+ PropertyUtils.setOrRemove(comm,user,VeniceNamespaces.COMMUNITY_PROFILE_NAMESPACE,"address.1",
+ dlg.getValue("addr1"));
+ PropertyUtils.setOrRemove(comm,user,VeniceNamespaces.COMMUNITY_PROFILE_NAMESPACE,"address.2",
+ dlg.getValue("addr2"));
+ PropertyUtils.setOrRemove(comm,user,VeniceNamespaces.COMMUNITY_PROFILE_NAMESPACE,"locality",
+ dlg.getValue("loc"));
+ PropertyUtils.setOrRemove(comm,user,VeniceNamespaces.COMMUNITY_PROFILE_NAMESPACE,"region",
+ dlg.getValue("reg"));
+ comm.setObject(user,VeniceNamespaces.COMMUNITY_PROFILE_NAMESPACE,"postal.code",dlg.getValue("pcode"));
+ comm.setObject(user,VeniceNamespaces.COMMUNITY_PROFILE_NAMESPACE,"country",dlg.getValue("country"));
+
+ // TODO: do something with "comtype" and "joinkey"
+ comm.setVisibility(user,CommunityVisibility.getEnum(dlg.getValue("visibility")));
+
+ vlib.forceReloadMenu(req); // the menu might have changed, so reload it
+
+ // All done - bounce back to the main admin menu
+ rc = new Redirect("SERVLET",return_URL);
+
+ } // end try
+ catch (e)
+ { // get the exception type and check it out
+ 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",return_URL);
+ else if (etype.match(/DynamoSecurityException/))
+ rc = new ErrorBox("Security Error",e,"SERVLET",return_URL);
+ else
+ rc = new ErrorBox("Unknown Exception",e,"SERVLET",return_URL);
+
+ } // end catch
+
+ } // end else
+
+} // end else
+
+if (rc==null)
+{ // output dialog if we don't have another value
+ dlg.setSubtitle(comm.getName());
+ rc = new FrameDialog(dlg);
+
+} // end if
+dynamo.scriptOutput(rc);