Additional option for menu to show only selected level and its sub levels but not siblings

git-svn-id: https://svn.libreccm.org/ccm/trunk@3110 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2015-01-30 13:31:41 +00:00
parent d34ff0c008
commit 10d37ff138
1 changed files with 82 additions and 33 deletions

View File

@ -281,6 +281,9 @@
<xsl:with-param name="show-description-text" <xsl:with-param name="show-description-text"
select="foundry:get-attribute-value(current(), 'show-description-text', 'true')" select="foundry:get-attribute-value(current(), 'show-description-text', 'true')"
tunnel="yes"/> tunnel="yes"/>
<xsl:with-param name="selected-only"
tunnel="yes"
select="foundry:boolean(foundry:get-attribute-value(current(), 'selected-only', 'false'))"/>
</xsl:apply-templates> </xsl:apply-templates>
</xsl:template> </xsl:template>
@ -290,6 +293,7 @@
<xsl:param name="min-level" tunnel="yes"/> <xsl:param name="min-level" tunnel="yes"/>
<xsl:param name="max-level" tunnel="yes"/> <xsl:param name="max-level" tunnel="yes"/>
<xsl:param name="show-description-text" tunnel="yes"/> <xsl:param name="show-description-text" tunnel="yes"/>
<xsl:param name="selected-only" tunnel="yes"/>
<xsl:param name="current-level" select="1" tunnel="yes"/> <xsl:param name="current-level" select="1" tunnel="yes"/>
<xsl:param name="current-level-tree" <xsl:param name="current-level-tree"
select="$data-tree//nav:categoryMenu[@id=$navigation-id]/nav:category/nav:category" select="$data-tree//nav:categoryMenu[@id=$navigation-id]/nav:category/nav:category"
@ -350,50 +354,95 @@
<xsl:param name="min-level" tunnel="yes"/> <xsl:param name="min-level" tunnel="yes"/>
<xsl:param name="max-level" tunnel="yes"/> <xsl:param name="max-level" tunnel="yes"/>
<xsl:param name="show-description-text" tunnel="yes"/> <xsl:param name="show-description-text" tunnel="yes"/>
<xsl:param name="selected-only" tunnel="yes"/>
<xsl:param name="current-level" tunnel="yes"/> <xsl:param name="current-level" tunnel="yes"/>
<xsl:param name="current-level-tree" tunnel="yes"/> <xsl:param name="current-level-tree" tunnel="yes"/>
<xsl:param name="navigation-links-tree" tunnel="yes"/> <xsl:param name="navigation-links-tree" tunnel="yes"/>
<xsl:variable name="link-tree" select="current()"/> <xsl:variable name="link-tree" select="current()"/>
<xsl:for-each select="$current-level-tree"> <xsl:choose>
<xsl:apply-templates select="$link-tree/*"> <xsl:when test="$selected-only">
<xsl:with-param name="navigation-id" select="$navigation-id" tunnel="yes"/> <xsl:for-each select="$current-level-tree[@isSelected = 'true']">
<xsl:with-param name="with-colorset" select="$with-colorset" tunnel="yes"/> <xsl:apply-templates select="$link-tree/*">
<xsl:with-param name="min-level" select="$min-level" tunnel="yes"/> <xsl:with-param name="navigation-id" select="$navigation-id" tunnel="yes"/>
<xsl:with-param name="max-level" select="$max-level" tunnel="yes"/> <xsl:with-param name="with-colorset" select="$with-colorset" tunnel="yes"/>
<xsl:with-param name="show-description-text" <xsl:with-param name="min-level" select="$min-level" tunnel="yes"/>
<xsl:with-param name="max-level" select="$max-level" tunnel="yes"/>
<xsl:with-param name="show-description-text"
select="show-description-text" select="show-description-text"
tunnel="yes"/> tunnel="yes"/>
<xsl:with-param name="current-level" select="$current-level" tunnel="yes"/> <xsl:with-param name="current-level" select="$current-level" tunnel="yes"/>
<xsl:with-param name="current-level-tree" <xsl:with-param name="current-level-tree"
select="current()" select="current()"
tunnel="yes"/> tunnel="yes"/>
<xsl:with-param name="navigation-links-tree" <xsl:with-param name="navigation-links-tree"
select="$navigation-links-tree" select="$navigation-links-tree"
tunnel="yes"/> tunnel="yes"/>
<xsl:with-param name="href" select="./@url" tunnel="yes"/> <xsl:with-param name="href" select="./@url" tunnel="yes"/>
<xsl:with-param name="title" tunnel="yes"> <xsl:with-param name="title" tunnel="yes">
<xsl:choose> <xsl:choose>
<xsl:when test="$show-description-text and ./@description"> <xsl:when test="$show-description-text and ./@description">
<xsl:value-of select="./@description"/> <xsl:value-of select="./@description"/>
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
<xsl:value-of select="./@title"/> <xsl:value-of select="./@title"/>
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
</xsl:with-param> </xsl:with-param>
<xsl:with-param name="link-label" select="./@title" tunnel="yes"/> <xsl:with-param name="link-label" select="./@title" tunnel="yes"/>
<xsl:with-param name="class"> <xsl:with-param name="class">
<xsl:if test="./@isSelected = 'true'"> <xsl:if test="./@isSelected = 'true'">
<xsl:value-of select="'active'"/> <xsl:value-of select="'active'"/>
</xsl:if> </xsl:if>
<xsl:if test="$current-level = 2 and $with-colorset = true()"> <xsl:if test="$current-level = 2 and $with-colorset = true()">
<xsl:value-of select="concat(' colorset-', position())"/> <xsl:value-of select="concat(' colorset-', position())"/>
</xsl:if> </xsl:if>
</xsl:with-param> </xsl:with-param>
</xsl:apply-templates> </xsl:apply-templates>
</xsl:for-each> </xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:for-each select="$current-level-tree">
<xsl:apply-templates select="$link-tree/*">
<xsl:with-param name="navigation-id" select="$navigation-id" tunnel="yes"/>
<xsl:with-param name="with-colorset" select="$with-colorset" tunnel="yes"/>
<xsl:with-param name="min-level" select="$min-level" tunnel="yes"/>
<xsl:with-param name="max-level" select="$max-level" tunnel="yes"/>
<xsl:with-param name="show-description-text"
select="show-description-text"
tunnel="yes"/>
<xsl:with-param name="current-level" select="$current-level" tunnel="yes"/>
<xsl:with-param name="current-level-tree"
select="current()"
tunnel="yes"/>
<xsl:with-param name="navigation-links-tree"
select="$navigation-links-tree"
tunnel="yes"/>
<xsl:with-param name="href" select="./@url" tunnel="yes"/>
<xsl:with-param name="title" tunnel="yes">
<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" tunnel="yes"/>
<xsl:with-param name="class">
<xsl:if test="./@isSelected = 'true'">
<xsl:value-of select="'active'"/>
</xsl:if>
<xsl:if test="$current-level = 2 and $with-colorset = true()">
<xsl:value-of select="concat(' colorset-', position())"/>
</xsl:if>
</xsl:with-param>
</xsl:apply-templates>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</xsl:template> </xsl:template>
<xsl:template match="navigation-link//navigation-link-label"> <xsl:template match="navigation-link//navigation-link-label">
@ -408,11 +457,11 @@
<xsl:param name="min-level" tunnel="yes"/> <xsl:param name="min-level" tunnel="yes"/>
<xsl:param name="max-level" tunnel="yes"/> <xsl:param name="max-level" tunnel="yes"/>
<xsl:param name="show-description-text" tunnel="yes"/> <xsl:param name="show-description-text" tunnel="yes"/>
<xsl:param name="selected-only" tunnel="yes"/>
<xsl:param name="current-level" tunnel="yes"/> <xsl:param name="current-level" tunnel="yes"/>
<xsl:param name="current-level-tree" tunnel="yes"/> <xsl:param name="current-level-tree" tunnel="yes"/>
<xsl:param name="navigation-links-tree" tunnel="yes"/> <xsl:param name="navigation-links-tree" tunnel="yes"/>
<xsl:if test="($current-level &lt;= $max-level) and $current-level-tree/nav:category"> <xsl:if test="($current-level &lt;= $max-level) and $current-level-tree/nav:category">
<xsl:apply-templates select="$navigation-links-tree"> <xsl:apply-templates select="$navigation-links-tree">
<xsl:with-param name="navigation-id" select="$navigation-id"/> <xsl:with-param name="navigation-id" select="$navigation-id"/>