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

View File

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

View File

@ -186,13 +186,6 @@
<xsl:param name="path" as="xs:string"/> <xsl:param name="path" as="xs:string"/>
<xsl:param name="origin" 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:choose>
<xsl:when test="$origin = ''"> <xsl:when test="$origin = ''">
<xsl:sequence select="concat($theme-prefix, '/', $path)"/> <xsl:sequence select="concat($theme-prefix, '/', $path)"/>
@ -201,7 +194,7 @@
<xsl:sequence select="concat($theme-prefix, '/', $path)"/> <xsl:sequence select="concat($theme-prefix, '/', $path)"/>
</xsl:when> </xsl:when>
<xsl:when test="$origin = 'master' and $theme-mode = 'child'"> <xsl:when test="$origin = 'master' and $theme-mode = 'child'">
<xsl:sequence select="concat($dispatcher-prefix, <xsl:sequence select="concat($context-prefix,
'/themes/', '/themes/',
$master-theme, $master-theme,
'/', '/',
@ -211,8 +204,8 @@
<xsl:sequence select="concat($theme-prefix, '/foundry/', $path)"/> <xsl:sequence select="concat($theme-prefix, '/foundry/', $path)"/>
</xsl:when> </xsl:when>
<xsl:when test="$origin = 'internal' and $theme-mode = 'child'"> <xsl:when test="$origin = 'internal' and $theme-mode = 'child'">
<xsl:sequence select="concat($dispatcher-prefix, <xsl:sequence select="concat($context-prefix,
'/themes/foundry/', '/themes/foundry/foundry/',
$path)"/> $path)"/>
</xsl:when> </xsl:when>
</xsl:choose> </xsl:choose>