svn commit: r619333 - in /lenya/trunk/src/webapp: global-sitemap.xmap lenya/xslt/modules/modules2xinclude.xsl

[email protected]
Newsgroups gmane.comp.cms.lenya.cvs
Message-ID <[email protected]>
Author: andreas
Date: Thu Feb  7 01:49:22 2008
New Revision: 619333

URL: http://svn.apache.org/viewvc?rev=619333&view=rev
Log:
Cleaned up and simplified menu aggregation code.

Modified:
    lenya/trunk/src/webapp/global-sitemap.xmap
    lenya/trunk/src/webapp/lenya/xslt/modules/modules2xinclude.xsl

Modified: lenya/trunk/src/webapp/global-sitemap.xmap
URL: http://svn.apache.org/viewvc/lenya/trunk/src/webapp/global-sitemap.xmap?rev=619333&r1=619332&r2=619333&view=diff
==============================================================================
--- lenya/trunk/src/webapp/global-sitemap.xmap (original)
+++ lenya/trunk/src/webapp/global-sitemap.xmap Thu Feb  7 01:49:22 2008
@@ -131,11 +131,7 @@
           <map:serialize type="xml"/>
         </map:match>
         <!-- for everything else: --> 
-        <map:aggregate element="menu" ns="http://apache.org/cocoon/lenya/menubar/1.0">
-          <map:part src="cocoon:/menu-xml/{1}/{2}/{3}" strip-root="true"/>
-          <map:part src="cocoon:/menu-xml/modules.xml" strip-root="true"/>
-        </map:aggregate>
-        <map:transform src="lenya/xslt/menu/merge-menus.xsl"/>
+        <map:generate src="cocoon:/menu-xml/{1}.xml"/>
         <map:transform type="menufilter"/>
         <!-- Disable menu items according to usecase policies -->
         <map:transform type="usecasemenu"/>
@@ -163,12 +159,15 @@
       </map:match>
 
 
-      <!-- collect the menu items for all modules used in the publication -->
-      <!-- menu-xml/modules.xml -->
-      <map:match pattern="menu-xml/modules.xml">
+      <!-- collect the menu items for the publication and all modules used in the publication -->
+      <!-- menu-xml/{pubId}.xml -->
+      <map:match pattern="menu-xml/*.xml">
         <map:generate src="aggregate-fallback://config/publication.xml"/>
-        <map:transform src="lenya/xslt/modules/modules2xinclude.xsl"/>
+        <map:transform src="lenya/xslt/modules/modules2xinclude.xsl">
+          <map:parameter name="pub" value="{1}"/>
+        </map:transform>
         <map:transform type="xinclude"/>
+        <map:transform src="lenya/xslt/menu/merge-menus.xsl"/>
         <map:serialize type="xml"/>
       </map:match>
   
@@ -184,10 +183,7 @@
             <map:generate src="fallback://lenya/modules/{1}/config/menu.xml"/>
             <map:serialize type="xml"/>
           </map:when>
-          <map:when test="fallback://lenya/modules/{1}/config/menu.xsp">
-            <map:generate src="fallback://lenya/modules/{1}/config/menu.xsp" type="serverpages"/>
-            <map:serialize type="xml"/>
-          </map:when>
+          <!-- @deprecated: Mount menus.xmap for backwards-compatibility reasons -->
           <map:when test="fallback://lenya/modules/{1}/menus.xmap">
             <map:mount uri-prefix="menu-xml/module/" src="{fallback:lenya/modules/{1}/menus.xmap}" check-reload="true" reload-method="synchron" pass-through="true"/>
           </map:when>
@@ -199,8 +195,8 @@
       </map:match>
 
       <!-- include publication-specific menus -->
-      <!-- menu-xml/{publication-id}/... -->
-      <map:match pattern="menu-xml/*/**" internal-only="true">
+      <!-- menu-xml/pub/{publication-id}/... -->
+      <map:match pattern="menu-xml/pub/*.xml" internal-only="true">
         <map:select type="resource-exists">
           <map:when test="fallback://lenya/pubs/{1}/config/menu.xml">
             <map:generate src="fallback://lenya/pubs/{1}/config/menu.xml"/>
@@ -208,7 +204,7 @@
           </map:when>
           <!-- @deprecated: Mount menus.xmap for backwards-compatibility reasons -->
           <map:otherwise>
-            <map:mount uri-prefix="menu-xml/{1}/" src="{fallback:menus.xmap}" check-reload="true" reload-method="synchron" pass-through="true"/>
+            <map:mount uri-prefix="menu-xml/pub/{1}" src="{fallback:menus.xmap}" check-reload="true" reload-method="synchron" pass-through="true"/>
           </map:otherwise>
         </map:select>
       </map:match>

Modified: lenya/trunk/src/webapp/lenya/xslt/modules/modules2xinclude.xsl
URL: http://svn.apache.org/viewvc/lenya/trunk/src/webapp/lenya/xslt/modules/modules2xinclude.xsl?rev=619333&r1=619332&r2=619333&view=diff
==============================================================================
--- lenya/trunk/src/webapp/lenya/xslt/modules/modules2xinclude.xsl (original)
+++ lenya/trunk/src/webapp/lenya/xslt/modules/modules2xinclude.xsl Thu Feb  7 01:49:22 2008
@@ -23,10 +23,13 @@
     xmlns:menu="http://apache.org/cocoon/lenya/menubar/1.0"
     xmlns:xi="http://www.w3.org/2001/XInclude"
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
->
+>
+  
+  <xsl:param name="pub"/>
 
   <xsl:template match="lenya:publication">
     <menu:menu>
+      <xi:include href="cocoon:/menu-xml/pub/{$pub}.xml" xpointer="xpointer(/*/*)"/>
       <xsl:apply-templates select="lenya:modules/lenya:module"/>
     </menu:menu>
   </xsl:template>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.