From fc7ce33b0a14cdb608ea265ac72995c7b25be2bf Mon Sep 17 00:00:00 2001 From: jensp Date: Thu, 25 Sep 2014 13:15:45 +0000 Subject: [PATCH] Language switching now works for the list of countries in the Address content type (#1764) git-svn-id: https://svn.libreccm.org/ccm/trunk@2876 8810af33-2d31-482b-a856-94f89814c4df --- .../ui/GenericAddressPropertyForm.java | 16 +- .../foundry/lib/template-tags/html-tags.xsl | 4 +- .../foundry/lib/template-tags/navigation.xsl | 147 +++++++++++++++++- .../web/themes/foundry/foundry/lib/utils.xsl | 85 ++++++++++ .../foundry/templates/default-layout.xml | 27 ++-- 5 files changed, 253 insertions(+), 26 deletions(-) diff --git a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericAddressPropertyForm.java b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericAddressPropertyForm.java index 0242afac1..efcf97917 100644 --- a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericAddressPropertyForm.java +++ b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericAddressPropertyForm.java @@ -43,6 +43,7 @@ import com.arsdigita.cms.contenttypes.GenericAddress; import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil; import com.arsdigita.cms.ui.authoring.BasicPageForm; import com.arsdigita.cms.util.GlobalizationUtil; +import com.arsdigita.globalization.GlobalizationHelper; import com.arsdigita.util.UncheckedWrapperException; import java.util.Iterator; import java.util.Map; @@ -98,7 +99,7 @@ public class GenericAddressPropertyForm extends BasicPageForm address.setRows(5); address.setCols(30); add(address); - + ParameterModel postalCodeParam = new StringParameter(POSTAL_CODE); TextField postalCode = new TextField(postalCodeParam); postalCode.setLabel(ContenttypesGlobalizationUtil @@ -124,7 +125,7 @@ public class GenericAddressPropertyForm extends BasicPageForm SingleSelect country = new SingleSelect(countryParam); country.setLabel(ContenttypesGlobalizationUtil .globalize("cms.contenttypes.ui.address.iso_country_code")); - + try { country.addPrintListener(new PrintListener() { @@ -133,12 +134,13 @@ public class GenericAddressPropertyForm extends BasicPageForm final SingleSelect target = (SingleSelect) event.getTarget(); target.clearOptions(); - final Iterator countries = GenericAddress.getSortedListOfCountries(null) + final Iterator countries = GenericAddress.getSortedListOfCountries( + GlobalizationHelper.getNegotiatedLocale()) .entrySet().iterator(); target.addOption(new Option("", - new Label(GlobalizationUtil - .globalize("cms.ui.select_one")))); - + new Label(GlobalizationUtil + .globalize("cms.ui.select_one")))); + while (countries.hasNext()) { Map.Entry elem = (Map.Entry) countries .next(); @@ -163,7 +165,7 @@ public class GenericAddressPropertyForm extends BasicPageForm if (isoCode == null || isoCode.length() == 0) { data.addError(ContenttypesGlobalizationUtil .globalize("cms.contenttypes.ui.address.error_iso_country") - ); + ); } } diff --git a/ccm-sci-bundle/web/themes/foundry/foundry/lib/template-tags/html-tags.xsl b/ccm-sci-bundle/web/themes/foundry/foundry/lib/template-tags/html-tags.xsl index f5b7cc452..4693681a0 100644 --- a/ccm-sci-bundle/web/themes/foundry/foundry/lib/template-tags/html-tags.xsl +++ b/ccm-sci-bundle/web/themes/foundry/foundry/lib/template-tags/html-tags.xsl @@ -60,8 +60,8 @@ - - + + diff --git a/ccm-sci-bundle/web/themes/foundry/foundry/lib/template-tags/navigation.xsl b/ccm-sci-bundle/web/themes/foundry/foundry/lib/template-tags/navigation.xsl index 98e505efb..b28132652 100644 --- a/ccm-sci-bundle/web/themes/foundry/foundry/lib/template-tags/navigation.xsl +++ b/ccm-sci-bundle/web/themes/foundry/foundry/lib/template-tags/navigation.xsl @@ -49,9 +49,7 @@ - + @@ -68,7 +66,146 @@ - + + + + + + + + + + + + + + + + + + + + +
+
navigation-id
+
+
with-colorset
+
+
min-level
+
+
max-level
+
+
current-level
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ccm-sci-bundle/web/themes/foundry/foundry/lib/utils.xsl b/ccm-sci-bundle/web/themes/foundry/foundry/lib/utils.xsl index c199adf24..9c42e6373 100644 --- a/ccm-sci-bundle/web/themes/foundry/foundry/lib/utils.xsl +++ b/ccm-sci-bundle/web/themes/foundry/foundry/lib/utils.xsl @@ -34,6 +34,91 @@ EXSLT functions. version="1.0"> + + + The value to evaluate. + + +

+ A helper function for evaluating certain string values to boolean. This function has two + two purposes. First it simplifies some expressions. for example if you have a + template tag with a attribute containing a (pseudo) boolean value (attribute values + are always treated as strings) you would have to write something like: +

+
+                ...
+                
+                    ...
+                
+                ...
+            
+

+ Using foundry:boolean this can be simplified to +

+
+                ...
+                
+                    ...
+                
+                ...
+            
+

+ The more important purpose is to make the usage of boolean values more user + friendly, especially in the templates. Using foundry:boolean no only + true is evaluated to boolean true. A number of other + strings is also evaluated to true: +

+
    +
  • + true +
  • +
  • + TRUE +
  • +
  • + yes +
  • +
  • + YES +
  • +
  • + t +
  • +
  • + T +
  • +
  • + y +
  • +
  • + Y +
  • +
+

+ All other values are evaluated to false. +

+
+
+ + + + + + + + + + + + + diff --git a/ccm-sci-bundle/web/themes/foundry/templates/default-layout.xml b/ccm-sci-bundle/web/themes/foundry/templates/default-layout.xml index d42245e76..5f222fb47 100644 --- a/ccm-sci-bundle/web/themes/foundry/templates/default-layout.xml +++ b/ccm-sci-bundle/web/themes/foundry/templates/default-layout.xml @@ -9,18 +9,21 @@