henning 2003/06/03 06:21:52
Modified: . maven.xml
conf TurbineResources.properties
conf/master TurbineResources.master
src/java/org/apache/turbine/modules/layouts
VelocityOnlyLayout.java
xdocs changes.xml
Added: src/macros TurbineMacros.vm
Removed: proposals/henning/velocitymacros README TurbineMacros.vm
Log:
Move the velocity macros proposal in. It is fairly non intrusive, has
been tested for some time (I use it all the time in our internal development
and it proved to be stable).
Incorporated the suggestion from Angelo Turetta <[EMAIL PROTECTED]>
to use an attribute returning macro so that HTML editors won't choke
on the missing body tag.
Revision Changes Path
1.13 +5 -1 jakarta-turbine-2/maven.xml
Index: maven.xml
===================================================================
RCS file: /home/cvs/jakarta-turbine-2/maven.xml,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- maven.xml 21 Apr 2003 18:11:33 -0000 1.12
+++ maven.xml 3 Jun 2003 13:21:50 -0000 1.13
@@ -27,6 +27,10 @@
file="${maven.src.dir}/dtd/intake.dtd"
todir="${maven.build.dest}/org/apache/turbine/services/intake/transform"
/>
+ <copy
+ file="${maven.src.dir}/macros/TurbineMacros.vm"
+ todir="${maven.build.dest}/macros"
+ />
</postGoal>
<!-- ================================================================== -->
1.41 +5 -1 jakarta-turbine-2/conf/TurbineResources.properties
Index: TurbineResources.properties
===================================================================
RCS file: /home/cvs/jakarta-turbine-2/conf/TurbineResources.properties,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -r1.40 -r1.41
--- TurbineResources.properties 9 May 2003 11:01:30 -0000 1.40
+++ TurbineResources.properties 3 Jun 2003 13:21:50 -0000 1.41
@@ -505,6 +505,7 @@
services.VelocityService.runtime.log=/logs/velocity.log
#services.VelocityService.input.encoding=UTF-8
services.VelocityService.velocimacro.library = GlobalMacros.vm
+services.VelocityService.velocimacro.library = macros/TurbineMacros.vm
# Set the following line to true to cause velocity to automatically reload
# library macro files if they change. This is useful for debugging.
@@ -517,6 +518,9 @@
services.VelocityService.file.resource.loader.cache = false
services.VelocityService.file.resource.loader.modificationCheckInterval = 2
+#
+# Do not remove the class path loader lightly, it is used to load the TurbineMacros
from VelocityOnlyLayout
+#
services.VelocityService.resource.loader = classpath
services.VelocityService.classpath.resource.loader.description = Velocity Classpath
Resource Loader
services.VelocityService.classpath.resource.loader.class =
org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
1.40 +5 -1 jakarta-turbine-2/conf/master/TurbineResources.master
Index: TurbineResources.master
===================================================================
RCS file: /home/cvs/jakarta-turbine-2/conf/master/TurbineResources.master,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- TurbineResources.master 9 May 2003 11:01:30 -0000 1.39
+++ TurbineResources.master 3 Jun 2003 13:21:50 -0000 1.40
@@ -505,6 +505,7 @@
services.VelocityService.runtime.log=/logs/velocity.log
#services.VelocityService.input.encoding=UTF-8
services.VelocityService.velocimacro.library = GlobalMacros.vm
+services.VelocityService.velocimacro.library = macros/TurbineMacros.vm
# Set the following line to true to cause velocity to automatically reload
# library macro files if they change. This is useful for debugging.
@@ -517,6 +518,9 @@
services.VelocityService.file.resource.loader.cache = false
services.VelocityService.file.resource.loader.modificationCheckInterval = 2
+#
+# Do not remove the class path loader lightly, it is used to load the TurbineMacros
from VelocityOnlyLayout
+#
services.VelocityService.resource.loader = classpath
services.VelocityService.classpath.resource.loader.description = Velocity Classpath
Resource Loader
services.VelocityService.classpath.resource.loader.class =
org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
1.10 +21 -1
jakarta-turbine-2/src/java/org/apache/turbine/modules/layouts/VelocityOnlyLayout.java
Index: VelocityOnlyLayout.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/modules/layouts/VelocityOnlyLayout.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- VelocityOnlyLayout.java 11 Mar 2003 13:54:11 -0000 1.9
+++ VelocityOnlyLayout.java 3 Jun 2003 13:21:52 -0000 1.10
@@ -79,6 +79,26 @@
* screens and navigations there should be relatively few reasons to
* subclass this Layout.
*
+ * To get the same functionality as with VelocityECSLayout, you can
+ * use two supplied VelocityMacros, TurbineHtmlHead and TurbineHtmlBodyAttributes
+ * in your templates. These are used to put HtmlPageAttributes into a page
+ * before rendering.
+ *
+ * Use these macros should be used in the Layout template like this:
+ *
+ * ... set things like style sheets, scripts here.
+ * <html>
+ * #TurbineHtmlHead()
+ * <body #TurbineHtmlBodyAttributes() >
+ * .... your body information
+ * </body>
+ * </html>
+ *
+ * As the layout template is rendered _after_ the screen template, you
+ * can of course, add information to the $page tool in your screen
+ * template. This will be added correctly to the <head>...</head> and
+ * <body> tags.
+ *
* @author <a href="mailto:[EMAIL PROTECTED]">John D. McNally</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Dave Bryson</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Henning P. Schmiedehausen</a>
1.1 jakarta-turbine-2/src/macros/TurbineMacros.vm
Index: TurbineMacros.vm
===================================================================
## ====================================================================
## The Apache Software License, Version 1.1
##
## Copyright (c) 2001-2003 The Apache Software Foundation. All rights
## reserved.
##
## Redistribution and use in source and binary forms, with or without
## modification, are permitted provided that the following conditions
## are met:
##
## 1. Redistributions of source code must retain the above copyright
## notice, this list of conditions and the following disclaimer.
##
## 2. Redistributions in binary form must reproduce the above copyright
## notice, this list of conditions and the following disclaimer in
## the documentation and/or other materials provided with the
## distribution.
##
## 3. The end-user documentation included with the redistribution,
## if any, must include the following acknowledgment:
## "This product includes software developed by the
## Apache Software Foundation (http://www.apache.org/)."
## Alternately, this acknowledgment may appear in the software itself,
## if and wherever such third-party acknowledgments normally appear.
##
## 4. The names "Apache" and "Apache Software Foundation" and
## "Apache Turbine" must not be used to endorse or promote products
## derived from this software without prior written permission. For
## written permission, please contact [EMAIL PROTECTED]
##
## 5. Products derived from this software may not be called "Apache",
## "Apache Turbine", nor may "Apache" appear in their name, without
## prior written permission of the Apache Software Foundation.
##
## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
## OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
## DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
## ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
## SUCH DAMAGE.
## ====================================================================
##
## This software consists of voluntary contributions made by many
## individuals on behalf of the Apache Software Foundation. For more
## information on the Apache Software Foundation, please see
## <http://www.apache.org/>.
##
## @author <a href="mailto:[EMAIL PROTECTED]">Henning P. Schmiedehausen</a>
## @version $Id: TurbineMacros.vm,v 1.1 2003/06/03 13:21:52 henning Exp $
##
## Build the <head> ... </head> tag of a web page with VelocityOnly Layout
##
#macro (TurbineHtmlHead)
<head>
#if ($!page.Title)
<title>$page.Title</title>
#end
#if ($page.MetaTags.size() > 0)
#foreach($metaTag in $page.MetaTags.keySet())
<meta name="$metaTag" content="$page.MetaTags.get($metaTag)">
#end
#end
#if ($page.HttpEquivs.size() > 0)
#foreach($httpEquiv in $page.HttpEquivs.keySet())
<meta http-equiv="$httpEquiv" content="$page.HttpEquivs.get($httpEquiv)">
#end
#end
#if ($page.StyleSheets.size() > 0)
#foreach( $styleSheet in $page.StyleSheets )
<link rel="stylesheet" href="$styleSheet.Url"
#if($!styleSheet.Type) type="$styleSheet.Type" #end
#if($!styleSheet.Media) media="$styleSheet.Media" #end
#if($!styleSheet.Title) title="$styleSheet.Title" #end
>
#end
#end
#if ($page.Scripts.size() > 0)
#foreach( $script in $page.Scripts )
<script type="text/javascript" src="$script" language="JavaScript"></script>
#end
#end
</head>
#end
##
## Build the Tags for the Body start tag of a web page with VelocityOnly Layout
## <body #TurbineHtmlBodyAttributes() >
##
#macro (TurbineHtmlBodyAttributes)
#if ($page.BodyAttributes.size() > 0)
#foreach( $attributeName in $page.BodyAttributes.keySet() )
$attributeName = "$page.BodyAttributes.get($attributeName)"
#end
#end
1.50 +5 -0 jakarta-turbine-2/xdocs/changes.xml
Index: changes.xml
===================================================================
RCS file: /home/cvs/jakarta-turbine-2/xdocs/changes.xml,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -r1.49 -r1.50
--- changes.xml 3 Jun 2003 12:50:03 -0000 1.49
+++ changes.xml 3 Jun 2003 13:21:52 -0000 1.50
@@ -380,6 +380,11 @@
Turbine now has some integration for Avalon Components. It can start
Avalon based components with the new AvalonComponentService.
</li>
+ <li>Added a new TurbineMacros file to the turbine jar, which contains some
helper
+ macros for Velocity Templates. Currently there are only some macros to be
used
+ with VelocityOnlyLayout to render the page attributes like in
VelocityECSLayout
+ based pages.
+ </li>
</ul>
</p>
</subsection>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]