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 2005/07/05 02:26:36 UTC
svn commit: r209151 - in
/forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view:
./ lib/ resources/stylesheets/
Author: thorsten
Date: Mon Jul 4 17:26:35 2005
New Revision: 209151
URL: http://svn.apache.org/viewcvs?rev=209151&view=rev
Log:
Activated per dir view fallbacks. That means we match now file-specific->(sub-)dir-specific->plugin specific views. This change makes the conf/default.fv view obsolete, because we now expecting it in xdocs/default.fv.
Added:
forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/
forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/databases-block.jar (with props)
forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/eventcache-block.jar (with props)
forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/jms-block.jar (with props)
forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/readme.txt (with props)
forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/repository-block.jar (with props)
forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/includes-viewLocationmap.xsl (with props)
forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/viewLocationmap.xsl (with props)
forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/viewLocationmap2path.xsl (with props)
Modified:
forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/internal.xmap
Modified: forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/internal.xmap
URL: http://svn.apache.org/viewcvs/forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/internal.xmap?rev=209151&r1=209150&r2=209151&view=diff
==============================================================================
--- forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/internal.xmap (original)
+++ forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/internal.xmap Mon Jul 4 17:26:35 2005
@@ -22,6 +22,13 @@
<map:selector logger="sitemap.selector.exists" name="exists" src="org.apache.forrest.sourceexists.SourceExistsSelector" />
</map:selectors>
<map:generators default="file">
+ <map:generator
+ name="traverse"
+ src="org.apache.cocoon.generation.TraversableGenerator"
+ logger="sitemap.generator.traverse"
+ label="content"
+ pool-max="16"
+ />
<map:generator name="directory" src="org.apache.cocoon.generation.DirectoryGenerator" />
<map:generator label="content" logger="sitemap.generator.jx" name="jx" pool-grow="2" pool-max="16" pool-min="2" src="org.apache.cocoon.generation.JXTemplateGenerator"/>
</map:generators>
@@ -76,35 +83,33 @@
prepares and transforms the requested contracts (viewHelper) and populate them with the content (businessHelper).
-->
<map:pipeline>
+ <!--Refactor for dir-->
+ <map:match pattern="viewLocationmap.xml">
+ <map:generate type="traverse" src="{project:content.xdocs}">
+ <map:parameter name="depth" value="100"/>
+ <map:parameter name="exclude" value="[\w]*.svn"/>
+ <!--<map:parameter name="include" value="[\w]*.fv"/>-->
+ </map:generate>
+ <map:transform src="resources/stylesheets/viewLocationmap.xsl"/>
+ <map:serialize type="xml"/>
+ </map:match>
+
+
<!--
View config resolver
File specific views have priority before default ones.
If no views can be found in the project we use the default one of the view plugin.
-->
<map:match pattern="prepare.view.**">
- <map:select type="exists">
- <!--
- Here we will have to test, whether the requested page needs a specific view.
- This will be assumed as soon there is a .fv
- e.g. index.xml + index.fv
- -->
- <map:when test="{project:content.xdocs}{1}.fv">
- <map:generate src="{project:content.xdocs}{1}.fv"/>
- </map:when>
- <!--
- If there is no file specific view then use the default.fv of the project stored in "project.conf-dir".
- -->
- <map:when test="{project:conf}/default.fv">
- <map:generate src="{project:conf}/default.fv"/>
- </map:when>
- <!--
- If the above not matches then get the default view of this plugin.
- -->
- <map:otherwise>
- <map:generate src="resources/views/default.fv"/>
- </map:otherwise>
- </map:select>
- <map:serialize type="xml"/>
+ <map:generate src="cocoon:/viewLocationmap.xml"/>
+ <map:transform src="resources/stylesheets/viewLocationmap2path.xsl"/>
+ <map:transform src="resources/stylesheets/includes-viewLocationmap.xsl">
+ <map:parameter value="{1}" name="path"/>
+ <map:parameter value="{project:content.xdocs}" name="root"/>
+ <map:parameter value="resources/views/default.fv" name="viewFallback"/>
+ </map:transform>
+ <map:transform type="xinclude"/>
+ <map:serialize type="xml"/>
</map:match>
<!--Add businessHelper to the presentation model that the content can be used later on.-->
Added: forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/databases-block.jar
URL: http://svn.apache.org/viewcvs/forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/databases-block.jar?rev=209151&view=auto
==============================================================================
Binary file - no diff available.
Propchange: forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/databases-block.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/eventcache-block.jar
URL: http://svn.apache.org/viewcvs/forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/eventcache-block.jar?rev=209151&view=auto
==============================================================================
Binary file - no diff available.
Propchange: forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/eventcache-block.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/jms-block.jar
URL: http://svn.apache.org/viewcvs/forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/jms-block.jar?rev=209151&view=auto
==============================================================================
Binary file - no diff available.
Propchange: forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/jms-block.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/readme.txt
URL: http://svn.apache.org/viewcvs/forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/readme.txt?rev=209151&view=auto
==============================================================================
--- forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/readme.txt (added)
+++ forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/readme.txt Mon Jul 4 17:26:35 2005
@@ -0,0 +1 @@
+Place any libraries required by your plugin in this directory.
\ No newline at end of file
Propchange: forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/readme.txt
------------------------------------------------------------------------------
svn:keywords = Id svn:eol-style=native
Added: forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/repository-block.jar
URL: http://svn.apache.org/viewcvs/forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/repository-block.jar?rev=209151&view=auto
==============================================================================
Binary file - no diff available.
Propchange: forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/repository-block.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/includes-viewLocationmap.xsl
URL: http://svn.apache.org/viewcvs/forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/includes-viewLocationmap.xsl?rev=209151&view=auto
==============================================================================
--- forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/includes-viewLocationmap.xsl (added)
+++ forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/includes-viewLocationmap.xsl Mon Jul 4 17:26:35 2005
@@ -0,0 +1,157 @@
+<?xml version="1.0"?>
+<!--
+ Copyright 2002-2004 The Apache Software Foundation or its licensors,
+ as applicable.
+
+ Licensed 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.
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:collection="http://apache.org/cocoon/collection/1.0"
+ xmlns:xi="http://www.w3.org/2001/XInclude"
+ xmlns:dyn="http://exslt.org/dynamic">
+
+ <xsl:param name="defaultView" select="'default.fv'"/>
+ <xsl:param name="rootElement" select="'/xdocs/'"/>
+ <xsl:param name="path" select="'.'"/>
+ <xsl:param name="root" select="'xdocs'"/>
+ <xsl:param name="viewFallback" select="'resources/views/default.fv'"/>
+ <xsl:variable name="lastFallback" select="boolean(/xdocs/*[local-name()=$defaultView])"/>
+ <!--
+ *viewSelector* project-xdocs
+ will return which view is responsible for the requested path.
+ If no view (choice|fallback) could be found the template will return the viewFallback.
+
+ ex.:
+ 1.request: index
+ First choice: index.fv
+ First/last fallback: default.fv
+
+ 2.request: sample/index
+ First choice: sample/index.fv
+ First fallback: sample/default.fv
+ Last fallback: default.fv
+
+ 3.request: sample/subdir/index
+ First choice: sample/subdir/index.fv
+ First fallback: sample/subdir/default.fv
+ Second fallback: sample/default.fv
+ Last fallback: default.fv
+
+ ...
+
+ des.:
+ The parent view (root-view) inherits to its children until
+ a child is overriding this view. This override can be used for
+ directories (default.fv) and/or files (*.fv).
+ That means that the root view is the default view as long no other
+ view can be found in the requested child.
+ -->
+ <xsl:template match="/">
+ <!--<xsl:comment>
+ lastFallback: <xsl:value-of select="$lastFallback"/>
+ root: <xsl:value-of select="$root"/>
+ request: <xsl:value-of select="$path"/>
+ default view: <xsl:value-of select="$defaultView"/>
+ function-available('dyn:evaluate') <xsl:value-of select="function-available('dyn:evaluate')"/>
+ </xsl:comment>-->
+ <xsl:variable name="view2response">
+ <xsl:call-template name="viewSelector">
+ <xsl:with-param name="request" select="concat($path,'.fv')"/>
+ <xsl:with-param name="rest" select="''"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <!--Nothing can be found, returning the default.fv-->
+ <xsl:if test="not($lastFallback) and $view2response=''">
+ <xi:include href="{$viewFallback}"/>
+ </xsl:if>
+ <!--The lastFallback can be found, returning this-->
+ <xsl:if test="$lastFallback and $view2response=''">
+ <xi:include href="{concat('file://', $root,$defaultView)}"/>
+ </xsl:if>
+ <!--Some fallback can be found that is not the last one-->
+ <xsl:if test="$view2response!=''">
+ <xi:include href="{concat('file://', $root,$view2response)}"/>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template name="viewSelector">
+ <xsl:param name="request" select="''"/>
+ <xsl:param name="rest" select="''"/>
+ <xsl:param name="view2response" select="''"/>
+ <xsl:if test="contains($request,'/')">
+ <xsl:variable name="nextRequest" select="substring-after($request,'/')"/>
+ <xsl:variable name="currentDir" select="substring-before($request,'/')"/>
+ <!--<xsl:comment>
+ request: <xsl:value-of select="$request"/>
+ currentDir: <xsl:value-of select="$currentDir"/>
+ currentDir has default view: <xsl:value-of select="boolean(dyn:evaluate(concat($rootElement,$rest,$currentDir,'/',$defaultView)))"/>
+ next request: <xsl:value-of select="$nextRequest"/>
+ rest: <xsl:value-of select="$rest"/>
+ view2response: <xsl:value-of select="$view2response"/>
+ </xsl:comment>-->
+ <!--In the path are still directories-->
+ <xsl:if test="boolean(dyn:evaluate(concat($rootElement,$rest,$currentDir,'/',$defaultView)))">
+ <!--<xsl:comment>view2response set - <xsl:value-of select="(concat($rest,$currentDir,'/',$defaultView)"/></xsl:comment>-->
+ <xsl:variable name="viewTemp" select="concat($rest,$currentDir,'/',$defaultView)"/>
+ <xsl:call-template name="viewSelector">
+ <xsl:with-param name="request" select="$nextRequest"/>
+ <xsl:with-param name="rest" select="concat($rest,$currentDir,'/')"/>
+ <xsl:with-param name="view2response" select="$viewTemp"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="not(dyn:evaluate(concat($rootElement,$rest,$currentDir,'/',$defaultView)))">
+ <!--<xsl:comment>no view2response set</xsl:comment>-->
+ <xsl:if test="$view2response=''">
+ <xsl:variable name="viewTemp" select="''"/>
+ <xsl:call-template name="viewSelector">
+ <xsl:with-param name="request" select="$nextRequest"/>
+ <xsl:with-param name="rest" select="concat($rest,$currentDir,'/')"/>
+ <xsl:with-param name="view2response" select="$viewTemp"/>
+ </xsl:call-template>
+ </xsl:if>
+ <xsl:if test="$view2response!=''">
+ <xsl:variable name="viewTemp" select="$view2response"/>
+ <xsl:call-template name="viewSelector">
+ <xsl:with-param name="request" select="$nextRequest"/>
+ <xsl:with-param name="rest" select="concat($rest,$currentDir,'/')"/>
+ <xsl:with-param name="view2response" select="$viewTemp"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="not(contains($request,'/'))">
+ <!--<xsl:comment>
+ request: <xsl:value-of select="$request"/>
+ rest: <xsl:value-of select="$rest"/>
+ iteration: <xsl:value-of select="number($iteration)"/>
+ view2response: <xsl:value-of select="$view2response"/>
+ </xsl:comment>-->
+ <xsl:if test="not(dyn:evaluate(concat($rootElement, $rest, $request)))">
+ <!--<xsl:comment>no file specific override</xsl:comment>-->
+ <xsl:if test="boolean(dyn:evaluate(concat($rootElement,$rest,$defaultView)))">
+ <!--<xsl:comment>dir specific override</xsl:comment>-->
+ <xsl:value-of select="concat($rest,$defaultView)"/>
+ </xsl:if>
+ <xsl:if test="not(dyn:evaluate(concat($rootElement,$rest,$defaultView)))">
+ <!--<xsl:comment>no dir specific override</xsl:comment>-->
+ <xsl:value-of select="$view2response"/>
+ </xsl:if>
+ </xsl:if>
+ <xsl:if test="boolean(dyn:evaluate(concat($rootElement, $rest, $request)))">
+ <!--<xsl:comment>file specific override</xsl:comment>-->
+ <xsl:value-of select="concat($rest, $request)"/>
+ </xsl:if>
+ </xsl:if>
+ </xsl:template>
+
+</xsl:stylesheet>
Propchange: forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/includes-viewLocationmap.xsl
------------------------------------------------------------------------------
svn:keywords = Id svn:eol-style=native
Added: forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/viewLocationmap.xsl
URL: http://svn.apache.org/viewcvs/forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/viewLocationmap.xsl?rev=209151&view=auto
==============================================================================
--- forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/viewLocationmap.xsl (added)
+++ forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/viewLocationmap.xsl Mon Jul 4 17:26:35 2005
@@ -0,0 +1,42 @@
+<?xml version="1.0"?>
+<!--
+ Copyright 2002-2004 The Apache Software Foundation or its licensors,
+ as applicable.
+
+ Licensed 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.
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:collection="http://apache.org/cocoon/collection/1.0">
+ <xsl:variable name="includePattern" select="'.fv'"/>
+
+ <xsl:template match="/">
+ <xsl:apply-templates/>
+ </xsl:template>
+ <xsl:template match="collection:collection">
+ <dir name="{@name}">
+ <xsl:apply-templates/>
+ </dir>
+ </xsl:template>
+ <xsl:template match="collection:resource[contains(@name,$includePattern)]">
+ <view name="{@name}">
+ <xsl:apply-templates/>
+ </view>
+ </xsl:template>
+ <!--/collection:resource[contains(@name,$includePattern)]-->
+ <!-- <xsl:template match="//*/*[contains(@name,$includePattern)]">
+ <xsl:variable name="parent" select="../."/>
+ <node id="{$parent/@name}"/>
+ <!-#-<xsl:copy-of select="$parent"/>-#->
+ </xsl:template>-->
+
+</xsl:stylesheet>
Propchange: forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/viewLocationmap.xsl
------------------------------------------------------------------------------
svn:keywords = Id svn:eol-style=native
Added: forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/viewLocationmap2path.xsl
URL: http://svn.apache.org/viewcvs/forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/viewLocationmap2path.xsl?rev=209151&view=auto
==============================================================================
--- forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/viewLocationmap2path.xsl (added)
+++ forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/viewLocationmap2path.xsl Mon Jul 4 17:26:35 2005
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+<!--
+ Copyright 2002-2004 The Apache Software Foundation or its licensors,
+ as applicable.
+
+ Licensed 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.
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:collection="http://apache.org/cocoon/collection/1.0">
+
+ <xsl:template match="/">
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <xsl:template match="dir[view or dir]">
+ <xsl:element name="{@name}">
+ <xsl:apply-templates/>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template match="view">
+ <xsl:element name="{@name}"/>
+ </xsl:template>
+
+</xsl:stylesheet>
Propchange: forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/viewLocationmap2path.xsl
------------------------------------------------------------------------------
svn:keywords = Id svn:eol-style=native
Re: svn commit: r209151 - in
/forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view:
./ lib/ resources/stylesheets/
Posted by Thorsten Scherler <th...@apache.org>.
On Thu, 2005-07-07 at 18:12 +0200, Johannes Schaefer wrote:
> Just a curiosity:
>
> I remembered vaguely the discussion and this mail
> about the file-dir-general configuration file.
>
> We came across a similar problem in a cocoon project
> and I digged in here ... which solved our problem!
> We reuse
> org\apache\forrest\sourceexists\SourceExistsSelector.class
>
> So, a special thanks to whomever wrote this selector
> and to Thorsten for this submit :-)
>
lol
:)
salu2
> Shouldn't something like this not be part of cocoon
> in the first place?
>
> Johannes
>
>
>
> thorsten@apache.org schrieb:
> > Author: thorsten
> > Date: Mon Jul 4 17:26:35 2005
> > New Revision: 209151
> >
> > URL: http://svn.apache.org/viewcvs?rev=209151&view=rev
> > Log:
> > Activated per dir view fallbacks. That means we match now file-specific->(sub-)dir-specific->plugin specific views. This change makes the conf/default.fv view obsolete, because we now expecting it in xdocs/default.fv.
> >
> > Added:
> > forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/
> > forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/databases-block.jar (with props)
> > forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/eventcache-block.jar (with props)
> > forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/jms-block.jar (with props)
> > forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/readme.txt (with props)
> > forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/repository-block.jar (with props)
> > forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/includes-viewLocationmap.xsl (with props)
> > forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/viewLocationmap.xsl (with props)
> > forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/viewLocationmap2path.xsl (with props)
> > Modified:
> > forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/internal.xmap
> >
> > Modified: forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/internal.xmap
> > URL: http://svn.apache.org/viewcvs/forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/internal.xmap?rev=209151&r1=209150&r2=209151&view=diff
> > ==============================================================================
> > --- forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/internal.xmap (original)
> > +++ forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/internal.xmap Mon Jul 4 17:26:35 2005
> > @@ -22,6 +22,13 @@
> > <map:selector logger="sitemap.selector.exists" name="exists" src="org.apache.forrest.sourceexists.SourceExistsSelector" />
> > </map:selectors>
> > <map:generators default="file">
> > + <map:generator
> > + name="traverse"
> > + src="org.apache.cocoon.generation.TraversableGenerator"
> > + logger="sitemap.generator.traverse"
> > + label="content"
> > + pool-max="16"
> > + />
> > <map:generator name="directory" src="org.apache.cocoon.generation.DirectoryGenerator" />
> > <map:generator label="content" logger="sitemap.generator.jx" name="jx" pool-grow="2" pool-max="16" pool-min="2" src="org.apache.cocoon.generation.JXTemplateGenerator"/>
> > </map:generators>
> > @@ -76,35 +83,33 @@
> > prepares and transforms the requested contracts (viewHelper) and populate them with the content (businessHelper).
> > -->
> > <map:pipeline>
> > + <!--Refactor for dir-->
> > + <map:match pattern="viewLocationmap.xml">
> > + <map:generate type="traverse" src="{project:content.xdocs}">
> > + <map:parameter name="depth" value="100"/>
> > + <map:parameter name="exclude" value="[\w]*.svn"/>
> > + <!--<map:parameter name="include" value="[\w]*.fv"/>-->
> > + </map:generate>
> > + <map:transform src="resources/stylesheets/viewLocationmap.xsl"/>
> > + <map:serialize type="xml"/>
> > + </map:match>
> > +
> > +
> > <!--
> > View config resolver
> > File specific views have priority before default ones.
> > If no views can be found in the project we use the default one of the view plugin.
> > -->
> > <map:match pattern="prepare.view.**">
> > - <map:select type="exists">
> > - <!--
> > - Here we will have to test, whether the requested page needs a specific view.
> > - This will be assumed as soon there is a .fv
> > - e.g. index.xml + index.fv
> > - -->
> > - <map:when test="{project:content.xdocs}{1}.fv">
> > - <map:generate src="{project:content.xdocs}{1}.fv"/>
> > - </map:when>
> > - <!--
> > - If there is no file specific view then use the default.fv of the project stored in "project.conf-dir".
> > - -->
> > - <map:when test="{project:conf}/default.fv">
> > - <map:generate src="{project:conf}/default.fv"/>
> > - </map:when>
> > - <!--
> > - If the above not matches then get the default view of this plugin.
> > - -->
> > - <map:otherwise>
> > - <map:generate src="resources/views/default.fv"/>
> > - </map:otherwise>
> > - </map:select>
> > - <map:serialize type="xml"/>
> > + <map:generate src="cocoon:/viewLocationmap.xml"/>
> > + <map:transform src="resources/stylesheets/viewLocationmap2path.xsl"/>
> > + <map:transform src="resources/stylesheets/includes-viewLocationmap.xsl">
> > + <map:parameter value="{1}" name="path"/>
> > + <map:parameter value="{project:content.xdocs}" name="root"/>
> > + <map:parameter value="resources/views/default.fv" name="viewFallback"/>
> > + </map:transform>
> > + <map:transform type="xinclude"/>
> > + <map:serialize type="xml"/>
> > </map:match>
> >
> > <!--Add businessHelper to the presentation model that the content can be used later on.-->
> >
> > Added: forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/databases-block.jar
> > URL: http://svn.apache.org/viewcvs/forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/databases-block.jar?rev=209151&view=auto
> > ==============================================================================
> > Binary file - no diff available.
> >
> > Propchange: forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/databases-block.jar
> > ------------------------------------------------------------------------------
> > svn:mime-type = application/octet-stream
> >
> > Added: forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/eventcache-block.jar
> > URL: http://svn.apache.org/viewcvs/forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/eventcache-block.jar?rev=209151&view=auto
> > ==============================================================================
> > Binary file - no diff available.
> >
> > Propchange: forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/eventcache-block.jar
> > ------------------------------------------------------------------------------
> > svn:mime-type = application/octet-stream
> >
> > Added: forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/jms-block.jar
> > URL: http://svn.apache.org/viewcvs/forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/jms-block.jar?rev=209151&view=auto
> > ==============================================================================
> > Binary file - no diff available.
> >
> > Propchange: forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/jms-block.jar
> > ------------------------------------------------------------------------------
> > svn:mime-type = application/octet-stream
> >
> > Added: forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/readme.txt
> > URL: http://svn.apache.org/viewcvs/forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/readme.txt?rev=209151&view=auto
> > ==============================================================================
> > --- forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/readme.txt (added)
> > +++ forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/readme.txt Mon Jul 4 17:26:35 2005
> > @@ -0,0 +1 @@
> > +Place any libraries required by your plugin in this directory.
> > \ No newline at end of file
> >
> > Propchange: forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/readme.txt
> > ------------------------------------------------------------------------------
> > svn:keywords = Id svn:eol-style=native
> >
> > Added: forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/repository-block.jar
> > URL: http://svn.apache.org/viewcvs/forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/repository-block.jar?rev=209151&view=auto
> > ==============================================================================
> > Binary file - no diff available.
> >
> > Propchange: forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/repository-block.jar
> > ------------------------------------------------------------------------------
> > svn:mime-type = application/octet-stream
> >
> > Added: forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/includes-viewLocationmap.xsl
> > URL: http://svn.apache.org/viewcvs/forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/includes-viewLocationmap.xsl?rev=209151&view=auto
> > ==============================================================================
> > --- forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/includes-viewLocationmap.xsl (added)
> > +++ forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/includes-viewLocationmap.xsl Mon Jul 4 17:26:35 2005
> > @@ -0,0 +1,157 @@
> > +<?xml version="1.0"?>
> > +<!--
> > + Copyright 2002-2004 The Apache Software Foundation or its licensors,
> > + as applicable.
> > +
> > + Licensed 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.
> > +-->
> > +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> > + xmlns:collection="http://apache.org/cocoon/collection/1.0"
> > + xmlns:xi="http://www.w3.org/2001/XInclude"
> > + xmlns:dyn="http://exslt.org/dynamic">
> > +
> > + <xsl:param name="defaultView" select="'default.fv'"/>
> > + <xsl:param name="rootElement" select="'/xdocs/'"/>
> > + <xsl:param name="path" select="'.'"/>
> > + <xsl:param name="root" select="'xdocs'"/>
> > + <xsl:param name="viewFallback" select="'resources/views/default.fv'"/>
> > + <xsl:variable name="lastFallback" select="boolean(/xdocs/*[local-name()=$defaultView])"/>
> > + <!--
> > + *viewSelector* project-xdocs
> > + will return which view is responsible for the requested path.
> > + If no view (choice|fallback) could be found the template will return the viewFallback.
> > +
> > + ex.:
> > + 1.request: index
> > + First choice: index.fv
> > + First/last fallback: default.fv
> > +
> > + 2.request: sample/index
> > + First choice: sample/index.fv
> > + First fallback: sample/default.fv
> > + Last fallback: default.fv
> > +
> > + 3.request: sample/subdir/index
> > + First choice: sample/subdir/index.fv
> > + First fallback: sample/subdir/default.fv
> > + Second fallback: sample/default.fv
> > + Last fallback: default.fv
> > +
> > + ...
> > +
> > + des.:
> > + The parent view (root-view) inherits to its children until
> > + a child is overriding this view. This override can be used for
> > + directories (default.fv) and/or files (*.fv).
> > + That means that the root view is the default view as long no other
> > + view can be found in the requested child.
> > + -->
> > + <xsl:template match="/">
> > + <!--<xsl:comment>
> > + lastFallback: <xsl:value-of select="$lastFallback"/>
> > + root: <xsl:value-of select="$root"/>
> > + request: <xsl:value-of select="$path"/>
> > + default view: <xsl:value-of select="$defaultView"/>
> > + function-available('dyn:evaluate') <xsl:value-of select="function-available('dyn:evaluate')"/>
> > + </xsl:comment>-->
> > + <xsl:variable name="view2response">
> > + <xsl:call-template name="viewSelector">
> > + <xsl:with-param name="request" select="concat($path,'.fv')"/>
> > + <xsl:with-param name="rest" select="''"/>
> > + </xsl:call-template>
> > + </xsl:variable>
> > + <!--Nothing can be found, returning the default.fv-->
> > + <xsl:if test="not($lastFallback) and $view2response=''">
> > + <xi:include href="{$viewFallback}"/>
> > + </xsl:if>
> > + <!--The lastFallback can be found, returning this-->
> > + <xsl:if test="$lastFallback and $view2response=''">
> > + <xi:include href="{concat('file://', $root,$defaultView)}"/>
> > + </xsl:if>
> > + <!--Some fallback can be found that is not the last one-->
> > + <xsl:if test="$view2response!=''">
> > + <xi:include href="{concat('file://', $root,$view2response)}"/>
> > + </xsl:if>
> > + </xsl:template>
> > +
> > + <xsl:template name="viewSelector">
> > + <xsl:param name="request" select="''"/>
> > + <xsl:param name="rest" select="''"/>
> > + <xsl:param name="view2response" select="''"/>
> > + <xsl:if test="contains($request,'/')">
> > + <xsl:variable name="nextRequest" select="substring-after($request,'/')"/>
> > + <xsl:variable name="currentDir" select="substring-before($request,'/')"/>
> > + <!--<xsl:comment>
> > + request: <xsl:value-of select="$request"/>
> > + currentDir: <xsl:value-of select="$currentDir"/>
> > + currentDir has default view: <xsl:value-of select="boolean(dyn:evaluate(concat($rootElement,$rest,$currentDir,'/',$defaultView)))"/>
> > + next request: <xsl:value-of select="$nextRequest"/>
> > + rest: <xsl:value-of select="$rest"/>
> > + view2response: <xsl:value-of select="$view2response"/>
> > + </xsl:comment>-->
> > + <!--In the path are still directories-->
> > + <xsl:if test="boolean(dyn:evaluate(concat($rootElement,$rest,$currentDir,'/',$defaultView)))">
> > + <!--<xsl:comment>view2response set - <xsl:value-of select="(concat($rest,$currentDir,'/',$defaultView)"/></xsl:comment>-->
> > + <xsl:variable name="viewTemp" select="concat($rest,$currentDir,'/',$defaultView)"/>
> > + <xsl:call-template name="viewSelector">
> > + <xsl:with-param name="request" select="$nextRequest"/>
> > + <xsl:with-param name="rest" select="concat($rest,$currentDir,'/')"/>
> > + <xsl:with-param name="view2response" select="$viewTemp"/>
> > + </xsl:call-template>
> > + </xsl:if>
> > + <xsl:if test="not(dyn:evaluate(concat($rootElement,$rest,$currentDir,'/',$defaultView)))">
> > + <!--<xsl:comment>no view2response set</xsl:comment>-->
> > + <xsl:if test="$view2response=''">
> > + <xsl:variable name="viewTemp" select="''"/>
> > + <xsl:call-template name="viewSelector">
> > + <xsl:with-param name="request" select="$nextRequest"/>
> > + <xsl:with-param name="rest" select="concat($rest,$currentDir,'/')"/>
> > + <xsl:with-param name="view2response" select="$viewTemp"/>
> > + </xsl:call-template>
> > + </xsl:if>
> > + <xsl:if test="$view2response!=''">
> > + <xsl:variable name="viewTemp" select="$view2response"/>
> > + <xsl:call-template name="viewSelector">
> > + <xsl:with-param name="request" select="$nextRequest"/>
> > + <xsl:with-param name="rest" select="concat($rest,$currentDir,'/')"/>
> > + <xsl:with-param name="view2response" select="$viewTemp"/>
> > + </xsl:call-template>
> > + </xsl:if>
> > + </xsl:if>
> > + </xsl:if>
> > + <xsl:if test="not(contains($request,'/'))">
> > + <!--<xsl:comment>
> > + request: <xsl:value-of select="$request"/>
> > + rest: <xsl:value-of select="$rest"/>
> > + iteration: <xsl:value-of select="number($iteration)"/>
> > + view2response: <xsl:value-of select="$view2response"/>
> > + </xsl:comment>-->
> > + <xsl:if test="not(dyn:evaluate(concat($rootElement, $rest, $request)))">
> > + <!--<xsl:comment>no file specific override</xsl:comment>-->
> > + <xsl:if test="boolean(dyn:evaluate(concat($rootElement,$rest,$defaultView)))">
> > + <!--<xsl:comment>dir specific override</xsl:comment>-->
> > + <xsl:value-of select="concat($rest,$defaultView)"/>
> > + </xsl:if>
> > + <xsl:if test="not(dyn:evaluate(concat($rootElement,$rest,$defaultView)))">
> > + <!--<xsl:comment>no dir specific override</xsl:comment>-->
> > + <xsl:value-of select="$view2response"/>
> > + </xsl:if>
> > + </xsl:if>
> > + <xsl:if test="boolean(dyn:evaluate(concat($rootElement, $rest, $request)))">
> > + <!--<xsl:comment>file specific override</xsl:comment>-->
> > + <xsl:value-of select="concat($rest, $request)"/>
> > + </xsl:if>
> > + </xsl:if>
> > + </xsl:template>
> > +
> > +</xsl:stylesheet>
> >
> > Propchange: forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/includes-viewLocationmap.xsl
> > ------------------------------------------------------------------------------
> > svn:keywords = Id svn:eol-style=native
> >
> > Added: forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/viewLocationmap.xsl
> > URL: http://svn.apache.org/viewcvs/forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/viewLocationmap.xsl?rev=209151&view=auto
> > ==============================================================================
> > --- forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/viewLocationmap.xsl (added)
> > +++ forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/viewLocationmap.xsl Mon Jul 4 17:26:35 2005
> > @@ -0,0 +1,42 @@
> > +<?xml version="1.0"?>
> > +<!--
> > + Copyright 2002-2004 The Apache Software Foundation or its licensors,
> > + as applicable.
> > +
> > + Licensed 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.
> > +-->
> > +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> > + xmlns:collection="http://apache.org/cocoon/collection/1.0">
> > + <xsl:variable name="includePattern" select="'.fv'"/>
> > +
> > + <xsl:template match="/">
> > + <xsl:apply-templates/>
> > + </xsl:template>
> > + <xsl:template match="collection:collection">
> > + <dir name="{@name}">
> > + <xsl:apply-templates/>
> > + </dir>
> > + </xsl:template>
> > + <xsl:template match="collection:resource[contains(@name,$includePattern)]">
> > + <view name="{@name}">
> > + <xsl:apply-templates/>
> > + </view>
> > + </xsl:template>
> > + <!--/collection:resource[contains(@name,$includePattern)]-->
> > + <!-- <xsl:template match="//*/*[contains(@name,$includePattern)]">
> > + <xsl:variable name="parent" select="../."/>
> > + <node id="{$parent/@name}"/>
> > + <!-#-<xsl:copy-of select="$parent"/>-#->
> > + </xsl:template>-->
> > +
> > +</xsl:stylesheet>
> >
> > Propchange: forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/viewLocationmap.xsl
> > ------------------------------------------------------------------------------
> > svn:keywords = Id svn:eol-style=native
> >
> > Added: forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/viewLocationmap2path.xsl
> > URL: http://svn.apache.org/viewcvs/forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/viewLocationmap2path.xsl?rev=209151&view=auto
> > ==============================================================================
> > --- forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/viewLocationmap2path.xsl (added)
> > +++ forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/viewLocationmap2path.xsl Mon Jul 4 17:26:35 2005
> > @@ -0,0 +1,35 @@
> > +<?xml version="1.0"?>
> > +<!--
> > + Copyright 2002-2004 The Apache Software Foundation or its licensors,
> > + as applicable.
> > +
> > + Licensed 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.
> > +-->
> > +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> > + xmlns:collection="http://apache.org/cocoon/collection/1.0">
> > +
> > + <xsl:template match="/">
> > + <xsl:apply-templates/>
> > + </xsl:template>
> > +
> > + <xsl:template match="dir[view or dir]">
> > + <xsl:element name="{@name}">
> > + <xsl:apply-templates/>
> > + </xsl:element>
> > + </xsl:template>
> > +
> > + <xsl:template match="view">
> > + <xsl:element name="{@name}"/>
> > + </xsl:template>
> > +
> > +</xsl:stylesheet>
> >
> > Propchange: forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/viewLocationmap2path.xsl
> > ------------------------------------------------------------------------------
> > svn:keywords = Id svn:eol-style=native
> >
> >
> >
>
>
--
thorsten
"Together we stand, divided we fall!"
Hey you (Pink Floyd)
Re: svn commit: r209151 - in /forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view:
./ lib/ resources/stylesheets/
Posted by Johannes Schaefer <jo...@uidesign.de>.
Just a curiosity:
I remembered vaguely the discussion and this mail
about the file-dir-general configuration file.
We came across a similar problem in a cocoon project
and I digged in here ... which solved our problem!
We reuse
org\apache\forrest\sourceexists\SourceExistsSelector.class
So, a special thanks to whomever wrote this selector
and to Thorsten for this submit :-)
Shouldn't something like this not be part of cocoon
in the first place?
Johannes
thorsten@apache.org schrieb:
> Author: thorsten
> Date: Mon Jul 4 17:26:35 2005
> New Revision: 209151
>
> URL: http://svn.apache.org/viewcvs?rev=209151&view=rev
> Log:
> Activated per dir view fallbacks. That means we match now file-specific->(sub-)dir-specific->plugin specific views. This change makes the conf/default.fv view obsolete, because we now expecting it in xdocs/default.fv.
>
> Added:
> forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/
> forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/databases-block.jar (with props)
> forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/eventcache-block.jar (with props)
> forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/jms-block.jar (with props)
> forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/readme.txt (with props)
> forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/repository-block.jar (with props)
> forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/includes-viewLocationmap.xsl (with props)
> forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/viewLocationmap.xsl (with props)
> forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/viewLocationmap2path.xsl (with props)
> Modified:
> forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/internal.xmap
>
> Modified: forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/internal.xmap
> URL: http://svn.apache.org/viewcvs/forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/internal.xmap?rev=209151&r1=209150&r2=209151&view=diff
> ==============================================================================
> --- forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/internal.xmap (original)
> +++ forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/internal.xmap Mon Jul 4 17:26:35 2005
> @@ -22,6 +22,13 @@
> <map:selector logger="sitemap.selector.exists" name="exists" src="org.apache.forrest.sourceexists.SourceExistsSelector" />
> </map:selectors>
> <map:generators default="file">
> + <map:generator
> + name="traverse"
> + src="org.apache.cocoon.generation.TraversableGenerator"
> + logger="sitemap.generator.traverse"
> + label="content"
> + pool-max="16"
> + />
> <map:generator name="directory" src="org.apache.cocoon.generation.DirectoryGenerator" />
> <map:generator label="content" logger="sitemap.generator.jx" name="jx" pool-grow="2" pool-max="16" pool-min="2" src="org.apache.cocoon.generation.JXTemplateGenerator"/>
> </map:generators>
> @@ -76,35 +83,33 @@
> prepares and transforms the requested contracts (viewHelper) and populate them with the content (businessHelper).
> -->
> <map:pipeline>
> + <!--Refactor for dir-->
> + <map:match pattern="viewLocationmap.xml">
> + <map:generate type="traverse" src="{project:content.xdocs}">
> + <map:parameter name="depth" value="100"/>
> + <map:parameter name="exclude" value="[\w]*.svn"/>
> + <!--<map:parameter name="include" value="[\w]*.fv"/>-->
> + </map:generate>
> + <map:transform src="resources/stylesheets/viewLocationmap.xsl"/>
> + <map:serialize type="xml"/>
> + </map:match>
> +
> +
> <!--
> View config resolver
> File specific views have priority before default ones.
> If no views can be found in the project we use the default one of the view plugin.
> -->
> <map:match pattern="prepare.view.**">
> - <map:select type="exists">
> - <!--
> - Here we will have to test, whether the requested page needs a specific view.
> - This will be assumed as soon there is a .fv
> - e.g. index.xml + index.fv
> - -->
> - <map:when test="{project:content.xdocs}{1}.fv">
> - <map:generate src="{project:content.xdocs}{1}.fv"/>
> - </map:when>
> - <!--
> - If there is no file specific view then use the default.fv of the project stored in "project.conf-dir".
> - -->
> - <map:when test="{project:conf}/default.fv">
> - <map:generate src="{project:conf}/default.fv"/>
> - </map:when>
> - <!--
> - If the above not matches then get the default view of this plugin.
> - -->
> - <map:otherwise>
> - <map:generate src="resources/views/default.fv"/>
> - </map:otherwise>
> - </map:select>
> - <map:serialize type="xml"/>
> + <map:generate src="cocoon:/viewLocationmap.xml"/>
> + <map:transform src="resources/stylesheets/viewLocationmap2path.xsl"/>
> + <map:transform src="resources/stylesheets/includes-viewLocationmap.xsl">
> + <map:parameter value="{1}" name="path"/>
> + <map:parameter value="{project:content.xdocs}" name="root"/>
> + <map:parameter value="resources/views/default.fv" name="viewFallback"/>
> + </map:transform>
> + <map:transform type="xinclude"/>
> + <map:serialize type="xml"/>
> </map:match>
>
> <!--Add businessHelper to the presentation model that the content can be used later on.-->
>
> Added: forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/databases-block.jar
> URL: http://svn.apache.org/viewcvs/forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/databases-block.jar?rev=209151&view=auto
> ==============================================================================
> Binary file - no diff available.
>
> Propchange: forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/databases-block.jar
> ------------------------------------------------------------------------------
> svn:mime-type = application/octet-stream
>
> Added: forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/eventcache-block.jar
> URL: http://svn.apache.org/viewcvs/forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/eventcache-block.jar?rev=209151&view=auto
> ==============================================================================
> Binary file - no diff available.
>
> Propchange: forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/eventcache-block.jar
> ------------------------------------------------------------------------------
> svn:mime-type = application/octet-stream
>
> Added: forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/jms-block.jar
> URL: http://svn.apache.org/viewcvs/forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/jms-block.jar?rev=209151&view=auto
> ==============================================================================
> Binary file - no diff available.
>
> Propchange: forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/jms-block.jar
> ------------------------------------------------------------------------------
> svn:mime-type = application/octet-stream
>
> Added: forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/readme.txt
> URL: http://svn.apache.org/viewcvs/forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/readme.txt?rev=209151&view=auto
> ==============================================================================
> --- forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/readme.txt (added)
> +++ forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/readme.txt Mon Jul 4 17:26:35 2005
> @@ -0,0 +1 @@
> +Place any libraries required by your plugin in this directory.
> \ No newline at end of file
>
> Propchange: forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/readme.txt
> ------------------------------------------------------------------------------
> svn:keywords = Id svn:eol-style=native
>
> Added: forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/repository-block.jar
> URL: http://svn.apache.org/viewcvs/forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/repository-block.jar?rev=209151&view=auto
> ==============================================================================
> Binary file - no diff available.
>
> Propchange: forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/lib/repository-block.jar
> ------------------------------------------------------------------------------
> svn:mime-type = application/octet-stream
>
> Added: forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/includes-viewLocationmap.xsl
> URL: http://svn.apache.org/viewcvs/forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/includes-viewLocationmap.xsl?rev=209151&view=auto
> ==============================================================================
> --- forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/includes-viewLocationmap.xsl (added)
> +++ forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/includes-viewLocationmap.xsl Mon Jul 4 17:26:35 2005
> @@ -0,0 +1,157 @@
> +<?xml version="1.0"?>
> +<!--
> + Copyright 2002-2004 The Apache Software Foundation or its licensors,
> + as applicable.
> +
> + Licensed 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.
> +-->
> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> + xmlns:collection="http://apache.org/cocoon/collection/1.0"
> + xmlns:xi="http://www.w3.org/2001/XInclude"
> + xmlns:dyn="http://exslt.org/dynamic">
> +
> + <xsl:param name="defaultView" select="'default.fv'"/>
> + <xsl:param name="rootElement" select="'/xdocs/'"/>
> + <xsl:param name="path" select="'.'"/>
> + <xsl:param name="root" select="'xdocs'"/>
> + <xsl:param name="viewFallback" select="'resources/views/default.fv'"/>
> + <xsl:variable name="lastFallback" select="boolean(/xdocs/*[local-name()=$defaultView])"/>
> + <!--
> + *viewSelector* project-xdocs
> + will return which view is responsible for the requested path.
> + If no view (choice|fallback) could be found the template will return the viewFallback.
> +
> + ex.:
> + 1.request: index
> + First choice: index.fv
> + First/last fallback: default.fv
> +
> + 2.request: sample/index
> + First choice: sample/index.fv
> + First fallback: sample/default.fv
> + Last fallback: default.fv
> +
> + 3.request: sample/subdir/index
> + First choice: sample/subdir/index.fv
> + First fallback: sample/subdir/default.fv
> + Second fallback: sample/default.fv
> + Last fallback: default.fv
> +
> + ...
> +
> + des.:
> + The parent view (root-view) inherits to its children until
> + a child is overriding this view. This override can be used for
> + directories (default.fv) and/or files (*.fv).
> + That means that the root view is the default view as long no other
> + view can be found in the requested child.
> + -->
> + <xsl:template match="/">
> + <!--<xsl:comment>
> + lastFallback: <xsl:value-of select="$lastFallback"/>
> + root: <xsl:value-of select="$root"/>
> + request: <xsl:value-of select="$path"/>
> + default view: <xsl:value-of select="$defaultView"/>
> + function-available('dyn:evaluate') <xsl:value-of select="function-available('dyn:evaluate')"/>
> + </xsl:comment>-->
> + <xsl:variable name="view2response">
> + <xsl:call-template name="viewSelector">
> + <xsl:with-param name="request" select="concat($path,'.fv')"/>
> + <xsl:with-param name="rest" select="''"/>
> + </xsl:call-template>
> + </xsl:variable>
> + <!--Nothing can be found, returning the default.fv-->
> + <xsl:if test="not($lastFallback) and $view2response=''">
> + <xi:include href="{$viewFallback}"/>
> + </xsl:if>
> + <!--The lastFallback can be found, returning this-->
> + <xsl:if test="$lastFallback and $view2response=''">
> + <xi:include href="{concat('file://', $root,$defaultView)}"/>
> + </xsl:if>
> + <!--Some fallback can be found that is not the last one-->
> + <xsl:if test="$view2response!=''">
> + <xi:include href="{concat('file://', $root,$view2response)}"/>
> + </xsl:if>
> + </xsl:template>
> +
> + <xsl:template name="viewSelector">
> + <xsl:param name="request" select="''"/>
> + <xsl:param name="rest" select="''"/>
> + <xsl:param name="view2response" select="''"/>
> + <xsl:if test="contains($request,'/')">
> + <xsl:variable name="nextRequest" select="substring-after($request,'/')"/>
> + <xsl:variable name="currentDir" select="substring-before($request,'/')"/>
> + <!--<xsl:comment>
> + request: <xsl:value-of select="$request"/>
> + currentDir: <xsl:value-of select="$currentDir"/>
> + currentDir has default view: <xsl:value-of select="boolean(dyn:evaluate(concat($rootElement,$rest,$currentDir,'/',$defaultView)))"/>
> + next request: <xsl:value-of select="$nextRequest"/>
> + rest: <xsl:value-of select="$rest"/>
> + view2response: <xsl:value-of select="$view2response"/>
> + </xsl:comment>-->
> + <!--In the path are still directories-->
> + <xsl:if test="boolean(dyn:evaluate(concat($rootElement,$rest,$currentDir,'/',$defaultView)))">
> + <!--<xsl:comment>view2response set - <xsl:value-of select="(concat($rest,$currentDir,'/',$defaultView)"/></xsl:comment>-->
> + <xsl:variable name="viewTemp" select="concat($rest,$currentDir,'/',$defaultView)"/>
> + <xsl:call-template name="viewSelector">
> + <xsl:with-param name="request" select="$nextRequest"/>
> + <xsl:with-param name="rest" select="concat($rest,$currentDir,'/')"/>
> + <xsl:with-param name="view2response" select="$viewTemp"/>
> + </xsl:call-template>
> + </xsl:if>
> + <xsl:if test="not(dyn:evaluate(concat($rootElement,$rest,$currentDir,'/',$defaultView)))">
> + <!--<xsl:comment>no view2response set</xsl:comment>-->
> + <xsl:if test="$view2response=''">
> + <xsl:variable name="viewTemp" select="''"/>
> + <xsl:call-template name="viewSelector">
> + <xsl:with-param name="request" select="$nextRequest"/>
> + <xsl:with-param name="rest" select="concat($rest,$currentDir,'/')"/>
> + <xsl:with-param name="view2response" select="$viewTemp"/>
> + </xsl:call-template>
> + </xsl:if>
> + <xsl:if test="$view2response!=''">
> + <xsl:variable name="viewTemp" select="$view2response"/>
> + <xsl:call-template name="viewSelector">
> + <xsl:with-param name="request" select="$nextRequest"/>
> + <xsl:with-param name="rest" select="concat($rest,$currentDir,'/')"/>
> + <xsl:with-param name="view2response" select="$viewTemp"/>
> + </xsl:call-template>
> + </xsl:if>
> + </xsl:if>
> + </xsl:if>
> + <xsl:if test="not(contains($request,'/'))">
> + <!--<xsl:comment>
> + request: <xsl:value-of select="$request"/>
> + rest: <xsl:value-of select="$rest"/>
> + iteration: <xsl:value-of select="number($iteration)"/>
> + view2response: <xsl:value-of select="$view2response"/>
> + </xsl:comment>-->
> + <xsl:if test="not(dyn:evaluate(concat($rootElement, $rest, $request)))">
> + <!--<xsl:comment>no file specific override</xsl:comment>-->
> + <xsl:if test="boolean(dyn:evaluate(concat($rootElement,$rest,$defaultView)))">
> + <!--<xsl:comment>dir specific override</xsl:comment>-->
> + <xsl:value-of select="concat($rest,$defaultView)"/>
> + </xsl:if>
> + <xsl:if test="not(dyn:evaluate(concat($rootElement,$rest,$defaultView)))">
> + <!--<xsl:comment>no dir specific override</xsl:comment>-->
> + <xsl:value-of select="$view2response"/>
> + </xsl:if>
> + </xsl:if>
> + <xsl:if test="boolean(dyn:evaluate(concat($rootElement, $rest, $request)))">
> + <!--<xsl:comment>file specific override</xsl:comment>-->
> + <xsl:value-of select="concat($rest, $request)"/>
> + </xsl:if>
> + </xsl:if>
> + </xsl:template>
> +
> +</xsl:stylesheet>
>
> Propchange: forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/includes-viewLocationmap.xsl
> ------------------------------------------------------------------------------
> svn:keywords = Id svn:eol-style=native
>
> Added: forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/viewLocationmap.xsl
> URL: http://svn.apache.org/viewcvs/forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/viewLocationmap.xsl?rev=209151&view=auto
> ==============================================================================
> --- forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/viewLocationmap.xsl (added)
> +++ forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/viewLocationmap.xsl Mon Jul 4 17:26:35 2005
> @@ -0,0 +1,42 @@
> +<?xml version="1.0"?>
> +<!--
> + Copyright 2002-2004 The Apache Software Foundation or its licensors,
> + as applicable.
> +
> + Licensed 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.
> +-->
> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> + xmlns:collection="http://apache.org/cocoon/collection/1.0">
> + <xsl:variable name="includePattern" select="'.fv'"/>
> +
> + <xsl:template match="/">
> + <xsl:apply-templates/>
> + </xsl:template>
> + <xsl:template match="collection:collection">
> + <dir name="{@name}">
> + <xsl:apply-templates/>
> + </dir>
> + </xsl:template>
> + <xsl:template match="collection:resource[contains(@name,$includePattern)]">
> + <view name="{@name}">
> + <xsl:apply-templates/>
> + </view>
> + </xsl:template>
> + <!--/collection:resource[contains(@name,$includePattern)]-->
> + <!-- <xsl:template match="//*/*[contains(@name,$includePattern)]">
> + <xsl:variable name="parent" select="../."/>
> + <node id="{$parent/@name}"/>
> + <!-#-<xsl:copy-of select="$parent"/>-#->
> + </xsl:template>-->
> +
> +</xsl:stylesheet>
>
> Propchange: forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/viewLocationmap.xsl
> ------------------------------------------------------------------------------
> svn:keywords = Id svn:eol-style=native
>
> Added: forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/viewLocationmap2path.xsl
> URL: http://svn.apache.org/viewcvs/forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/viewLocationmap2path.xsl?rev=209151&view=auto
> ==============================================================================
> --- forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/viewLocationmap2path.xsl (added)
> +++ forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/viewLocationmap2path.xsl Mon Jul 4 17:26:35 2005
> @@ -0,0 +1,35 @@
> +<?xml version="1.0"?>
> +<!--
> + Copyright 2002-2004 The Apache Software Foundation or its licensors,
> + as applicable.
> +
> + Licensed 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.
> +-->
> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> + xmlns:collection="http://apache.org/cocoon/collection/1.0">
> +
> + <xsl:template match="/">
> + <xsl:apply-templates/>
> + </xsl:template>
> +
> + <xsl:template match="dir[view or dir]">
> + <xsl:element name="{@name}">
> + <xsl:apply-templates/>
> + </xsl:element>
> + </xsl:template>
> +
> + <xsl:template match="view">
> + <xsl:element name="{@name}"/>
> + </xsl:template>
> +
> +</xsl:stylesheet>
>
> Propchange: forrest/branches/locationmap_branch/whiteboard/plugins/org.apache.forrest.plugin.internal.view/resources/stylesheets/viewLocationmap2path.xsl
> ------------------------------------------------------------------------------
> svn:keywords = Id svn:eol-style=native
>
>
>
--
User Interface Design GmbH * Teinacher Str. 38 * D-71634 Ludwigsburg
Fon +49 (0)7141 377 000 * Fax +49 (0)7141 377 00-99
Geschäftsstelle: User Interface Design GmbH * Lehrer-Götz-Weg 11 * D-81825 München
www.uidesign.de
Buch "User Interface Tuning" von Joachim Machate & Michael Burmester
www.user-interface-tuning.de