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-94f89814c4dfmaster
parent
e8a69ca7fb
commit
fc7ce33b0a
|
|
@ -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;
|
||||
|
|
@ -133,7 +134,8 @@ 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
|
||||
|
|
|
|||
|
|
@ -60,8 +60,8 @@
|
|||
</foundry:doc-see-also>
|
||||
</foundry:doc>
|
||||
<xsl:template match="a">
|
||||
<xsl:with-param name="href" select="''"/>
|
||||
<xsl:with-param name="title" select="''"/>
|
||||
<xsl:param name="href" select="''"/>
|
||||
<xsl:param name="title" select="''"/>
|
||||
|
||||
<a>
|
||||
<xsl:if test="./@download">
|
||||
|
|
|
|||
|
|
@ -49,9 +49,7 @@
|
|||
<xsl:value-of select="$data-tree//nav:categoryMenu[@id=$navigation-id]/nav:category/@title"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="foundry:get-static-text('navigation',
|
||||
$data-tree//nav:categoryMenu[@id=$navigation-id]/@navigation-id,
|
||||
'false')"/>
|
||||
<xsl:value-of select="foundry:get-static-text('navigation', $data-tree//nav:categoryMenu[@id=$navigation-id]/@navigation-id, 'false')"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:when>
|
||||
|
|
@ -68,7 +66,146 @@
|
|||
<xsl:value-of select="foundry:shying($data-tree//nav:categoryMenu[@id=$navigation-id]/nav:category/@title)"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="navigation-layout">
|
||||
<xsl:template match="navigation">
|
||||
<apply-templates/>
|
||||
<xsl:apply-templates select=".//navigation-links">
|
||||
<xsl:with-param name="navigation-id"
|
||||
select="foundry:get-attribute-value('navigation-id', 'categoryMenu')"/>
|
||||
<xsl:with-param name="with-colorset"
|
||||
select="foundry:get-attribute-value('with-colorset', 'false')"/>
|
||||
<xsl:with-param name="min-level"
|
||||
select="foundry:get-attribute-value('min-level', 1)"/>
|
||||
<xsl:with-param name="max-level"
|
||||
select="foundry:get-attribute-value('max-level', 999)"/>
|
||||
<xsl:with-param name="show-description-text"
|
||||
select="foundry:get-attribute-value('show-description-text', 'true')"/>
|
||||
</xsl:apply-templates>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="navigation//navigation-links">
|
||||
<xsl:param name="navigation-id"/>
|
||||
<xsl:param name="with-colorset"/>
|
||||
<xsl:param name="min-level"/>
|
||||
<xsl:param name="max-level"/>
|
||||
<xsl:param name="show-description-text"/>
|
||||
<xsl:param name="current-level" select="1"/>
|
||||
<xsl:param name="current-level-tree" select="$data-tree//nav:categoryMenu[@id=$navigation-id]/nav:category/nav:category"/>
|
||||
|
||||
<dl>
|
||||
<dt>navigation-id</dt>
|
||||
<dd><xsl:value-of select="$navigation-id"/></dd>
|
||||
<dt>with-colorset</dt>
|
||||
<dd><xsl:value-of select="$with-colorset"/></dd>
|
||||
<dt>min-level</dt>
|
||||
<dd><xsl:value-of select="$min-level"/></dd>
|
||||
<dt>max-level</dt>
|
||||
<dd><xsl:value-of select="$max-level"/></dd>
|
||||
<dt>current-level</dt>
|
||||
<dd><xsl:value-of select="$current-level"/></dd>
|
||||
</dl>
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="($current-level >= $min-level) and ($current-level <= $max-level)">
|
||||
<xsl:apply-templates>
|
||||
<xsl:with-param name="navigation-id" select="$navigation-id"/>
|
||||
<xsl:with-param name="with-colorset" select="$with-colorset"/>
|
||||
<xsl:with-param name="min-level" select="$min-level"/>
|
||||
<xsl:with-param name="max-level" select="$max-level"/>
|
||||
<xsl:with-param name="show-description-text" select="$show-description-text"/>
|
||||
<xsl:with-param name="current-level" select="1"/>
|
||||
<xsl:with-param name="current-level-tree" select="$current-level-tree"/>
|
||||
<xsl:with-param name="navigation-links-tree" select="."/>
|
||||
</xsl:apply-templates>
|
||||
</xsl:when>
|
||||
<xsl:when test="($current-level < $min-level) and $current-level-tree/nav:category">
|
||||
<xsl:apply-templates select=".">
|
||||
<xsl:with-param name="navigation-id" select="$navigation-id"/>
|
||||
<xsl:with-param name="with-colorset" select="$with-colorset"/>
|
||||
<xsl:with-param name="min-level" select="$min-level"/>
|
||||
<xsl:with-param name="max-level" select="$max-level"/>
|
||||
<xsl:with-param name="show-description-text" select="$show-description-text"/>
|
||||
<xsl:with-param name="current-level" select="$current-level + 1"/>
|
||||
<xsl:with-param name="current-level-tree"
|
||||
select="$current-level-tree/nav:category"/>
|
||||
<xsl:with-param name="navigation-links-tree" select="."/>
|
||||
</xsl:apply-templates>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="navigationlinks//navigation-link">
|
||||
<xsl:param name="navigation-id"/>
|
||||
<xsl:param name="with-colorset"/>
|
||||
<xsl:param name="min-level"/>
|
||||
<xsl:param name="max-level"/>
|
||||
<xsl:param name="show-description-text"/>
|
||||
<xsl:param name="current-level"/>
|
||||
<xsl:param name="current-level-tree"/>
|
||||
<xsl:param name="navigation-links-tree"/>
|
||||
|
||||
<xsl:variable name="link-tree" select="."/>
|
||||
|
||||
<xsl:for-each select="$current-level-tree">
|
||||
<xsl:apply-templates select="$link-tree">
|
||||
<xsl:with-param name="navigation-id" select="$navigation-id"/>
|
||||
<xsl:with-param name="with-colorset" select="$with-colorset"/>
|
||||
<xsl:with-param name="min-level" select="$min-level"/>
|
||||
<xsl:with-param name="max-level" select="$max-level"/>
|
||||
<xsl:with-param name="show-description-text"
|
||||
select="show-description-text"/>
|
||||
<xsl:with-param name="current-level" select="$current-level"/>
|
||||
<xsl:with-param name="current-level-tree" select="$current-level-tree"/>
|
||||
<xsl:with-param name="navigation-links-tree" select="$navigation-links-tree"/>
|
||||
<xsl:with-param name="href" select="./@url"/>
|
||||
<xsl:with-param name="title">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$show-description-text and ./@description">
|
||||
<xsl:value-of select="./@description"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="./@title"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:with-param>
|
||||
<xsl:with-param name="link-label" select="./@title"/>
|
||||
</xsl:apply-templates>
|
||||
</xsl:for-each>
|
||||
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="navigation-link//navigation-link-label">
|
||||
<xsl:param name="link-label"/>
|
||||
|
||||
<xsl:value-of select="$link-label"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="navigation-link//navigation-sublinks">
|
||||
<xsl:param name="navigation-id"/>
|
||||
<xsl:param name="with-colorset"/>
|
||||
<xsl:param name="min-level"/>
|
||||
<xsl:param name="max-level"/>
|
||||
<xsl:param name="show-description-text"/>
|
||||
<xsl:param name="current-level"/>
|
||||
<xsl:param name="current-level-tree"/>
|
||||
<xsl:param name="navigation-links-tree"/>
|
||||
|
||||
|
||||
<xsl:if test="($current-level <= $max-level) and $current-level-tree/nav:category">
|
||||
<xsl:apply-templates select="$navigation-links-tree">
|
||||
<xsl:with-param name="navigation-id" select="$navigation-id"/>
|
||||
<xsl:with-param name="with-colorset" select="$with-colorset"/>
|
||||
<xsl:with-param name="min-level" select="$min-level"/>
|
||||
<xsl:with-param name="max-level" select="$max-level"/>
|
||||
<xsl:with-param name="show-description-text" select="$show-description-text"/>
|
||||
<xsl:with-param name="current-level" select="$current-level + 1"/>
|
||||
<xsl:with-param name="navigation-links-tree" select="$navigation-links-tree"/>
|
||||
</xsl:apply-templates>
|
||||
</xsl:if>
|
||||
|
||||
</xsl:template>
|
||||
|
||||
<!--<xsl:template match="navigation-layout">
|
||||
<xsl:apply-templates>
|
||||
<xsl:with-param name="navigation-id"
|
||||
select="foundry:get-attribute-value('navigation-id', 'categoryMenu')"/>
|
||||
|
|
@ -219,6 +356,6 @@
|
|||
<xsl:value-of select="$title"/>
|
||||
</a>
|
||||
|
||||
</xsl:template>
|
||||
</xsl:template>-->
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
|
@ -34,6 +34,91 @@ EXSLT functions.
|
|||
version="1.0">
|
||||
|
||||
|
||||
<foundry:doc section="devel">
|
||||
<foundry:doc-param name="value" mandatory="yes">
|
||||
The value to evaluate.
|
||||
</foundry:doc-param>
|
||||
<foundry:doc-desc>
|
||||
<p>
|
||||
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:
|
||||
</p>
|
||||
<pre>
|
||||
...
|
||||
<xsl:if test="./@attr = 'true'">
|
||||
...
|
||||
</xsl:if>
|
||||
...
|
||||
</pre>
|
||||
<p>
|
||||
Using <code>foundry:boolean</code> this can be simplified to
|
||||
</p>
|
||||
<pre>
|
||||
...
|
||||
<xsl:if test="foundry:boolean(./@attr)">
|
||||
...
|
||||
</xsl:if>
|
||||
...
|
||||
</pre>
|
||||
<p>
|
||||
The more important purpose is to make the usage of boolean values more user
|
||||
friendly, especially in the templates. Using <code>foundry:boolean</code> no only
|
||||
<code>true</code> is evaluated to boolean <code>true</code>. A number of other
|
||||
strings is also evaluated to <code>true</code>:
|
||||
</p>
|
||||
<ul>
|
||||
<li>
|
||||
<code>true</code>
|
||||
</li>
|
||||
<li>
|
||||
<code>TRUE</code>
|
||||
</li>
|
||||
<li>
|
||||
<code>yes</code>
|
||||
</li>
|
||||
<li>
|
||||
<code>YES</code>
|
||||
</li>
|
||||
<li>
|
||||
<code>t</code>
|
||||
</li>
|
||||
<li>
|
||||
<code>T</code>
|
||||
</li>
|
||||
<li>
|
||||
<code>y</code>
|
||||
</li>
|
||||
<li>
|
||||
<code>Y</code>
|
||||
</li>
|
||||
</ul>
|
||||
<p>
|
||||
All other values are evaluated to <code>false</code>.
|
||||
</p>
|
||||
</foundry:doc-desc>
|
||||
</foundry:doc>
|
||||
<func:function name="foundry:boolean">
|
||||
<xsl:param name="value"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$value = 'true'
|
||||
or $value = 'TRUE'
|
||||
or $value = 'yes'
|
||||
or $value = 'YES'
|
||||
or $value = 't'
|
||||
or $value = 'T'
|
||||
or $value = 'y'
|
||||
or $value = 'Y'">
|
||||
<func:result select="true()"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<func:result select="false()"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
|
||||
</func:function>
|
||||
|
||||
<foundry:doc section="devel">
|
||||
<foundry:doc-param name="level"
|
||||
mandatory="yes">
|
||||
|
|
|
|||
|
|
@ -9,18 +9,21 @@
|
|||
</head>
|
||||
<body>
|
||||
<nav>
|
||||
<navigation-layout>
|
||||
<navigation-home-link/>
|
||||
<navigation-link-list>
|
||||
<navigation>
|
||||
<div class="nav-wrapper">
|
||||
<navigation-links>
|
||||
<ul>
|
||||
<navigation-link-layout>
|
||||
<navigation-link>
|
||||
<li>
|
||||
<navigation-link/>
|
||||
<a><navigation-link-label/></a>
|
||||
<navigation-sublinks/>
|
||||
</li>
|
||||
</navigation-link-layout>
|
||||
</navigation-link>
|
||||
</ul>
|
||||
</navigation-link-list>
|
||||
</navigation-layout>
|
||||
</navigation-links>
|
||||
</div>
|
||||
</navigation>
|
||||
</nav>
|
||||
<main>
|
||||
<div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue