Some bugfixes for the Foundry master theme

git-svn-id: https://svn.libreccm.org/ccm/trunk@2979 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2014-11-19 15:15:37 +00:00
parent 2156e9b5a6
commit b5f0c78969
4 changed files with 101 additions and 128 deletions

View File

@ -62,9 +62,13 @@ processor, some are read from the configuration files of Foundry and some are de
</p>
</foundry:doc-desc>
</foundry:doc>
<xsl:variable name="theme-mode" select="foundry:get-setting('global',
'theme-mode',
'master')"/>
<!--
We have to duplicate the logic of foundry:get-setting here because otherwise
theme-mode would depend on its own value.
-->
<xsl:variable name="theme-mode"
select="document(concat($theme-prefix, '/conf/global.xml'))/foundry:configuration/setting[@id='theme-mode']"/>
<foundry:doc section="devel" type="env-var">
<foundry:doc-desc>
<p>
@ -199,15 +203,15 @@ processor, some are read from the configuration files of Foundry and some are de
</foundry:doc>
<xsl:variable name="languages">
</xsl:variable>-->
</xsl:variable>-->
<foundry:doc section="devel" type="env-var">
<foundry:doc-desc>
<p>
The languages supported by this theme. They are configured in
<code>conf/global.xml</code> using the <code>&lt;supported-languages&gt;</code>
element. Example for german and english:
<pre>
<foundry:doc section="devel" type="env-var">
<foundry:doc-desc>
<p>
The languages supported by this theme. They are configured in
<code>conf/global.xml</code> using the <code>&lt;supported-languages&gt;</code>
element. Example for german and english:
<pre>
&lt;?xml version="1.0"?&gt;
&lt;foundry:configuration&gt;
&hellip;
@ -217,89 +221,89 @@ processor, some are read from the configuration files of Foundry and some are de
&lt;/supported-languages&gt;
&hellip;
&lt;/foundry:configuration&gt;
</pre>
</p>
</foundry:doc-desc>
</foundry:doc>
<xsl:variable name="supported-languages"
select="document(foundry:gen-path('conf/global.xml'))/foundry:configuration/supported-languages"/>
</pre>
</p>
</foundry:doc-desc>
</foundry:doc>
<xsl:variable name="supported-languages"
select="document(foundry:gen-path('conf/global.xml'))/foundry:configuration/supported-languages"/>
<foundry:doc section="devel" type="template-tag">
<foundry:doc-desc>
<p>
The language to use by theme engine for static texts etc. The language is determined
as follows:
</p>
<ul>
<li>If the negotiated language is also in the <code>supported-languages</code></li>
<li>If not the language which set by the default attribute of the
<code>&lt;supported-languages&gt;</code> is used, but only if this language
is in the supported languages.</li>
<li>Otherwise the first of the supported languages is used.</li>
</ul>
</foundry:doc-desc>
</foundry:doc>
<xsl:variable name="language">
<xsl:choose>
<xsl:when test="$supported-languages/language[@locale=$negotiated-language]">
<xsl:value-of select="$negotiated-language"/>
</xsl:when>
<xsl:when test="not($supported-languages/language[@locale=$negotiated-language]) and $supported-languages/language[$supported-languages/@default]">
<xsl:value-of select="$supported-languages/language[$supported-languages/@default]"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$supported-languages/language[1]/@locale"/>
</xsl:otherwise>
</xsl:choose>
<foundry:doc section="devel" type="template-tag">
<foundry:doc-desc>
<p>
The language to use by theme engine for static texts etc. The language is determined
as follows:
</p>
<ul>
<li>If the negotiated language is also in the <code>supported-languages</code></li>
<li>If not the language which set by the default attribute of the
<code>&lt;supported-languages&gt;</code> is used, but only if this language
is in the supported languages.</li>
<li>Otherwise the first of the supported languages is used.</li>
</ul>
</foundry:doc-desc>
</foundry:doc>
<xsl:variable name="language">
<xsl:choose>
<xsl:when test="$supported-languages/language[@locale=$negotiated-language]">
<xsl:value-of select="$negotiated-language"/>
</xsl:when>
<xsl:when test="not($supported-languages/language[@locale=$negotiated-language]) and $supported-languages/language[$supported-languages/@default]">
<xsl:value-of select="$supported-languages/language[$supported-languages/@default]"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$supported-languages/language[1]/@locale"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
</xsl:variable>
<!-- **************************************************************************** -->
<!-- **************************************************************************** -->
<!--
Variables describing the user agent.
ToDo: Check if we still need them.
-->
<!--<foundry:doc section="devel" type="evn-var">
<foundry:doc-desc>
<p>
The name of the user agent (browser) which is used to access CCM.
</p>
</foundry:doc-desc>
</foundry:doc>-->
<xsl:param name="user-agent"/>
<!--
Variables describing the user agent.
ToDo: Check if we still need them.
-->
<!--<foundry:doc section="devel" type="evn-var">
<foundry:doc-desc>
<p>
The name of the user agent (browser) which is used to access CCM.
</p>
</foundry:doc-desc>
</foundry:doc>-->
<xsl:param name="user-agent"/>
<xsl:variable name="mozilla-version">
<xsl:value-of select="substring(substring-after($user-agent, 'Mozilla/'), 1, 1)"/>
</xsl:variable>
<xsl:variable name="mozilla-version">
<xsl:value-of select="substring(substring-after($user-agent, 'Mozilla/'), 1, 1)"/>
</xsl:variable>
<!-- Firefox -->
<xsl:variable name="firefox-version">
<xsl:value-of select="substring(substring-after($user-agent, 'Firefox/'), 1, 1)"/>
</xsl:variable>
<!-- Firefox -->
<xsl:variable name="firefox-version">
<xsl:value-of select="substring(substring-after($user-agent, 'Firefox/'), 1, 1)"/>
</xsl:variable>
<!-- Konqueror -->
<xsl:variable name="konqueror-version">
<xsl:value-of select="substring(substring-after($user-agent, 'Konqueror/'), 1, 1)"/>
</xsl:variable>
<!-- Konqueror -->
<xsl:variable name="konqueror-version">
<xsl:value-of select="substring(substring-after($user-agent, 'Konqueror/'), 1, 1)"/>
</xsl:variable>
<!-- Opera -->
<xsl:variable name="opera-version1">
<xsl:value-of select="substring(substring-after($user-agent, 'Opera/'), 1, 1)"/>
</xsl:variable>
<!-- Opera -->
<xsl:variable name="opera-version1">
<xsl:value-of select="substring(substring-after($user-agent, 'Opera/'), 1, 1)"/>
</xsl:variable>
<xsl:variable name="opera-version2">
<xsl:value-of select="substring(substring-after($user-agent, 'Opera '), 1, 1)"/>
</xsl:variable>
<xsl:variable name="opera-version2">
<xsl:value-of select="substring(substring-after($user-agent, 'Opera '), 1, 1)"/>
</xsl:variable>
<!-- MSIE -->
<xsl:variable name="msie_version">
<xsl:value-of select="substring(substring-after($user-agent, 'MSIE '), 1, 1)"/>
</xsl:variable>
<!-- MSIE -->
<xsl:variable name="msie_version">
<xsl:value-of select="substring(substring-after($user-agent, 'MSIE '), 1, 1)"/>
</xsl:variable>
<!-- AppleWebKit -->
<xsl:variable name="webkit_version">
<xsl:value-of select="substring(substring-after($user-agent, 'AppleWebKit/'), 1, 3)"/>
</xsl:variable>
<!-- AppleWebKit -->
<xsl:variable name="webkit_version">
<xsl:value-of select="substring(substring-after($user-agent, 'AppleWebKit/'), 1, 3)"/>
</xsl:variable>
</xsl:stylesheet>

View File

@ -412,7 +412,7 @@
</foundry:doc-see-also>
</foundry:doc>
<xsl:template match="body">
<body>
<body id="site-body">
<xsl:call-template name="foundry:process-layouttree-attributes"/>
<xsl:if test="foundry:debug-enabled()">
@ -427,6 +427,10 @@
<dd>
<xsl:value-of select="$foundry-version"/>
</dd>
<dt>Theme mode</dt>
<dd>
<xsl:value-of select="$theme-mode"/>
</dd>
</dl>
</div>
<div id="foundry-debug-panel-layout" class="foundry-debug-panel-box">
@ -486,7 +490,7 @@
</div>
</xsl:if>
<span id="top"/>
<!--<span id="top"/>-->
<a href="#startcontent" accesskey="S" class="nav-hide">
<xsl:attribute name="title">
<xsl:value-of select="foundry:get-static-text('', 'layout/page/skipnav/title')"/>
@ -1140,7 +1144,7 @@
<xsl:if test="foundry:debug-enabled()">
<link rel="stylesheet"
type="text/css"
href="{foundry:gen-path('foundry/styles/debug-mode.css')}"/>
href="{foundry:gen-path('styles/debug-mode.css', 'internal')}"/>
</xsl:if>
<!-- Not implemented yet <xsl:call-template name="bebop:double-click-protection"/> -->

View File

@ -166,45 +166,17 @@
<xsl:param name="media" select="''"/>
<xsl:param name="origin" select="''"/>
<!--<xsl:variable name="style-dir">
<xsl:choose>
<xsl:when test="$origin = ''">
<xsl:value-of select="'styles/'"/>
</xsl:when>
<xsl:when test="$origin = 'internal'">
<xsl:value-of select="'foundry/styles/'"/>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="starts-with($origin, '/') and ends-with($origin, '/')">
<xsl:value-of select="substring($origin, 2)"/>
</xsl:when>
<xsl:when test="starts-with($origin, '/')">
<xsl:value-of select="concat(substring($origin, 2), '/')"/>
</xsl:when>
<xsl:when test="ends-with($origin, '/')">
<xsl:value-of select="$origin"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat($origin, '/')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>-->
<xsl:choose>
<xsl:when test="string-length($media) &gt; 0">
<link rel="stylesheet"
type="text/css"
href="{foundry:gen-path(concat('css/', $media, '/', $filename, $origin))}"
href="{foundry:gen-path(concat('styles/', $media, '/', $filename, $origin))}"
media="{$media}" />
</xsl:when>
<xsl:otherwise>
<link rel="stylesheet"
type="text/css"
href="{foundry:gen-path(concat('css/', $filename, $origin))}" />
href="{foundry:gen-path(concat('styles/', $filename, $origin))}" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>

View File

@ -185,14 +185,7 @@
<xsl:function name="foundry:gen-path" as="xs:string">
<xsl:param name="path" as="xs:string"/>
<xsl:param name="origin" as="xs:string"/>
<!--<xsl:variable name="theme-mode" select="foundry:get-setting('global',
'theme-mode',
'master')"/>
<xsl:variable name="master-theme" select="foundry:get-setting('global',
'master-theme',
'foundry')"/>-->
<xsl:choose>
<xsl:when test="$origin = ''">
<xsl:sequence select="concat($theme-prefix, '/', $path)"/>
@ -201,7 +194,7 @@
<xsl:sequence select="concat($theme-prefix, '/', $path)"/>
</xsl:when>
<xsl:when test="$origin = 'master' and $theme-mode = 'child'">
<xsl:sequence select="concat($dispatcher-prefix,
<xsl:sequence select="concat($context-prefix,
'/themes/',
$master-theme,
'/',
@ -211,8 +204,8 @@
<xsl:sequence select="concat($theme-prefix, '/foundry/', $path)"/>
</xsl:when>
<xsl:when test="$origin = 'internal' and $theme-mode = 'child'">
<xsl:sequence select="concat($dispatcher-prefix,
'/themes/foundry/',
<xsl:sequence select="concat($context-prefix,
'/themes/foundry/foundry/',
$path)"/>
</xsl:when>
</xsl:choose>