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/03/27 22:54:51 UTC
svn commit: r159191 - in
forrest/trunk/plugins/org.apache.forrest.plugin.views: output.xmap
resources/stylesheets/prepare.xhtml.xsl resources/templates/nav.ft
src/documentation/content/xdocs/index.xml status.xml
Author: thorsten
Date: Sun Mar 27 12:54:49 2005
New Revision: 159191
URL: http://svn.apache.org/viewcvs?view=rev&rev=159191
Log:
extracted the menu and innermenuli to the nav contract implementation from the prepare.xhtml.xsl. This fixed as well the linking. :) I added as well some docu.
Modified:
forrest/trunk/plugins/org.apache.forrest.plugin.views/output.xmap
forrest/trunk/plugins/org.apache.forrest.plugin.views/resources/stylesheets/prepare.xhtml.xsl
forrest/trunk/plugins/org.apache.forrest.plugin.views/resources/templates/nav.ft
forrest/trunk/plugins/org.apache.forrest.plugin.views/src/documentation/content/xdocs/index.xml
forrest/trunk/plugins/org.apache.forrest.plugin.views/status.xml
Modified: forrest/trunk/plugins/org.apache.forrest.plugin.views/output.xmap
URL: http://svn.apache.org/viewcvs/forrest/trunk/plugins/org.apache.forrest.plugin.views/output.xmap?view=diff&r1=159190&r2=159191
==============================================================================
--- forrest/trunk/plugins/org.apache.forrest.plugin.views/output.xmap (original)
+++ forrest/trunk/plugins/org.apache.forrest.plugin.views/output.xmap Sun Mar 27 12:54:49 2005
@@ -128,7 +128,7 @@
</map:match>
</map:pipeline>
<!-- ls.fbits
- list the default fbits-->
+ list the project fbits-->
<map:pipeline>
<map:match pattern="ls.contracts.project">
<map:generate type="directory" src="{project:resources}/templates/">
@@ -153,7 +153,7 @@
</map:match>
</map:pipeline>
<!--ls.fbits.l
-transform this dir-list and add more information
+transform this dir-list of the project and add more information
-->
<map:pipeline>
<map:match pattern="ls.contracts.project.l">
Modified: forrest/trunk/plugins/org.apache.forrest.plugin.views/resources/stylesheets/prepare.xhtml.xsl
URL: http://svn.apache.org/viewcvs/forrest/trunk/plugins/org.apache.forrest.plugin.views/resources/stylesheets/prepare.xhtml.xsl?view=diff&r1=159190&r2=159191
==============================================================================
--- forrest/trunk/plugins/org.apache.forrest.plugin.views/resources/stylesheets/prepare.xhtml.xsl (original)
+++ forrest/trunk/plugins/org.apache.forrest.plugin.views/resources/stylesheets/prepare.xhtml.xsl Sun Mar 27 12:54:49 2005
@@ -35,31 +35,11 @@
<alias:param name="request"/>
<alias:variable name="config" select="//skinconfig"/>
<alias:variable name="minitoc-location" select="$config/toc/@location"/>
- <!--<alias:variable name="root">
- <alias:call-template name="dotdots">
- <alias:with-param name="path" select="$path"/>
- </alias:call-template>
- </alias:variable>-->
- <!--
- <!-#- Source filename (eg 'foo.xml') of current page -#->
- <alias:variable name="filename">
- <alias:call-template name="filename">
- <alias:with-param name="path" select="$path"/>
- </alias:call-template>
- </alias:variable>
-
- <!-#- Path of Lucene search results page (relative to $root) -#->
- <alias:param name="lucene-search" select="'lucene-search.html'"/>
-
- <alias:variable name="filename-noext">
- <alias:call-template name="filename-noext">
- <alias:with-param name="path" select="$path"/>
- </alias:call-template>
- </alias:variable>
-
- <alias:variable name="skin-img-dir" select="concat(string($root), 'skin/images')"/>
- <alias:variable name="spacer" select="concat($root, 'skin/images/spacer.gif')"/>-->
-
+ <!--FIXME: get all additional templates-->
+<!-- <xsl:comment>All xhtml additional templates requested by the forrest:template</xsl:comment>
+ <xsl:for-each select="/*/forrest:properties/*[@additional='true']">
+ <xsl:copy-of select=""/>
+ </xsl:for-each>-->
<xsl:comment>All xhtml head elements requested by the forrest:template</xsl:comment>
<alias:template name="getHead">
<xsl:for-each select="/*/forrest:properties/*[@head='true']">
@@ -124,77 +104,7 @@
</body>
</xhtml>
</alias:template>
- <alias:template name="menu">
-<alias:comment>+
- |start Menu
- +</alias:comment>
- <div id="nav">
- <ul>
-<!--menu - inner-->
- <alias:for-each select = "div[@id='menu']/ul/li">
- <alias:call-template name = "innermenuli" >
- <alias:with-param name="id" select="concat('1.', position())"/>
- </alias:call-template>
- </alias:for-each>
- </ul>
- </div>
- </alias:template>
-
- <alias:template name="innermenuli">
- <alias:param name="id"/>
- <alias:variable name="tagid">
- <alias:choose>
- <alias:when test="descendant-or-self::node()/li/div/@class='current'"><alias:value-of select="concat('menu_selected_',$id)"/></alias:when>
- <alias:otherwise><alias:value-of select="concat('menu_',concat(font,$id))"/></alias:otherwise>
- </alias:choose>
- </alias:variable>
- <alias:variable name="whichGroup">
- <alias:choose>
- <alias:when test="descendant-or-self::node()/li/div/@class='current'">currentmenuitemgroup</alias:when>
- <alias:otherwise>menuitemgroup</alias:otherwise>
- </alias:choose>
- </alias:variable>
-
-
- <li class="pagegroup"><strong><alias:value-of select="h1"/></strong>
- <ul>
- <alias:for-each select= "ul/li">
-
- <alias:choose>
- <alias:when test="a">
- <li><a href="{a/@href}"><alias:value-of select="a" /></a></li>
- </alias:when>
- <alias:when test="div/@class='current'">
- <li class="menupage">
- <div class="menupagetitle"><alias:value-of select="div" /></div>
- <alias:if test="$config/toc/@max-depth>0 and contains($minitoc-location,'menu')">
- <li class="menupageitemgroup">
- <alias:for-each select = "//tocitems/tocitem">
- <div class="menupageitem">
- <alias:choose>
- <alias:when test="string-length(@title)>15">
- <a href="{@href}" title="{@title}"><alias:value-of select="substring(@title,0,20)" />...</a>
- </alias:when>
- <alias:otherwise>
- <a href="{@href}"><alias:value-of select="@title" /></a>
- </alias:otherwise>
- </alias:choose>
- </div>
- </alias:for-each>
- </li>
- </alias:if>
- </li>
- </alias:when>
- <alias:otherwise>
- <alias:call-template name = "innermenuli">
- <alias:with-param name="id" select="concat($id, '.', position())"/>
- </alias:call-template>
- </alias:otherwise>
- </alias:choose>
-
- </alias:for-each>
- </ul></li>
- </alias:template>
+
</alias:stylesheet>
</xsl:template>
Modified: forrest/trunk/plugins/org.apache.forrest.plugin.views/resources/templates/nav.ft
URL: http://svn.apache.org/viewcvs/forrest/trunk/plugins/org.apache.forrest.plugin.views/resources/templates/nav.ft?view=diff&r1=159190&r2=159191
==============================================================================
--- forrest/trunk/plugins/org.apache.forrest.plugin.views/resources/templates/nav.ft (original)
+++ forrest/trunk/plugins/org.apache.forrest.plugin.views/resources/templates/nav.ft Sun Mar 27 12:54:49 2005
@@ -123,6 +123,76 @@
|end menu
+</xsl:comment>
</xsl:template>
+ <xsl:template name="menu">
+<xsl:comment>+
+ |start Menu
+ +</xsl:comment>
+ <div id="nav">
+ <ul>
+<!--menu - inner-->
+ <xsl:for-each select = "div[@id='menu']/ul/li">
+ <xsl:call-template name = "innermenuli" >
+ <xsl:with-param name="id" select="concat('1.', position())"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </ul>
+ </div>
+ </xsl:template>
+
+ <xsl:template name="innermenuli">
+ <xsl:param name="id"/>
+ <xsl:variable name="tagid">
+ <xsl:choose>
+ <xsl:when test="descendant-or-self::node()/li/div/@class='current'"><xsl:value-of select="concat('menu_selected_',$id)"/></xsl:when>
+ <xsl:otherwise><xsl:value-of select="concat('menu_',concat(font,$id))"/></xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="whichGroup">
+ <xsl:choose>
+ <xsl:when test="descendant-or-self::node()/li/div/@class='current'">currentmenuitemgroup</xsl:when>
+ <xsl:otherwise>menuitemgroup</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <li class="pagegroup"><strong><xsl:value-of select="h1"/></strong>
+ <ul>
+ <xsl:for-each select= "ul/li">
+
+ <xsl:choose>
+ <xsl:when test="a">
+ <li><a href="{a/@href}"><xsl:value-of select="a" /></a></li>
+ </xsl:when>
+ <xsl:when test="div/@class='current'">
+ <li class="menupage">
+ <div class="menupagetitle"><xsl:value-of select="div" /></div>
+ <xsl:if test="$config/toc/@max-depth>0 and contains($minitoc-location,'menu')">
+ <li class="menupageitemgroup">
+ <xsl:for-each select = "//tocitems/tocitem">
+ <div class="menupageitem">
+ <xsl:choose>
+ <xsl:when test="string-length(@title)>15">
+ <a href="{@href}" title="{@title}"><xsl:value-of select="substring(@title,0,20)" />...</a>
+ </xsl:when>
+ <xsl:otherwise>
+ <a href="{@href}"><xsl:value-of select="@title" /></a>
+ </xsl:otherwise>
+ </xsl:choose>
+ </div>
+ </xsl:for-each>
+ </li>
+ </xsl:if>
+ </li>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name = "innermenuli">
+ <xsl:with-param name="id" select="concat($id, '.', position())"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ </xsl:for-each>
+ </ul></li>
+ </xsl:template>
</xsl:stylesheet>
</forrest:template>
</forrest:contract>
Modified: forrest/trunk/plugins/org.apache.forrest.plugin.views/src/documentation/content/xdocs/index.xml
URL: http://svn.apache.org/viewcvs/forrest/trunk/plugins/org.apache.forrest.plugin.views/src/documentation/content/xdocs/index.xml?view=diff&r1=159190&r2=159191
==============================================================================
--- forrest/trunk/plugins/org.apache.forrest.plugin.views/src/documentation/content/xdocs/index.xml (original)
+++ forrest/trunk/plugins/org.apache.forrest.plugin.views/src/documentation/content/xdocs/index.xml Sun Mar 27 12:54:49 2005
@@ -23,7 +23,172 @@
<body>
<section>
<title>Apache Forrest - org.apache.forrest.plugin.views Plugin</title>
- <p>This plugin ...</p>
+ <source>
+How it works
+************
+
+(taken from SOME comments of the output.xmap of views)
+
+This plugin has three components:
+ 1. fbits - delivers contracts in form of xsl:templates
+ 2. nuggets - delivers content that is used in the contracts
+ 3. views - prepares and transforms the requested contracts (fbits)
+ and populate them with the content (nuggets)
+
+1. fbits
+ This is the template producing factory.
+
+a. <![CDATA[<map:match pattern="resolve.contract.*">]]> -> Resolving factory
+Project implementation of templates have priority before default ones.
+If no implementation can be found we use the noFt (~ - no
+forrest:template) implementation.
+
+b. <![CDATA[<map:match pattern="get.contract.*.*">]]>
+Get the xsl:templates of the requested contract and specific format.
+
+c. <![CDATA[<map:match pattern="get.contract-property.*">]]>
+Get the forrest:properties of the requested contract.
+This will determine which templates (css, head, body) we have to call
+later on
+
+GENERAL:
+Contracts are stored in forrest:templates ({contract-name}.ft) please
+have look on
+plugins/org.apache.forrest.plugin.views/resources/templates/*.ft do get
+an idea how your own implementation have to look like.
+
+
+2. nuggets
+ This is the content producing factory.
+
+NOTE: <![CDATA[<map:match pattern="*.page">]]>
+The current factory uses the skin producing templates (e.g.
+document2xhtml.xsl).
+It is only exchanging the last step of a skin producing pipe
+(site2xhtml.xsl) till now.
+This will have to be changed in the future.
+
+
+3. views
+ prepares and transforms the requested contracts (fbits) and populate
+them with the content (nuggets).
+
+a. <![CDATA[<map:match pattern="prepare.view.*">]]> -> View config resolver
+File specific views have priority before default ones.
+If no view can be found in the project we use the default one of the
+views plugin.
+
+b. <![CDATA[<map:match pattern="prepare.include.*"> ]]>
+Aggregate the contract-templates requested by the view with xinclude.
+The result is a stylesheet with all needed xsl:templates.
+
+c. <![CDATA[<map:match pattern="prepare.properties.*">]]>
+Aggregate the forrest:properties requested by the *.fv.
+The result is an aggregation of properties which defines the templates
+to be call.
+
+d. <![CDATA[<map:match pattern="prepare.xhtml.*">]]>
+Aggregate all contracts-templates requested by the view.
+Create a xsl that can be used for the last step of the transformation of
+the view.
+
+e. <![CDATA[<map:match pattern="*.html"> ]]>-> Last processing step.
+Here we are overriding the default skin generation.
+
+GENERAL:
+Views are stored in forrest:view ({file-name}.fv) please have look on
+plugins/org.apache.forrest.plugin.views/src/documentation/default.fv do
+get an idea how your own implementation have to look like.
+
+Known issues
+************
+- The generation of the linking is not working.
+- Menu /innermenu templates are added directly. Add support for
+additional templates support.
+- Uses resources of leather (document2html.xsl defines the pdf/xml/...
+link this have to be done by the template).
+- The views are only working for html so far
+- The css support and implementation is VERY basic
+- Only first level files are working
+- ...
+
+Resume
+******
+The views plugin can be seen as prototype for the next generation
+skinning of forrest. It is still in early stage but with the cleanup I
+hope to make it easier for all devs (not only committer) to get the idea
+and help to enhance it.
+
+Some basic and simple hints:
+a) If you want another implementation of a contract then create a folder
+"templates" in ${project.resources-dir} and it will be matched before
+the standard implementation.
+
+e.g. feedback contract:
+<![CDATA[
+<forrest:contract name="feedback" type="nugget"
+ xmlns:forrest="http://apache.org/forrest/templates/1.0">
+<description>
+This function will output the html feedback information.
+</description>
+
+<forrest:template
+xmlns:forrest="http://apache.org/forrest/templates/1.0"
+format="xhtml" name="feedback" inputFormat="xsl" body="true"
+head="false" css="true">
+
+<xsl:stylesheet version="1.1"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:jx="http://apache.org/cocoon/templates/jx/1.0">
+
+<xsl:template name="feedback-css">
+#feedback {
+ color: black;
+ background: #CFDCED;
+ text-align:center;
+ margin-top: 5px;
+}
+#feedback #feedbackto {
+ font-size: 90%;
+ color: black;
+}</xsl:template>
+
+<xsl:template name="feedback-body">
+<div id="feedback"> Modified project implementation
+<xsl:value-of select="$config/feedback"/>
+<xsl:choose>
+<xsl:when test="$config/feedback/@href and
+not($config/feedback/@href='')">
+ <a id="feedbackto">
+ <xsl:attribute name="href">
+ <xsl:value-of select="$config/feedback/@href"/>
+ <xsl:value-of select="$path"/>
+ </xsl:attribute>
+ <xsl:value-of select="$config/feedback/@to"/>
+ </a>
+</xsl:when>
+<xsl:otherwise>
+ <xsl:value-of select="$config/feedback/@to"/>
+</xsl:otherwise>
+</xsl:choose>
+</div>
+</xsl:template>
+</xsl:stylesheet>
+</forrest:template>
+</forrest:contract>
+]]>
+The @attributes (body="true" head="false" css="true") of the
+forrest:template defining which parts of the html page (head, head-css
+and body) we have to render. The xsl:templates are following the simple
+naming convention {@name}-(css|head|body).
+
+
+b. If you want a default view for your project then copy the default.fv
+from the plugin to your ${project.conf-dir} and modify this file. When
+you want another view for a specific file (e.g. index.html) then copy
+the default.fv to your ${project.xdocs-dir} and renamed it to e.g.
+index.fv.
+ </source>
</section>
</body>
</document>
Modified: forrest/trunk/plugins/org.apache.forrest.plugin.views/status.xml
URL: http://svn.apache.org/viewcvs/forrest/trunk/plugins/org.apache.forrest.plugin.views/status.xml?view=diff&r1=159190&r2=159191
==============================================================================
--- forrest/trunk/plugins/org.apache.forrest.plugin.views/status.xml (original)
+++ forrest/trunk/plugins/org.apache.forrest.plugin.views/status.xml Sun Mar 27 12:54:49 2005
@@ -19,6 +19,7 @@
<developers>
<person name="Ross Gardler" email="rgardler@apache.org" id="RDG" />
+ <person name="Thorsten Scherler" email="thorsten@apache.org" id="TS" />
<person name="Volunteer needed" email="dev@forrest.apache.org" id="open"/>
</developers>