Some extensions for Foundry:

- An element with the "with-colorset" attribute will now get two classes: The numbered colorset class (colorset-1, colorset-2 etc)
  *and* a named colorset class (colorset-$name, where $name is the name of currently selected category)
- New attribute "with-application-class" which adds the name of current application to the classes of the element. The class
  has the form "application-$applicationname" where $applicationname is the name of current application as provided in the
  XML from CCM
- New attribute "with-path-classes". If this attribute is set to "yes" a class of the form path-$category-names" is added for each
  catgory in the path. $category-names is a string concatenated from the names of the categories in the path.



git-svn-id: https://svn.libreccm.org/ccm/trunk@4127 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2016-06-01 11:23:17 +00:00
parent 1320957bfc
commit 7a22894ce7
1 changed files with 196 additions and 132 deletions

View File

@ -361,7 +361,7 @@
<xsl:when test="count($data-tree/nav:categoryMenu/nav:category/nav:category[./@isSelected = 'true']) &gt; 0"> <xsl:when test="count($data-tree/nav:categoryMenu/nav:category/nav:category[./@isSelected = 'true']) &gt; 0">
<xsl:for-each select="$data-tree/nav:categoryMenu/nav:category/nav:category"> <xsl:for-each select="$data-tree/nav:categoryMenu/nav:category/nav:category">
<xsl:if test="./@isSelected = 'true'"> <xsl:if test="./@isSelected = 'true'">
<xsl:value-of select="concat('colorset-', position())"/> <xsl:value-of select="concat('colorset-', position(), ' ', 'colorset-', translate(lower-case(./@name), ' ', '-'))"/>
</xsl:if> </xsl:if>
</xsl:for-each> </xsl:for-each>
</xsl:when> </xsl:when>
@ -371,6 +371,54 @@
</xsl:choose> </xsl:choose>
</xsl:function> </xsl:function>
<foundry:doc section="devel" type="function-template">
<foundry:doc-desc>
Helper function to create classes from the current category path
</foundry:doc-desc>
</foundry:doc>
<xsl:function name="foundry:get-path-classes" as="xs:string">
<xsl:choose>
<xsl:when test="count($data-tree/nav:categoryPath) &gt; 0">
<xsl:value-of select="foundry:generate-path-classes(1, '')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="''"/>
</xsl:otherwise>
</xsl:choose>
</xsl:function>
<xsl:function name="foundry:generate-path-classes">
<xsl:param name="index" as="xs:integer"/>
<xsl:param name="classes" as="xs:string"/>
<xsl:choose>
<xsl:when test="$index &gt; count($data-tree/nav:categoryPath/nav:category)">
<xsl:value-of select="$classes"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="foundry:generate-path-classes($index + 1, concat($classes, ' ', foundry:generate-path-class($index, 1, 'path')))"/>
<!--<xsl:value-of select="concat('path-', translate(lower-case($data-tree/nav:categoryPath/nav:category[$index]/@name), ' ', '-'))"/>-->
</xsl:otherwise>
</xsl:choose>
</xsl:function>
<xsl:function name="foundry:generate-path-class">
<xsl:param name="index" as="xs:integer"/>
<xsl:param name="current-index" as="xs:integer"/>
<xsl:param name="class" as="xs:string"/>
<xsl:choose>
<xsl:when test="$current-index &gt; $index">
<xsl:value-of select="$class"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="foundry:generate-path-class($index, $current-index + 1, concat($class, '-', translate(lower-case($data-tree/nav:categoryPath/nav:category[$current-index]/@name), ' ', '-')))"/>
</xsl:otherwise>
</xsl:choose>
</xsl:function>
<foundry:doc section="devel" type="function-template"> <foundry:doc section="devel" type="function-template">
<foundry:doc-desc> <foundry:doc-desc>
Helper functions for retrieving the name of the content type of the current content item Helper functions for retrieving the name of the content type of the current content item
@ -628,8 +676,20 @@
</xsl:if> </xsl:if>
</xsl:variable> </xsl:variable>
<xsl:variable name="application-class">
<xsl:if test="foundry:boolean($current-layout-node/@with-application-class)">
<xsl:value-of select="concat('application-', $data-tree/@application)"/>
</xsl:if>
</xsl:variable>
<xsl:variable name="path-classes">
<xsl:if test="foundry:boolean($current-layout-node/@with-path-classes)">
<xsl:value-of select="foundry:get-path-classes()"/>
</xsl:if>
</xsl:variable>
<xsl:variable name="type-class"> <xsl:variable name="type-class">
<xsl:if test="$current-layout-node/@set-type-class='true'"> <xsl:if test="foundry:boolean($current-layout-node/@with-type-class)">
<xsl:value-of select="foundry:get-content-type-name()"/> <xsl:value-of select="foundry:get-content-type-name()"/>
</xsl:if> </xsl:if>
</xsl:variable> </xsl:variable>
@ -665,6 +725,10 @@
' ', ' ',
$cond-class, $cond-class,
' ', ' ',
$application-class,
' ',
$path-classes,
' ',
$type-class, $type-class,
' ', ' ',
$color-class))"/> $color-class))"/>