)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() ;
+ if (isoCode == null || isoCode.length() == 0) {
+ data.addError((String)BaseAddressGlobalizationUtil.globalize("cms.contenttypes.ui.baseAddress.error_iso_country").localize());
+ }
+ }
+ }
+ );
+
+ add(country);
+ }
+
+ }
+
+ public void init(FormSectionEvent fse) {
+ FormData data = fse.getFormData();
+ PageState state = fse.getPageState();
+ HealthCareFacility healthCareFacility = (HealthCareFacility)getItemSelectionModel().getSelectedObject(state);
+
+ if(healthCareFacility.getAddress() != null) {
+ data.put(ADDRESS, healthCareFacility.getAddress().getAddress());
+ data.put(POSTAL_CODE, healthCareFacility.getAddress().getPostalCode());
+ data.put(CITY, healthCareFacility.getAddress().getCity());
+ data.put(STATE, healthCareFacility.getAddress().getState());
+ if(!BaseAddress.getConfig().getHideCountryCodeSelection()) {
+ data.put(ISO_COUNTRY_CODE, healthCareFacility.getAddress().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();
+ PageState state = fse.getPageState();
+ HealthCareFacility healthCareFacility = (HealthCareFacility)getItemSelectionModel().getSelectedObject(state);
+
+ if (healthCareFacility.getAddress() != null &&
+ getSaveCancelSection().getSaveButton().isSelected(fse.getPageState())) {
+ healthCareFacility.getAddress().setAddress((String)data.get(ADDRESS));
+ healthCareFacility.getAddress().setPostalCode((String)data.get(POSTAL_CODE));
+ healthCareFacility.getAddress().setCity((String)data.get(CITY));
+ healthCareFacility.getAddress().setState((String)data.get(STATE));
+ healthCareFacility.getAddress().setIsoCountryCode((String)data.get(ISO_COUNTRY_CODE));
+
+ healthCareFacility.getAddress().save();
+ }
+
+ if (m_step != null) {
+ m_step.maybeForwardToNextStep(fse.getPageState());
+ }
+ }
+}
\ No newline at end of file
diff --git a/ccm-cms-types-healthCareFacility/src/com/arsdigita/cms/contenttypes/ui/HealthCareFacilityPropertiesStep.java b/ccm-cms-types-healthCareFacility/src/com/arsdigita/cms/contenttypes/ui/HealthCareFacilityPropertiesStep.java
new file mode 100644
index 000000000..df8c30cda
--- /dev/null
+++ b/ccm-cms-types-healthCareFacility/src/com/arsdigita/cms/contenttypes/ui/HealthCareFacilityPropertiesStep.java
@@ -0,0 +1,114 @@
+package com.arsdigita.cms.contenttypes.ui;
+
+import com.arsdigita.bebop.PageState;
+import com.arsdigita.cms.ContentPage;
+import com.arsdigita.cms.ContentSection;
+import com.arsdigita.cms.ItemSelectionModel;
+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.domain.DomainObject;
+import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
+import com.arsdigita.cms.util.GlobalizationUtil;
+import com.arsdigita.bebop.Component;
+import com.arsdigita.bebop.Label;
+import com.arsdigita.bebop.SegmentedPanel;
+import com.arsdigita.cms.contenttypes.HealthCareFacility;
+import com.arsdigita.cms.contenttypes.util.HealthCareFacilityGlobalizationUtil;
+
+import java.text.DateFormat;
+import org.apache.log4j.Logger;
+
+/**
+ * AuthoringStep for the basic properties of a basic contact
+ */
+public class HealthCareFacilityPropertiesStep extends SimpleEditStep {
+
+ private static final Logger logger = Logger.getLogger(HealthCareFacilityPropertiesStep.class);
+
+ /**
+ * Name of the this edit sheet (Don't know if this this really needed.
+ * It has the same value in almost all PropertiesStep classes)
+ */
+ public static final String EDIT_BASIC_SHEET_NAME = "editBasic";
+
+ /**
+ * Constructor for the PropertiesStep.
+ *
+ * @param itemModel
+ * @param parent
+ */
+ public HealthCareFacilityPropertiesStep(ItemSelectionModel itemModel, AuthoringKitWizard parent) {
+ super(itemModel, parent);
+
+ /* Use a Segmented Panel for the multiple parts of data */
+ SegmentedPanel segmentedPanel = new SegmentedPanel();
+
+ setDefaultEditKey(EDIT_BASIC_SHEET_NAME);
+
+ /* The different parts of information are displayed in seperated segments each containing a SimpleEditStep */
+ /* Well, not so simple anymore... */
+
+ /* A new SimpleEditStep */
+ SimpleEditStep basicProperties = new SimpleEditStep(itemModel, parent, EDIT_BASIC_SHEET_NAME);
+
+ /* Create the edit component for this SimpleEditStep and the corresponding link */
+ BasicPageForm editBasicSheet = new HealthCareFacilityPropertyForm(itemModel, this);
+ basicProperties.add(EDIT_BASIC_SHEET_NAME, (String)HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.edit_basic_properties").localize(), new WorkflowLockedComponentAccess(editBasicSheet, itemModel), editBasicSheet.getSaveCancelSection().getCancelButton());
+
+ /* Set the displayComponent for this step */
+ basicProperties.setDisplayComponent(getHealthCareFacilityPropertySheet(itemModel));
+
+ /* Add the SimpleEditStep to the segmented panel */
+ segmentedPanel.addSegment(new Label((String)HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.basic_properties").localize()), basicProperties);
+
+ // If not disabled via registry, add the ui for attaching a baseAddress
+ if(!HealthCareFacility.getConfig().getHideAddress()) {
+ HealthCareFacilityAddressPropertiesStep addressProperties = new HealthCareFacilityAddressPropertiesStep(itemModel, parent);
+ segmentedPanel.addSegment(new Label((String)HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.address").localize()), addressProperties);
+ }
+
+ HealthCareFacilityBaseContactPropertiesStep baseContacts = new HealthCareFacilityBaseContactPropertiesStep(itemModel, parent);
+ segmentedPanel.addSegment(new Label((String)HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.contact").localize()), baseContacts);
+
+ /* Sets the composed segmentedPanel as display component */
+ setDisplayComponent(segmentedPanel);
+ }
+
+ /**
+ * Creates and returns the sheet for editing the basic properties
+ * of an organization. (@see HealthCareFacilityPropertyForm).
+ *
+ *
+ * @param itemModel
+ * @return The sheet for editing the properties of the organization.
+ */
+ public static Component getHealthCareFacilityPropertySheet(ItemSelectionModel itemModel) {
+
+
+ /* The DisplayComponent for the Basic Properties */
+ DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(itemModel);
+
+ sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.name"),"name");
+ sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.title"),"title");
+
+ if(!ContentSection.getConfig().getHideLaunchDate()) {
+ sheet.add(GlobalizationUtil.globalize("cms.ui.authoring.page_launch_date"), ContentPage.LAUNCH_DATE, new DomainObjectPropertySheet.AttributeFormatter() {
+
+ public String format(DomainObject obj, String attribute, PageState state) {
+ ContentPage page = (ContentPage)obj;
+ if(page.getLaunchDate() != null) {
+ return DateFormat.getDateInstance(DateFormat.LONG).format(page.getLaunchDate());
+ }
+ else {
+ return (String)GlobalizationUtil.globalize("cms.ui.unknown").localize();
+ }
+ }
+ });
+ }
+
+ return sheet;
+ }
+
+}
\ No newline at end of file
diff --git a/ccm-cms-types-healthCareFacility/src/com/arsdigita/cms/contenttypes/ui/HealthCareFacilityPropertyForm.java b/ccm-cms-types-healthCareFacility/src/com/arsdigita/cms/contenttypes/ui/HealthCareFacilityPropertyForm.java
new file mode 100644
index 000000000..9c3f3063a
--- /dev/null
+++ b/ccm-cms-types-healthCareFacility/src/com/arsdigita/cms/contenttypes/ui/HealthCareFacilityPropertyForm.java
@@ -0,0 +1,97 @@
+package com.arsdigita.cms.contenttypes.ui;
+
+import com.arsdigita.bebop.FormProcessException;
+import com.arsdigita.cms.ui.authoring.BasicPageForm;
+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.cms.ItemSelectionModel;
+import com.arsdigita.bebop.FormData;
+import com.arsdigita.cms.contenttypes.HealthCareFacility;
+
+import org.apache.log4j.Logger;
+
+/**
+ * Form for editing the basic properties of a basic contact.
+ */
+public class HealthCareFacilityPropertyForm extends BasicPageForm implements FormProcessListener, FormInitListener, FormSubmissionListener {
+
+ private static final Logger logger = Logger.getLogger(HealthCareFacilityPropertyForm.class);
+
+ private HealthCareFacilityPropertiesStep m_step;
+
+ public static final String ADRESS = HealthCareFacility.ADDRESS;
+ public static final String CONTACTS= HealthCareFacility.CONTACTS;
+
+ /**
+ * ID of the form
+ */
+ public static final String ID = "HealthCareFacility_edit";
+
+ /**
+ * Constrctor taking an ItemSelectionModel
+ *
+ * @param itemModel
+ */
+ public HealthCareFacilityPropertyForm(ItemSelectionModel itemModel) {
+ this(itemModel, null);
+ }
+
+ /**
+ * Constrctor taking an ItemSelectionModel and an instance of HealthCareFacilityPropertiesStep.
+ *
+ *
+ * @param itemModel
+ * @param step
+ */
+ public HealthCareFacilityPropertyForm(ItemSelectionModel itemModel, HealthCareFacilityPropertiesStep step) {
+ super(ID, itemModel);
+ m_step = step;
+ addSubmissionListener(this);
+ }
+
+ @Override
+ public void addWidgets() {
+ super.addWidgets();
+
+/*
+ add(new Label((String)HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.basic_properties.description").localize())));
+ TextArea description = new TextArea(DESCRIPTION);
+ description.setRows(5);
+ description.setCols(30);
+ add(description);
+*/
+ }
+
+ @Override
+ public void init(FormSectionEvent e) throws FormProcessException {
+ FormData data = e.getFormData();
+ HealthCareFacility healthCareFacility = (HealthCareFacility)super.initBasicWidgets(e);
+
+// data.put(DESCRIPTION, healthCareFacility.getDescription());
+ }
+
+ @Override
+ public void process(FormSectionEvent e) throws FormProcessException {
+ FormData data = e.getFormData();
+
+ HealthCareFacility healthCareFacility = (HealthCareFacility)super.processBasicWidgets(e);
+
+ if((healthCareFacility != null) && (getSaveCancelSection().getSaveButton().isSelected(e.getPageState()))) {
+// healthCareFacility.setDescription((String)data.get(DESCRIPTION));
+
+ healthCareFacility.save();
+ }
+
+ if(m_step != null) {
+ m_step.maybeForwardToNextStep(e.getPageState());
+ }
+ }
+
+ public void submitted(FormSectionEvent e) throws FormProcessException {
+ if((m_step != null) && (getSaveCancelSection().getCancelButton().isSelected(e.getPageState()))) {
+ m_step.cancelStreamlinedCreation(e.getPageState());
+ }
+ }
+}
\ No newline at end of file
diff --git a/ccm-cms-types-healthCareFacility/src/com/arsdigita/cms/contenttypes/util/HealthCareFacilityGlobalizationUtil.java b/ccm-cms-types-healthCareFacility/src/com/arsdigita/cms/contenttypes/util/HealthCareFacilityGlobalizationUtil.java
new file mode 100644
index 000000000..9122e9ce8
--- /dev/null
+++ b/ccm-cms-types-healthCareFacility/src/com/arsdigita/cms/contenttypes/util/HealthCareFacilityGlobalizationUtil.java
@@ -0,0 +1,53 @@
+/*
+ * 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.contenttypes.util;
+
+import com.arsdigita.globalization.GlobalizedMessage;
+
+/**
+ *
+ * .
+ * Contains methods to simplify globalizing keys
+ *
+ *
+ * @author randyg@arsdigita.com
+ * @version $Revision: #4 $ $Date: 2004/08/17 $
+ */
+
+public class HealthCareFacilityGlobalizationUtil {
+
+ final public static String BUNDLE_NAME =
+ "com.arsdigita.cms.contenttypes.util.HealthCareFacilityResourceBundle";
+
+ /**
+ * This returns a globalized message using the type specific bundle,
+ * BUNDLE_NAME
+ */
+ public static GlobalizedMessage globalize(String key) {
+ return new GlobalizedMessage(key, BUNDLE_NAME);
+ }
+
+ /**
+ * This returns a globalized message using the type specific bundle,
+ * BUNDLE_NAME
+ */
+ public static GlobalizedMessage globalize(String key, Object[] args) {
+ return new GlobalizedMessage(key, BUNDLE_NAME, args);
+ }
+}
diff --git a/ccm-cms-types-healthCareFacility/src/com/arsdigita/cms/contenttypes/util/HealthCareFacilityResourceBundle.java b/ccm-cms-types-healthCareFacility/src/com/arsdigita/cms/contenttypes/util/HealthCareFacilityResourceBundle.java
new file mode 100644
index 000000000..d268234a7
--- /dev/null
+++ b/ccm-cms-types-healthCareFacility/src/com/arsdigita/cms/contenttypes/util/HealthCareFacilityResourceBundle.java
@@ -0,0 +1,39 @@
+/*
+ * 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.contenttypes.util;
+
+import java.util.PropertyResourceBundle;
+import com.arsdigita.globalization.ChainedResourceBundle;
+import com.arsdigita.cms.CMSGlobalized;
+
+/**
+ * Form to edit the basic properties of an event. This form can be extended to
+ * create forms for Event subclasses.
+ **/
+public class HealthCareFacilityResourceBundle extends ChainedResourceBundle implements CMSGlobalized {
+
+ public final static String HEALTH_CARE_FACILITY_BUNDLE_NAME =
+ "com.arsdigita.cms.contenttypes.HealthCareFacilityResources";
+
+ public HealthCareFacilityResourceBundle() {
+ super();
+ addBundle((PropertyResourceBundle)getBundle(HEALTH_CARE_FACILITY_BUNDLE_NAME));
+ addBundle((PropertyResourceBundle)getBundle(BUNDLE_NAME));
+ }
+}
diff --git a/ccm-cms-types-healthCareFacility/web/static/content-types/com/arsdigita/cms/contenttypes/HealthCareFacility.xsl b/ccm-cms-types-healthCareFacility/web/static/content-types/com/arsdigita/cms/contenttypes/HealthCareFacility.xsl
new file mode 100644
index 000000000..531c92cc7
--- /dev/null
+++ b/ccm-cms-types-healthCareFacility/web/static/content-types/com/arsdigita/cms/contenttypes/HealthCareFacility.xsl
@@ -0,0 +1,41 @@
+
+]>
+
+
+
+
+
+
+
+
+
+
+ Address
+
+
+
+
+
\ No newline at end of file