You are viewing a plain text version of this content. The canonical link for it is here.
Posted to svn@forrest.apache.org by th...@apache.org on 2006/01/29 21:46:30 UTC

svn commit: r373354 - in /forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher: dataModel.xmap internal.xmap menu.xmap tabs.xmap

Author: thorsten
Date: Sun Jan 29 12:45:49 2006
New Revision: 373354

URL: http://svn.apache.org/viewcvs?rev=373354&view=rev
Log:
Bugfix 738 - refactored the menu and tab code and removed all calls to *.html which have let to a loop. As well removed code/resources in the spirit of FOR-798

Removed:
    forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/menu.xmap
    forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/tabs.xmap
Modified:
    forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/dataModel.xmap
    forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/internal.xmap

Modified: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/dataModel.xmap
URL: http://svn.apache.org/viewcvs/forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/dataModel.xmap?rev=373354&r1=373353&r2=373354&view=diff
==============================================================================
--- forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/dataModel.xmap (original)
+++ forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/dataModel.xmap Sun Jan 29 12:45:49 2006
@@ -82,45 +82,134 @@
     </map:pipeline>
     <map:pipeline>
       <!-- navigation for the current request -->
-      <map:match pattern="*.navigation.xml">
+      <map:match pattern="**.navigation.xml">
         <map:aggregate element="navigation">
-          <map:part src="cocoon:/tab-{1}.html" element="tab" />
-          <map:part src="cocoon:/menu-{1}.html" element="menu" />
+          <map:part src="cocoon:/{1}.tab.xml" element="tab" />
+          <map:part src="cocoon:/{1}.menu.xml" element="menu" />
         </map:aggregate>
         <map:serialize />
       </map:match>
     </map:pipeline>
     <map:pipeline>
-      <map:match pattern="**/*.navigation.xml">
-        <map:aggregate element="navigation">
-          <map:part src="cocoon:/{1}/tab-{2}.html" element="tab" />
-          <map:part src="cocoon:/{1}/menu-{2}.html" element="menu" />
-        </map:aggregate>
-        <map:serialize />
-      </map:match>
-    </map:pipeline>
-    <map:pipeline>
-      <!-- navigation for the current request PART menu-->
-      <map:match pattern="**book-*.html">
-        <map:mount uri-prefix="" src="menu.xmap" check-reload="yes" />
-      </map:match>
-    </map:pipeline>
-    <map:pipeline>
-      <map:match pattern="**menu-*.html">
-        <map:generate src="cocoon:/{1}book-{2}.html" />
+      <map:match pattern="**.menu.xml">
+        <map:generate src="cocoon://{1}.book.xml" />
         <map:transform type="linkrewriter"
-          src="cocoon://{1}linkmap-{2}.html" />
+          src="cocoon://linkmap-{1}" />
         <map:transform src="{lm:transform.html.broken-links}"/>
         <map:transform src="{lm:dataModel-html-book-to-menu.xsl}">
-          <map:parameter name="path" value="{1}{2}.html" />
+          <map:parameter name="path" value="{1}.html" />
         </map:transform>
         <map:serialize />
       </map:match>
     </map:pipeline>
     <map:pipeline>
       <!-- navigation for the current request PART tab-->
-      <map:match pattern="**tab-*.html">
-        <map:mount uri-prefix="" src="tabs.xmap" check-reload="yes" />
+       <map:match pattern="**.tab.xml">
+        <map:select type="exists">
+          <map:when test="{project:content.xdocs}tabs.xml">
+            <map:generate src="{project:content.xdocs}tabs.xml"/>
+          </map:when>
+          <map:when test="{lm:tabs.xml}">
+            <map:generate src="{lm:tabs.xml}"/>
+          </map:when>
+          <map:otherwise>
+            <map:generate src="{project:content.xdocs}tabs.xml"/>
+          </map:otherwise>
+        </map:select>
+        <map:transform type="xinclude"/>
+        <map:select type="config">
+          <map:parameter name="value" value="{defaults:i18n}"/>
+          <map:when test="true">
+            <map:act type="locale">
+              <map:transform src="{forrest:stylesheets}/i18n.xsl"/>
+              <map:transform type="i18n">
+                <map:parameter name="locale" value="{request:locale}"/>
+              </map:transform>
+            </map:act>
+          </map:when>
+        </map:select>
+        <map:transform type="linkrewriter" src="cocoon://linkmap-{1}"/>
+        <map:transform src="{lm:dataModel-html-tab-to-menu.xsl}">
+        <!--<map:transform src="{lm:dataModel-html-tab2menu.xsl}">-->
+          <map:parameter name="path" value="{1}{2}.html"/>
+        </map:transform>
+        <map:serialize />
+      </map:match>
+    </map:pipeline>
+      <map:pipeline>
+      <map:match pattern="**.book.xml">
+        <map:match pattern="**/*.book.xml">
+          <map:select type="exists">
+          <map:when test="{project:content.xdocs}{1}book.xml">
+            <!-- If a hand-created book.xml exists, use it -->
+            <map:parameter name="url" 
+              value="{project:content.xdocs}{1}book.xml" />
+            <map:generate src="{project:content.xdocs}{1}book.xml" />
+          </map:when>
+          <map:otherwise>
+            <!-- If no book.xml, generate it from the linkmap. -->
+            <map:generate src="cocoon:/menulinks-{1}{2}" />
+            <!-- The above generates the subset of the linkmap relevant to our directory. -->
+            <map:transform src="{forrest:stylesheets}/site-to-book.xsl" />
+          </map:otherwise>
+        </map:select>
+        </map:match>
+        <map:match pattern="*.book.xml">
+          <map:select type="exists">
+          <map:when test="{project:content.xdocs}/book.xml">
+            <!-- If a hand-created book.xml exists, use it -->
+            <map:parameter name="url" 
+              value="{project:content.xdocs}/book.xml" />
+            <map:generate src="{project:content.xdocs}/book.xml" />
+          </map:when>
+          <map:otherwise>
+            <!-- If no book.xml, generate it from the linkmap. -->
+            <map:generate src="cocoon:/menulinks-{1}" />
+            <!-- The above generates the subset of the linkmap relevant to our directory. -->
+            <map:transform src="{forrest:stylesheets}/site-to-book.xsl" />
+          </map:otherwise>
+        </map:select>
+        </map:match>
+        <map:select type="config">
+          <map:parameter name="value" value="{defaults:i18n}"/>
+          <map:when test="true">
+            <map:act type="locale">
+              <map:transform src="{forrest:stylesheets}/i18n.xsl"/>
+              <map:transform type="i18n">
+                <!-- We can use a default locale attribute or Request Parameter
+                <map:parameter name="locale" value="{defaults:locale}"/>
+                <map:parameter name="locale" value="{lang}{country}{variant}"-->
+                <map:parameter name="locale" value="{request:locale}"/>
+              </map:transform>
+            </map:act>
+          </map:when>
+        </map:select>
+        <map:serialize type="xml"/>
+      </map:match>
+      <map:match pattern="**menulinks-*">
+        <map:generate src="cocoon://site.navigation.links.xml"/>
+        <map:transform type="xinclude"/>
+        <map:transform src="{forrest:stylesheets}/absolutize-linkmap.xsl" />
+        <map:select type="config">
+          <map:parameter name="value" value="{defaults:menu-scheme}"/>
+          <map:when test="tab_attributes">
+            <map:transform 
+              src="{forrest:stylesheets}/site-to-site-normalizetabs.xsl" />
+            <map:transform src="{forrest:stylesheets}/normalizehrefs.xsl"/>
+            <map:transform src="{forrest:stylesheets}/site-to-site-selectnode.xsl">
+              <map:parameter name="path" value="{1}{2}.html"/>
+            </map:transform>
+          </map:when>
+          <map:when test="directories">
+            <map:transform type="xpath">
+              <map:parameter name="include" value="//*[@href='{1}']" />
+            </map:transform>
+          </map:when>
+        </map:select>
+        <map:transform src="{forrest:stylesheets}/relativize-linkmap.xsl">
+          <map:parameter name="path" value="{1}{2}.html" />
+        </map:transform>
+        <map:serialize type="xml" />
       </map:match>
     </map:pipeline>
   </map:pipelines>

Modified: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/internal.xmap
URL: http://svn.apache.org/viewcvs/forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/internal.xmap?rev=373354&r1=373353&r2=373354&view=diff
==============================================================================
--- forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/internal.xmap (original)
+++ forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/internal.xmap Sun Jan 29 12:45:49 2006
@@ -42,6 +42,8 @@
     <map:selectors>
       <map:selector logger="sitemap.selector.exists" name="exists"
         src="org.apache.forrest.sourceexists.SourceExistsSelector" />
+      <map:selector logger="sitemap.selector.config" name="config" 
+        src="org.apache.cocoon.selection.SimpleSelector" />
     </map:selectors>
     <map:generators default="file">
       <map:generator name="traverse"
@@ -85,6 +87,9 @@
         src="org.apache.cocoon.serialization.TextSerializer"
         mime-type="text/plain" logger="sitemap.serializer.text" />
     </map:serializers>
+      <map:actions>
+      <map:action name="locale" src="org.apache.cocoon.acting.LocaleAction" />
+    </map:actions>
   </map:components>
   <map:resources>
     <map:resource name="jx-transformer">