From f7df4efa32326c66a014af657f5698a0d8bb1447 Mon Sep 17 00:00:00 2001 From: pb Date: Wed, 19 May 2010 15:55:49 +0000 Subject: [PATCH] =?UTF-8?q?Einf=C3=BChrung=20von=20cms=20basetypes=20f?= =?UTF-8?q?=C3=BCr=20Personen,=20Adressen,=20Artikel=20und=20Erstellen=20d?= =?UTF-8?q?es=20neuen=20Content=20Typs=20Member,=20der=20auf=20basetypes?= =?UTF-8?q?=20aufbaut.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://svn.libreccm.org/ccm/trunk@424 8810af33-2d31-482b-a856-94f89814c4df --- .../com/arsdigita/content-types/Article.pdl | 4 +- .../arsdigita/cms/contenttypes/Article.java | 2 +- .../arsdigita/content-types/BaseAddress.pdl | 9 +- .../cms/contenttypes/BaseAddress.java | 95 +------- .../cms/contenttypes/BaseAddressConfig.java | 31 +-- .../ui/BaseAddressPropertiesStep.java | 82 ++----- .../ui/BaseAddressPropertyForm.java | 146 ++----------- .../cms/contenttypes/BaseContact.java | 6 +- .../BaseContactAttachPersonPropertyForm.java | 4 +- .../ui/BaseContactEditPersonPropertyForm.java | 20 +- .../ui/BaseContactPersonPropertiesStep.java | 12 +- .../application.xml | 4 +- .../com/arsdigita/content-types/Member.pdl | 31 +++ .../ccm-cms-types-member}/postgres-create.sql | 0 .../com/arsdigita/cms/contenttypes/Member.xml | 18 +- .../src/ccm-cms-types-member.config | 5 + .../src/ccm-cms-types-member.load | 8 +- .../arsdigita/cms/contenttypes/Member.java | 81 +++++++ .../cms/contenttypes/MemberConfig.java | 4 +- .../cms/contenttypes/MemberInitializer.java | 18 +- .../cms/contenttypes/MemberLoader.java | 6 +- .../contenttypes/ui/MemberPropertiesStep.java | 51 +++++ .../contenttypes/ui/MemberPropertyForm.java | 84 ++++++++ .../util/MemberGlobalizationUtil.java | 4 +- .../util/MemberResourceBundle.java | 10 +- .../com/arsdigita/cms/contenttypes/Member.xsl | 8 +- .../com/arsdigita/content-types/NewsItem.pdl | 4 +- .../arsdigita/cms/contenttypes/NewsItem.java | 2 +- .../cms/contenttypes/Membership.java | 12 +- .../cms/contenttypes/OrganizationalUnit.java | 16 +- .../MembershipPropertyForm.java | 4 +- .../organizationalunit/MembershipTable.java | 4 +- ...ionalUnitChooseAssistentDirectorTable.java | 10 +- ...OrganizationalUnitChooseDirectorTable.java | 10 +- .../src/ccm-cms-types-person.config | 5 - .../cms/contenttypes/Project2Person.java | 12 +- .../project/Project2PersonPropertyForm.java | 4 +- .../ui/project/Project2PersonTable.java | 4 +- .../ResearchNetworkMembership.java | 12 +- ...ResearchNetworkMembershipPropertyForm.java | 4 +- .../ui/ResearchNetworkMembershipTable.java | 4 +- .../pdl/com/arsdigita/basetypes/Address.pdl | 16 ++ .../Article.pdl | 3 +- .../pdl/com/arsdigita/basetypes}/Person.pdl | 13 +- .../WEB-INF/resources/cms-item-adapters.xml | 4 +- ccm-cms/src/ccm-cms.config | 2 + .../com/arsdigita/cms/basetypes/Address.java | 202 ++++++++++++++++++ .../cms/basetypes/AddressConfig.java | 55 +++++ .../AddressConfig_parameter.properties | 9 + .../cms/{ => basetypes}/Article.java | 9 +- .../ArticleImageAssnCollection.java | 4 +- .../ArticleImageAssociation.java | 8 +- .../basetypes/BasetypesResources.properties | 7 + .../BasetypesResources_de.properties | 7 + .../com/arsdigita/cms/basetypes}/Person.java | 16 +- .../basetypes/ui/AddressPropertiesStep.java | 104 +++++++++ .../cms/basetypes/ui/AddressPropertyForm.java | 176 +++++++++++++++ .../basetypes}/ui/PersonPropertiesStep.java | 33 +-- .../cms/basetypes}/ui/PersonPropertyForm.java | 15 +- .../util/BasetypesGlobalizationUtil.java | 35 +++ .../util/BasetypesResourceBundle.java | 35 +++ .../arsdigita/cms/dispatcher/StreamImage.java | 2 +- .../arsdigita/cms/ui/ArticleImageDisplay.java | 2 +- .../com/arsdigita/cms/ui/ImageBrowser.java | 2 +- .../cms/ui/SingleImageSelectionModel.java | 2 +- .../cms/ui/authoring/ArticleImage.java | 2 +- .../cms/ui/authoring/ArticleImageChooser.java | 2 +- .../cms/ui/authoring/BasicImageForm.java | 2 +- .../cms/ui/authoring/ImagePropertiesForm.java | 2 +- .../cms/ui/authoring/ImageSelectionForm.java | 2 +- .../cms/ui/authoring/ImageUploadForm.java | 2 +- .../bundles/handbook/cfg/applications.cfg | 2 + .../cms/ItemImageAttachmentInitializer.java | 1 + environment/project.xml.handbook | 2 + 74 files changed, 1142 insertions(+), 486 deletions(-) rename {ccm-cms-types-person => ccm-cms-types-member}/application.xml (91%) create mode 100644 ccm-cms-types-member/pdl/com/arsdigita/content-types/Member.pdl rename {ccm-cms-types-person/sql/ccm-cms-types-person => ccm-cms-types-member/sql/ccm-cms-types-member}/postgres-create.sql (100%) rename ccm-cms-types-person/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/Person.xml => ccm-cms-types-member/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/Member.xml (54%) create mode 100644 ccm-cms-types-member/src/ccm-cms-types-member.config rename ccm-cms-types-person/src/ccm-cms-types-person.load => ccm-cms-types-member/src/ccm-cms-types-member.load (54%) create mode 100644 ccm-cms-types-member/src/com/arsdigita/cms/contenttypes/Member.java rename ccm-cms-types-person/src/com/arsdigita/cms/contenttypes/PersonConfig.java => ccm-cms-types-member/src/com/arsdigita/cms/contenttypes/MemberConfig.java (86%) rename ccm-cms-types-person/src/com/arsdigita/cms/contenttypes/PersonInitializer.java => ccm-cms-types-member/src/com/arsdigita/cms/contenttypes/MemberInitializer.java (72%) rename ccm-cms-types-person/src/com/arsdigita/cms/contenttypes/PersonLoader.java => ccm-cms-types-member/src/com/arsdigita/cms/contenttypes/MemberLoader.java (85%) create mode 100644 ccm-cms-types-member/src/com/arsdigita/cms/contenttypes/ui/MemberPropertiesStep.java create mode 100644 ccm-cms-types-member/src/com/arsdigita/cms/contenttypes/ui/MemberPropertyForm.java rename ccm-cms-types-person/src/com/arsdigita/cms/contenttypes/util/PersonGlobalizationUtil.java => ccm-cms-types-member/src/com/arsdigita/cms/contenttypes/util/MemberGlobalizationUtil.java (92%) rename ccm-cms-types-person/src/com/arsdigita/cms/contenttypes/util/PersonResourceBundle.java => ccm-cms-types-member/src/com/arsdigita/cms/contenttypes/util/MemberResourceBundle.java (81%) rename ccm-cms-types-person/web/static/content-types/com/arsdigita/cms/contenttypes/Person.xsl => ccm-cms-types-member/web/static/content-types/com/arsdigita/cms/contenttypes/Member.xsl (85%) delete mode 100644 ccm-cms-types-person/src/ccm-cms-types-person.config create mode 100644 ccm-cms/pdl/com/arsdigita/basetypes/Address.pdl rename ccm-cms/pdl/com/arsdigita/{content-section => basetypes}/Article.pdl (96%) rename {ccm-cms-types-person/pdl/com/arsdigita/content-types => ccm-cms/pdl/com/arsdigita/basetypes}/Person.pdl (70%) create mode 100644 ccm-cms/src/com/arsdigita/cms/basetypes/Address.java create mode 100644 ccm-cms/src/com/arsdigita/cms/basetypes/AddressConfig.java create mode 100644 ccm-cms/src/com/arsdigita/cms/basetypes/AddressConfig_parameter.properties rename ccm-cms/src/com/arsdigita/cms/{ => basetypes}/Article.java (96%) rename ccm-cms/src/com/arsdigita/cms/{ => basetypes}/ArticleImageAssnCollection.java (95%) rename ccm-cms/src/com/arsdigita/cms/{ => basetypes}/ArticleImageAssociation.java (97%) create mode 100644 ccm-cms/src/com/arsdigita/cms/basetypes/BasetypesResources.properties create mode 100644 ccm-cms/src/com/arsdigita/cms/basetypes/BasetypesResources_de.properties rename {ccm-cms-types-person/src/com/arsdigita/cms/contenttypes => ccm-cms/src/com/arsdigita/cms/basetypes}/Person.java (89%) create mode 100644 ccm-cms/src/com/arsdigita/cms/basetypes/ui/AddressPropertiesStep.java create mode 100644 ccm-cms/src/com/arsdigita/cms/basetypes/ui/AddressPropertyForm.java rename {ccm-cms-types-person/src/com/arsdigita/cms/contenttypes => ccm-cms/src/com/arsdigita/cms/basetypes}/ui/PersonPropertiesStep.java (66%) rename {ccm-cms-types-person/src/com/arsdigita/cms/contenttypes => ccm-cms/src/com/arsdigita/cms/basetypes}/ui/PersonPropertyForm.java (87%) create mode 100644 ccm-cms/src/com/arsdigita/cms/basetypes/util/BasetypesGlobalizationUtil.java create mode 100644 ccm-cms/src/com/arsdigita/cms/basetypes/util/BasetypesResourceBundle.java diff --git a/ccm-cms-types-article/pdl/com/arsdigita/content-types/Article.pdl b/ccm-cms-types-article/pdl/com/arsdigita/content-types/Article.pdl index 04c9f8b7a..00aa019b6 100755 --- a/ccm-cms-types-article/pdl/com/arsdigita/content-types/Article.pdl +++ b/ccm-cms-types-article/pdl/com/arsdigita/content-types/Article.pdl @@ -19,9 +19,9 @@ // $DateTime: 2004/08/17 23:15:09 $ model com.arsdigita.cms.contenttypes; -import com.arsdigita.cms.*; +import com.arsdigita.cms.basetypes.*; -object type Article extends com.arsdigita.cms.Article { +object type Article extends com.arsdigita.cms.basetypes.Article { String [0..1] lead = ct_articles.lead VARCHAR(1000); reference key (ct_articles.item_id); diff --git a/ccm-cms-types-article/src/com/arsdigita/cms/contenttypes/Article.java b/ccm-cms-types-article/src/com/arsdigita/cms/contenttypes/Article.java index 5fad0b79d..81cda9b8e 100755 --- a/ccm-cms-types-article/src/com/arsdigita/cms/contenttypes/Article.java +++ b/ccm-cms-types-article/src/com/arsdigita/cms/contenttypes/Article.java @@ -32,7 +32,7 @@ import java.math.BigDecimal; * * @version $Revision: #6 $ $Date: 2004/08/17 $ */ -public class Article extends com.arsdigita.cms.Article { +public class Article extends com.arsdigita.cms.basetypes.Article { private final static org.apache.log4j.Logger s_log = diff --git a/ccm-cms-types-baseAddress/pdl/com/arsdigita/content-types/BaseAddress.pdl b/ccm-cms-types-baseAddress/pdl/com/arsdigita/content-types/BaseAddress.pdl index 20b7475fe..e32141882 100644 --- a/ccm-cms-types-baseAddress/pdl/com/arsdigita/content-types/BaseAddress.pdl +++ b/ccm-cms-types-baseAddress/pdl/com/arsdigita/content-types/BaseAddress.pdl @@ -1,15 +1,10 @@ model com.arsdigita.cms.contenttypes; +import com.arsdigita.cms.basetypes.Address; import com.arsdigita.cms.ContentPage; // Address object -object type BaseAddress extends ContentPage { - - String [0..1] address = ct_baseAddresses.address VARCHAR(1000); - String [0..1] postalCode = ct_baseAddresses.postalCode VARCHAR(20); - String [0..1] city = ct_baseAddresses.city VARCHAR(200); - String [0..1] state = ct_baseAddresses.state VARCHAR(200); - String [0..1] isoCountryCode = ct_baseAddresses.isoCountryCode VARCHAR(2); +object type BaseAddress extends Address { reference key ( ct_baseAddresses.address_id ); } diff --git a/ccm-cms-types-baseAddress/src/com/arsdigita/cms/contenttypes/BaseAddress.java b/ccm-cms-types-baseAddress/src/com/arsdigita/cms/contenttypes/BaseAddress.java index 33b6d0b69..31c5a1f5b 100755 --- a/ccm-cms-types-baseAddress/src/com/arsdigita/cms/contenttypes/BaseAddress.java +++ b/ccm-cms-types-baseAddress/src/com/arsdigita/cms/contenttypes/BaseAddress.java @@ -21,7 +21,7 @@ package com.arsdigita.cms.contenttypes; import com.arsdigita.globalization.LocaleNegotiator; import com.arsdigita.cms.ContentType; -import com.arsdigita.cms.ContentPage; +import com.arsdigita.cms.basetypes.Address; import com.arsdigita.domain.DataObjectNotFoundException; import com.arsdigita.persistence.DataObject; import com.arsdigita.persistence.OID; @@ -42,31 +42,20 @@ import java.util.TreeMap; * * @author Sören Bernstein **/ -public class BaseAddress extends ContentPage { - - /** PDL property name for address */ - public static final String ADDRESS = "address"; - /** PDL property name for postal code */ - public static final String POSTAL_CODE = "postalCode"; - /** PDL property name for city */ - public static final String CITY = "city"; - /** PDL property name for state */ - public static final String STATE = "state"; - /** PDL property name for country iso code */ - public static final String ISO_COUNTRY_CODE = "isoCountryCode"; +public class BaseAddress extends Address { /** Data object type for this domain object */ public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.contenttypes.BaseAddress"; private static final BaseAddressConfig s_config = new BaseAddressConfig(); - static { - s_config.load(); - } - public static final BaseAddressConfig getConfig() - { - return s_config; - } +// static { +// s_config.load(); +// } +// public static BaseAddressConfig getConfig() +// { +// return s_config; +// } /** * Default constructor. This creates a new (empty) BaseAddress. @@ -133,70 +122,4 @@ public class BaseAddress extends ContentPage { } /* accessors *****************************************************/ - public String getAddress() { - return (String) get(ADDRESS); - } - - public void setAddress(String address) { - set(ADDRESS, address); - } - - public String getIsoCountryCode() { - return (String) get(ISO_COUNTRY_CODE); - } - - public void setIsoCountryCode(String isoCountryCode) { - set(ISO_COUNTRY_CODE, isoCountryCode); - } - - public String getPostalCode() { - return (String) get(POSTAL_CODE); - } - - public void setPostalCode(String postalCode) { - set(POSTAL_CODE, postalCode); - } - - public String getCity() { - return (String) get(CITY); - } - - public void setCity(String city) { - set(CITY, city); - } - - public String getState() { - return (String) get(STATE); - } - - public void setState(String state) { - set(STATE, state); - } - - // Convert the iso country code to country names using the current locale - public static String getCountryNameFromIsoCode(String isoCountryCode) { - - LocaleNegotiator negotiatedLocale = new LocaleNegotiator("", "", "", null); - java.util.Locale locale = new java.util.Locale("", isoCountryCode); - return locale.getDisplayCountry(negotiatedLocale.getLocale()); - - } - - // Get a sorted list auf all countries - public static TreeMap getSortedListOfCountries(Locale inLang) { - - LocaleNegotiator negotiatedLocale = new LocaleNegotiator("", "", "", null); - String[] countries = Locale.getISOCountries(); - TreeMap countryNames = new TreeMap(); - - for(String country : countries) { - if(inLang != null) { - countryNames.put(new java.util.Locale("", country).getDisplayCountry(inLang), country); - } else { - countryNames.put(new java.util.Locale("", country).getDisplayCountry(negotiatedLocale.getLocale()), country); - } - } - - return countryNames; - } } diff --git a/ccm-cms-types-baseAddress/src/com/arsdigita/cms/contenttypes/BaseAddressConfig.java b/ccm-cms-types-baseAddress/src/com/arsdigita/cms/contenttypes/BaseAddressConfig.java index 2fd2b871b..a8b810220 100644 --- a/ccm-cms-types-baseAddress/src/com/arsdigita/cms/contenttypes/BaseAddressConfig.java +++ b/ccm-cms-types-baseAddress/src/com/arsdigita/cms/contenttypes/BaseAddressConfig.java @@ -23,33 +23,34 @@ import com.arsdigita.util.parameter.Parameter; import com.arsdigita.util.parameter.BooleanParameter; public class BaseAddressConfig extends AbstractConfig { - + private final Parameter m_hideCountryCodeSelection; private final Parameter m_hidePostalCode; public BaseAddressConfig() { m_hideCountryCodeSelection = new BooleanParameter( - "com.arsdigita.cms.contenttypes.baseaddress.hide_country_code_selection", - Parameter.REQUIRED, - new Boolean(false)); - - m_hidePostalCode = new BooleanParameter( - "com.arsdigita.cms.contenttypes.baseaddress.hide_postal_code", - Parameter.REQUIRED, - new Boolean(false)); - - + "com.arsdigita.cms.contenttypes.baseaddress.hide_country_code_selection", + Parameter.REQUIRED, + new Boolean(false)); + + m_hidePostalCode = new BooleanParameter( + "com.arsdigita.cms.contenttypes.baseaddress.hide_postal_code", + Parameter.REQUIRED, + new Boolean(false)); + + register(m_hideCountryCodeSelection); - register(m_hidePostalCode); + register(m_hidePostalCode); loadInfo(); } - + public final boolean getHideCountryCodeSelection() { - return ((Boolean) get(m_hideCountryCodeSelection)).booleanValue(); + return ((Boolean) get(m_hideCountryCodeSelection)).booleanValue(); } + public final boolean getHidePostalCode() { - return ((Boolean) get(m_hidePostalCode)).booleanValue(); + return ((Boolean) get(m_hidePostalCode)).booleanValue(); } } diff --git a/ccm-cms-types-baseAddress/src/com/arsdigita/cms/contenttypes/ui/BaseAddressPropertiesStep.java b/ccm-cms-types-baseAddress/src/com/arsdigita/cms/contenttypes/ui/BaseAddressPropertiesStep.java index 03a65e8a6..d57c23a60 100644 --- a/ccm-cms-types-baseAddress/src/com/arsdigita/cms/contenttypes/ui/BaseAddressPropertiesStep.java +++ b/ccm-cms-types-baseAddress/src/com/arsdigita/cms/contenttypes/ui/BaseAddressPropertiesStep.java @@ -16,88 +16,34 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ - package com.arsdigita.cms.contenttypes.ui; import com.arsdigita.bebop.Component; -import com.arsdigita.bebop.PageState; -import com.arsdigita.cms.ContentPage; -import com.arsdigita.cms.ContentSection; +import com.arsdigita.cms.basetypes.ui.AddressPropertiesStep; import com.arsdigita.cms.ItemSelectionModel; -import com.arsdigita.cms.contenttypes.BaseAddress; -import com.arsdigita.domain.DomainObject; -import com.arsdigita.toolbox.ui.DomainObjectPropertySheet; import com.arsdigita.cms.ui.authoring.AuthoringKitWizard; import com.arsdigita.cms.ui.authoring.BasicPageForm; -import com.arsdigita.cms.ui.authoring.SimpleEditStep; import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess; -import com.arsdigita.cms.contenttypes.util.BaseAddressGlobalizationUtil; -import java.text.DateFormat; -public class BaseAddressPropertiesStep extends SimpleEditStep { +public class BaseAddressPropertiesStep extends AddressPropertiesStep { + public static final String EDIT_SHEET_NAME = "edit"; public BaseAddressPropertiesStep(ItemSelectionModel itemModel, - AuthoringKitWizard parent) { - super(itemModel, parent); - - setDefaultEditKey(EDIT_SHEET_NAME); - BasicPageForm editSheet; + AuthoringKitWizard parent) { + super(itemModel, parent); + } - editSheet = new BaseAddressPropertyForm(itemModel, this); - add(EDIT_SHEET_NAME, "Edit", - new WorkflowLockedComponentAccess(editSheet, itemModel), - editSheet.getSaveCancelSection().getCancelButton()); - - setDisplayComponent(getBaseAddressPropertySheet(itemModel)); + @Override + protected void createEditSheet(ItemSelectionModel itemModel) { + BasicPageForm editSheet; + editSheet = new BaseAddressPropertyForm(itemModel, this); + add(EDIT_SHEET_NAME, "Edit", new WorkflowLockedComponentAccess(editSheet, itemModel), editSheet.getSaveCancelSection().getCancelButton()); } public static Component getBaseAddressPropertySheet(ItemSelectionModel itemModel) { - DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(itemModel); - - sheet.add((String)BaseAddressGlobalizationUtil.globalize("cms.contenttypes.ui.name").localize(), BaseAddress.NAME); - sheet.add((String)BaseAddressGlobalizationUtil.globalize("cms.contenttypes.ui.title").localize(), BaseAddress.TITLE); - sheet.add((String)BaseAddressGlobalizationUtil.globalize("cms.contenttypes.ui.baseAddress.address").localize(), BaseAddress.ADDRESS); - sheet.add((String)BaseAddressGlobalizationUtil.globalize("cms.contenttypes.ui.baseAddress.postal_code").localize(), BaseAddress.POSTAL_CODE); - sheet.add((String)BaseAddressGlobalizationUtil.globalize("cms.contenttypes.ui.baseAddress.city").localize(), BaseAddress.CITY); - sheet.add((String)BaseAddressGlobalizationUtil.globalize("cms.contenttypes.ui.baseAddress.state").localize(), BaseAddress.STATE); - - sheet.add((String)BaseAddressGlobalizationUtil.globalize("cms.contenttypes.ui.baseAddress.iso_country_code").localize(), - BaseAddress.ISO_COUNTRY_CODE, - new DomainObjectPropertySheet.AttributeFormatter() { - public String format(DomainObject item, - String attribute, - PageState state) { - BaseAddress baseAddress = (BaseAddress)item; - if(baseAddress != null && baseAddress.getIsoCountryCode() != null) { - return BaseAddress.getCountryNameFromIsoCode(baseAddress.getIsoCountryCode()); - } else { - return (String)BaseAddressGlobalizationUtil.globalize - ("cms.ui.unknown").localize(); - } - } - } - ); - - if(!ContentSection.getConfig().getHideLaunchDate()) { - sheet.add((String)BaseAddressGlobalizationUtil.globalize("cms.ui.authoring.page_launch_date").localize(), - ContentPage.LAUNCH_DATE, - new DomainObjectPropertySheet.AttributeFormatter() { - public String format(DomainObject item, - String attribute, - PageState state) { - ContentPage page = (ContentPage)item; - if (page.getLaunchDate() != null) { - return DateFormat.getDateInstance(DateFormat.LONG).format(page.getLaunchDate()); - } - else { - return (String)BaseAddressGlobalizationUtil.globalize("cms.ui.unknown").localize(); - } - } - }); - } - - return sheet; + Component sheet = AddressPropertiesStep.getAddressPropertySheet(itemModel); + return sheet; } -} \ No newline at end of file +} diff --git a/ccm-cms-types-baseAddress/src/com/arsdigita/cms/contenttypes/ui/BaseAddressPropertyForm.java b/ccm-cms-types-baseAddress/src/com/arsdigita/cms/contenttypes/ui/BaseAddressPropertyForm.java index 80da134d5..05229d3d2 100644 --- a/ccm-cms-types-baseAddress/src/com/arsdigita/cms/contenttypes/ui/BaseAddressPropertyForm.java +++ b/ccm-cms-types-baseAddress/src/com/arsdigita/cms/contenttypes/ui/BaseAddressPropertyForm.java @@ -16,33 +16,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ - package com.arsdigita.cms.contenttypes.ui; -import com.arsdigita.bebop.FormData; -import com.arsdigita.bebop.FormProcessException; -import com.arsdigita.bebop.Label; +import com.arsdigita.cms.basetypes.ui.AddressPropertyForm; import com.arsdigita.bebop.event.FormInitListener; import com.arsdigita.bebop.event.FormProcessListener; import com.arsdigita.bebop.event.FormSectionEvent; import com.arsdigita.bebop.event.FormSubmissionListener; -import com.arsdigita.bebop.event.ParameterEvent; -import com.arsdigita.bebop.event.ParameterListener; -import com.arsdigita.bebop.form.Option; -import com.arsdigita.bebop.form.SingleSelect; -import com.arsdigita.bebop.form.TextArea; -import com.arsdigita.bebop.form.TextField; -import com.arsdigita.bebop.parameters.NotNullValidationListener; -import com.arsdigita.bebop.parameters.StringInRangeValidationListener; -import com.arsdigita.bebop.parameters.ParameterModel; -import com.arsdigita.bebop.parameters.StringParameter; -import com.arsdigita.bebop.parameters.ParameterData; import com.arsdigita.cms.ItemSelectionModel; -import com.arsdigita.cms.contenttypes.BaseAddress; -import com.arsdigita.cms.contenttypes.util.BaseAddressGlobalizationUtil; -import com.arsdigita.cms.ui.authoring.BasicPageForm; -import java.util.Iterator; -import java.util.Map; import org.apache.log4j.Logger; /** @@ -51,128 +32,39 @@ import org.apache.log4j.Logger; * @author: Jens Pelzetter * @author: Sören Bernstein */ -public class BaseAddressPropertyForm extends BasicPageForm implements FormProcessListener, FormInitListener, FormSubmissionListener { +public class BaseAddressPropertyForm extends AddressPropertyForm implements FormProcessListener, FormInitListener, FormSubmissionListener { + private static final Logger s_log = Logger.getLogger(BaseAddressPropertyForm.class); - private BaseAddressPropertiesStep m_step; - - public static final String ADDRESS = BaseAddress.ADDRESS; - public static final String POSTAL_CODE = BaseAddress.POSTAL_CODE; - public static final String CITY = BaseAddress.CITY; - public static final String STATE = BaseAddress.STATE; - public static final String ISO_COUNTRY_CODE = BaseAddress.ISO_COUNTRY_CODE; - public static final String ID = "BaseAddress_edit"; public BaseAddressPropertyForm(ItemSelectionModel itemModel) { - this(itemModel,null); + this(itemModel, null); } - + public BaseAddressPropertyForm(ItemSelectionModel itemModel, BaseAddressPropertiesStep step) { - super(ID, itemModel); - m_step = step; - addSubmissionListener (this); + super(itemModel, step); + m_step = step; + addSubmissionListener(this); } + @Override protected void addWidgets() { - super.addWidgets (); - - add(new Label((String)BaseAddressGlobalizationUtil.globalize("cms.contenttypes.ui.baseAddress.address").localize())); - ParameterModel addressParam = new StringParameter(ADDRESS); - addressParam.addParameterListener( new NotNullValidationListener( ) ); - addressParam.addParameterListener( new StringInRangeValidationListener(0, 1000) ); - TextArea address = new TextArea(addressParam); - address.setRows(5); - address.setCols(30); - add(address); - - add(new Label((String)BaseAddressGlobalizationUtil.globalize("cms.contenttypes.ui.baseAddress.postal_code").localize())); - ParameterModel postalCodeParam = new StringParameter(POSTAL_CODE); - TextField postalCode = new TextField(postalCodeParam); - /* XXX NumberListener ?*/ - add(postalCode); - - add(new Label((String)BaseAddressGlobalizationUtil.globalize("cms.contenttypes.ui.baseAddress.city").localize())); - ParameterModel cityParam = new StringParameter(CITY); - TextField city = new TextField(cityParam); - add(city); - - add(new Label((String)BaseAddressGlobalizationUtil.globalize("cms.contenttypes.ui.baseAddress.state").localize())); - ParameterModel stateParam = new StringParameter(STATE); - TextField state = new TextField(stateParam); - add(state); - - if (!BaseAddress.getConfig().getHideCountryCodeSelection()) { - add(new Label((String)BaseAddressGlobalizationUtil.globalize("cms.contenttypes.ui.baseAddress.iso_country_code").localize())); - ParameterModel countryParam = new StringParameter(ISO_COUNTRY_CODE); - countryParam.addParameterListener(new StringInRangeValidationListener(0, 2)); - - SingleSelect country = new SingleSelect(countryParam); - - country.addOption(new Option("", new Label((String)BaseAddressGlobalizationUtil.globalize("cms.ui.select_one" ).localize()))); - - Iterator countries = BaseAddress.getSortedListOfCountries(null).entrySet().iterator(); - while(countries.hasNext()) { - Map.Entry elem = (Map.Entry)countries.next(); - country.addOption(new Option(elem.getValue().toString(), elem.getKey().toString())); - } - - country.addValidationListener( - new ParameterListener() { - public void validate(ParameterEvent e) throws FormProcessException { - ParameterData data = e.getParameterData(); - String isoCode = (String) data.getValue() ; - s_log.debug("ISO code is : " + isoCode); - if (isoCode == null || isoCode.length() == 0) { - data.addError((String)BaseAddressGlobalizationUtil.globalize("cms.contenttypes.ui.address.error_iso_country").localize()); - } - } - } - ); - - add(country); - } - + super.addWidgets(); } + @Override public void init(FormSectionEvent fse) { - FormData data = fse.getFormData(); - BaseAddress baseAddress = (BaseAddress)super.initBasicWidgets(fse); - - data.put(ADDRESS, baseAddress.getAddress()); - data.put(POSTAL_CODE, baseAddress.getPostalCode()); - data.put(CITY, baseAddress.getCity()); - data.put(STATE, baseAddress.getState()); - if(!BaseAddress.getConfig().getHideCountryCodeSelection()) { - data.put(ISO_COUNTRY_CODE, baseAddress.getIsoCountryCode()); - } - } - - public void submitted(FormSectionEvent fse) { - if (m_step != null && - getSaveCancelSection().getCancelButton().isSelected(fse.getPageState())) { - m_step.cancelStreamlinedCreation(fse.getPageState()); - } + super.init(fse); +// FormData data = fse.getFormData(); +// BaseAddress baseAddress = (BaseAddress) super.initBasicWidgets(fse); } + @Override public void process(FormSectionEvent fse) { - FormData data = fse.getFormData(); + super.process(fse); +// FormData data = fse.getFormData(); - BaseAddress baseAddress = (BaseAddress)super.processBasicWidgets(fse); - - if (baseAddress != null && - getSaveCancelSection().getSaveButton().isSelected(fse.getPageState())) { - baseAddress.setAddress((String)data.get(ADDRESS)); - baseAddress.setPostalCode((String)data.get(POSTAL_CODE)); - baseAddress.setCity((String)data.get(CITY)); - baseAddress.setState((String)data.get(STATE)); - baseAddress.setIsoCountryCode((String)data.get(ISO_COUNTRY_CODE)); - - baseAddress.save(); - } - - if (m_step != null) { - m_step.maybeForwardToNextStep(fse.getPageState()); - } +// BaseAddress baseAddress = (BaseAddress) super.processBasicWidgets(fse); } -} \ No newline at end of file +} diff --git a/ccm-cms-types-baseContact/src/com/arsdigita/cms/contenttypes/BaseContact.java b/ccm-cms-types-baseContact/src/com/arsdigita/cms/contenttypes/BaseContact.java index dc59bb42c..2bb4c0cf5 100755 --- a/ccm-cms-types-baseContact/src/com/arsdigita/cms/contenttypes/BaseContact.java +++ b/ccm-cms-types-baseContact/src/com/arsdigita/cms/contenttypes/BaseContact.java @@ -93,12 +93,12 @@ public class BaseContact extends ContentPage { // accessors // Get the person for this contact - public Person getPerson() { - return (Person) DomainObjectFactory.newInstance((DataObject)get(PERSON)); + public Member getPerson() { + return (Member) DomainObjectFactory.newInstance((DataObject)get(PERSON)); } // Set the person for this contact - public void setPerson(Person person) { + public void setPerson(Member person) { set(PERSON, person); } diff --git a/ccm-cms-types-baseContact/src/com/arsdigita/cms/contenttypes/ui/BaseContactAttachPersonPropertyForm.java b/ccm-cms-types-baseContact/src/com/arsdigita/cms/contenttypes/ui/BaseContactAttachPersonPropertyForm.java index 82e009b34..3efcbd060 100644 --- a/ccm-cms-types-baseContact/src/com/arsdigita/cms/contenttypes/ui/BaseContactAttachPersonPropertyForm.java +++ b/ccm-cms-types-baseContact/src/com/arsdigita/cms/contenttypes/ui/BaseContactAttachPersonPropertyForm.java @@ -23,7 +23,7 @@ import com.arsdigita.bebop.event.PrintListener; import com.arsdigita.bebop.form.Submit; import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.ui.authoring.BasicPageForm; -import com.arsdigita.cms.contenttypes.Person; +import com.arsdigita.cms.contenttypes.Member; import com.arsdigita.cms.contenttypes.BaseContact; import com.arsdigita.cms.ui.ItemSearchWidget; import com.arsdigita.cms.ContentType; @@ -101,7 +101,7 @@ public class BaseContactAttachPersonPropertyForm extends BasicPageForm implement BaseContact baseContact = (BaseContact)getItemSelectionModel().getSelectedObject(state); if (!this.getSaveCancelSection().getCancelButton().isSelected(state)) { - baseContact.setPerson((Person)data.get(ITEM_SEARCH)); + baseContact.setPerson((Member)data.get(ITEM_SEARCH)); } init(fse); } diff --git a/ccm-cms-types-baseContact/src/com/arsdigita/cms/contenttypes/ui/BaseContactEditPersonPropertyForm.java b/ccm-cms-types-baseContact/src/com/arsdigita/cms/contenttypes/ui/BaseContactEditPersonPropertyForm.java index bd28b30eb..f367b5f23 100644 --- a/ccm-cms-types-baseContact/src/com/arsdigita/cms/contenttypes/ui/BaseContactEditPersonPropertyForm.java +++ b/ccm-cms-types-baseContact/src/com/arsdigita/cms/contenttypes/ui/BaseContactEditPersonPropertyForm.java @@ -24,8 +24,8 @@ import com.arsdigita.bebop.parameters.StringParameter; import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.ui.authoring.BasicPageForm; import com.arsdigita.cms.contenttypes.BaseContact; -import com.arsdigita.cms.contenttypes.Person; -import com.arsdigita.cms.contenttypes.util.PersonGlobalizationUtil; +import com.arsdigita.cms.contenttypes.Member; +import com.arsdigita.cms.contenttypes.util.MemberGlobalizationUtil; import org.apache.log4j.Logger; @@ -39,10 +39,10 @@ public class BaseContactEditPersonPropertyForm extends BasicPageForm implements private BaseContactPersonPropertiesStep m_step; - public static final String SURNAME = Person.SURNAME; - public static final String GIVENNAME = Person.GIVENNAME; - public static final String TITLEPRE = Person.TITLEPRE; - public static final String TITLEPOST = Person.TITLEPOST; + public static final String SURNAME = Member.SURNAME; + public static final String GIVENNAME = Member.GIVENNAME; + public static final String TITLEPRE = Member.TITLEPRE; + public static final String TITLEPOST = Member.TITLEPOST; /** * ID of the form @@ -72,27 +72,27 @@ public class BaseContactEditPersonPropertyForm extends BasicPageForm implements @Override public void addWidgets() { - add(new Label((String)PersonGlobalizationUtil.globalize("cms.contenttypes.ui.person.surname").localize())); + add(new Label((String)MemberGlobalizationUtil.globalize("cms.contenttypes.ui.person.surname").localize())); ParameterModel surnameParam = new StringParameter(SURNAME); surnameParam.addParameterListener( new NotNullValidationListener( ) ); surnameParam.addParameterListener( new StringInRangeValidationListener(0, 1000) ); TextField surname = new TextField(surnameParam); add(surname); - add(new Label((String)PersonGlobalizationUtil.globalize("cms.contenttypes.ui.person.givenname").localize())); + add(new Label((String)MemberGlobalizationUtil.globalize("cms.contenttypes.ui.person.givenname").localize())); ParameterModel givennameParam = new StringParameter(GIVENNAME); givennameParam.addParameterListener( new NotNullValidationListener( ) ); givennameParam.addParameterListener( new StringInRangeValidationListener(0, 1000) ); TextField givenname = new TextField(givennameParam); add(givenname); - add(new Label((String)PersonGlobalizationUtil.globalize("cms.contenttypes.ui.person.titlepre").localize())); + add(new Label((String)MemberGlobalizationUtil.globalize("cms.contenttypes.ui.person.titlepre").localize())); ParameterModel titlepreParam = new StringParameter(TITLEPRE); titlepreParam.addParameterListener( new StringInRangeValidationListener(0, 1000) ); TextField titlepre = new TextField(titlepreParam); add(titlepre); - add(new Label((String)PersonGlobalizationUtil.globalize("cms.contenttypes.ui.person.titlepost").localize())); + add(new Label((String)MemberGlobalizationUtil.globalize("cms.contenttypes.ui.person.titlepost").localize())); ParameterModel titlepostParam = new StringParameter(TITLEPOST); titlepostParam.addParameterListener( new StringInRangeValidationListener(0, 1000) ); TextField titlepost = new TextField(titlepostParam); diff --git a/ccm-cms-types-baseContact/src/com/arsdigita/cms/contenttypes/ui/BaseContactPersonPropertiesStep.java b/ccm-cms-types-baseContact/src/com/arsdigita/cms/contenttypes/ui/BaseContactPersonPropertiesStep.java index 26b701dc4..8801ed9e4 100644 --- a/ccm-cms-types-baseContact/src/com/arsdigita/cms/contenttypes/ui/BaseContactPersonPropertiesStep.java +++ b/ccm-cms-types-baseContact/src/com/arsdigita/cms/contenttypes/ui/BaseContactPersonPropertiesStep.java @@ -17,8 +17,8 @@ import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess; import com.arsdigita.toolbox.ui.DomainObjectPropertySheet; import com.arsdigita.bebop.Component; import com.arsdigita.bebop.Label; -import com.arsdigita.cms.contenttypes.Person; -import com.arsdigita.cms.contenttypes.util.PersonGlobalizationUtil; +import com.arsdigita.cms.contenttypes.Member; +import com.arsdigita.cms.contenttypes.util.MemberGlobalizationUtil; import com.arsdigita.cms.contenttypes.util.BaseContactGlobalizationUtil; /** @@ -71,10 +71,10 @@ public class BaseContactPersonPropertiesStep extends SimpleEditStep { public static Component getPersonPropertySheet(ItemSelectionModel itemModel) { DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(itemModel); - sheet.add((String)PersonGlobalizationUtil.globalize("cms.contenttypes.ui.person.surname").localize(), "person." + Person.SURNAME); - sheet.add((String)PersonGlobalizationUtil.globalize("cms.contenttypes.ui.person.givenname").localize(), "person." + Person.GIVENNAME); - sheet.add((String)PersonGlobalizationUtil.globalize("cms.contenttypes.ui.person.titlepre").localize(), "person." + Person.TITLEPRE); - sheet.add((String)PersonGlobalizationUtil.globalize("cms.contenttypes.ui.person.titlepost").localize(), "person." + Person.TITLEPOST); + sheet.add((String)MemberGlobalizationUtil.globalize("cms.contenttypes.ui.person.surname").localize(), "person." + Member.SURNAME); + sheet.add((String)MemberGlobalizationUtil.globalize("cms.contenttypes.ui.person.givenname").localize(), "person." + Member.GIVENNAME); + sheet.add((String)MemberGlobalizationUtil.globalize("cms.contenttypes.ui.person.titlepre").localize(), "person." + Member.TITLEPRE); + sheet.add((String)MemberGlobalizationUtil.globalize("cms.contenttypes.ui.person.titlepost").localize(), "person." + Member.TITLEPOST); return sheet; } diff --git a/ccm-cms-types-person/application.xml b/ccm-cms-types-member/application.xml similarity index 91% rename from ccm-cms-types-person/application.xml rename to ccm-cms-types-member/application.xml index 4695c58c1..9e5203211 100644 --- a/ccm-cms-types-person/application.xml +++ b/ccm-cms-types-member/application.xml @@ -1,6 +1,6 @@ - Basic person type for OpenCCM + Member type for OpenCCM diff --git a/ccm-cms-types-member/pdl/com/arsdigita/content-types/Member.pdl b/ccm-cms-types-member/pdl/com/arsdigita/content-types/Member.pdl new file mode 100644 index 000000000..85ca1edda --- /dev/null +++ b/ccm-cms-types-member/pdl/com/arsdigita/content-types/Member.pdl @@ -0,0 +1,31 @@ +// +// Copyright (C) 2009 Jens Pelzetter, for the Center of Social Politics of the University of Bremen +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public License +// as published by the Free Software Foundation; either version 2.1 of +// the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// + +model com.arsdigita.cms.contenttypes; + +import com.arsdigita.cms.basetypes.*; +import com.arsdigita.cms.ContentPage; + +object type Member extends Person { + +// Address address [0..1] = join Address ct_members.address_id +// to cms_addresses.address_id; + + reference key (ct_members.member_id); +} \ No newline at end of file diff --git a/ccm-cms-types-person/sql/ccm-cms-types-person/postgres-create.sql b/ccm-cms-types-member/sql/ccm-cms-types-member/postgres-create.sql similarity index 100% rename from ccm-cms-types-person/sql/ccm-cms-types-person/postgres-create.sql rename to ccm-cms-types-member/sql/ccm-cms-types-member/postgres-create.sql diff --git a/ccm-cms-types-person/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/Person.xml b/ccm-cms-types-member/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/Member.xml similarity index 54% rename from ccm-cms-types-person/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/Person.xml rename to ccm-cms-types-member/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/Member.xml index 406d6d0be..9df8ccf00 100644 --- a/ccm-cms-types-person/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/Person.xml +++ b/ccm-cms-types-member/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/Member.xml @@ -5,20 +5,20 @@ xsi:schemaLocation="http://xmlns.redhat.com/cms/content-types content-types.xsd"> + label="Member" + description="A generic, Member type" + objectType="com.arsdigita.cms.contenttypes.Member" + classname="com.arsdigita.cms.contenttypes.Member"> diff --git a/ccm-cms-types-member/src/ccm-cms-types-member.config b/ccm-cms-types-member/src/ccm-cms-types-member.config new file mode 100644 index 000000000..c91bf1def --- /dev/null +++ b/ccm-cms-types-member/src/ccm-cms-types-member.config @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/ccm-cms-types-person/src/ccm-cms-types-person.load b/ccm-cms-types-member/src/ccm-cms-types-member.load similarity index 54% rename from ccm-cms-types-person/src/ccm-cms-types-person.load rename to ccm-cms-types-member/src/ccm-cms-types-member.load index 23e2bfa60..ec0a81bd8 100644 --- a/ccm-cms-types-person/src/ccm-cms-types-person.load +++ b/ccm-cms-types-member/src/ccm-cms-types-member.load @@ -6,11 +6,11 @@ - - +
+ - - + + \ No newline at end of file diff --git a/ccm-cms-types-member/src/com/arsdigita/cms/contenttypes/Member.java b/ccm-cms-types-member/src/com/arsdigita/cms/contenttypes/Member.java new file mode 100644 index 000000000..a7f82ecac --- /dev/null +++ b/ccm-cms-types-member/src/com/arsdigita/cms/contenttypes/Member.java @@ -0,0 +1,81 @@ +/* + * Copyright (C) 2009 Jens Pelzetter, for the Center of Social Politics of the University of Bremen + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +package com.arsdigita.cms.contenttypes; + +import com.arsdigita.cms.ContentType; +import com.arsdigita.cms.basetypes.Person; +import com.arsdigita.domain.DataObjectNotFoundException; +import com.arsdigita.persistence.DataObject; +import com.arsdigita.persistence.OID; +import com.arsdigita.util.Assert; +import java.math.BigDecimal; + +/** + * Basic Member Contenttype for OpenCCM. + * + * @author Jens Pelzetter + */ +public class Member extends Person { + + /** Data object type for this domain object */ + public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.contenttypes.Member"; +// private static final MemberConfig s_config = new MemberConfig(); + + +// static { +// s_config.load(); +// } + +// public static final MemberConfig getConfig() { +// return s_config; +// } + + /** + * Default constructor. This creates a new (empty) Member. + **/ + public Member() { + this(BASE_DATA_OBJECT_TYPE); + } + + public Member(BigDecimal id) throws DataObjectNotFoundException { + this(new OID(BASE_DATA_OBJECT_TYPE, id)); + } + + public Member(OID id) throws DataObjectNotFoundException { + super(id); + } + + public Member(DataObject obj) { + super(obj); + } + + public Member(String type) { + super(type); + } + + @Override + public void beforeSave() { + super.beforeSave(); + + Assert.exists(getContentType(), ContentType.class); + } + + /* accessors *****************************************************/ +} diff --git a/ccm-cms-types-person/src/com/arsdigita/cms/contenttypes/PersonConfig.java b/ccm-cms-types-member/src/com/arsdigita/cms/contenttypes/MemberConfig.java similarity index 86% rename from ccm-cms-types-person/src/com/arsdigita/cms/contenttypes/PersonConfig.java rename to ccm-cms-types-member/src/com/arsdigita/cms/contenttypes/MemberConfig.java index a75ff25ae..2018f47af 100644 --- a/ccm-cms-types-person/src/com/arsdigita/cms/contenttypes/PersonConfig.java +++ b/ccm-cms-types-member/src/com/arsdigita/cms/contenttypes/MemberConfig.java @@ -20,13 +20,11 @@ package com.arsdigita.cms.contenttypes; import com.arsdigita.runtime.AbstractConfig; -import com.arsdigita.util.parameter.Parameter; -import com.arsdigita.util.parameter.BooleanParameter; /** * * @author Jens Pelzetter */ -public class PersonConfig extends AbstractConfig { +public class MemberConfig extends AbstractConfig { } diff --git a/ccm-cms-types-person/src/com/arsdigita/cms/contenttypes/PersonInitializer.java b/ccm-cms-types-member/src/com/arsdigita/cms/contenttypes/MemberInitializer.java similarity index 72% rename from ccm-cms-types-person/src/com/arsdigita/cms/contenttypes/PersonInitializer.java rename to ccm-cms-types-member/src/com/arsdigita/cms/contenttypes/MemberInitializer.java index 6e47df0ae..6a2edf9cf 100644 --- a/ccm-cms-types-person/src/com/arsdigita/cms/contenttypes/PersonInitializer.java +++ b/ccm-cms-types-member/src/com/arsdigita/cms/contenttypes/MemberInitializer.java @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ - package com.arsdigita.cms.contenttypes; import com.arsdigita.cms.contenttypes.ContentTypeInitializer; @@ -31,18 +30,13 @@ import org.apache.log4j.Logger; * * @author Jens Pelzetter */ -public class PersonInitializer extends ContentTypeInitializer { +public class MemberInitializer extends ContentTypeInitializer { - public final static String versionId = - "$Id: PersonInitializer.java 1 2009-03-19 08:30:26Z jensp $" + - "$Author: jensp $" + - "$DateTime: 2009/03/19 09:30:00 $"; + private static final Logger s_log = Logger.getLogger(MemberInitializer.class); - private static final Logger s_log = Logger.getLogger(PersonInitializer.class); - - public PersonInitializer() { - super("ccm-cms-types-person.pdl.mf", - Person.BASE_DATA_OBJECT_TYPE); + public MemberInitializer() { + super("ccm-cms-types-member.pdl.mf", + Member.BASE_DATA_OBJECT_TYPE); } @Override @@ -52,6 +46,6 @@ public class PersonInitializer extends ContentTypeInitializer { @Override public String[] getStylesheets() { - return new String[] { "/static/content-types/com/arsdigita/cms/contenttypes/Person.xsl" }; + return new String[]{"/static/content-types/com/arsdigita/cms/contenttypes/Member.xsl"}; } } diff --git a/ccm-cms-types-person/src/com/arsdigita/cms/contenttypes/PersonLoader.java b/ccm-cms-types-member/src/com/arsdigita/cms/contenttypes/MemberLoader.java similarity index 85% rename from ccm-cms-types-person/src/com/arsdigita/cms/contenttypes/PersonLoader.java rename to ccm-cms-types-member/src/com/arsdigita/cms/contenttypes/MemberLoader.java index f012046bf..65779b4da 100644 --- a/ccm-cms-types-person/src/com/arsdigita/cms/contenttypes/PersonLoader.java +++ b/ccm-cms-types-member/src/com/arsdigita/cms/contenttypes/MemberLoader.java @@ -27,11 +27,11 @@ import org.apache.log4j.Logger; * * @author Jens Pelzetter */ -public class PersonLoader extends AbstractContentTypeLoader { +public class MemberLoader extends AbstractContentTypeLoader { - private static final Logger s_log = Logger.getLogger(PersonLoader.class); + private static final Logger s_log = Logger.getLogger(MemberLoader.class); private static final String[] TYPES = { - "/WEB-INF/content-types/com/arsdigita/cms/contenttypes/Person.xml" + "/WEB-INF/content-types/com/arsdigita/cms/contenttypes/Member.xml" }; public String[] getTypes() { diff --git a/ccm-cms-types-member/src/com/arsdigita/cms/contenttypes/ui/MemberPropertiesStep.java b/ccm-cms-types-member/src/com/arsdigita/cms/contenttypes/ui/MemberPropertiesStep.java new file mode 100644 index 000000000..43f8aa63a --- /dev/null +++ b/ccm-cms-types-member/src/com/arsdigita/cms/contenttypes/ui/MemberPropertiesStep.java @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2009 Jens Pelzetter, for the Center of Social Politics of the University of Bremen + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ +package com.arsdigita.cms.contenttypes.ui; + +import com.arsdigita.bebop.Component; +import com.arsdigita.cms.ItemSelectionModel; +import com.arsdigita.cms.basetypes.Person; +import com.arsdigita.cms.basetypes.ui.PersonPropertiesStep; +import com.arsdigita.cms.ui.authoring.AuthoringKitWizard; +import com.arsdigita.cms.ui.authoring.BasicPageForm; +import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess; + +public class MemberPropertiesStep extends PersonPropertiesStep { + + public static final String EDIT_SHEET_NAME = "edit"; + + public MemberPropertiesStep(ItemSelectionModel itemModel, AuthoringKitWizard parent) { + super(itemModel, parent); +// createEditSheet(itemModel); + +// setDisplayComponent(getMemberPropertySheet(itemModel)); + } + + protected void createEditSheet(ItemSelectionModel itemModel) { + BasicPageForm editSheet; + editSheet = new MemberPropertyForm(itemModel, this); + add(EDIT_SHEET_NAME, "Edit", new WorkflowLockedComponentAccess(editSheet, itemModel), editSheet.getSaveCancelSection().getCancelButton()); + } + + public static Component getMemberPropertySheet(ItemSelectionModel itemModel) { + Component sheet = PersonPropertiesStep.getPersonPropertySheet(itemModel); + + return sheet; + } +} diff --git a/ccm-cms-types-member/src/com/arsdigita/cms/contenttypes/ui/MemberPropertyForm.java b/ccm-cms-types-member/src/com/arsdigita/cms/contenttypes/ui/MemberPropertyForm.java new file mode 100644 index 000000000..c096654d8 --- /dev/null +++ b/ccm-cms-types-member/src/com/arsdigita/cms/contenttypes/ui/MemberPropertyForm.java @@ -0,0 +1,84 @@ +/* + * Copyright (C) 2009 Jens Pelzetter, for the Center of Social Politics of the University of Bremen + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ +package com.arsdigita.cms.contenttypes.ui; + +import com.arsdigita.bebop.FormData; +import com.arsdigita.bebop.Label; +import com.arsdigita.bebop.event.FormInitListener; +import com.arsdigita.bebop.event.FormProcessListener; +import com.arsdigita.bebop.event.FormSectionEvent; +import com.arsdigita.bebop.event.FormSubmissionListener; +import com.arsdigita.bebop.form.TextField; +import com.arsdigita.bebop.parameters.ParameterModel; +import com.arsdigita.bebop.parameters.StringParameter; +import com.arsdigita.cms.ItemSelectionModel; +import com.arsdigita.cms.basetypes.ui.PersonPropertyForm; +import com.arsdigita.cms.contenttypes.Member; +import com.arsdigita.cms.contenttypes.util.MemberGlobalizationUtil; +import com.arsdigita.cms.ui.authoring.BasicPageForm; +import org.apache.log4j.Logger; + +/** + * Form to edit the properties of a member. + * + * @author: Jens Pelzetter + */ +public class MemberPropertyForm extends PersonPropertyForm implements FormProcessListener, FormInitListener, FormSubmissionListener { + + private static final Logger s_log = Logger.getLogger(MemberPropertyForm.class); + private MemberPropertiesStep m_step; + public static final String ID = "Member_edit"; + + public MemberPropertyForm(ItemSelectionModel itemModel) { + this(itemModel, null); + } + + public MemberPropertyForm(ItemSelectionModel itemModel, MemberPropertiesStep step) { + super(itemModel, step); + m_step = step; + addSubmissionListener(this); + } + + @Override + protected void addWidgets() { + super.addWidgets(); + } + + public void init(FormSectionEvent fse) { + super.init(fse); + FormData data = fse.getFormData(); + Member member = (Member) super.initBasicWidgets(fse); + } + +/* + public void submitted(FormSectionEvent fse) { + if (m_step != null + && getSaveCancelSection().getCancelButton().isSelected(fse.getPageState())) { + m_step.cancelStreamlinedCreation(fse.getPageState()); + } + } +*/ + + public void process(FormSectionEvent fse) { + super.process(fse); + FormData data = fse.getFormData(); + + } +} + \ No newline at end of file diff --git a/ccm-cms-types-person/src/com/arsdigita/cms/contenttypes/util/PersonGlobalizationUtil.java b/ccm-cms-types-member/src/com/arsdigita/cms/contenttypes/util/MemberGlobalizationUtil.java similarity index 92% rename from ccm-cms-types-person/src/com/arsdigita/cms/contenttypes/util/PersonGlobalizationUtil.java rename to ccm-cms-types-member/src/com/arsdigita/cms/contenttypes/util/MemberGlobalizationUtil.java index 8d51027e7..f565a8247 100644 --- a/ccm-cms-types-person/src/com/arsdigita/cms/contenttypes/util/PersonGlobalizationUtil.java +++ b/ccm-cms-types-member/src/com/arsdigita/cms/contenttypes/util/MemberGlobalizationUtil.java @@ -21,9 +21,9 @@ package com.arsdigita.cms.contenttypes.util; import com.arsdigita.globalization.GlobalizedMessage; -public class PersonGlobalizationUtil { +public class MemberGlobalizationUtil { final public static String BUNDLE_NAME = - "com.arsdigita.cms.contenttypes.util.PersonResourceBundle"; + "com.arsdigita.cms.contenttypes.util.MemberResourceBundle"; public static GlobalizedMessage globalize (String key) { return new GlobalizedMessage(key, BUNDLE_NAME); diff --git a/ccm-cms-types-person/src/com/arsdigita/cms/contenttypes/util/PersonResourceBundle.java b/ccm-cms-types-member/src/com/arsdigita/cms/contenttypes/util/MemberResourceBundle.java similarity index 81% rename from ccm-cms-types-person/src/com/arsdigita/cms/contenttypes/util/PersonResourceBundle.java rename to ccm-cms-types-member/src/com/arsdigita/cms/contenttypes/util/MemberResourceBundle.java index 999bbf468..fd7116351 100644 --- a/ccm-cms-types-person/src/com/arsdigita/cms/contenttypes/util/PersonResourceBundle.java +++ b/ccm-cms-types-member/src/com/arsdigita/cms/contenttypes/util/MemberResourceBundle.java @@ -23,13 +23,13 @@ import java.util.PropertyResourceBundle; import com.arsdigita.globalization.ChainedResourceBundle; import com.arsdigita.cms.CMSGlobalized; -public class PersonResourceBundle extends ChainedResourceBundle implements CMSGlobalized { - public static final String PERSON_BUNDLE_NAME = - "com.arsdigita.cms.contenttypes.PersonResources"; +public class MemberResourceBundle extends ChainedResourceBundle implements CMSGlobalized { + public static final String MEMBER_BUNDLE_NAME = + "com.arsdigita.cms.contenttypes.MemberResources"; - public PersonResourceBundle() { + public MemberResourceBundle() { super(); - addBundle((PropertyResourceBundle)getBundle(PERSON_BUNDLE_NAME)); + addBundle((PropertyResourceBundle)getBundle(MEMBER_BUNDLE_NAME)); addBundle((PropertyResourceBundle)getBundle(BUNDLE_NAME)); } } \ No newline at end of file diff --git a/ccm-cms-types-person/web/static/content-types/com/arsdigita/cms/contenttypes/Person.xsl b/ccm-cms-types-member/web/static/content-types/com/arsdigita/cms/contenttypes/Member.xsl similarity index 85% rename from ccm-cms-types-person/web/static/content-types/com/arsdigita/cms/contenttypes/Person.xsl rename to ccm-cms-types-member/web/static/content-types/com/arsdigita/cms/contenttypes/Member.xsl index 22cbc0292..0dfb73645 100644 --- a/ccm-cms-types-person/web/static/content-types/com/arsdigita/cms/contenttypes/Person.xsl +++ b/ccm-cms-types-member/web/static/content-types/com/arsdigita/cms/contenttypes/Member.xsl @@ -7,9 +7,9 @@ xmlns:cms="http://www.arsdigita.com/cms/1.0" version="1.0"> - + name="cms:CT_graphics_com_arsdigita_cms_contenttypes_Member">

  @@ -20,9 +20,9 @@ - + name="cms:CT_text_com_arsdigita_cms_contenttypes_Member">

diff --git a/ccm-cms-types-newsitem/pdl/com/arsdigita/content-types/NewsItem.pdl b/ccm-cms-types-newsitem/pdl/com/arsdigita/content-types/NewsItem.pdl index 9aede0659..3c019fc8d 100755 --- a/ccm-cms-types-newsitem/pdl/com/arsdigita/content-types/NewsItem.pdl +++ b/ccm-cms-types-newsitem/pdl/com/arsdigita/content-types/NewsItem.pdl @@ -19,11 +19,11 @@ // $DateTime: 2004/08/17 23:15:09 $ model com.arsdigita.cms.contenttypes; -import com.arsdigita.cms.*; +import com.arsdigita.cms.basetypes.*; // object type to hold extended attributes of news content type -object type NewsItem extends com.arsdigita.cms.Article { +object type NewsItem extends com.arsdigita.cms.basetypes.Article { // The tease/lead paragraph for the news item String [0..1] lead = ct_news.tease_lead VARCHAR(4000); // The date for the news item diff --git a/ccm-cms-types-newsitem/src/com/arsdigita/cms/contenttypes/NewsItem.java b/ccm-cms-types-newsitem/src/com/arsdigita/cms/contenttypes/NewsItem.java index e9a67c66f..2c36613ae 100755 --- a/ccm-cms-types-newsitem/src/com/arsdigita/cms/contenttypes/NewsItem.java +++ b/ccm-cms-types-newsitem/src/com/arsdigita/cms/contenttypes/NewsItem.java @@ -19,7 +19,7 @@ package com.arsdigita.cms.contenttypes; -import com.arsdigita.cms.Article; +import com.arsdigita.cms.basetypes.Article; import com.arsdigita.cms.ContentType; import com.arsdigita.domain.DataObjectNotFoundException; import com.arsdigita.persistence.DataObject; diff --git a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/Membership.java b/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/Membership.java index 7d3371b4f..0aed2c1d9 100644 --- a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/Membership.java +++ b/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/Membership.java @@ -120,18 +120,18 @@ public class Membership extends ACSObject { setAssociation(MEMBERSHIP_OWNER, ou); } - public Person getTargetItem() { + public Member getTargetItem() { DataObject obj = (DataObject) get(TARGET_ITEM); - return (Person) DomainObjectFactory.newInstance(obj); + return (Member) DomainObjectFactory.newInstance(obj); } - public void setTargetItem(Person person) { - Assert.exists(person, Person.class); + public void setTargetItem(Member person) { + Assert.exists(person, Member.class); setAssociation(TARGET_ITEM, person); } public String getURI(PageState state) { - Person person = this.getTargetItem(); + Member person = this.getTargetItem(); if (person == null) { logger.error(getOID() + " is a link between a OrganizationalUnit and a Person, but the associated Person is null"); @@ -145,7 +145,7 @@ public class Membership extends ACSObject { return URL.there(state.getRequest(), url).toString(); } - public static DataCollection getReferingPersons(Person person) { + public static DataCollection getReferingPersons(Member person) { Session session = SessionManager.getSession(); DataCollection memberships = session.retrieve(BASE_DATA_OBJECT_TYPE); Filter filter = memberships.addInSubqueryFilter("id", "com.arsdigita.cms.contenttypes.getReferingPersons"); diff --git a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/OrganizationalUnit.java b/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/OrganizationalUnit.java index 723d87df9..79c568aef 100644 --- a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/OrganizationalUnit.java +++ b/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/OrganizationalUnit.java @@ -83,32 +83,32 @@ public class OrganizationalUnit extends ContentPage{ set(ORGANIZATIONALUNIT_DESCRIPTION, description); } - public Person getDirection() { + public Member getDirection() { DataObject dobj = (DataObject) get(DIRECTION); if (dobj != null) { - return (Person) DomainObjectFactory.newInstance(dobj); + return (Member) DomainObjectFactory.newInstance(dobj); } else { return null; } } - public void setDirection(Person person) { + public void setDirection(Member person) { logger.debug("Setting direction..."); - Assert.exists(person, Person.class); + Assert.exists(person, Member.class); setAssociation(DIRECTION, person); } - public Person getAssistentDirection() { + public Member getAssistentDirection() { DataObject dobj = (DataObject) get(ASSISTENT_DIRECTION); if (dobj != null) { - return (Person) DomainObjectFactory.newInstance(dobj); + return (Member) DomainObjectFactory.newInstance(dobj); } else { return null; } } - public void setAssistentDirection(Person person) { - Assert.exists(person, Person.class); + public void setAssistentDirection(Member person) { + Assert.exists(person, Member.class); setAssociation(ASSISTENT_DIRECTION, person); } diff --git a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/MembershipPropertyForm.java b/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/MembershipPropertyForm.java index 9ca1a0d97..8a5d189c2 100644 --- a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/MembershipPropertyForm.java +++ b/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/MembershipPropertyForm.java @@ -26,7 +26,7 @@ import com.arsdigita.cms.contenttypes.Membership; import com.arsdigita.cms.contenttypes.MembershipStatus; import com.arsdigita.cms.contenttypes.OrganizationalUnit; import com.arsdigita.cms.contenttypes.OrganizationalUnitGlobalizationUtil; -import com.arsdigita.cms.contenttypes.Person; +import com.arsdigita.cms.contenttypes.Member; import com.arsdigita.cms.ui.ItemSearchWidget; import com.arsdigita.domain.DomainObjectFactory; import com.arsdigita.persistence.DataCollection; @@ -166,7 +166,7 @@ public class MembershipPropertyForm extends FormSection implements FormInitListe PageState state = event.getPageState(); FormData data = event.getFormData(); - membership.setTargetItem((Person) data.get(PERSON_SEARCH)); + membership.setTargetItem((Member) data.get(PERSON_SEARCH)); MembershipStatus status = new MembershipStatus(new BigDecimal((String) this.m_status.getValue(state))); logger.debug("this.m_status.getValues() = " + this.m_status.getValue(state)); diff --git a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/MembershipTable.java b/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/MembershipTable.java index 43017158e..7352dd516 100644 --- a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/MembershipTable.java +++ b/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/MembershipTable.java @@ -19,7 +19,7 @@ import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.contenttypes.Membership; import com.arsdigita.cms.contenttypes.MembershipStatus; import com.arsdigita.cms.contenttypes.OrganizationalUnitGlobalizationUtil; -import com.arsdigita.cms.contenttypes.Person; +import com.arsdigita.cms.contenttypes.Member; import com.arsdigita.cms.dispatcher.Utilities; import com.arsdigita.domain.DataObjectNotFoundException; import com.arsdigita.domain.DomainObjectFactory; @@ -96,7 +96,7 @@ public class MembershipTable extends Table { String url = membership.getURI(state); if (column == m_personCol.getModelIndex()) { - Person person = membership.getTargetItem(); + Member person = membership.getTargetItem(); StringBuilder fullNameBuilder = new StringBuilder(); if(person.getTitlePre() != null) { diff --git a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/OrganizationalUnitChooseAssistentDirectorTable.java b/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/OrganizationalUnitChooseAssistentDirectorTable.java index 315627b22..82432101e 100644 --- a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/OrganizationalUnitChooseAssistentDirectorTable.java +++ b/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/OrganizationalUnitChooseAssistentDirectorTable.java @@ -34,7 +34,7 @@ import com.arsdigita.cms.ContentItem; import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.contenttypes.OrganizationalUnit; import com.arsdigita.cms.contenttypes.OrganizationalUnitGlobalizationUtil; -import com.arsdigita.cms.contenttypes.Person; +import com.arsdigita.cms.contenttypes.Member; import com.arsdigita.domain.DomainObjectFactory; import com.arsdigita.persistence.DataCollection; import com.arsdigita.persistence.OID; @@ -78,7 +78,7 @@ public class OrganizationalUnitChooseAssistentDirectorTable extends Table implem public TableModel makeModel(Table t, PageState s) { t.getRowSelectionModel().clearSelection(s); - DataCollection m_persons = SessionManager.getSession().retrieve(Person.BASE_DATA_OBJECT_TYPE); + DataCollection m_persons = SessionManager.getSession().retrieve(Member.BASE_DATA_OBJECT_TYPE); m_persons.addEqualsFilter(ContentItem.VERSION, ContentItem.DRAFT); return new OrganizationalUnitChooseAssistentDirectorTableModel(t, m_persons); } @@ -88,7 +88,7 @@ public class OrganizationalUnitChooseAssistentDirectorTable extends Table implem private Table m_table; private DataCollection m_persons; - private Person m_person; + private Member m_person; private OrganizationalUnitChooseAssistentDirectorTableModel(Table t, DataCollection persons) { m_table = t; @@ -101,7 +101,7 @@ public class OrganizationalUnitChooseAssistentDirectorTable extends Table implem public boolean nextRow() { if (m_persons.next()) { - m_person = (Person) DomainObjectFactory.newInstance(m_persons.getDataObject()); + m_person = (Member) DomainObjectFactory.newInstance(m_persons.getDataObject()); return true; } else { return false; @@ -163,7 +163,7 @@ public class OrganizationalUnitChooseAssistentDirectorTable extends Table implem m_parent.showDisplayPane(state); BigDecimal personID = new BigDecimal (e.getRowKey().toString()); OrganizationalUnit orgaunit = (OrganizationalUnit) this.m_selOrgaUnit.getSelectedObject(state); - Person person = (Person) DomainObjectFactory.newInstance(new OID(Person.BASE_DATA_OBJECT_TYPE, personID)); + Member person = (Member) DomainObjectFactory.newInstance(new OID(Member.BASE_DATA_OBJECT_TYPE, personID)); orgaunit.setAssistentDirection(person); } } diff --git a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/OrganizationalUnitChooseDirectorTable.java b/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/OrganizationalUnitChooseDirectorTable.java index bdcb7462d..c315fb6a8 100644 --- a/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/OrganizationalUnitChooseDirectorTable.java +++ b/ccm-cms-types-organizationalunit/src/com/arsdigita/cms/contenttypes/ui/organizationalunit/OrganizationalUnitChooseDirectorTable.java @@ -33,7 +33,7 @@ import com.arsdigita.bebop.table.TableModelBuilder; import com.arsdigita.cms.ContentItem; import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.contenttypes.OrganizationalUnit; -import com.arsdigita.cms.contenttypes.Person; +import com.arsdigita.cms.contenttypes.Member; import com.arsdigita.domain.DomainObjectFactory; import com.arsdigita.persistence.DataCollection; import com.arsdigita.persistence.OID; @@ -79,7 +79,7 @@ public class OrganizationalUnitChooseDirectorTable extends Table implements Tabl public TableModel makeModel(Table t, PageState s) { t.getRowSelectionModel().clearSelection(s); - DataCollection m_persons = SessionManager.getSession().retrieve(Person.BASE_DATA_OBJECT_TYPE); + DataCollection m_persons = SessionManager.getSession().retrieve(Member.BASE_DATA_OBJECT_TYPE); m_persons.addEqualsFilter(ContentItem.VERSION, ContentItem.DRAFT); return new OrganizationalUnitChooseDirectorTableModel(t, m_persons); } @@ -89,7 +89,7 @@ public class OrganizationalUnitChooseDirectorTable extends Table implements Tabl private Table m_table; private DataCollection m_persons; - private Person m_person; + private Member m_person; private OrganizationalUnitChooseDirectorTableModel(Table t, DataCollection persons) { m_table = t; @@ -102,7 +102,7 @@ public class OrganizationalUnitChooseDirectorTable extends Table implements Tabl public boolean nextRow() { if (m_persons.next()) { - m_person = (Person) DomainObjectFactory.newInstance(m_persons.getDataObject()); + m_person = (Member) DomainObjectFactory.newInstance(m_persons.getDataObject()); return true; } else { return false; @@ -167,7 +167,7 @@ public class OrganizationalUnitChooseDirectorTable extends Table implements Tabl m_parent.showDisplayPane(state); BigDecimal personID = new BigDecimal (e.getRowKey().toString()); OrganizationalUnit orgaunit = (OrganizationalUnit) this.m_selOrgaUnit.getSelectedObject(state); - Person person = (Person) DomainObjectFactory.newInstance(new OID(Person.BASE_DATA_OBJECT_TYPE, personID)); + Member person = (Member) DomainObjectFactory.newInstance(new OID(Member.BASE_DATA_OBJECT_TYPE, personID)); orgaunit.setDirection(person); } } diff --git a/ccm-cms-types-person/src/ccm-cms-types-person.config b/ccm-cms-types-person/src/ccm-cms-types-person.config deleted file mode 100644 index 8bfd32469..000000000 --- a/ccm-cms-types-person/src/ccm-cms-types-person.config +++ /dev/null @@ -1,5 +0,0 @@ - - - - \ No newline at end of file diff --git a/ccm-cms-types-project/src/com/arsdigita/cms/contenttypes/Project2Person.java b/ccm-cms-types-project/src/com/arsdigita/cms/contenttypes/Project2Person.java index f97d2d30c..113dc5aaf 100644 --- a/ccm-cms-types-project/src/com/arsdigita/cms/contenttypes/Project2Person.java +++ b/ccm-cms-types-project/src/com/arsdigita/cms/contenttypes/Project2Person.java @@ -74,17 +74,17 @@ public class Project2Person extends ACSObject { setAssociation(PROJECT, project); } - public Person getTargetItem() { + public Member getTargetItem() { DataObject obj = (DataObject) get(TARGET_ITEM); if (obj == null) { return null; } else { - return (Person) DomainObjectFactory.newInstance(obj); + return (Member) DomainObjectFactory.newInstance(obj); } } - public void setTargetItem(Person person) { - Assert.exists(person, Person.class); + public void setTargetItem(Member person) { + Assert.exists(person, Member.class); setAssociation(TARGET_ITEM, person); } @@ -99,7 +99,7 @@ public class Project2Person extends ACSObject { public String getURI(PageState state) { - Person person = this.getTargetItem(); + Member person = this.getTargetItem(); if (person == null) { s_log.error(getOID() + " is a link between a Project and a Person, but the associated Person is null"); @@ -113,7 +113,7 @@ public class Project2Person extends ACSObject { return URL.there(state.getRequest(), url).toString(); } - public static DataCollection getReferingProject2Persons(Person person) { + public static DataCollection getReferingProject2Persons(Member person) { Session session = SessionManager.getSession(); DataCollection project2Persons = session.retrieve(BASE_DATA_OBJECT_TYPE); Filter filter = project2Persons.addInSubqueryFilter("id", "com.arsdigita.cms.contenttypes.getReferingProject2Persons"); diff --git a/ccm-cms-types-project/src/com/arsdigita/cms/contenttypes/ui/project/Project2PersonPropertyForm.java b/ccm-cms-types-project/src/com/arsdigita/cms/contenttypes/ui/project/Project2PersonPropertyForm.java index 53f352fe7..df6292c86 100644 --- a/ccm-cms-types-project/src/com/arsdigita/cms/contenttypes/ui/project/Project2PersonPropertyForm.java +++ b/ccm-cms-types-project/src/com/arsdigita/cms/contenttypes/ui/project/Project2PersonPropertyForm.java @@ -17,7 +17,7 @@ import com.arsdigita.bebop.event.PrintListener; import com.arsdigita.bebop.form.Submit; import com.arsdigita.cms.ContentType; import com.arsdigita.cms.ItemSelectionModel; -import com.arsdigita.cms.contenttypes.Person; +import com.arsdigita.cms.contenttypes.Member; import com.arsdigita.cms.contenttypes.Project; import com.arsdigita.cms.contenttypes.Project2Person; import com.arsdigita.cms.contenttypes.ProjectGlobalizationUtil; @@ -128,7 +128,7 @@ public class Project2PersonPropertyForm PageState state = e.getPageState(); FormData data = e.getFormData(); - project2Person.setTargetItem((Person) data.get(ITEM_SEARCH)); + project2Person.setTargetItem((Member) data.get(ITEM_SEARCH)); project2Person.save(); } diff --git a/ccm-cms-types-project/src/com/arsdigita/cms/contenttypes/ui/project/Project2PersonTable.java b/ccm-cms-types-project/src/com/arsdigita/cms/contenttypes/ui/project/Project2PersonTable.java index 75474ea8b..d0fa1563e 100644 --- a/ccm-cms-types-project/src/com/arsdigita/cms/contenttypes/ui/project/Project2PersonTable.java +++ b/ccm-cms-types-project/src/com/arsdigita/cms/contenttypes/ui/project/Project2PersonTable.java @@ -19,7 +19,7 @@ import com.arsdigita.bebop.table.TableColumnModel; import com.arsdigita.cms.ContentItem; import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.SecurityManager; -import com.arsdigita.cms.contenttypes.Person; +import com.arsdigita.cms.contenttypes.Member; import com.arsdigita.cms.contenttypes.Project2Person; import com.arsdigita.cms.contenttypes.ProjectGlobalizationUtil; import com.arsdigita.cms.dispatcher.Utilities; @@ -121,7 +121,7 @@ public class Project2PersonTable extends Table { String url = project2Person.getURI(state); if (column == m_personCol.getModelIndex()) { - Person person = project2Person.getTargetItem(); + Member person = project2Person.getTargetItem(); StringBuilder fullNameBuilder = new StringBuilder(); if (person.getTitlePre() != null) { diff --git a/ccm-cms-types-researchnetwork/src/com/arsdigita/cms/contenttypes/ResearchNetworkMembership.java b/ccm-cms-types-researchnetwork/src/com/arsdigita/cms/contenttypes/ResearchNetworkMembership.java index a53403c32..ad4147293 100644 --- a/ccm-cms-types-researchnetwork/src/com/arsdigita/cms/contenttypes/ResearchNetworkMembership.java +++ b/ccm-cms-types-researchnetwork/src/com/arsdigita/cms/contenttypes/ResearchNetworkMembership.java @@ -66,18 +66,18 @@ public class ResearchNetworkMembership extends ACSObject { setAssociation(MEMBER_OWNER, rn); } - public Person getTargetItem() { + public Member getTargetItem() { DataObject obj = (DataObject) get(TARGET_ITEM); - return (Person) DomainObjectFactory.newInstance(obj); + return (Member) DomainObjectFactory.newInstance(obj); } - public void setTargetItem(Person person) { - Assert.exists(person, Person.class); + public void setTargetItem(Member person) { + Assert.exists(person, Member.class); setAssociation(TARGET_ITEM, person); } public String getURI(PageState state) { - Person person = this.getTargetItem(); + Member person = this.getTargetItem(); if (person == null) { s_log.error(getOID() + " is a link between a ResearchNetwork and a Person, but the associated person is null"); @@ -91,7 +91,7 @@ public class ResearchNetworkMembership extends ACSObject { return URL.there(state.getRequest(), url).toString(); } - public static DataCollection getReferingPersons(Person person) { + public static DataCollection getReferingPersons(Member person) { Session session = SessionManager.getSession(); DataCollection members = session.retrieve(BASE_DATA_OBJECT_TYPE); Filter filter = members.addInSubqueryFilter("id", "com.arsdigita.cms.contenttypes.getReferingPersons"); diff --git a/ccm-cms-types-researchnetwork/src/com/arsdigita/cms/contenttypes/ui/ResearchNetworkMembershipPropertyForm.java b/ccm-cms-types-researchnetwork/src/com/arsdigita/cms/contenttypes/ui/ResearchNetworkMembershipPropertyForm.java index 46b2bed06..c83658eb9 100644 --- a/ccm-cms-types-researchnetwork/src/com/arsdigita/cms/contenttypes/ui/ResearchNetworkMembershipPropertyForm.java +++ b/ccm-cms-types-researchnetwork/src/com/arsdigita/cms/contenttypes/ui/ResearchNetworkMembershipPropertyForm.java @@ -18,7 +18,7 @@ import com.arsdigita.bebop.form.Submit; import com.arsdigita.bebop.util.GlobalizationUtil; import com.arsdigita.cms.ContentType; import com.arsdigita.cms.ItemSelectionModel; -import com.arsdigita.cms.contenttypes.Person; +import com.arsdigita.cms.contenttypes.Member; import com.arsdigita.cms.contenttypes.ResearchNetwork; import com.arsdigita.cms.contenttypes.ResearchNetworkGlobalizationUtil; import com.arsdigita.cms.contenttypes.ResearchNetworkMembership; @@ -124,7 +124,7 @@ public class ResearchNetworkMembershipPropertyForm extends FormSection implemen PageState state = event.getPageState(); FormData data = event.getFormData(); - membership.setTargetItem((Person) data.get(PERSON_SEARCH)); + membership.setTargetItem((Member) data.get(PERSON_SEARCH)); membership.save(); } diff --git a/ccm-cms-types-researchnetwork/src/com/arsdigita/cms/contenttypes/ui/ResearchNetworkMembershipTable.java b/ccm-cms-types-researchnetwork/src/com/arsdigita/cms/contenttypes/ui/ResearchNetworkMembershipTable.java index 741b7de5d..f9134dd66 100644 --- a/ccm-cms-types-researchnetwork/src/com/arsdigita/cms/contenttypes/ui/ResearchNetworkMembershipTable.java +++ b/ccm-cms-types-researchnetwork/src/com/arsdigita/cms/contenttypes/ui/ResearchNetworkMembershipTable.java @@ -16,7 +16,7 @@ import com.arsdigita.cms.ContentItem; import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.dispatcher.Utilities; import com.arsdigita.cms.SecurityManager; -import com.arsdigita.cms.contenttypes.Person; +import com.arsdigita.cms.contenttypes.Member; import com.arsdigita.cms.contenttypes.ResearchNetworkGlobalizationUtil; import com.arsdigita.cms.contenttypes.ResearchNetworkMembership; import com.arsdigita.domain.DataObjectNotFoundException; @@ -92,7 +92,7 @@ public class ResearchNetworkMembershipTable extends Table { String url = membership.getURI(state); if (column == m_personCol.getModelIndex()) { - Person person = membership.getTargetItem(); + Member person = membership.getTargetItem(); StringBuilder fullNameBuilder = new StringBuilder(); if (person.getTitlePre() != null) { diff --git a/ccm-cms/pdl/com/arsdigita/basetypes/Address.pdl b/ccm-cms/pdl/com/arsdigita/basetypes/Address.pdl new file mode 100644 index 000000000..365daba69 --- /dev/null +++ b/ccm-cms/pdl/com/arsdigita/basetypes/Address.pdl @@ -0,0 +1,16 @@ +model com.arsdigita.cms.basetypes; + +import com.arsdigita.cms.ContentPage; + +// Address object +object type Address extends ContentPage { + + String [0..1] address = cms_addresses.address VARCHAR(1000); + String [0..1] postalCode = cms_addresses.postalCode VARCHAR(20); + String [0..1] city = cms_addresses.city VARCHAR(200); + String [0..1] state = cms_addresses.state VARCHAR(200); + String [0..1] isoCountryCode = cms_addresses.isoCountryCode VARCHAR(2); + + reference key ( cms_addresses.address_id ); +} + diff --git a/ccm-cms/pdl/com/arsdigita/content-section/Article.pdl b/ccm-cms/pdl/com/arsdigita/basetypes/Article.pdl similarity index 96% rename from ccm-cms/pdl/com/arsdigita/content-section/Article.pdl rename to ccm-cms/pdl/com/arsdigita/basetypes/Article.pdl index 22def9e52..247293466 100755 --- a/ccm-cms/pdl/com/arsdigita/content-section/Article.pdl +++ b/ccm-cms/pdl/com/arsdigita/basetypes/Article.pdl @@ -17,8 +17,9 @@ // // $Id: Article.pdl 287 2005-02-22 00:29:02Z sskracic $ // $DateTime: 2004/08/17 23:15:09 $ -model com.arsdigita.cms; +model com.arsdigita.cms.basetypes; +import com.arsdigita.cms.*; import com.arsdigita.kernel.*; object type Article extends TextPage { diff --git a/ccm-cms-types-person/pdl/com/arsdigita/content-types/Person.pdl b/ccm-cms/pdl/com/arsdigita/basetypes/Person.pdl similarity index 70% rename from ccm-cms-types-person/pdl/com/arsdigita/content-types/Person.pdl rename to ccm-cms/pdl/com/arsdigita/basetypes/Person.pdl index b69195ece..ede7af649 100644 --- a/ccm-cms-types-person/pdl/com/arsdigita/content-types/Person.pdl +++ b/ccm-cms/pdl/com/arsdigita/basetypes/Person.pdl @@ -17,16 +17,15 @@ // // -model com.arsdigita.cms.contenttypes; +model com.arsdigita.cms.basetypes; -import com.arsdigita.cms.ContentItem; import com.arsdigita.cms.ContentPage; object type Person extends ContentPage { - String[0..1] surname = ct_persons.surname VARCHAR(512); - String[0..1] givenname = ct_persons.givenname VARCHAR(512); - String[0..1] titlepre = ct_persons.titlepre VARCHAR(256); - String[0..1] titlepost = ct_persons.titlepost VARCHAR(256); + String[0..1] surname = cms_persons.surname VARCHAR(512); + String[0..1] givenname = cms_persons.givenname VARCHAR(512); + String[0..1] titlepre = cms_persons.titlepre VARCHAR(256); + String[0..1] titlepost = cms_persons.titlepost VARCHAR(256); - reference key (ct_persons.person_id); + reference key (cms_persons.person_id); } \ No newline at end of file diff --git a/ccm-cms/src/WEB-INF/resources/cms-item-adapters.xml b/ccm-cms/src/WEB-INF/resources/cms-item-adapters.xml index a9f768a73..77c93d0d6 100755 --- a/ccm-cms/src/WEB-INF/resources/cms-item-adapters.xml +++ b/ccm-cms/src/WEB-INF/resources/cms-item-adapters.xml @@ -85,7 +85,7 @@ - + @@ -166,7 +166,7 @@ - + diff --git a/ccm-cms/src/ccm-cms.config b/ccm-cms/src/ccm-cms.config index 01e9a5697..d1ef96dda 100755 --- a/ccm-cms/src/ccm-cms.config +++ b/ccm-cms/src/ccm-cms.config @@ -6,4 +6,6 @@ storage="ccm-cms/lifecycle.properties"/> + diff --git a/ccm-cms/src/com/arsdigita/cms/basetypes/Address.java b/ccm-cms/src/com/arsdigita/cms/basetypes/Address.java new file mode 100644 index 000000000..b8d052b18 --- /dev/null +++ b/ccm-cms/src/com/arsdigita/cms/basetypes/Address.java @@ -0,0 +1,202 @@ +/* + * Copyright (C) 2002-2004 Red Hat Inc. All Rights Reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ +package com.arsdigita.cms.basetypes; + + +import com.arsdigita.globalization.LocaleNegotiator; +import com.arsdigita.cms.ContentType; +import com.arsdigita.cms.ContentPage; +import com.arsdigita.domain.DataObjectNotFoundException; +import com.arsdigita.persistence.DataObject; +import com.arsdigita.persistence.OID; +import com.arsdigita.util.Assert; +import java.math.BigDecimal; +import java.util.Locale; +import java.util.TreeMap; + +/** + *

DomainObject class to represent address ContentType + * objects. + *
+ * This content type represents a generic address which is not country specific. + * It provides methods for creating new address objects, retrieving existing + * objects from the persistent storage and retrieving and setting is properties.

+ *

This class extends {@link com.arsdigita.cms.ContentItem content item} and + * adds extended attributes specific for an not country specific address:

+ * + * @author Sören Bernstein + **/ +public class Address extends ContentPage { + + /** PDL property name for address */ + public static final String ADDRESS = "address"; + /** PDL property name for postal code */ + public static final String POSTAL_CODE = "postalCode"; + /** PDL property name for city */ + public static final String CITY = "city"; + /** PDL property name for state */ + public static final String STATE = "state"; + /** PDL property name for country iso code */ + public static final String ISO_COUNTRY_CODE = "isoCountryCode"; + + /** Data object type for this domain object */ + public static final String BASE_DATA_OBJECT_TYPE + = "com.arsdigita.cms.basetypes.Address"; + + private static final AddressConfig s_config = new AddressConfig(); + static { + s_config.load(); + } + public static AddressConfig getConfig() + { + return s_config; + } + + /** + * Default constructor. This creates a new (empty) Address. + **/ + public Address() { + this(BASE_DATA_OBJECT_TYPE); + } + + /** + * Constructor. The contained DataObject is retrieved + * from the persistent storage mechanism with an OID + * specified by id and + * Address.BASE_DATA_OBJECT_TYPE. + * + * @param id The id for the retrieved + * DataObject. + **/ + public Address(BigDecimal id) throws DataObjectNotFoundException { + this(new OID(BASE_DATA_OBJECT_TYPE, id)); + } + + /** + * Constructor. The contained DataObject is retrieved + * from the persistent storage mechanism with an OID + * specified by id. + * + * @param id The OID for the retrieved + * DataObject. + **/ + public Address(OID id) throws DataObjectNotFoundException { + super(id); + } + + /** + * Constructor. Retrieves or creates a content item using the + * DataObject argument. + * + * @param obj The DataObject with which to create or + * load a content item + */ + public Address(DataObject obj) { + super(obj); + } + + /** + * Constructor. Creates a new content item using the given data + * object type. Such items are created as draft versions. + * + * @param type The String data object type of the + * item to create + */ + public Address(String type) { + super(type); + } + + /** + * For new content items, sets the associated content type if it + * has not been already set. + */ + public void beforeSave() { + super.beforeSave(); + + Assert.exists(getContentType(), ContentType.class); + } + + /* accessors *****************************************************/ + public String getAddress() { + return (String) get(ADDRESS); + } + + public void setAddress(String address) { + set(ADDRESS, address); + } + + public String getIsoCountryCode() { + return (String) get(ISO_COUNTRY_CODE); + } + + public void setIsoCountryCode(String isoCountryCode) { + set(ISO_COUNTRY_CODE, isoCountryCode); + } + + public String getPostalCode() { + return (String) get(POSTAL_CODE); + } + + public void setPostalCode(String postalCode) { + set(POSTAL_CODE, postalCode); + } + + public String getCity() { + return (String) get(CITY); + } + + public void setCity(String city) { + set(CITY, city); + } + + public String getState() { + return (String) get(STATE); + } + + public void setState(String state) { + set(STATE, state); + } + + // Convert the iso country code to country names using the current locale + public static String getCountryNameFromIsoCode(String isoCountryCode) { + + LocaleNegotiator negotiatedLocale = new LocaleNegotiator("", "", "", null); + java.util.Locale locale = new java.util.Locale("", isoCountryCode); + return locale.getDisplayCountry(negotiatedLocale.getLocale()); + + } + + // Get a sorted list auf all countries + public static TreeMap getSortedListOfCountries(Locale inLang) { + + LocaleNegotiator negotiatedLocale = new LocaleNegotiator("", "", "", null); + String[] countries = Locale.getISOCountries(); + TreeMap countryNames = new TreeMap(); + + for(String country : countries) { + if(inLang != null) { + countryNames.put(new java.util.Locale("", country).getDisplayCountry(inLang), country); + } else { + countryNames.put(new java.util.Locale("", country).getDisplayCountry(negotiatedLocale.getLocale()), country); + } + } + + return countryNames; + } +} diff --git a/ccm-cms/src/com/arsdigita/cms/basetypes/AddressConfig.java b/ccm-cms/src/com/arsdigita/cms/basetypes/AddressConfig.java new file mode 100644 index 000000000..bcabe197a --- /dev/null +++ b/ccm-cms/src/com/arsdigita/cms/basetypes/AddressConfig.java @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2004 Red Hat Inc. All Rights Reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ +package com.arsdigita.cms.basetypes; + +import com.arsdigita.runtime.AbstractConfig; +import com.arsdigita.util.parameter.Parameter; +import com.arsdigita.util.parameter.BooleanParameter; + +public class AddressConfig extends AbstractConfig { + + private final Parameter m_hideCountryCodeSelection; + private final Parameter m_hidePostalCode; + + public AddressConfig() { + m_hideCountryCodeSelection = new BooleanParameter( + "com.arsdigita.cms.basetypes.ddress.hide_country_code_selection", + Parameter.REQUIRED, + new Boolean(false)); + + m_hidePostalCode = new BooleanParameter( + "com.arsdigita.cms.basetypes.address.hide_postal_code", + Parameter.REQUIRED, + new Boolean(false)); + + + register(m_hideCountryCodeSelection); + register(m_hidePostalCode); + + loadInfo(); + } + + public final boolean getHideCountryCodeSelection() { + return ((Boolean) get(m_hideCountryCodeSelection)).booleanValue(); + } + public final boolean getHidePostalCode() { + return ((Boolean) get(m_hidePostalCode)).booleanValue(); + } +} + diff --git a/ccm-cms/src/com/arsdigita/cms/basetypes/AddressConfig_parameter.properties b/ccm-cms/src/com/arsdigita/cms/basetypes/AddressConfig_parameter.properties new file mode 100644 index 000000000..9a6874520 --- /dev/null +++ b/ccm-cms/src/com/arsdigita/cms/basetypes/AddressConfig_parameter.properties @@ -0,0 +1,9 @@ +com.arsdigita.cms.basetypes.address.hide_country_code_selection.title=Hide ISO Country Code +com.arsdigita.cms.basetypes.address.hide_country_code_selection.purpose=Hide the ISO country code selection box +com.arsdigita.cms.basetypes.address.hide_country_code_selection.example=false +com.arsdigita.cms.basetypes.address.hide_country_code_selection.format=[boolean] + +com.arsdigita.cms.basetypes.address.hide_postal_code.title=Hide Postal Code +com.arsdigita.cms.basetypes.address.hide_postal_code.purpose=Hide the the postal code entry field +com.arsdigita.cms.basetypes.address.hide_postal_code.example=false +com.arsdigita.cms.basetypes.address.hide_postal_code.format=[boolean] diff --git a/ccm-cms/src/com/arsdigita/cms/Article.java b/ccm-cms/src/com/arsdigita/cms/basetypes/Article.java similarity index 96% rename from ccm-cms/src/com/arsdigita/cms/Article.java rename to ccm-cms/src/com/arsdigita/cms/basetypes/Article.java index 435edb01e..3357417a0 100755 --- a/ccm-cms/src/com/arsdigita/cms/Article.java +++ b/ccm-cms/src/com/arsdigita/cms/basetypes/Article.java @@ -16,8 +16,11 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ -package com.arsdigita.cms; +package com.arsdigita.cms.basetypes; +import com.arsdigita.cms.ImageAsset; +import com.arsdigita.cms.ImageAssetCollection; +import com.arsdigita.cms.TextPage; import com.arsdigita.domain.DataObjectNotFoundException; import com.arsdigita.persistence.DataAssociation; import com.arsdigita.persistence.DataAssociationCursor; @@ -38,7 +41,7 @@ import java.math.BigDecimal; public class Article extends TextPage { public static final String BASE_DATA_OBJECT_TYPE = - "com.arsdigita.cms.Article"; + "com.arsdigita.cms.basetypes.Article"; protected static final String IMAGES = "imageAssets"; @@ -91,6 +94,7 @@ public class Article extends TextPage { * @return the base PDL object type for this item. Child classes should * override this method to return the correct value */ + @Override public String getBaseDataObjectType() { return BASE_DATA_OBJECT_TYPE; } @@ -181,6 +185,7 @@ public class Article extends TextPage { } } + @Override protected void propagateMaster(com.arsdigita.versioning.VersionedACSObject master) { super.propagateMaster(master); ImageAssetCollection collection = getImages(); diff --git a/ccm-cms/src/com/arsdigita/cms/ArticleImageAssnCollection.java b/ccm-cms/src/com/arsdigita/cms/basetypes/ArticleImageAssnCollection.java similarity index 95% rename from ccm-cms/src/com/arsdigita/cms/ArticleImageAssnCollection.java rename to ccm-cms/src/com/arsdigita/cms/basetypes/ArticleImageAssnCollection.java index fd1abf566..849ece4f2 100755 --- a/ccm-cms/src/com/arsdigita/cms/ArticleImageAssnCollection.java +++ b/ccm-cms/src/com/arsdigita/cms/basetypes/ArticleImageAssnCollection.java @@ -16,8 +16,10 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ -package com.arsdigita.cms; +package com.arsdigita.cms.basetypes; +import com.arsdigita.cms.ImageAsset; +import com.arsdigita.cms.ImageAssetCollection; import com.arsdigita.domain.DomainObject; import com.arsdigita.persistence.DataCollection; import com.arsdigita.persistence.Filter; diff --git a/ccm-cms/src/com/arsdigita/cms/ArticleImageAssociation.java b/ccm-cms/src/com/arsdigita/cms/basetypes/ArticleImageAssociation.java similarity index 97% rename from ccm-cms/src/com/arsdigita/cms/ArticleImageAssociation.java rename to ccm-cms/src/com/arsdigita/cms/basetypes/ArticleImageAssociation.java index f728a1279..be2a84850 100755 --- a/ccm-cms/src/com/arsdigita/cms/ArticleImageAssociation.java +++ b/ccm-cms/src/com/arsdigita/cms/basetypes/ArticleImageAssociation.java @@ -16,8 +16,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ -package com.arsdigita.cms; +package com.arsdigita.cms.basetypes; +import com.arsdigita.cms.ContentItem; +import com.arsdigita.cms.CustomCopy; +import com.arsdigita.cms.ImageAsset; +import com.arsdigita.cms.ItemCollection; +import com.arsdigita.cms.ItemCopier; +import com.arsdigita.cms.basetypes.Article; import com.arsdigita.domain.DataObjectNotFoundException; import com.arsdigita.domain.DomainObjectFactory; import com.arsdigita.persistence.DataCollection; diff --git a/ccm-cms/src/com/arsdigita/cms/basetypes/BasetypesResources.properties b/ccm-cms/src/com/arsdigita/cms/basetypes/BasetypesResources.properties new file mode 100644 index 000000000..0efc1bd55 --- /dev/null +++ b/ccm-cms/src/com/arsdigita/cms/basetypes/BasetypesResources.properties @@ -0,0 +1,7 @@ +cms.basetypes.ui.address.address=Address +cms.basetypes.ui.address.postal_code=Postal Code +cms.basetypes.ui.address.city=City +cms.basetypes.ui.address.state=State +cms.basetypes.ui.address.iso_country_code=Country +cms.basetypes.ui.address.error_iso_country=You must select a country +address.authoring.basic_properties.title=Basic Properties \ No newline at end of file diff --git a/ccm-cms/src/com/arsdigita/cms/basetypes/BasetypesResources_de.properties b/ccm-cms/src/com/arsdigita/cms/basetypes/BasetypesResources_de.properties new file mode 100644 index 000000000..6504aeb34 --- /dev/null +++ b/ccm-cms/src/com/arsdigita/cms/basetypes/BasetypesResources_de.properties @@ -0,0 +1,7 @@ +cms.basetypes.ui.address.address=Anschrift +cms.basetypes.ui.address.postal_code=Postleitzahl +cms.basetypes.ui.address.city=Stadt +cms.basetypes.ui.address.state=Bundesland +cms.basetypes.ui.address.iso_country_code=Land +cms.basetypes.ui.address.error_iso_country=Bitte w\u00E4hlen Sie ein Land aus +address.authoring.basic_properties.title=Eigenschaften von Adresse \ No newline at end of file diff --git a/ccm-cms-types-person/src/com/arsdigita/cms/contenttypes/Person.java b/ccm-cms/src/com/arsdigita/cms/basetypes/Person.java similarity index 89% rename from ccm-cms-types-person/src/com/arsdigita/cms/contenttypes/Person.java rename to ccm-cms/src/com/arsdigita/cms/basetypes/Person.java index e7e3630f1..91d53187e 100644 --- a/ccm-cms-types-person/src/com/arsdigita/cms/contenttypes/Person.java +++ b/ccm-cms/src/com/arsdigita/cms/basetypes/Person.java @@ -17,8 +17,9 @@ * */ -package com.arsdigita.cms.contenttypes; +package com.arsdigita.cms.basetypes; +import com.arsdigita.cms.contenttypes.*; import com.arsdigita.cms.ContentType; import com.arsdigita.cms.ContentPage; import com.arsdigita.domain.DataObjectNotFoundException; @@ -40,18 +41,9 @@ public class Person extends ContentPage { public static final String TITLEPRE = "titlepre"; public static final String TITLEPOST = "titlepost"; /** Data object type for this domain object */ - public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.contenttypes.Person"; - private static final PersonConfig s_config = new PersonConfig(); + public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.basetypes.Person"; - static { - s_config.load(); - } - - public static final PersonConfig getConfig() { - return s_config; - } - /** * Default constructor. This creates a new (empty) Person. **/ @@ -81,7 +73,7 @@ public class Person extends ContentPage { Assert.exists(getContentType(), ContentType.class); } - /* accessors *****************************************************/ + /* accessors *****************************************************/ public String getSurname() { return (String)get(SURNAME); } diff --git a/ccm-cms/src/com/arsdigita/cms/basetypes/ui/AddressPropertiesStep.java b/ccm-cms/src/com/arsdigita/cms/basetypes/ui/AddressPropertiesStep.java new file mode 100644 index 000000000..3061a08d6 --- /dev/null +++ b/ccm-cms/src/com/arsdigita/cms/basetypes/ui/AddressPropertiesStep.java @@ -0,0 +1,104 @@ +/* + * Copyright (C) 2009 Jens Pelzetter, for the Center of Social Politics of the University of Bremen + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ +package com.arsdigita.cms.basetypes.ui; + +import com.arsdigita.bebop.Component; +import com.arsdigita.bebop.PageState; +import com.arsdigita.cms.ContentPage; +import com.arsdigita.cms.ContentSection; +import com.arsdigita.cms.ItemSelectionModel; +import com.arsdigita.cms.basetypes.Address; +import com.arsdigita.domain.DomainObject; +import com.arsdigita.toolbox.ui.DomainObjectPropertySheet; +import com.arsdigita.cms.ui.authoring.AuthoringKitWizard; +import com.arsdigita.cms.ui.authoring.BasicPageForm; +import com.arsdigita.cms.ui.authoring.SimpleEditStep; +import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess; +import com.arsdigita.cms.basetypes.util.BasetypesGlobalizationUtil; +import com.arsdigita.cms.util.GlobalizationUtil; + +import java.text.DateFormat; + +public class AddressPropertiesStep extends SimpleEditStep { + + public static final String EDIT_SHEET_NAME = "edit"; + + public AddressPropertiesStep(ItemSelectionModel itemModel, + AuthoringKitWizard parent) { + super(itemModel, parent); + + setDefaultEditKey(EDIT_SHEET_NAME); + createEditSheet(itemModel); + + setDisplayComponent(getAddressPropertySheet(itemModel)); + } + + protected void createEditSheet(ItemSelectionModel itemModel) { + BasicPageForm editSheet; + editSheet = new AddressPropertyForm(itemModel, this); + add(EDIT_SHEET_NAME, "Edit", new WorkflowLockedComponentAccess(editSheet, itemModel), editSheet.getSaveCancelSection().getCancelButton()); + } + + public static Component getAddressPropertySheet(ItemSelectionModel itemModel) { + DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(itemModel); + + sheet.add((String) BasetypesGlobalizationUtil.globalize("cms.basetypes.ui.name").localize(), Address.NAME); + sheet.add((String) BasetypesGlobalizationUtil.globalize("cms.basetypes.ui.title").localize(), Address.TITLE); + sheet.add((String) BasetypesGlobalizationUtil.globalize("cms.basetypes.ui.address.address").localize(), Address.ADDRESS); + sheet.add((String) BasetypesGlobalizationUtil.globalize("cms.basetypes.ui.address.postal_code").localize(), Address.POSTAL_CODE); + sheet.add((String) BasetypesGlobalizationUtil.globalize("cms.basetypes.ui.address.city").localize(), Address.CITY); + sheet.add((String) BasetypesGlobalizationUtil.globalize("cms.basetypes.ui.address.state").localize(), Address.STATE); + + sheet.add((String) BasetypesGlobalizationUtil.globalize("cms.basetypes.ui.address.iso_country_code").localize(), + Address.ISO_COUNTRY_CODE, + new DomainObjectPropertySheet.AttributeFormatter() { + + public String format(DomainObject item, + String attribute, + PageState state) { + Address address = (Address) item; + if (address != null && address.getIsoCountryCode() != null) { + return Address.getCountryNameFromIsoCode(address.getIsoCountryCode()); + } else { + return (String) GlobalizationUtil.globalize("cms.ui.unknown").localize(); + } + } + }); + + if (!ContentSection.getConfig().getHideLaunchDate()) { + sheet.add((String) GlobalizationUtil.globalize("cms.ui.authoring.page_launch_date").localize(), + ContentPage.LAUNCH_DATE, + new DomainObjectPropertySheet.AttributeFormatter() { + + public String format(DomainObject item, + String attribute, + PageState state) { + ContentPage page = (ContentPage) item; + if (page.getLaunchDate() != null) { + return DateFormat.getDateInstance(DateFormat.LONG).format(page.getLaunchDate()); + } else { + return (String) GlobalizationUtil.globalize("cms.ui.unknown").localize(); + } + } + }); + } + + return sheet; + } +} diff --git a/ccm-cms/src/com/arsdigita/cms/basetypes/ui/AddressPropertyForm.java b/ccm-cms/src/com/arsdigita/cms/basetypes/ui/AddressPropertyForm.java new file mode 100644 index 000000000..922c30db8 --- /dev/null +++ b/ccm-cms/src/com/arsdigita/cms/basetypes/ui/AddressPropertyForm.java @@ -0,0 +1,176 @@ +/* + * Copyright (C) 2009 Jens Pelzetter, for the Center of Social Politics of the University of Bremen + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ +package com.arsdigita.cms.basetypes.ui; + +import com.arsdigita.bebop.FormData; +import com.arsdigita.bebop.FormProcessException; +import com.arsdigita.bebop.Label; +import com.arsdigita.bebop.event.FormInitListener; +import com.arsdigita.bebop.event.FormProcessListener; +import com.arsdigita.bebop.event.FormSectionEvent; +import com.arsdigita.bebop.event.FormSubmissionListener; +import com.arsdigita.bebop.event.ParameterEvent; +import com.arsdigita.bebop.event.ParameterListener; +import com.arsdigita.bebop.form.Option; +import com.arsdigita.bebop.form.SingleSelect; +import com.arsdigita.bebop.form.TextArea; +import com.arsdigita.bebop.form.TextField; +import com.arsdigita.bebop.parameters.NotNullValidationListener; +import com.arsdigita.bebop.parameters.StringInRangeValidationListener; +import com.arsdigita.bebop.parameters.ParameterModel; +import com.arsdigita.bebop.parameters.StringParameter; +import com.arsdigita.bebop.parameters.ParameterData; +import com.arsdigita.cms.ItemSelectionModel; +import com.arsdigita.cms.basetypes.Address; +import com.arsdigita.cms.basetypes.util.BasetypesGlobalizationUtil; +import com.arsdigita.cms.ui.authoring.BasicPageForm; +import java.util.Iterator; +import java.util.Map; +import org.apache.log4j.Logger; + +/** + * Form to edit the properties of a address. + * + * @author: Jens Pelzetter + * @author: Sören Bernstein + */ +public class AddressPropertyForm extends BasicPageForm implements FormProcessListener, FormInitListener, FormSubmissionListener { + + private static final Logger s_log = Logger.getLogger(AddressPropertyForm.class); + private AddressPropertiesStep m_step; + public static final String ADDRESS = Address.ADDRESS; + public static final String POSTAL_CODE = Address.POSTAL_CODE; + public static final String CITY = Address.CITY; + public static final String STATE = Address.STATE; + public static final String ISO_COUNTRY_CODE = Address.ISO_COUNTRY_CODE; + public static final String ID = "Address_edit"; + + public AddressPropertyForm(ItemSelectionModel itemModel) { + this(itemModel, null); + } + + public AddressPropertyForm(ItemSelectionModel itemModel, AddressPropertiesStep step) { + super(ID, itemModel); + m_step = step; + addSubmissionListener(this); + } + + @Override + protected void addWidgets() { + super.addWidgets(); + + add(new Label((String) BasetypesGlobalizationUtil.globalize("cms.basetypes.ui.address.address").localize())); + ParameterModel addressParam = new StringParameter(ADDRESS); + addressParam.addParameterListener(new NotNullValidationListener()); + addressParam.addParameterListener(new StringInRangeValidationListener(0, 1000)); + TextArea address = new TextArea(addressParam); + address.setRows(5); + address.setCols(30); + add(address); + + add(new Label((String) BasetypesGlobalizationUtil.globalize("cms.basetypes.ui.address.postal_code").localize())); + ParameterModel postalCodeParam = new StringParameter(POSTAL_CODE); + TextField postalCode = new TextField(postalCodeParam); + /* XXX NumberListener ?*/ + add(postalCode); + + add(new Label((String) BasetypesGlobalizationUtil.globalize("cms.basetypes.ui.address.city").localize())); + ParameterModel cityParam = new StringParameter(CITY); + TextField city = new TextField(cityParam); + add(city); + + add(new Label((String) BasetypesGlobalizationUtil.globalize("cms.basetypes.ui.address.state").localize())); + ParameterModel stateParam = new StringParameter(STATE); + TextField state = new TextField(stateParam); + add(state); + + if (!Address.getConfig().getHideCountryCodeSelection()) { + add(new Label((String) BasetypesGlobalizationUtil.globalize("cms.basetypes.ui.address.iso_country_code").localize())); + ParameterModel countryParam = new StringParameter(ISO_COUNTRY_CODE); + countryParam.addParameterListener(new StringInRangeValidationListener(0, 2)); + + SingleSelect country = new SingleSelect(countryParam); + + country.addOption(new Option("", new Label((String) BasetypesGlobalizationUtil.globalize("cms.ui.select_one").localize()))); + + Iterator countries = Address.getSortedListOfCountries(null).entrySet().iterator(); + while (countries.hasNext()) { + Map.Entry elem = (Map.Entry) countries.next(); + country.addOption(new Option(elem.getValue().toString(), elem.getKey().toString())); + } + + country.addValidationListener( + new ParameterListener() { + + public void validate(ParameterEvent e) throws FormProcessException { + ParameterData data = e.getParameterData(); + String isoCode = (String) data.getValue(); + s_log.debug("ISO code is : " + isoCode); + if (isoCode == null || isoCode.length() == 0) { + data.addError((String) BasetypesGlobalizationUtil.globalize("cms.basetypes.ui.address.error_iso_country").localize()); + } + } + }); + + add(country); + } + + } + + public void init(FormSectionEvent fse) { + FormData data = fse.getFormData(); + Address address = (Address) super.initBasicWidgets(fse); + + data.put(ADDRESS, address.getAddress()); + data.put(POSTAL_CODE, address.getPostalCode()); + data.put(CITY, address.getCity()); + data.put(STATE, address.getState()); + if (!Address.getConfig().getHideCountryCodeSelection()) { + data.put(ISO_COUNTRY_CODE, address.getIsoCountryCode()); + } + } + + public void submitted(FormSectionEvent fse) { + if (m_step != null + && getSaveCancelSection().getCancelButton().isSelected(fse.getPageState())) { + m_step.cancelStreamlinedCreation(fse.getPageState()); + } + } + + public void process(FormSectionEvent fse) { + FormData data = fse.getFormData(); + + Address address = (Address) super.processBasicWidgets(fse); + + if (address != null + && getSaveCancelSection().getSaveButton().isSelected(fse.getPageState())) { + address.setAddress((String) data.get(ADDRESS)); + address.setPostalCode((String) data.get(POSTAL_CODE)); + address.setCity((String) data.get(CITY)); + address.setState((String) data.get(STATE)); + address.setIsoCountryCode((String) data.get(ISO_COUNTRY_CODE)); + + address.save(); + } + + if (m_step != null) { + m_step.maybeForwardToNextStep(fse.getPageState()); + } + } +} diff --git a/ccm-cms-types-person/src/com/arsdigita/cms/contenttypes/ui/PersonPropertiesStep.java b/ccm-cms/src/com/arsdigita/cms/basetypes/ui/PersonPropertiesStep.java similarity index 66% rename from ccm-cms-types-person/src/com/arsdigita/cms/contenttypes/ui/PersonPropertiesStep.java rename to ccm-cms/src/com/arsdigita/cms/basetypes/ui/PersonPropertiesStep.java index 950d4fd34..955c232f1 100644 --- a/ccm-cms-types-person/src/com/arsdigita/cms/contenttypes/ui/PersonPropertiesStep.java +++ b/ccm-cms/src/com/arsdigita/cms/basetypes/ui/PersonPropertiesStep.java @@ -17,23 +17,23 @@ * */ -package com.arsdigita.cms.contenttypes.ui; +package com.arsdigita.cms.basetypes.ui; import com.arsdigita.bebop.Component; import com.arsdigita.bebop.PageState; import com.arsdigita.cms.ContentPage; import com.arsdigita.cms.ContentSection; import com.arsdigita.cms.ItemSelectionModel; -import com.arsdigita.cms.contenttypes.Person; +import com.arsdigita.cms.basetypes.Person; import com.arsdigita.domain.DomainObject; import com.arsdigita.toolbox.ui.DomainObjectPropertySheet; import com.arsdigita.cms.ui.authoring.AuthoringKitWizard; import com.arsdigita.cms.ui.authoring.BasicPageForm; import com.arsdigita.cms.ui.authoring.SimpleEditStep; import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess; -import com.arsdigita.cms.contenttypes.util.PersonGlobalizationUtil; +import com.arsdigita.cms.basetypes.util.BasetypesGlobalizationUtil; -import com.arsdigita.cms.util.GlobalizationUtil; +import com.arsdigita.cms.basetypes.util.BasetypesGlobalizationUtil; import java.text.DateFormat; public class PersonPropertiesStep extends SimpleEditStep { @@ -44,26 +44,27 @@ public class PersonPropertiesStep extends SimpleEditStep { super(itemModel, parent); setDefaultEditKey(EDIT_SHEET_NAME); - BasicPageForm editSheet; - - editSheet = new PersonPropertyForm(itemModel, this); - add(EDIT_SHEET_NAME, "Edit", - new WorkflowLockedComponentAccess(editSheet, itemModel), - editSheet.getSaveCancelSection().getCancelButton()); + createEditSheet(itemModel); setDisplayComponent(getPersonPropertySheet(itemModel)); } + protected void createEditSheet(ItemSelectionModel itemModel) { + BasicPageForm editSheet; + editSheet = new PersonPropertyForm(itemModel, this); + add(EDIT_SHEET_NAME, "Edit", new WorkflowLockedComponentAccess(editSheet, itemModel), editSheet.getSaveCancelSection().getCancelButton()); + } + public static Component getPersonPropertySheet(ItemSelectionModel itemModel) { DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(itemModel); - sheet.add((String)PersonGlobalizationUtil.globalize("cms.contenttypes.ui.person.surname").localize(), Person.SURNAME); - sheet.add((String)PersonGlobalizationUtil.globalize("cms.contenttypes.ui.person.givenname").localize(), Person.GIVENNAME); - sheet.add((String)PersonGlobalizationUtil.globalize("cms.contenttypes.ui.person.titlepre").localize(), Person.TITLEPRE); - sheet.add((String)PersonGlobalizationUtil.globalize("cms.contenttypes.ui.person.titlepost").localize(), Person.TITLEPOST); + sheet.add((String)BasetypesGlobalizationUtil.globalize("cms.basetypes.ui.person.surname").localize(), Person.SURNAME); + sheet.add((String)BasetypesGlobalizationUtil.globalize("cms.basetypes.ui.person.givenname").localize(), Person.GIVENNAME); + sheet.add((String)BasetypesGlobalizationUtil.globalize("cms.basetypes.ui.person.titlepre").localize(), Person.TITLEPRE); + sheet.add((String)BasetypesGlobalizationUtil.globalize("cms.basetypes.ui.person.titlepost").localize(), Person.TITLEPOST); if(!ContentSection.getConfig().getHideLaunchDate()) { - sheet.add((String)GlobalizationUtil.globalize("cms.ui.authoring.page_launch_date").localize(), + sheet.add((String)BasetypesGlobalizationUtil.globalize("cms.ui.authoring.page_launch_date").localize(), ContentPage.LAUNCH_DATE, new DomainObjectPropertySheet.AttributeFormatter() { public String format(DomainObject item, @@ -74,7 +75,7 @@ public class PersonPropertiesStep extends SimpleEditStep { return DateFormat.getDateInstance(DateFormat.LONG).format(page.getLaunchDate()); } else { - return (String)GlobalizationUtil.globalize("cms.ui.unknown").localize(); + return (String)BasetypesGlobalizationUtil.globalize("cms.ui.unknown").localize(); } } }); diff --git a/ccm-cms-types-person/src/com/arsdigita/cms/contenttypes/ui/PersonPropertyForm.java b/ccm-cms/src/com/arsdigita/cms/basetypes/ui/PersonPropertyForm.java similarity index 87% rename from ccm-cms-types-person/src/com/arsdigita/cms/contenttypes/ui/PersonPropertyForm.java rename to ccm-cms/src/com/arsdigita/cms/basetypes/ui/PersonPropertyForm.java index be431bd27..9b088f966 100644 --- a/ccm-cms-types-person/src/com/arsdigita/cms/contenttypes/ui/PersonPropertyForm.java +++ b/ccm-cms/src/com/arsdigita/cms/basetypes/ui/PersonPropertyForm.java @@ -17,7 +17,7 @@ * */ -package com.arsdigita.cms.contenttypes.ui; +package com.arsdigita.cms.basetypes.ui; import com.arsdigita.bebop.FormData; import com.arsdigita.bebop.Label; @@ -29,8 +29,8 @@ import com.arsdigita.bebop.form.TextField; import com.arsdigita.bebop.parameters.ParameterModel; import com.arsdigita.bebop.parameters.StringParameter; import com.arsdigita.cms.ItemSelectionModel; -import com.arsdigita.cms.contenttypes.Person; -import com.arsdigita.cms.contenttypes.util.PersonGlobalizationUtil; +import com.arsdigita.cms.basetypes.Person; +import com.arsdigita.cms.basetypes.util.BasetypesGlobalizationUtil; import com.arsdigita.cms.ui.authoring.BasicPageForm; import org.apache.log4j.Logger; @@ -62,25 +62,26 @@ public class PersonPropertyForm extends BasicPageForm implements FormProcessList addSubmissionListener (this); } + @Override protected void addWidgets() { super.addWidgets (); - add(new Label((String)PersonGlobalizationUtil.globalize("cms.contenttypes.ui.person.surname").localize())); + add(new Label((String)BasetypesGlobalizationUtil.globalize("cms.basetypes.ui.person.surname").localize())); ParameterModel surnameParam = new StringParameter(SURNAME); TextField surname = new TextField (surnameParam); add(surname); - add(new Label((String)PersonGlobalizationUtil.globalize("cms.contenttypes.ui.person.givenname").localize())); + add(new Label((String)BasetypesGlobalizationUtil.globalize("cms.basetypes.ui.person.givenname").localize())); ParameterModel givennameParam = new StringParameter(GIVENNAME); TextField givenname = new TextField (givennameParam); add(givenname); - add(new Label((String)PersonGlobalizationUtil.globalize("cms.contenttypes.ui.person.titlepre").localize())); + add(new Label((String)BasetypesGlobalizationUtil.globalize("cms.basetypes.ui.person.titlepre").localize())); ParameterModel titlepreParam = new StringParameter(TITLEPRE); TextField titlepre = new TextField (titlepreParam); add(titlepre); - add(new Label((String)PersonGlobalizationUtil.globalize("cms.contenttypes.ui.person.titlepost").localize())); + add(new Label((String)BasetypesGlobalizationUtil.globalize("cms.basetypes.ui.person.titlepost").localize())); ParameterModel titlepostParam = new StringParameter(TITLEPOST); TextField titlepost = new TextField (titlepostParam); add(titlepost); diff --git a/ccm-cms/src/com/arsdigita/cms/basetypes/util/BasetypesGlobalizationUtil.java b/ccm-cms/src/com/arsdigita/cms/basetypes/util/BasetypesGlobalizationUtil.java new file mode 100644 index 000000000..76286334e --- /dev/null +++ b/ccm-cms/src/com/arsdigita/cms/basetypes/util/BasetypesGlobalizationUtil.java @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2009 Jens Pelzetter, for the Center of Social Politics of the University of Bremen + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +package com.arsdigita.cms.basetypes.util; + +import com.arsdigita.globalization.GlobalizedMessage; + +public class BasetypesGlobalizationUtil { + final public static String BUNDLE_NAME = + "com.arsdigita.cms.basetypes.util.BaetypesResourceBundle"; + + public static GlobalizedMessage globalize (String key) { + return new GlobalizedMessage(key, BUNDLE_NAME); + } + + public static GlobalizedMessage globalize (String key, Object[] args) { + return new GlobalizedMessage(key, BUNDLE_NAME, args); + } +} \ No newline at end of file diff --git a/ccm-cms/src/com/arsdigita/cms/basetypes/util/BasetypesResourceBundle.java b/ccm-cms/src/com/arsdigita/cms/basetypes/util/BasetypesResourceBundle.java new file mode 100644 index 000000000..60d8af180 --- /dev/null +++ b/ccm-cms/src/com/arsdigita/cms/basetypes/util/BasetypesResourceBundle.java @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2009 Jens Pelzetter, for the Center of Social Politics of the University of Bremen + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +package com.arsdigita.cms.basetypes.util; + +import java.util.PropertyResourceBundle; +import com.arsdigita.globalization.ChainedResourceBundle; +import com.arsdigita.cms.CMSGlobalized; + +public class BasetypesResourceBundle extends ChainedResourceBundle implements CMSGlobalized { + public static final String MEMBER_BUNDLE_NAME = + "com.arsdigita.cms.basetypes.BasetypesResources"; + + public BasetypesResourceBundle() { + super(); + addBundle((PropertyResourceBundle)getBundle(MEMBER_BUNDLE_NAME)); + addBundle((PropertyResourceBundle)getBundle(BUNDLE_NAME)); + } +} \ No newline at end of file diff --git a/ccm-cms/src/com/arsdigita/cms/dispatcher/StreamImage.java b/ccm-cms/src/com/arsdigita/cms/dispatcher/StreamImage.java index 7f5df4671..a7a4a6205 100755 --- a/ccm-cms/src/com/arsdigita/cms/dispatcher/StreamImage.java +++ b/ccm-cms/src/com/arsdigita/cms/dispatcher/StreamImage.java @@ -19,7 +19,7 @@ package com.arsdigita.cms.dispatcher; import com.arsdigita.bebop.parameters.BigDecimalParameter; -import com.arsdigita.cms.Article; +import com.arsdigita.cms.basetypes.Article; import com.arsdigita.cms.ImageAsset; import com.arsdigita.cms.ImageAssetCollection; import com.arsdigita.cms.util.GlobalizationUtil; diff --git a/ccm-cms/src/com/arsdigita/cms/ui/ArticleImageDisplay.java b/ccm-cms/src/com/arsdigita/cms/ui/ArticleImageDisplay.java index 650f79f7d..2c8a57999 100755 --- a/ccm-cms/src/com/arsdigita/cms/ui/ArticleImageDisplay.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/ArticleImageDisplay.java @@ -19,7 +19,7 @@ package com.arsdigita.cms.ui; import com.arsdigita.bebop.PageState; -import com.arsdigita.cms.Article; +import com.arsdigita.cms.basetypes.Article; import com.arsdigita.cms.ImageAsset; import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.util.Assert; diff --git a/ccm-cms/src/com/arsdigita/cms/ui/ImageBrowser.java b/ccm-cms/src/com/arsdigita/cms/ui/ImageBrowser.java index 6760e85ec..f114765e8 100755 --- a/ccm-cms/src/com/arsdigita/cms/ui/ImageBrowser.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/ImageBrowser.java @@ -30,7 +30,7 @@ import com.arsdigita.bebop.table.DefaultTableCellRenderer; import com.arsdigita.bebop.table.TableCellRenderer; import com.arsdigita.bebop.table.TableModel; import com.arsdigita.bebop.table.TableModelBuilder; -import com.arsdigita.cms.ArticleImageAssociation; +import com.arsdigita.cms.basetypes.ArticleImageAssociation; import com.arsdigita.cms.ImageAsset; import com.arsdigita.cms.SecurityManager; import com.arsdigita.cms.dispatcher.Utilities; diff --git a/ccm-cms/src/com/arsdigita/cms/ui/SingleImageSelectionModel.java b/ccm-cms/src/com/arsdigita/cms/ui/SingleImageSelectionModel.java index caf8351ac..a9bf693bb 100755 --- a/ccm-cms/src/com/arsdigita/cms/ui/SingleImageSelectionModel.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/SingleImageSelectionModel.java @@ -22,7 +22,7 @@ import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.ParameterSingleSelectionModel; import com.arsdigita.bebop.SingleSelectionModel; import com.arsdigita.bebop.parameters.BigDecimalParameter; -import com.arsdigita.cms.Article; +import com.arsdigita.cms.basetypes.Article; import com.arsdigita.cms.ImageAsset; import com.arsdigita.cms.ImageAssetCollection; import com.arsdigita.cms.ItemSelectionModel; diff --git a/ccm-cms/src/com/arsdigita/cms/ui/authoring/ArticleImage.java b/ccm-cms/src/com/arsdigita/cms/ui/authoring/ArticleImage.java index 5f7a4f2b9..18d41cd7d 100755 --- a/ccm-cms/src/com/arsdigita/cms/ui/authoring/ArticleImage.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/authoring/ArticleImage.java @@ -32,7 +32,7 @@ import com.arsdigita.bebop.event.FormSectionEvent; import com.arsdigita.bebop.event.FormSubmissionListener; import com.arsdigita.bebop.parameters.BigDecimalParameter; import com.arsdigita.bebop.parameters.StringParameter; -import com.arsdigita.cms.Article; +import com.arsdigita.cms.basetypes.Article; import com.arsdigita.cms.ImageAsset; import com.arsdigita.cms.ImageAssetCollection; import com.arsdigita.cms.ItemSelectionModel; diff --git a/ccm-cms/src/com/arsdigita/cms/ui/authoring/ArticleImageChooser.java b/ccm-cms/src/com/arsdigita/cms/ui/authoring/ArticleImageChooser.java index b34040c6c..b881a6898 100755 --- a/ccm-cms/src/com/arsdigita/cms/ui/authoring/ArticleImageChooser.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/authoring/ArticleImageChooser.java @@ -27,7 +27,7 @@ import com.arsdigita.bebop.event.FormProcessListener; import com.arsdigita.bebop.event.FormSectionEvent; import com.arsdigita.bebop.event.FormSubmissionListener; import com.arsdigita.bebop.parameters.BigDecimalParameter; -import com.arsdigita.cms.ArticleImageAssociation; +import com.arsdigita.cms.basetypes.ArticleImageAssociation; import com.arsdigita.cms.ContentItem; import com.arsdigita.cms.ContentType; import com.arsdigita.cms.ImageAsset; diff --git a/ccm-cms/src/com/arsdigita/cms/ui/authoring/BasicImageForm.java b/ccm-cms/src/com/arsdigita/cms/ui/authoring/BasicImageForm.java index d4d562c07..d212b9976 100755 --- a/ccm-cms/src/com/arsdigita/cms/ui/authoring/BasicImageForm.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/authoring/BasicImageForm.java @@ -32,7 +32,7 @@ import com.arsdigita.bebop.event.FormSectionEvent; import com.arsdigita.bebop.form.TextField; import com.arsdigita.bebop.parameters.NotNullValidationListener; import com.arsdigita.bebop.parameters.StringParameter; -import com.arsdigita.cms.Article; +import com.arsdigita.cms.basetypes.Article; import com.arsdigita.cms.ImageAsset; import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.util.GlobalizationUtil; diff --git a/ccm-cms/src/com/arsdigita/cms/ui/authoring/ImagePropertiesForm.java b/ccm-cms/src/com/arsdigita/cms/ui/authoring/ImagePropertiesForm.java index a4eec81ae..146bed8a9 100755 --- a/ccm-cms/src/com/arsdigita/cms/ui/authoring/ImagePropertiesForm.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/authoring/ImagePropertiesForm.java @@ -23,7 +23,7 @@ import com.arsdigita.bebop.FormData; import com.arsdigita.bebop.FormProcessException; import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.event.FormSectionEvent; -import com.arsdigita.cms.Article; +import com.arsdigita.cms.basetypes.Article; import com.arsdigita.cms.ImageAsset; import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.util.GlobalizationUtil; diff --git a/ccm-cms/src/com/arsdigita/cms/ui/authoring/ImageSelectionForm.java b/ccm-cms/src/com/arsdigita/cms/ui/authoring/ImageSelectionForm.java index 786ddee87..5b193bf61 100755 --- a/ccm-cms/src/com/arsdigita/cms/ui/authoring/ImageSelectionForm.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/authoring/ImageSelectionForm.java @@ -23,7 +23,7 @@ import com.arsdigita.bebop.FormData; import com.arsdigita.bebop.FormProcessException; import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.event.FormSectionEvent; -import com.arsdigita.cms.Article; +import com.arsdigita.cms.basetypes.Article; import com.arsdigita.cms.ImageAsset; import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.ui.ImageDisplay; diff --git a/ccm-cms/src/com/arsdigita/cms/ui/authoring/ImageUploadForm.java b/ccm-cms/src/com/arsdigita/cms/ui/authoring/ImageUploadForm.java index 2a0b2d7ca..a5e125590 100755 --- a/ccm-cms/src/com/arsdigita/cms/ui/authoring/ImageUploadForm.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/authoring/ImageUploadForm.java @@ -26,7 +26,7 @@ import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.event.FormSectionEvent; import com.arsdigita.bebop.event.FormSubmissionListener; import com.arsdigita.bebop.parameters.NotNullValidationListener; -import com.arsdigita.cms.Article; +import com.arsdigita.cms.basetypes.Article; import com.arsdigita.cms.ImageAsset; import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.ReusableImageAsset; diff --git a/ccm-gen-aplaws/bundles/handbook/cfg/applications.cfg b/ccm-gen-aplaws/bundles/handbook/cfg/applications.cfg index 5334fc12d..2353733a6 100755 --- a/ccm-gen-aplaws/bundles/handbook/cfg/applications.cfg +++ b/ccm-gen-aplaws/bundles/handbook/cfg/applications.cfg @@ -11,6 +11,7 @@ ccm-cms-assets-relatedlink # Content types ccm-cms-types-address ccm-cms-types-article +ccm-cms-types-baseAddress ccm-cms-types-bookmark ccm-cms-types-contact ccm-cms-types-faqitem @@ -18,6 +19,7 @@ ccm-cms-types-filestorageitem ccm-cms-types-formitem ccm-cms-types-formsectionitem ccm-cms-types-glossaryitem +ccm-cms-types-member ccm-cms-types-mparticle ccm-cms-types-newsitem diff --git a/ccm-ldn-image-step/src/com/arsdigita/cms/ItemImageAttachmentInitializer.java b/ccm-ldn-image-step/src/com/arsdigita/cms/ItemImageAttachmentInitializer.java index 1cb280866..c0cc9da33 100755 --- a/ccm-ldn-image-step/src/com/arsdigita/cms/ItemImageAttachmentInitializer.java +++ b/ccm-ldn-image-step/src/com/arsdigita/cms/ItemImageAttachmentInitializer.java @@ -18,6 +18,7 @@ package com.arsdigita.cms; +import com.arsdigita.cms.basetypes.Article; import com.arsdigita.cms.contenttypes.ContentAssetInitializer; import com.arsdigita.cms.contenttypes.ItemImageAttachment; import com.arsdigita.cms.contenttypes.ui.ImageStep; diff --git a/environment/project.xml.handbook b/environment/project.xml.handbook index bd820b5c3..0a0a105b4 100644 --- a/environment/project.xml.handbook +++ b/environment/project.xml.handbook @@ -31,6 +31,7 @@ + @@ -45,6 +46,7 @@ +