You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2008/03/04 02:39:54 UTC
svn commit: r633348 - in /lenya/sandbox/modules/docustyle: sitemap.xmap
xslt/beforeCache.xsl xslt/navigation/ xslt/navigation/menu.xsl
xslt/navigation/tabs.xsl
Author: andreas
Date: Mon Mar 3 17:39:49 2008
New Revision: 633348
URL: http://svn.apache.org/viewvc?rev=633348&view=rev
Log:
Updating docustyle module to use navigation module.
Added:
lenya/sandbox/modules/docustyle/xslt/navigation/
lenya/sandbox/modules/docustyle/xslt/navigation/menu.xsl
lenya/sandbox/modules/docustyle/xslt/navigation/tabs.xsl
Modified:
lenya/sandbox/modules/docustyle/sitemap.xmap
lenya/sandbox/modules/docustyle/xslt/beforeCache.xsl
Modified: lenya/sandbox/modules/docustyle/sitemap.xmap
URL: http://svn.apache.org/viewvc/lenya/sandbox/modules/docustyle/sitemap.xmap?rev=633348&r1=633347&r2=633348&view=diff
==============================================================================
--- lenya/sandbox/modules/docustyle/sitemap.xmap (original)
+++ lenya/sandbox/modules/docustyle/sitemap.xmap Mon Mar 3 17:39:49 2008
@@ -31,6 +31,14 @@
<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
<map:components>
+ <map:generators default="file">
+ <map:generator name="menu" logger="lenya.generators.menu" src="org.apache.lenya.modules.navigation.SiteFragmentGenerator">
+ <map:parameter name="selector" value="org.apache.lenya.modules.navigation.SubtreeSelector"/>
+ </map:generator>
+ <map:generator name="tabs" logger="lenya.generators.breadcrumb" src="org.apache.lenya.modules.navigation.SiteFragmentGenerator">
+ <map:parameter name="selector" value="org.apache.lenya.modules.navigation.ChildrenSelector"/>
+ </map:generator>
+ </map:generators>
<map:transformers default="xslt">
<map:transformer name="metaData" logger="lenya.sitemap.transformer.metaData" src="org.apache.lenya.cms.cocoon.transformation.MetaDataTransformer"/>
</map:transformers>
@@ -77,7 +85,7 @@
</map:pipeline>
- <map:pipeline>
+ <map:pipeline type="noncaching">
<!-- Cacheable pipeline. -->
<!-- {1:pub}/{2:area}/{3:uuid}/{4:defaultLang}/{5:lang}/{6:path} -->
<map:match pattern="pageContext/*/*/*/*/*/**">
@@ -87,6 +95,7 @@
<map:parameter name="area" value="{2}"/>
<map:parameter name="uuid" value="{3}"/>
<map:parameter name="language" value="{5}"/>
+ <map:parameter name="path" value="{6}"/>
</map:transform>
<map:transform src="fallback://lenya/modules/docustyle/xslt/addNavIncludes.xsl">
<map:parameter name="params" value="{1}/{2}/{4}/{5}/{6}"/>
@@ -99,6 +108,32 @@
<!-- This is the pipeline that ultimately builds the page. -->
<map:pipeline type="noncaching">
+
+ <map:match pattern="menu/*">
+ <map:generate type="menu">
+ <map:parameter name="pub" value="{page-envelope:publication-id}"/>
+ <map:parameter name="area" value="{page-envelope:area}"/>
+ <map:parameter name="lang" value="{page-envelope:language}"/>
+ <map:parameter name="path" value="{page-envelope:document-path}"/>
+ <map:parameter name="selectorPath" value="/{1}"/>
+ </map:generate>
+ <map:transform type="sitemeta"/>
+ <map:transform src="fallback://lenya/modules/docustyle/xslt/navigation/menu.xsl"/>
+ <map:serialize/>
+ </map:match>
+
+ <map:match pattern="tabs">
+ <map:generate type="tabs">
+ <map:parameter name="pub" value="{page-envelope:publication-id}"/>
+ <map:parameter name="area" value="{page-envelope:area}"/>
+ <map:parameter name="lang" value="{page-envelope:language}"/>
+ <map:parameter name="path" value="{page-envelope:document-path}"/>
+ <map:parameter name="selectorPath" value="/"/>
+ </map:generate>
+ <map:transform src="fallback://lenya/modules/docustyle/xslt/navigation/tabs.xsl"/>
+ <map:serialize/>
+ </map:match>
+
<!--
This matcher takes the raw aggregated page content and applies SVG rendering and a doctype-specific
Modified: lenya/sandbox/modules/docustyle/xslt/beforeCache.xsl
URL: http://svn.apache.org/viewvc/lenya/sandbox/modules/docustyle/xslt/beforeCache.xsl?rev=633348&r1=633347&r2=633348&view=diff
==============================================================================
--- lenya/sandbox/modules/docustyle/xslt/beforeCache.xsl (original)
+++ lenya/sandbox/modules/docustyle/xslt/beforeCache.xsl Mon Mar 3 17:39:49 2008
@@ -35,6 +35,7 @@
<xsl:param name="area"/>
<xsl:param name="uuid"/>
<xsl:param name="language"/>
+ <xsl:param name="path"/>
<xsl:template match="/*">
<html>
@@ -72,13 +73,21 @@
</div>
<div id="tagline">Open Source Content Management</div>
</div>
+ <!--
<lenya:navElement name="tabs"/>
+ -->
+ <i:include src="cocoon:/tabs"/>
<div id="tabsSeparator"/>
</div>
<div id="main">
- <lenya:navElement name="menu"/>
- <lenya:navElement name="breadcrumb"/>
+ <xsl:variable name="firstPathStep">
+ <xsl:choose>
+ <xsl:when test="contains($path, '/')"><xsl:value-of select="substring-before($path, '/')"/></xsl:when>
+ <xsl:otherwise><xsl:value-of select="$path"/></xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <i:include src="cocoon:/menu/{$firstPathStep}"/>
<div id="body"/>
</div>
</div>
Added: lenya/sandbox/modules/docustyle/xslt/navigation/menu.xsl
URL: http://svn.apache.org/viewvc/lenya/sandbox/modules/docustyle/xslt/navigation/menu.xsl?rev=633348&view=auto
==============================================================================
--- lenya/sandbox/modules/docustyle/xslt/navigation/menu.xsl (added)
+++ lenya/sandbox/modules/docustyle/xslt/navigation/menu.xsl Mon Mar 3 17:39:49 2008
@@ -0,0 +1,125 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<!-- $Id: menu.xsl 42703 2004-03-13 12:57:53Z gregor $ -->
+
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:site="http://apache.org/lenya/site/1.0"
+ xmlns="http://www.w3.org/1999/xhtml"
+ exclude-result-prefixes="site"
+ >
+
+ <xsl:template match="site:fragment">
+ <ul id="menu">
+ <xsl:apply-templates select="site:node"/>
+ </ul>
+ </xsl:template>
+
+
+ <xsl:template match="site:node">
+ <xsl:param name="parent-id"/>
+ <xsl:variable name="id" select="concat($parent-id, position())"/>
+ <xsl:call-template name="item">
+ <xsl:with-param name="id" select="$id"/>
+ </xsl:call-template>
+ </xsl:template>
+
+
+ <xsl:template name="children">
+ <xsl:param name="id"/>
+ <xsl:if test="site:node">
+ <ul id="menu-{$id}">
+ <xsl:apply-templates select="site:node">
+ <xsl:with-param name="parent-id" select="concat($id, '.')"/>
+ </xsl:apply-templates>
+ </ul>
+ </xsl:if>
+ </xsl:template>
+
+
+ <xsl:template name="item">
+ <xsl:param name="id"/>
+ <xsl:choose>
+ <xsl:when test="@current = 'true'">
+ <xsl:call-template name="item-selected">
+ <xsl:with-param name="id" select="$id"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="item-default">
+ <xsl:with-param name="id" select="$id"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+
+ <xsl:template name="item-default">
+ <xsl:param name="id"/>
+ <li id="menuitem-{$id}">
+ <xsl:call-template name="menuItemClass"/>
+ <a>
+ <xsl:choose>
+ <xsl:when test="site:link/@href">
+ <xsl:copy-of select="site:link/@href"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="onclick">javascript:toggleMenu('menuitem-<xsl:value-of select="$id"/>');</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:value-of select="site:link/@label"/>
+ </a>
+ <xsl:call-template name="children">
+ <xsl:with-param name="id" select="$id"/>
+ </xsl:call-template>
+ </li>
+ </xsl:template>
+
+
+ <xsl:template name="menuItemClass">
+ <xsl:param name="baseClass"/>
+ <xsl:attribute name="class">
+ <xsl:if test="$baseClass">
+ <xsl:value-of select="$baseClass"/>
+ <xsl:text> </xsl:text>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="site:node and (@ancestorOfCurrent = 'true' or @current = 'true')">open</xsl:when>
+ <xsl:when test="site:node">closed</xsl:when>
+ </xsl:choose>
+ </xsl:attribute>
+
+ </xsl:template>
+
+
+ <xsl:template name="item-selected">
+ <xsl:param name="id"/>
+ <li id="menuitem-{$id}">
+ <xsl:call-template name="menuItemClass">
+ <xsl:with-param name="baseClass">selected</xsl:with-param>
+ </xsl:call-template>
+ <span><xsl:value-of select="site:link/@label"/></span>
+ <xsl:call-template name="children">
+ <xsl:with-param name="id" select="$id"/>
+ </xsl:call-template>
+ </li>
+ </xsl:template>
+
+
+</xsl:stylesheet>
Added: lenya/sandbox/modules/docustyle/xslt/navigation/tabs.xsl
URL: http://svn.apache.org/viewvc/lenya/sandbox/modules/docustyle/xslt/navigation/tabs.xsl?rev=633348&view=auto
==============================================================================
--- lenya/sandbox/modules/docustyle/xslt/navigation/tabs.xsl (added)
+++ lenya/sandbox/modules/docustyle/xslt/navigation/tabs.xsl Mon Mar 3 17:39:49 2008
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<!-- $Id: tabs.xsl 189880 2005-06-10 02:36:09Z gregor $ -->
+
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:site="http://apache.org/lenya/site/1.0"
+ xmlns="http://www.w3.org/1999/xhtml"
+ exclude-result-prefixes="site"
+ >
+
+ <xsl:template match="site:fragment">
+ <ul id="tabs">
+ <xsl:apply-templates select="site:node"/>
+ </ul>
+ </xsl:template>
+
+
+ <xsl:template match="site:node">
+ <li>
+ <xsl:attribute name="class">
+ <xsl:text>tab</xsl:text>
+ <xsl:if test="@current = 'true' or @ancestorOfCurrent = 'true'">
+ <xsl:text>-selected</xsl:text>
+ </xsl:if>
+ </xsl:attribute>
+ <a>
+ <xsl:if test="not(@current = 'true' or @ancestorOfCurrent = 'true')">
+ <xsl:copy-of select="site:link/@href"/>
+ </xsl:if>
+ <span><xsl:value-of select="site:link/@label"/></span>
+ </a>
+ </li>
+ </xsl:template>
+
+
+</xsl:stylesheet>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org