moved the language and country lists OUT of the database and into properties

files as they are likely to change VERY infrequently; this simplifies a lot
of bits of code that would otherwise have to call through VeniceEngine, etc.
Also folded the LocaleFactory class method into the new International object
used for managing the lists.
This commit is contained in:
Eric J. Bowersox
2001-11-16 22:12:14 +00:00
parent 33eecf87fc
commit 313a46818f
30 changed files with 1001 additions and 985 deletions

View File

@@ -1,26 +0,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) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
package com.silverwrist.venice.core;
public interface Country
{
public abstract String getCode();
public abstract String getName();
} // end interface Country

View File

@@ -1,26 +0,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) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
package com.silverwrist.venice.core;
public interface Language
{
public abstract String getCode();
public abstract String getName();
} // end interface Language

View File

@@ -31,12 +31,6 @@ public interface VeniceEngine extends SearchMode
public abstract BitSet getAllFeaturesMask();
public abstract List getCountryList() throws DataException;
public abstract List getLanguageList() throws DataException;
public abstract String getNameOfCountry(String code);
public abstract UserContext createUserContext(String remote_addr) throws DataException;
public abstract String getEmailAddressForUser(String username) throws DataException, AccessError;

View File

@@ -20,7 +20,7 @@ package com.silverwrist.venice.core.impl;
import java.sql.*;
import java.util.*;
import org.apache.log4j.*;
import com.silverwrist.util.LocaleFactory;
import com.silverwrist.util.International;
import com.silverwrist.venice.core.*;
import com.silverwrist.venice.db.*;
import com.silverwrist.venice.security.PasswordHash;
@@ -75,7 +75,7 @@ class AdminUserContextImpl implements AdminUserContext
this.created = SQLUtil.getFullDateTime(rs,"created");
this.last_access = SQLUtil.getFullDateTime(rs,"lastaccess");
this.description = rs.getString("description");
this.my_locale = LocaleFactory.createLocale(rs.getString("localeid"));
this.my_locale = International.get().createLocale(rs.getString("localeid"));
this.my_tz = TimeZone.getTimeZone(rs.getString("tzid"));
} // end constructor

View File

@@ -20,7 +20,7 @@ package com.silverwrist.venice.core.impl;
import java.sql.*;
import java.util.*;
import org.apache.log4j.*;
import com.silverwrist.util.StringUtil;
import com.silverwrist.util.*;
import com.silverwrist.venice.db.*;
import com.silverwrist.venice.security.AuditRecord;
import com.silverwrist.venice.security.Capability;
@@ -408,7 +408,11 @@ class CommunityUserContextImpl implements CommunityContext, CommunityBackend
{
String code = getLanguageCode();
if (code!=null)
return engine.getLanguageNameForCode(code);
{ // translate the language code to a name
Language l = International.get().getLanguageForCode(code);
return ((l==null) ? null : l.getName());
} // end if
else
return null;

View File

@@ -53,10 +53,6 @@ public interface EngineBackend
public abstract int getNewConfirmationNumber();
public abstract String getCountryNameForCode(String code);
public abstract String getLanguageNameForCode(String code);
public abstract CommunityData getCommunityDataObject(int cid) throws DataException;
public abstract void detachCommunityDataObject(int cid);

View File

@@ -20,9 +20,7 @@ package com.silverwrist.venice.core.impl;
import java.util.*;
import java.sql.*;
import org.apache.log4j.*;
import com.silverwrist.util.LocaleFactory;
import com.silverwrist.util.OptionSet;
import com.silverwrist.util.StringUtil;
import com.silverwrist.util.*;
import com.silverwrist.venice.*;
import com.silverwrist.venice.core.*;
import com.silverwrist.venice.db.*;
@@ -144,7 +142,7 @@ class UserContextImpl implements UserContext, UserBackend
my_tz = TimeZone.getTimeZone(rs.getString("tzid"));
if (my_locale==null)
my_locale = LocaleFactory.createLocale(rs.getString("localeid"));
my_locale = International.get().createLocale(rs.getString("localeid"));
// Load the user properties as well.
rs = stmt.executeQuery("SELECT ndx, data FROM propuser WHERE uid = " + uid + ";");

View File

@@ -20,6 +20,7 @@ package com.silverwrist.venice.core.impl;
import java.sql.*;
import java.util.*;
import org.apache.log4j.*;
import com.silverwrist.util.*;
import com.silverwrist.venice.core.*;
import com.silverwrist.venice.db.*;
@@ -331,7 +332,8 @@ class UserProfileImpl implements UserProfile
public String getFullCountry()
{
return engine.getCountryNameForCode(country);
Country c = International.get().getCountryForCode(country);
return ((c==null) ? null : c.getName());
} // end getFullCountry

View File

@@ -22,9 +22,7 @@ import java.sql.*;
import java.util.*;
import org.apache.log4j.*;
import org.w3c.dom.*;
import com.silverwrist.util.OptionSet;
import com.silverwrist.util.StringUtil;
import com.silverwrist.util.DOMElementHelper;
import com.silverwrist.util.*;
import com.silverwrist.util.cache.*;
import com.silverwrist.venice.core.*;
import com.silverwrist.venice.db.*;
@@ -38,68 +36,6 @@ import com.silverwrist.venice.security.DefaultLevels;
public class VeniceEngineImpl implements VeniceEngine, EngineBackend
{
/*--------------------------------------------------------------------------------
* Internal class implementing the Country interface
*--------------------------------------------------------------------------------
*/
static class CountryImpl implements Country
{
private String code;
private String name;
public CountryImpl(String code, String name)
{
this.code = code;
this.name = name;
} // end constructor
public String getCode()
{
return code;
} // end getCode
public String getName()
{
return name;
} // end getName
} // end class CountryImpl
/*--------------------------------------------------------------------------------
* Internal class implementing the Language interface
*--------------------------------------------------------------------------------
*/
static class LanguageImpl implements Language
{
private String code;
private String name;
public LanguageImpl(String code, String name)
{
this.code = code;
this.name = name;
} // end constructor
public String getCode()
{
return code;
} // end getCode
public String getName()
{
return name;
} // end getName
} // end class LanguageImpl
/*--------------------------------------------------------------------------------
* Internal class storing feature information.
*--------------------------------------------------------------------------------
@@ -1066,93 +1002,6 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
} // end getAllFeaturesMask
public List getCountryList() throws DataException
{
checkInitialized();
Connection conn = null;
ArrayList rc = new ArrayList();
try
{ // do a SELECT on the refcountry table to load the master country list
conn = datapool.getConnection();
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("SELECT code, name FROM refcountry ORDER BY name;");
while (rs.next())
{ // load up a stack of memory objects with the country list
Country c = new CountryImpl(rs.getString(1),rs.getString(2));
rc.add(c);
} // end while
if (logger.isDebugEnabled())
logger.debug("getCountryList(): loaded " + rc.size() + " country names");
} // end try
catch (SQLException e)
{ // remap to a DataException
logger.error("DB error loading countries: " + e.getMessage(),e);
throw new DataException("unable to load country data: " + e.getMessage(),e);
} // end catch
finally
{ // make sure the connection is released before we go
if (conn!=null)
datapool.releaseConnection(conn);
} // end finally
return Collections.unmodifiableList(rc);
} // end getCountryList
public List getLanguageList() throws DataException
{
checkInitialized();
Connection conn = null;
ArrayList rc = new ArrayList();
try
{ // do a SELECT on the refcountry table to load the master country list
conn = datapool.getConnection();
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("SELECT code, name FROM reflanguage ORDER BY name;");
while (rs.next())
{ // load up a stack of memory objects with the country list
Language l = new LanguageImpl(rs.getString(1),rs.getString(2));
rc.add(l);
} // end while
if (logger.isDebugEnabled())
logger.debug("getLanguageList(): loaded " + rc.size() + " language names");
} // end try
catch (SQLException e)
{ // remap to a DataException
logger.error("DB error loading languages: " + e.getMessage(),e);
throw new DataException("unable to load language data: " + e.getMessage(),e);
} // end catch
finally
{ // make sure the connection is released before we go
if (conn!=null)
datapool.releaseConnection(conn);
} // end finally
return Collections.unmodifiableList(rc);
} // end getLanguageList
public String getNameOfCountry(String code)
{
checkInitialized();
return getCountryNameForCode(code);
} // end getNameOfCountry
public UserContext createUserContext(String remote_addr) throws DataException
{
checkInitialized();
@@ -2003,92 +1852,6 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
} // end getNewConfirmationNumber
public String getCountryNameForCode(String code)
{
checkInitialized();
if (code==null)
return null;
Connection conn = null;
try
{ // do a SELECT on the refcountry table
conn = datapool.getConnection();
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("SELECT name FROM refcountry WHERE code = '" + code + "';");
if (rs.next())
{ // found it!
String rc = rs.getString("name");
if (logger.isDebugEnabled())
logger.debug("getCountryNameForCode(\"" + code + "\") => \"" + rc + "\"");
return rc;
} // end if
} // end try
catch (SQLException e)
{ // force to return null
logger.warn("DB error looking up country code: " + e.getMessage(),e);
if (logger.isDebugEnabled())
logger.debug("getCountryNameForCode(\"" + code + "\") => not found (data error)");
return null;
} // end catch
finally
{ // make sure the connection is released before we go
if (conn!=null)
datapool.releaseConnection(conn);
} // end finally
if (logger.isDebugEnabled())
logger.debug("getCountryNameForCode(\"" + code + "\") => not found");
return null; // if get here, it wasn't found
} // end getCountryNameForCode
public String getLanguageNameForCode(String code)
{
checkInitialized();
if (code==null)
return null;
Connection conn = null;
try
{ // do a SELECT on the refcountry table
conn = datapool.getConnection();
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("SELECT name FROM reflanguage WHERE CODE = '" + code + "';");
if (rs.next())
{ // found it!
String rc = rs.getString("name");
if (logger.isDebugEnabled())
logger.debug("getLanguageNameForCode(\"" + code + "\") => \"" + rc + "\"");
return rc;
} // end if
} // end try
catch (SQLException e)
{ // force to return null
logger.warn("DB error looking up language code: " + e.getMessage(),e);
if (logger.isDebugEnabled())
logger.debug("getLanguageNameForCode(\"" + code + "\") => not found (data error)");
return null;
} // end catch
finally
{ // make sure the connection is released before we go
if (conn!=null)
datapool.releaseConnection(conn);
} // end finally
if (logger.isDebugEnabled())
logger.debug("getLanguageNameForCode(\"" + code + "\") => not found");
return null; // if get here, it wasn't found
} // end getLanguageNameForCode
public CommunityData getCommunityDataObject(int cid) throws DataException
{
checkInitialized();

View File

@@ -58,7 +58,7 @@ public class Account extends VeniceServlet
if (!(cache.isCached(desired_name)))
{ // create a template and save it off
NewAccountDialog template = new NewAccountDialog(getCountryList());
NewAccountDialog template = new NewAccountDialog();
cache.saveTemplate(template);
} // end if
@@ -109,7 +109,7 @@ public class Account extends VeniceServlet
if (!(cache.isCached(desired_name)))
{ // create a template and save it off
EditProfileDialog template = new EditProfileDialog(getCountryList());
EditProfileDialog template = new EditProfileDialog();
cache.saveTemplate(template);
} // end if

View File

@@ -68,7 +68,7 @@ public class CommunityAdmin extends VeniceServlet
if (!(cache.isCached(desired_name)))
{ // create a template and save it off
EditCommunityProfileDialog template = new EditCommunityProfileDialog(getCountryList(),getLanguageList());
EditCommunityProfileDialog template = new EditCommunityProfileDialog();
cache.saveTemplate(template);
} // end if

View File

@@ -66,7 +66,7 @@ public class CommunityOperations extends VeniceServlet
if (!(cache.isCached(desired_name)))
{ // create a template and save it off
CreateCommunityDialog template = new CreateCommunityDialog(getCountryList(),getLanguageList());
CreateCommunityDialog template = new CreateCommunityDialog();
cache.saveTemplate(template);
} // end if

View File

@@ -65,7 +65,7 @@ public class SystemAdmin extends VeniceServlet
if (!(cache.isCached(desired_name)))
{ // create a template and save it off
AdminModifyUserDialog template = new AdminModifyUserDialog(getCountryList());
AdminModifyUserDialog template = new AdminModifyUserDialog();
cache.saveTemplate(template);
} // end if

View File

@@ -36,8 +36,6 @@ public class Variables
// ServletContext ("application") attributes
protected static final String ENGINE_ATTRIBUTE = "com.silverwrist.venice.core.Engine";
protected static final String COUNTRYLIST_ATTRIBUTE = "com.silverwrist.venice.db.CountryList";
protected static final String LANGUAGELIST_ATTRIBUTE = "com.silverwrist.venice.db.LanguageList";
protected static final String STYLESHEET_ATTRIBUTE = "com.silverwrist.venice.rendering.StyleSheet";
// HttpSession ("session") attributes
@@ -168,54 +166,6 @@ public class Variables
} // end clearUserContext
public static List getCountryList(ServletContext ctxt) throws ServletException
{
Object foo = ctxt.getAttribute(COUNTRYLIST_ATTRIBUTE);
if (foo!=null)
return (List)foo;
VeniceEngine engine = getVeniceEngine(ctxt);
try
{ // get the country list via the engine and save it
List rc = engine.getCountryList();
ctxt.setAttribute(COUNTRYLIST_ATTRIBUTE,rc);
return rc;
} // end try
catch (DataException e)
{ // the country list could not be retrieved
logger.error("Failed to retrieve country list from engine: " + e.getMessage(),e);
throw new ServletException("Country list retrieval failed: " + e.getMessage(),e);
} // end catch
} // end getCountryList
public static List getLanguageList(ServletContext ctxt) throws ServletException
{
Object foo = ctxt.getAttribute(LANGUAGELIST_ATTRIBUTE);
if (foo!=null)
return (List)foo;
VeniceEngine engine = getVeniceEngine(ctxt);
try
{ // get the country list via the engine and save it
List rc = engine.getLanguageList();
ctxt.setAttribute(LANGUAGELIST_ATTRIBUTE,rc);
return rc;
} // end try
catch (DataException e)
{ // the country list could not be retrieved
logger.error("Failed to retrieve language list from engine: " + e.getMessage(),e);
throw new ServletException("Language list retrieval failed: " + e.getMessage(),e);
} // end catch
} // end getLanguageList
public static ComponentRender getMenu(HttpSession session)
{
return (ComponentRender)(session.getAttribute(MENU_ATTRIBUTE));

View File

@@ -312,30 +312,6 @@ public abstract class VeniceServlet extends HttpServlet
} // end clearUserContext
protected static final List getCountryList(ServletContext ctxt) throws ServletException
{
return Variables.getCountryList(ctxt);
} // end getCountryList
protected final List getCountryList() throws ServletException
{
return Variables.getCountryList(getServletContext());
} // end getCountryList
protected final List getLanguageList(ServletContext ctxt) throws ServletException
{
return Variables.getLanguageList(ctxt);
} // end getLanguageList
protected final List getLanguageList() throws ServletException
{
return Variables.getLanguageList(getServletContext());
} // end getLanguageList
protected final void changeMenuTop(HttpServletRequest request)
{
Variables.setMenuTop(getServletContext(),request.getSession(true));

View File

@@ -18,8 +18,7 @@
package com.silverwrist.venice.servlets.format;
import java.util.*;
import com.silverwrist.util.LocaleFactory;
import com.silverwrist.util.StringUtil;
import com.silverwrist.util.*;
import com.silverwrist.venice.ValidationException;
import com.silverwrist.venice.core.*;
import com.silverwrist.venice.security.Role;
@@ -31,7 +30,7 @@ public class AdminModifyUserDialog extends ContentDialog
*--------------------------------------------------------------------------------
*/
public AdminModifyUserDialog(List country_list)
public AdminModifyUserDialog()
{
super("Modify User Account",null,"moduserform","sysadmin");
setHiddenField("cmd","UM");
@@ -60,7 +59,7 @@ public class AdminModifyUserDialog extends ContentDialog
addFormField(new CDTextFormField("loc","City",null,true,32,64));
addFormField(new CDTextFormField("reg","State/Province",null,true,32,64));
addFormField(new CDTextFormField("pcode","Zip/Postal Code",null,true,32,64));
addFormField(new CDCountryListFormField("country","Country",null,true,country_list));
addFormField(new CDCountryListFormField("country","Country",null,true));
addFormField(new CDFormCategoryHeader("Phone Numbers"));
addFormField(new CDTextFormField("phone","Telephone",null,false,32,32));
addFormField(new CDTextFormField("mobile","Mobile/cellphone",null,false,32,32));
@@ -277,7 +276,7 @@ public class AdminModifyUserDialog extends ContentDialog
// Save off the user's description and preferences.
admuser.setDescription(getFieldValue("descr"));
admuser.setLocale(LocaleFactory.createLocale(getFieldValue("locale")));
admuser.setLocale(International.get().createLocale(getFieldValue("locale")));
admuser.setTimeZone(TimeZone.getTimeZone(getFieldValue("tz")));
} // end doDialog

View File

@@ -20,8 +20,7 @@ package com.silverwrist.venice.servlets.format;
import java.util.List;
import java.io.Writer;
import java.io.IOException;
import com.silverwrist.util.StringUtil;
import com.silverwrist.venice.core.Country;
import com.silverwrist.util.*;
public class CDCountryListFormField extends CDPickListFormField
{
@@ -30,10 +29,9 @@ public class CDCountryListFormField extends CDPickListFormField
*--------------------------------------------------------------------------------
*/
public CDCountryListFormField(String name, String caption, String caption2, boolean required,
List country_list)
public CDCountryListFormField(String name, String caption, String caption2, boolean required)
{
super(name,caption,caption2,required,country_list);
super(name,caption,caption2,required,International.get().getCountryList());
} // end constructor

View File

@@ -7,7 +7,7 @@
* 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 Community System.
* 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
@@ -20,15 +20,18 @@ package com.silverwrist.venice.servlets.format;
import java.util.List;
import java.io.Writer;
import java.io.IOException;
import com.silverwrist.util.StringUtil;
import com.silverwrist.venice.core.Language;
import com.silverwrist.util.*;
public class CDLanguageListFormField extends CDPickListFormField
{
public CDLanguageListFormField(String name, String caption, String caption2, boolean required,
List language_list)
/*--------------------------------------------------------------------------------
* Constructors
*--------------------------------------------------------------------------------
*/
public CDLanguageListFormField(String name, String caption, String caption2, boolean required)
{
super(name,caption,caption2,required,language_list);
super(name,caption,caption2,required,International.get().getLanguageList());
} // end constructor
@@ -38,6 +41,11 @@ public class CDLanguageListFormField extends CDPickListFormField
} // end constructor
/*--------------------------------------------------------------------------------
* Overrides from class CDPickListFormField
*--------------------------------------------------------------------------------
*/
protected void renderChoice(Writer out, RenderData rdat, Object obj, String my_value) throws IOException
{
Language l = (Language)obj;
@@ -48,6 +56,11 @@ public class CDLanguageListFormField extends CDPickListFormField
} // end renderChoice
/*--------------------------------------------------------------------------------
* Implementations from interface CDFormField
*--------------------------------------------------------------------------------
*/
public CDFormField duplicate()
{
return new CDLanguageListFormField(this);

View File

@@ -18,7 +18,7 @@
package com.silverwrist.venice.servlets.format;
import javax.servlet.ServletRequest;
import com.silverwrist.util.StringUtil;
import com.silverwrist.util.*;
import com.silverwrist.venice.core.*;
public class CommunityProfileData implements JSPRender
@@ -163,7 +163,8 @@ public class CommunityProfileData implements JSPRender
public String getFullCountry()
{
return engine.getNameOfCountry(ci.getCountry());
Country c = International.get().getCountryForCode(ci.getCountry());
return ((c==null) ? null : c.getName());
} // end getFullCountry

View File

@@ -36,7 +36,7 @@ public class CreateCommunityDialog extends ContentDialog
*--------------------------------------------------------------------------------
*/
public CreateCommunityDialog(List country_list, List language_list)
public CreateCommunityDialog()
{
super("Create New Community",null,"createcommform","sigops");
setHiddenField("cmd","C");
@@ -58,12 +58,12 @@ public class CreateCommunityDialog extends ContentDialog
addFormField(new CDVeniceIDFormField("alias","Community Alias",null,true,32,32));
addFormField(new CDTextFormField("synopsis","Synopsis",null,false,32,255));
addFormField(new CDTextFormField("rules","Rules",null,false,32,255));
addFormField(new CDLanguageListFormField("language","Primary language",null,true,language_list));
addFormField(new CDLanguageListFormField("language","Primary language",null,true));
addFormField(new CDFormCategoryHeader("Location"));
addFormField(new CDTextFormField("loc","City",null,false,32,64));
addFormField(new CDTextFormField("reg","State/Province",null,false,32,64));
addFormField(new CDTextFormField("pcode","Zip/Postal Code",null,true,32,64));
addFormField(new CDCountryListFormField("country","Country",null,true,country_list));
addFormField(new CDCountryListFormField("country","Country",null,true));
addFormField(new CDFormCategoryHeader("Security"));
addFormField(new CDSimplePickListFormField("comtype","Community type:",null,true,vec_pubpriv,'|'));
addFormField(new CDTextFormField("joinkey","Join key","(for private communities)",false,32,64));

View File

@@ -101,7 +101,7 @@ public class EditCommunityProfileDialog extends ContentDialog
*--------------------------------------------------------------------------------
*/
public EditCommunityProfileDialog(List country_list, List language_list)
public EditCommunityProfileDialog()
{
super("Edit Community Profile:",null,"commprofform","sigadmin");
setHiddenField("cmd","P");
@@ -124,7 +124,7 @@ public class EditCommunityProfileDialog extends ContentDialog
addFormField(new CDVeniceIDFormField("alias","Community Alias",null,true,32,32));
addFormField(new CDTextFormField("synopsis","Synopsis",null,false,32,255));
addFormField(new CDTextFormField("rules","Rules",null,false,32,255));
addFormField(new CDLanguageListFormField("language","Primary language",null,true,language_list));
addFormField(new CDLanguageListFormField("language","Primary language",null,true));
addFormField(new CDTextFormField("url","Home page",null,false,32,255));
logo_control = new CDCommunityLogoControl("logo","Community logo","commlogo");
addFormField(logo_control);
@@ -136,7 +136,7 @@ public class EditCommunityProfileDialog extends ContentDialog
addFormField(new CDTextFormField("loc","City",null,false,32,64));
addFormField(new CDTextFormField("reg","State/Province",null,false,32,64));
addFormField(new CDTextFormField("pcode","Zip/Postal Code",null,true,32,64));
addFormField(new CDCountryListFormField("country","Country",null,true,country_list));
addFormField(new CDCountryListFormField("country","Country",null,true));
addFormField(new CDFormCategoryHeader("Security"));
addFormField(new CDSimplePickListFormField("comtype","Communty type",null,true,vec_pubpriv,'|'));

View File

@@ -20,8 +20,7 @@ package com.silverwrist.venice.servlets.format;
import java.io.*;
import java.net.URLEncoder;
import java.util.*;
import com.silverwrist.util.LocaleFactory;
import com.silverwrist.util.StringUtil;
import com.silverwrist.util.*;
import com.silverwrist.venice.ValidationException;
import com.silverwrist.venice.core.*;
@@ -100,7 +99,7 @@ public class EditProfileDialog extends ContentDialog
*--------------------------------------------------------------------------------
*/
public EditProfileDialog(List country_list)
public EditProfileDialog()
{
super("Edit Your Profile",null,"profform","account");
setHiddenField("cmd","P");
@@ -124,7 +123,7 @@ public class EditProfileDialog extends ContentDialog
addFormField(new CDTextFormField("loc","City",null,true,32,64));
addFormField(new CDTextFormField("reg","State/Province",null,true,32,64));
addFormField(new CDTextFormField("pcode","Zip/Postal Code",null,true,32,64));
addFormField(new CDCountryListFormField("country","Country",null,true,country_list));
addFormField(new CDCountryListFormField("country","Country",null,true));
addFormField(new CDFormCategoryHeader("Phone Numbers"));
addFormField(new CDTextFormField("phone","Telephone",null,false,32,32));
addFormField(new CDTextFormField("mobile","Mobile/cellphone",null,false,32,32));
@@ -289,7 +288,7 @@ public class EditProfileDialog extends ContentDialog
// Save off the user's description and preferences.
uc.setDescription(getFieldValue("descr"));
uc.setLocale(LocaleFactory.createLocale(getFieldValue("locale")));
uc.setLocale(International.get().createLocale(getFieldValue("locale")));
uc.setTimeZone(TimeZone.getTimeZone(getFieldValue("tz")));
// Finally, change the password if applicable.

View File

@@ -36,7 +36,7 @@ public class NewAccountDialog extends ContentDialog
*--------------------------------------------------------------------------------
*/
public NewAccountDialog(List country_list)
public NewAccountDialog()
{
super("Create Account",null,"createform","account");
setInstructions("To create a new account, please enter your information below.");
@@ -52,7 +52,7 @@ public class NewAccountDialog extends ContentDialog
addFormField(new CDTextFormField("loc","City",null,true,32,64));
addFormField(new CDTextFormField("reg","State/Province",null,true,32,64));
addFormField(new CDTextFormField("pcode","Zip/Postal Code",null,true,32,64));
addFormField(new CDCountryListFormField("country","Country",null,true,country_list));
addFormField(new CDCountryListFormField("country","Country",null,true));
addFormField(new CDFormCategoryHeader("E-mail"));
addFormField(new CDEmailAddressFormField("email","E-mail address",null,true,32,255));
addFormField(new CDFormCategoryHeader("Account Information"));