From 4710d07c4ebea17286b974a9ebe1376d547bfc49 Mon Sep 17 00:00:00 2001 From: pb Date: Thu, 24 Jul 2014 11:49:43 +0000 Subject: [PATCH] Last part of globalization of content types selection box. git-svn-id: https://svn.libreccm.org/ccm/trunk@2779 8810af33-2d31-482b-a856-94f89814c4df --- .../SimpleOrganizationResources.properties | 1 + .../SimpleOrganizationResources_de.properties | 1 + .../SiteProxyResources.properties | 1 + .../SiteProxyResources_de.properties | 1 + .../SiteProxyResources_fr.properties | 1 + .../xmlfeed/XMLFeedResources.properties | 1 + .../xmlfeed/XMLFeedResources_de.properties | 1 + .../src/com/arsdigita/cms/ContentType.java | 28 +++- .../arsdigita/cms/ContentTypeCollection.java | 2 +- .../src/com/arsdigita/bebop/form/Option.java | 147 +++++++++++------- .../com/arsdigita/bebop/form/OptionGroup.java | 73 ++++++--- .../src/com/arsdigita/bebop/form/Widget.java | 32 ++-- .../bebop/parameters/ParameterModel.java | 12 +- .../arsdigita/domain/DomainCollection.java | 6 +- .../src/com/arsdigita/domain/DomainQuery.java | 24 +-- .../cms/contenttypes/SciPublicationsMovie.xml | 6 +- ...blicationsDramaticArtsResources.properties | 2 + ...cationsDramaticArtsResources_de.properties | 2 + .../arsdigita/cms/contenttypes/Journal.xml | 2 +- .../arsdigita/cms/contenttypes/Monograph.xml | 2 +- .../arsdigita/cms/contenttypes/SciAuthor.xml | 21 +-- .../PublicationsResources.properties | 41 ++--- .../PublicationsResources_de.properties | 41 ++--- .../ui/SciAuthorPropertiesStep.java | 2 +- .../ui/SciAuthorPropertyForm.java | 1 - .../cms/contenttypes/SciDepartment.xml | 10 +- .../SciDepartmentResources.properties | 1 + .../SciDepartmentResources_de.properties | 1 + .../ui/SciDepartmentGlobalizationUtil.java | 2 +- .../cms/contenttypes/SciInstitute.xml | 8 +- .../{ui => }/SciInstituteResources.properties | 2 + .../SciInstituteResources_de.properties | 4 +- .../ui/SciInstituteGlobalizationUtil.java | 2 +- .../SciMemberResources.properties | 6 + .../SciMemberResources_de.properties | 6 + ccm-sci-types-project/application.xml | 2 +- .../upgrade/postgres-6.6.8-6.6.9.sql | 10 ++ .../{ui => }/SciProjectResources.properties | 1 + .../SciProjectResources_de.properties | 1 + .../ui/SciProjectGlobalizationUtil.java | 2 +- 40 files changed, 321 insertions(+), 188 deletions(-) rename ccm-cms-types-simpleorganization/src/com/arsdigita/cms/contenttypes/{ui => }/SimpleOrganizationResources.properties (54%) rename ccm-cms-types-simpleorganization/src/com/arsdigita/cms/contenttypes/{ui => }/SimpleOrganizationResources_de.properties (55%) rename ccm-sci-types-department/src/com/arsdigita/cms/contenttypes/{ui => }/SciDepartmentResources.properties (98%) rename ccm-sci-types-department/src/com/arsdigita/cms/contenttypes/{ui => }/SciDepartmentResources_de.properties (99%) rename ccm-sci-types-institute/src/com/arsdigita/cms/contenttypes/{ui => }/SciInstituteResources.properties (96%) rename ccm-sci-types-institute/src/com/arsdigita/cms/contenttypes/{ui => }/SciInstituteResources_de.properties (96%) create mode 100644 ccm-sci-types-member/src/com/arsdigita/cms/contenttypes/SciMemberResources.properties create mode 100644 ccm-sci-types-member/src/com/arsdigita/cms/contenttypes/SciMemberResources_de.properties create mode 100644 ccm-sci-types-project/sql/ccm-sci-types-project/upgrade/postgres-6.6.8-6.6.9.sql rename ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/{ui => }/SciProjectResources.properties (99%) rename ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/{ui => }/SciProjectResources_de.properties (99%) diff --git a/ccm-cms-types-simpleorganization/src/com/arsdigita/cms/contenttypes/ui/SimpleOrganizationResources.properties b/ccm-cms-types-simpleorganization/src/com/arsdigita/cms/contenttypes/SimpleOrganizationResources.properties similarity index 54% rename from ccm-cms-types-simpleorganization/src/com/arsdigita/cms/contenttypes/ui/SimpleOrganizationResources.properties rename to ccm-cms-types-simpleorganization/src/com/arsdigita/cms/contenttypes/SimpleOrganizationResources.properties index 9c40e3aea..eac188996 100644 --- a/ccm-cms-types-simpleorganization/src/com/arsdigita/cms/contenttypes/ui/SimpleOrganizationResources.properties +++ b/ccm-cms-types-simpleorganization/src/com/arsdigita/cms/contenttypes/SimpleOrganizationResources.properties @@ -1 +1,2 @@ sciorganization.ui.simpleorganization_properties.title=Basic properties +cms.contenttypes.simpleorganization.type_label=Organization diff --git a/ccm-cms-types-simpleorganization/src/com/arsdigita/cms/contenttypes/ui/SimpleOrganizationResources_de.properties b/ccm-cms-types-simpleorganization/src/com/arsdigita/cms/contenttypes/SimpleOrganizationResources_de.properties similarity index 55% rename from ccm-cms-types-simpleorganization/src/com/arsdigita/cms/contenttypes/ui/SimpleOrganizationResources_de.properties rename to ccm-cms-types-simpleorganization/src/com/arsdigita/cms/contenttypes/SimpleOrganizationResources_de.properties index 5d9e28cae..933dc5fa2 100644 --- a/ccm-cms-types-simpleorganization/src/com/arsdigita/cms/contenttypes/ui/SimpleOrganizationResources_de.properties +++ b/ccm-cms-types-simpleorganization/src/com/arsdigita/cms/contenttypes/SimpleOrganizationResources_de.properties @@ -1 +1,2 @@ sciorganization.ui.simpleorganization_properties.title=Basiseigenschaften +cms.contenttypes.simpleorganization.type_label=Organisation diff --git a/ccm-cms-types-siteproxy/src/com/arsdigita/cms/contenttypes/SiteProxyResources.properties b/ccm-cms-types-siteproxy/src/com/arsdigita/cms/contenttypes/SiteProxyResources.properties index 14ca211ef..04b994d46 100755 --- a/ccm-cms-types-siteproxy/src/com/arsdigita/cms/contenttypes/SiteProxyResources.properties +++ b/ccm-cms-types-siteproxy/src/com/arsdigita/cms/contenttypes/SiteProxyResources.properties @@ -13,3 +13,4 @@ cms.contenttypes.ui.siteproxy.link.editatoz=Edit #URL: cms.contenttypes.ui.siteproxy.url=URL: cms.contenttypes.ui.siteproxy.edit_form_link=Edit +cms.contenttypes.siteproxy.type_label=Site Proxy diff --git a/ccm-cms-types-siteproxy/src/com/arsdigita/cms/contenttypes/SiteProxyResources_de.properties b/ccm-cms-types-siteproxy/src/com/arsdigita/cms/contenttypes/SiteProxyResources_de.properties index 858a2ee0a..204cb4d43 100644 --- a/ccm-cms-types-siteproxy/src/com/arsdigita/cms/contenttypes/SiteProxyResources_de.properties +++ b/ccm-cms-types-siteproxy/src/com/arsdigita/cms/contenttypes/SiteProxyResources_de.properties @@ -13,3 +13,4 @@ cms.contenttypes.ui.siteproxy.link.editatoz=Bearbeiten #URL: cms.contenttypes.ui.siteproxy.url=URL: cms.contenttypes.ui.siteproxy.edit_form_link=Bearbeiten +cms.contenttypes.siteproxy.type_label=Site Proxy diff --git a/ccm-cms-types-siteproxy/src/com/arsdigita/cms/contenttypes/SiteProxyResources_fr.properties b/ccm-cms-types-siteproxy/src/com/arsdigita/cms/contenttypes/SiteProxyResources_fr.properties index 14ca211ef..04b994d46 100644 --- a/ccm-cms-types-siteproxy/src/com/arsdigita/cms/contenttypes/SiteProxyResources_fr.properties +++ b/ccm-cms-types-siteproxy/src/com/arsdigita/cms/contenttypes/SiteProxyResources_fr.properties @@ -13,3 +13,4 @@ cms.contenttypes.ui.siteproxy.link.editatoz=Edit #URL: cms.contenttypes.ui.siteproxy.url=URL: cms.contenttypes.ui.siteproxy.edit_form_link=Edit +cms.contenttypes.siteproxy.type_label=Site Proxy diff --git a/ccm-cms-types-xmlfeed/src/com/arsdigita/cms/contenttypes/xmlfeed/XMLFeedResources.properties b/ccm-cms-types-xmlfeed/src/com/arsdigita/cms/contenttypes/xmlfeed/XMLFeedResources.properties index 6133e7851..da6ea7f66 100755 --- a/ccm-cms-types-xmlfeed/src/com/arsdigita/cms/contenttypes/xmlfeed/XMLFeedResources.properties +++ b/ccm-cms-types-xmlfeed/src/com/arsdigita/cms/contenttypes/xmlfeed/XMLFeedResources.properties @@ -11,3 +11,4 @@ xmlfeed.authoring.query_form_step.title=Edit Query Form xmlfeed.authoring.query_form.description=The form that supplies the query fields. cms.contenttypes.ui.xmlfeed.xsl_file_type_error=File is not the correct type. cms.contenttypes.ui.xmlfeed.xsl_file_validation_error=Cannot verify the file is valid, please try again. +cms.contenttypes.xmlfeed.xmlfeed.type_label=XML Feed diff --git a/ccm-cms-types-xmlfeed/src/com/arsdigita/cms/contenttypes/xmlfeed/XMLFeedResources_de.properties b/ccm-cms-types-xmlfeed/src/com/arsdigita/cms/contenttypes/xmlfeed/XMLFeedResources_de.properties index 58f8c15bb..94f71dca1 100644 --- a/ccm-cms-types-xmlfeed/src/com/arsdigita/cms/contenttypes/xmlfeed/XMLFeedResources_de.properties +++ b/ccm-cms-types-xmlfeed/src/com/arsdigita/cms/contenttypes/xmlfeed/XMLFeedResources_de.properties @@ -11,3 +11,4 @@ xmlfeed.authoring.query_form_step.title=Abfrageformular bearbeiten xmlfeed.authoring.query_form.description=Das Formular, das die Eingabefelder f\u00fcr die Abfrage enth\u00e4lt. cms.contenttypes.ui.xmlfeed.xsl_file_type_error=Der Dateityp ist falsch. cms.contenttypes.ui.xmlfeed.xsl_file_validation_error=Dateityp kann nicht best\u00e4tigt werden, bitte erneut probieren. +cms.contenttypes.xmlfeed.xmlfeed.type_label=XML Feed diff --git a/ccm-cms/src/com/arsdigita/cms/ContentType.java b/ccm-cms/src/com/arsdigita/cms/ContentType.java index 6e141c9c8..e7be264fd 100755 --- a/ccm-cms/src/com/arsdigita/cms/ContentType.java +++ b/ccm-cms/src/com/arsdigita/cms/ContentType.java @@ -32,7 +32,6 @@ import com.arsdigita.persistence.OID; import com.arsdigita.persistence.SessionManager; import com.arsdigita.util.UncheckedWrapperException; import com.arsdigita.web.Web; -import java.io.File; import java.io.IOException; import java.io.InputStream; @@ -232,10 +231,10 @@ public class ContentType extends ACSObject { // Create the globalized label label = new GlobalizedMessage(labelKey, bundleName); } else { + // No property file found, try to use the item's definition file final InputStream defFile = Thread.currentThread().getContextClassLoader() .getResourceAsStream(typeResourcePath); - // No property file found, try to use the item's definition file if (defFile == null) { // Giving up! @@ -246,21 +245,21 @@ public class ContentType extends ACSObject { // found in a resource file. label = new GlobalizedMessage(getName()); } else { - // item definition file found. use it's + // item definition file found. Use it. + // determine the bundle from attribute "descriptionBundle" // which should provide an item specific description (but // unfortunately due to lazy programmers not always does). // As a proper example: // /WEB-INF/content-types/com.arsditita.cms.contenttypes.Event.xml - try { final SAXParserFactory parserFactory = SAXParserFactory.newInstance(); final SAXParser parser = parserFactory.newSAXParser(); final BundleName bundleName = new BundleName(); parser.parse(defFile, bundleName); - //String bundleName = "REPLACE ME"; // REPLACE ME! if (bundleName.getName() == null) { + // Fallback to the non-globalized identifier (name) return new GlobalizedMessage(getName()); } else { label = new GlobalizedMessage(labelKey, bundleName.getName()); @@ -279,25 +278,42 @@ public class ContentType extends ACSObject { return label; } + /** + * + */ private class BundleName extends DefaultHandler { private String name; + /** + * Constructor, does nothing. + */ public BundleName() { //Nothing } + /** + * + * @return + */ public String getName() { return name; } + /** + * + * @param namespaceURI + * @param localName + * @param qName + * @param attributes + */ @Override public void startElement(final String namespaceURI, final String localName, final String qName, final Attributes attributes) { if ("ctd:authoring-step".equals(qName)) { - name = attributes.getValue("labelBundle"); + name = attributes.getValue("descriptionBundle"); } } diff --git a/ccm-cms/src/com/arsdigita/cms/ContentTypeCollection.java b/ccm-cms/src/com/arsdigita/cms/ContentTypeCollection.java index ce7343495..0a3b002b0 100755 --- a/ccm-cms/src/com/arsdigita/cms/ContentTypeCollection.java +++ b/ccm-cms/src/com/arsdigita/cms/ContentTypeCollection.java @@ -34,7 +34,7 @@ import com.arsdigita.persistence.Filter; * @version $Id: ContentTypeCollection.java 2263 2012-01-08 17:43:22Z pboy $ */ public class ContentTypeCollection extends DomainCollection { - + /** * Constructor. * diff --git a/ccm-core/src/com/arsdigita/bebop/form/Option.java b/ccm-core/src/com/arsdigita/bebop/form/Option.java index 85584d533..96db3aa32 100755 --- a/ccm-core/src/com/arsdigita/bebop/form/Option.java +++ b/ccm-core/src/com/arsdigita/bebop/form/Option.java @@ -31,9 +31,10 @@ import com.arsdigita.xml.Element; * A class representing an option of a widget. * * The Option consist of two parts: - * - a value - * - a label (display component used as label (title) of the option.) - * + * - a value, used by the background task to process the option + * - a display component, used to display the option to the user in the GUI, + * usually a Label (title), but may be e.g. an image as well. + * @author Rory Solomon * @author Michael Pih * @@ -41,19 +42,29 @@ import com.arsdigita.xml.Element; */ public class Option extends DescriptiveComponent { + /** The value of the option, used by the background task to process the + * option. + * NOTE: The display component, the label, is provided by parent class! */ private String m_value; - private OptionGroup m_group; + /** The display component for the user in the GUI. It's usually a Label, + * but may be e.g. an image as well. */ private Component m_component; + private OptionGroup m_group; private boolean m_isSelectOption; + // /////////////////////////////////////////////////////////////////////// + // Constructor Section + // + /** - * (Too) simple Constructor which uses a String as value as well as display - * component. - * @param label A String used as value as well as display component. + * A (too) simple Constructor which uses a String as value as well as + * display component. + * + * @param value A String used as value as well as display component. * @deprecated use Option(value,component) instead */ - public Option(String label) { - this(label, label); + public Option(String value) { + this(value, value); } /** @@ -66,8 +77,8 @@ public class Option extends DescriptiveComponent { * @deprecated use Option(value,component) instead */ public Option(String value, String label) { - setLabel(label); setValue(value); + setLabel(label); } /** @@ -75,60 +86,80 @@ public class Option extends DescriptiveComponent { * usually a Label(GlobalizedMessage). * This constructor should be used to create a fully globalized and * localized user interface. + * * @param value * @param label */ public Option(String value, Component label) { - setComponent(label); setValue(value); - } - - /** - * - * @return - */ - public String getName() { - return m_group.getName(); - } - - - /** - * If the component is a Label (which most of the time it is) - * then this returns the value of the label. This assumes - * that the Component is a label - * - * @return - * @exception ClassCastException is thrown if the component is not - * a label - */ - // public final String getLabel() { - // return ((Label)m_component).getLabel(); - // } - - /** - * This sets the component to the label consisting of the passed in - * string - */ - public final void setLabel(String label) { - setComponent(new Label(label)); - } - - /** - * @deprecated Use {@link #setComponent(Component component)} instead - */ - public final void setLabel(Label label) { setComponent(label); } + // /////////////////////////////////////////////////////////////////////// + // Getter/Setter Section + // + + /** + * Retrieves the value part of an option. + * @return the value part of this option. + */ + public final String getValue() { + return m_value; + } + + /** + * Sets of modifies the value of on option. + * @param value new value part of the option + */ + public final void setValue(String value) { + m_value = value; + } + + + /** + * Retrieves the display part of the option. + * @return the display component for this option + */ + public final Component getComponent() { + return m_component; + } + + /** + * Sets of modifies the display component of an option. + * + * @param component the display component for this option + */ public final void setComponent(Component component) { Assert.isUnlocked(this); m_component = component; } - public final Component getComponent() { - return m_component; + /** + * Sets of modifies the display component of an option providing a Label. + * The label is internally stored as a component. + * + * @param label + */ + public final void setLabel(Label label) { + setComponent(label); } + /** + * This sets the display component using a String. It results in a badly + * globalized UI + * + * @param label String to use as the display component + * @deprecated Use {@link #setComponent(Component component)} instead + */ + public final void setLabel(String label) { + setComponent(new Label(label)); + } + + + /** + * + * @param group + */ public final void setGroup(OptionGroup group) { Assert.isUnlocked(this); Assert.exists(group); @@ -136,17 +167,25 @@ public class Option extends DescriptiveComponent { m_isSelectOption = BebopConstants.BEBOP_OPTION.equals(m_group.getOptionXMLElement()); } + /** + * + * @return + */ public final OptionGroup getGroup() { return m_group; } - public final String getValue() { - return m_value; + /** + * Retrieves the name (identifier) of the option group containing this + * option. Don't know the purpose of this. + * + * @return The name (identifier) of the option group this option belongs + * to + */ + public String getName() { + return m_group.getName(); } - public final void setValue(String value) { - m_value = value; - } /** * Sets the ONFOCUS attribute for the HTML tags that compose diff --git a/ccm-core/src/com/arsdigita/bebop/form/OptionGroup.java b/ccm-core/src/com/arsdigita/bebop/form/OptionGroup.java index 40e73f9ab..e200d679c 100755 --- a/ccm-core/src/com/arsdigita/bebop/form/OptionGroup.java +++ b/ccm-core/src/com/arsdigita/bebop/form/OptionGroup.java @@ -43,7 +43,7 @@ import javax.servlet.http.HttpServletRequestWrapper; import org.apache.log4j.Logger; /** - * A class representing any widget that contains a list options. + * A class representing any widget that contains a list of options. * * @author Karl Goldstein * @author Uday Mathur @@ -54,12 +54,15 @@ import org.apache.log4j.Logger; public abstract class OptionGroup extends Widget implements BebopConstants { private static final Logger LOGGER = Logger.getLogger(OptionGroup.class); + /** - * The XML element to be used by individual options belonging to this group. This variable has - * to be initialized by every subclass of OptionGroup. LEGACY: An abstract method would be the - * better design, but changing it would break the API. + * The XML element to be used by individual options belonging to this group. + * This variable has to be initialized by every subclass of OptionGroup. + * LEGACY: An abstract method would be the better design, but changing it + * would break the API. */ //protected String m_xmlElement; + // this only needs to be an ArrayList for multiple selection option groups private List m_selected; private List