forrest-svn mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thors...@apache.org
Subject svn commit: r190058 - in /forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.viewHelper.xhtml/resources/templates: content-feeder.ft content-ls-contracts.ft siteinfo-feedback-dyn.ft
Date Sat, 11 Jun 2005 01:58:45 GMT
Author: thorsten
Date: Fri Jun 10 18:58:44 2005
New Revision: 190058

URL: http://svn.apache.org/viewcvs?rev=190058&view=rev
Log:
added a new contract based on ls.contracts that allows to see the avaible contracts. Fixed
some param issues. Each contract needs to have unique param names!!!

Added:
    forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.viewHelper.xhtml/resources/templates/content-ls-contracts.ft
  (with props)
Modified:
    forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.viewHelper.xhtml/resources/templates/content-feeder.ft
    forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.viewHelper.xhtml/resources/templates/siteinfo-feedback-dyn.ft

Modified: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.viewHelper.xhtml/resources/templates/content-feeder.ft
URL: http://svn.apache.org/viewcvs/forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.viewHelper.xhtml/resources/templates/content-feeder.ft?rev=190058&r1=190057&r2=190058&view=diff
==============================================================================
--- forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.viewHelper.xhtml/resources/templates/content-feeder.ft
(original)
+++ forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.viewHelper.xhtml/resources/templates/content-feeder.ft
Fri Jun 10 18:58:44 2005
@@ -21,43 +21,35 @@
   <description>
     content-feeder will output the html information retrieved by the feeder plugin (needs
to be installed!). 
   </description>
-	<usage><![CDATA[ <!--Fixme: add usage of properties-->
-<forrest:contract name="content-feeder" nugget="get.nugget.feeder">
+	<usage><![CDATA[<forrest:contract name="feeder">
+    <forrest:properties contract="feeder">
+      <forrest:property name="feeder" nugget="get.nugget.feeder">
+        <url>/feeds/somefeed.xml</url>
+      </forrest:property>
+    </forrest:properties>
 </forrest:contract>]]></usage>
   <forrest:template
   xmlns:forrest="http://apache.org/forrest/templates/1.0"
   format="xhtml" name="content-feeder" inputFormat="xsl" body="true" head="false">
-
-      <xsl:stylesheet version="1.1" 
+    <xsl:stylesheet version="1.1" 
         xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-        
 	    <xsl:template name="content-feeder-body" >
 	      <xsl:param name="content-feeder"/>
-        <xsl:param name="feedConfig"/>
-        <xsl:copy-of select="$feedConfig"/>
-				<xsl:apply-templates select="$content-feeder/document">
-          <xsl:with-param name="feedConfig" select="$feedConfig"/>
-				</xsl:apply-templates>		    
+				<xsl:apply-templates select="$content-feeder/document"/>		    
 			</xsl:template>
       
       <xsl:template match="document">
-        <xsl:param name="feedConfig"/>
         <div id="content-feeder">
-		     <xsl:apply-templates select="body/section">
-          <xsl:with-param name="feedConfig" select="$feedConfig"/>
-		     </xsl:apply-templates>
+		     <xsl:apply-templates select="body/section"/>
 		    </div>
       </xsl:template>
       
       <xsl:template match="section">
-        <xsl:param name="feedConfig"/>
         <div class="channelTitle">
           <xsl:value-of select="title"/>
         </div>
         <div class="channelItems">
-          <xsl:apply-templates select="p[@class]">
-            <xsl:with-param name="feedConfig" select="$feedConfig"/>
-          </xsl:apply-templates>
+          <xsl:apply-templates select="p[@class]"/>
         </div>
       </xsl:template>
       
@@ -66,7 +58,6 @@
       </xsl:template>
       
       <xsl:template match="p[@class]">
-        <xsl:param name="feedConfig"/>
         <div class="{@class}">
           <xsl:apply-templates/>
         </div>

Added: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.viewHelper.xhtml/resources/templates/content-ls-contracts.ft
URL: http://svn.apache.org/viewcvs/forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.viewHelper.xhtml/resources/templates/content-ls-contracts.ft?rev=190058&view=auto
==============================================================================
--- forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.viewHelper.xhtml/resources/templates/content-ls-contracts.ft
(added)
+++ forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.viewHelper.xhtml/resources/templates/content-ls-contracts.ft
Fri Jun 10 18:58:44 2005
@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+
+<forrest:contract name="content-ls-contracts" type="nugget"
+  xmlns:forrest="http://apache.org/forrest/templates/1.0">
+  <description>
+    content-ls-contracts will output the contracts provided by the 
+    viewHelper (org.apache.forrest.plugin.input.viewHelper.xhtml.ls needs to be installed!).

+  </description>
+	<usage><![CDATA[<forrest:contract name="content-ls-contracts">
+  <forrest:properties contract="content-ls-contracts">
+    <forrest:property name="content-ls-contracts" 
+      nugget="get.nugget.ls.contracts">
+      <url>ls.contracts.xml</url>
+    </forrest:property>
+    <forrest:property name="content-ls-contracts-config" file="true" 
+      description="false" usage="true" path="false"/>
+  </forrest:properties>
+</forrest:contract>]]></usage>
+  <forrest:template
+  xmlns:forrest="http://apache.org/forrest/templates/1.0"
+  format="xhtml" name="content-ls-contracts" inputFormat="xsl" body="true" head="false">
+
+   <xsl:stylesheet version="1.1" 
+      xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+	   <xsl:template name="content-ls-contracts-body" >
+	      <xsl:param name="content-ls-contracts"/>
+        <xsl:param name="content-ls-contracts-config"/>
+        <div id="content-ls-contracts">
+					<xsl:apply-templates select="$content-ls-contracts/document">
+            <xsl:with-param name="content-ls-contracts-config" select="$content-ls-contracts-config"/>
+					</xsl:apply-templates>
+      	</div>    
+			</xsl:template>
+      <xsl:template match="document">
+        <xsl:param name="content-ls-contracts-config"/>
+        <xsl:if test="normalize-space(header/title)!=''">
+          <h1>
+            <xsl:value-of select="header/title"/>
+          </h1>
+          <xsl:apply-templates select="body/section">
+            <xsl:with-param name="content-ls-contracts-config" select="$content-ls-contracts-config"/>
+          </xsl:apply-templates>
+        </xsl:if>
+      </xsl:template>
+      
+      <xsl:template match="section">
+        <xsl:param name="content-ls-contracts-config"/>
+	    <!-- count the number of section in the ancestor-or-self axis to compute
+	         the title element name later on -->
+	    <xsl:variable name="sectiondepth" select="count(ancestor-or-self::section)"/>
+	    <!-- generate a title element, level 1 -> h3, level 2 -> h4 and so on... -->
+	    <xsl:element name="{concat('h',$sectiondepth + 2)}">
+	      <xsl:value-of select="title"/>
+	    </xsl:element>
+	
+	    <xsl:apply-templates select="*[not(self::title)]">
+        <xsl:with-param name="content-ls-contracts-config" select="$content-ls-contracts-config"/>
+	    </xsl:apply-templates>
+	  </xsl:template>
+      
+      <xsl:template match="source">
+		    <pre class="code">
+		      <xsl:apply-templates/>
+		    </pre>
+		  </xsl:template>
+      <xsl:template match="p[@class='file']">
+        <xsl:param name="content-ls-contracts-config"/>
+        <xsl:if test="$content-ls-contracts-config[@file='true']">
+          <p class="{@class}"><xsl:apply-templates/></p>
+        </xsl:if>
+		  </xsl:template>
+      <xsl:template match="p[@class='description']">
+        <xsl:param name="content-ls-contracts-config"/>
+        <xsl:if test="$content-ls-contracts-config[@description='true']">
+          <p class="{@class}"><xsl:apply-templates/></p>
+        </xsl:if>
+		  </xsl:template>
+      <xsl:template match="p[@class='usage']">
+        <xsl:param name="content-ls-contracts-config"/>
+        <xsl:if test="$content-ls-contracts-config[@usage='true']">
+          <p class="{@class}"><xsl:apply-templates/></p>
+        </xsl:if>
+		  </xsl:template>
+      <xsl:template match="p[@class='realpath']">
+        <xsl:param name="content-ls-contracts-config"/>
+        <xsl:if test="$content-ls-contracts-config[@realpath='true']">
+          <p class="{@class}"><xsl:apply-templates/></p>
+        </xsl:if>
+		  </xsl:template>
+      <xsl:template match="p"/>
+    </xsl:stylesheet>
+	</forrest:template>
+</forrest:contract>
\ No newline at end of file

Propchange: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.viewHelper.xhtml/resources/templates/content-ls-contracts.ft
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.viewHelper.xhtml/resources/templates/siteinfo-feedback-dyn.ft
URL: http://svn.apache.org/viewcvs/forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.viewHelper.xhtml/resources/templates/siteinfo-feedback-dyn.ft?rev=190058&r1=190057&r2=190058&view=diff
==============================================================================
--- forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.viewHelper.xhtml/resources/templates/siteinfo-feedback-dyn.ft
(original)
+++ forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.viewHelper.xhtml/resources/templates/siteinfo-feedback-dyn.ft
Fri Jun 10 18:58:44 2005
@@ -23,7 +23,7 @@
   </description>
   <usage><![CDATA[<forrest:contract name="siteinfo-feedback-dyn">
   <forrest:properties contract="siteinfo-feedback-dyn">
-    <forrest:property name="feedback" to="webmaster@foo.com" 
+    <forrest:property name="siteinfo-feedback-dyn-config" to="webmaster@foo.com" 
       href="mailto:webmaster@foo.com?subject=Feedback&#160;"> Send feedback 
       about the website to: </forrest:property>
   </forrest:properties>
@@ -33,20 +33,19 @@
   format="xhtml" name="siteinfo-feedback-dyn" inputFormat="xsl" body="true" head="false">
 
       <xsl:stylesheet version="1.1" 
-        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-        xmlns:jx="http://apache.org/cocoon/templates/jx/1.0">
+        xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
         
 	    <xsl:template name="siteinfo-feedback-dyn-body">
-	      <xsl:param name="main"/>
-	      <xsl:value-of select="$main/feedback"/>
+	      <xsl:param name="siteinfo-feedback-dyn-config"/>
+	      <xsl:value-of select="$siteinfo-feedback-dyn-config"/>
 	      <xsl:choose>
-	        <xsl:when test="$main/feedback/@href and not($main/feedback/@href='')">
+	        <xsl:when test="$siteinfo-feedback-dyn-config[@href] and $siteinfo-feedback-dyn-config[@href!='']">
 	          <a id="feedbackto">
 	            <xsl:attribute name="href">
-	              <xsl:value-of select="$main/feedback/@href"/>
+	              <xsl:value-of select="$siteinfo-feedback-dyn-config/@href"/>
 	              <xsl:value-of select="$path"/>
 	            </xsl:attribute>
-	            <xsl:value-of select="$main/feedback/@to"/>
+	            <xsl:value-of select="$siteinfo-feedback-dyn-config/@to"/>
 	          </a>
 	        </xsl:when>
 	        <xsl:otherwise>



Mime
View raw message