Added supported languages (from KernelConfig) to SiteBanner XML output. LanguageSelector in Foundry now uses these values.
git-svn-id: https://svn.libreccm.org/ccm/trunk@4479 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
0004054b52
commit
15d6aa4bca
|
|
@ -21,8 +21,10 @@ package com.arsdigita.ui;
|
||||||
import com.arsdigita.bebop.PageState;
|
import com.arsdigita.bebop.PageState;
|
||||||
import com.arsdigita.bebop.SimpleComponent;
|
import com.arsdigita.bebop.SimpleComponent;
|
||||||
import com.arsdigita.kernel.Kernel;
|
import com.arsdigita.kernel.Kernel;
|
||||||
|
import com.arsdigita.kernel.KernelConfig;
|
||||||
import com.arsdigita.web.Web;
|
import com.arsdigita.web.Web;
|
||||||
import com.arsdigita.xml.Element;
|
import com.arsdigita.xml.Element;
|
||||||
|
import java.util.StringTokenizer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -40,6 +42,8 @@ public class SiteBanner extends SimpleComponent {
|
||||||
content.addAttribute("hostname", getHostname());
|
content.addAttribute("hostname", getHostname());
|
||||||
content.addAttribute("sitename", getSiteName());
|
content.addAttribute("sitename", getSiteName());
|
||||||
content.addAttribute("admin", getAdminContactEmail());
|
content.addAttribute("admin", getAdminContactEmail());
|
||||||
|
|
||||||
|
addSupportedLanguages(content);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getHostname() {
|
protected String getHostname() {
|
||||||
|
|
@ -54,4 +58,14 @@ public class SiteBanner extends SimpleComponent {
|
||||||
return Kernel.getSecurityConfig().getAdminContactEmail();
|
return Kernel.getSecurityConfig().getAdminContactEmail();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void addSupportedLanguages(final Element content) {
|
||||||
|
final Element supportedLangsElem = content.newChildElement("supportedLanguages");
|
||||||
|
|
||||||
|
final StringTokenizer languages = KernelConfig.getConfig().getSupportedLanguagesTokenizer();
|
||||||
|
while(languages.hasMoreTokens()) {
|
||||||
|
final Element langElem = supportedLangsElem.newChildElement("language");
|
||||||
|
langElem.addAttribute("locale", languages.nextToken());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -105,6 +105,9 @@
|
||||||
<xsl:when test="$data-tree/nav:greetingItem">
|
<xsl:when test="$data-tree/nav:greetingItem">
|
||||||
<xsl:copy-of select="$data-tree/nav:greetingItem//availableLanguages/*" />
|
<xsl:copy-of select="$data-tree/nav:greetingItem//availableLanguages/*" />
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
|
<xsl:when test="$data-tree/ui:siteBanner/supportedLanguages">
|
||||||
|
<xsl:copy-of select="$data-tree/ui:siteBanner/supportedLanguages/*"
|
||||||
|
</xsl:when>
|
||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
<xsl:copy-of select="document(foundry:gen-path('conf/global.xml'))/foundry:configuration/supported-languages" />
|
<xsl:copy-of select="document(foundry:gen-path('conf/global.xml'))/foundry:configuration/supported-languages" />
|
||||||
</xsl:otherwise>
|
</xsl:otherwise>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue