You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by cz...@apache.org on 2005/09/20 20:56:34 UTC
svn commit: r290527 - in /cocoon/branches/BRANCH_2_1_X: ./
src/blocks/portal/java/org/apache/cocoon/portal/event/impl/
src/blocks/portal/samples/coplets/gallery/
src/blocks/portal/samples/profiles/copletdata/
Author: cziegeler
Date: Tue Sep 20 11:56:14 2005
New Revision: 290527
URL: http://svn.apache.org/viewcvs?rev=290527&view=rev
Log:
Provide sample for caching uri coplet adapter (Gallery coplet) and fix event hierarchy
Modified:
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/event/impl/CopletStatusEvent.java
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/gallery/gallery.xsl
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/gallery/picture.xsl
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/gallery/sitemap.xmap
cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/profiles/copletdata/portal.xml
cocoon/branches/BRANCH_2_1_X/status.xml
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/event/impl/CopletStatusEvent.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/event/impl/CopletStatusEvent.java?rev=290527&r1=290526&r2=290527&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/event/impl/CopletStatusEvent.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/event/impl/CopletStatusEvent.java Tue Sep 20 11:56:14 2005
@@ -17,6 +17,7 @@
import org.apache.cocoon.portal.coplet.CopletInstanceData;
import org.apache.cocoon.portal.event.ComparableEvent;
+import org.apache.cocoon.portal.event.CopletInstanceEvent;
import org.apache.cocoon.portal.event.Event;
/**
@@ -28,7 +29,7 @@
* @version CVS $Id$
*/
public abstract class CopletStatusEvent
- implements Event, ComparableEvent {
+ implements Event, ComparableEvent, CopletInstanceEvent {
protected CopletInstanceData coplet;
@@ -45,6 +46,13 @@
return ((CopletStatusEvent)event).getCopletInstanceData().getId().equals( this.coplet.getId() );
}
return false;
+ }
+
+ /**
+ * @see org.apache.cocoon.portal.event.ActionEvent#getTarget()
+ */
+ public Object getTarget() {
+ return this.coplet;
}
}
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/gallery/gallery.xsl
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/gallery/gallery.xsl?rev=290527&r1=290526&r2=290527&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/gallery/gallery.xsl (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/gallery/gallery.xsl Tue Sep 20 11:56:14 2005
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!--
- Copyright 1999-2004 The Apache Software Foundation
+ Copyright 1999-2005 The Apache Software Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -14,10 +14,12 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<!-- $Id: gallery.xsl,v 1.3 2004/03/06 02:25:57 antonio Exp $
+<!-- $Id$
-->
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:java="http://xml.apache.org/xalan/java">
<!-- The current picture (index) to display -->
<xsl:param name="pic"/>
@@ -25,73 +27,75 @@
<xsl:param name="fullscreen"/>
<xsl:template match="pictures" xmlns:cl="http://apache.org/cocoon/portal/coplet/1.0">
-<xsl:variable name="maxp" select="count(picture)"/>
+ <xsl:variable name="maxp" select="count(picture)"/>
-<xsl:choose>
-<xsl:when test="$fullscreen='true'">
- <!-- This is the two column version:
- <table>
- <xsl:for-each select="picture">
- <xsl:if test="position() mod 2 = 1">
+ <xsl:choose>
+ <xsl:when test="$fullscreen='true'">
+ <!-- This is the two column version:
+ <table><tbody>
+ <xsl:for-each select="picture">
+ <xsl:if test="position() mod 2 = 1">
<tr>
- <td><img src="{.}"/></td>
- <xsl:choose>
- <xsl:when test="position() = last()">
- <td> </td>
- </xsl:when>
- <xsl:otherwise>
- <xsl:variable name="p" select="position()+1"/>
- <td><img src="{//picture[position()=$p]}"/></td>
- </xsl:otherwise>
- </xsl:choose>
+ <td><img src="{.}"/></td>
+ <xsl:choose>
+ <xsl:when test="position() = last()">
+ <td> </td>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="p" select="position()+1"/>
+ <td><img src="{//picture[position()=$p]}"/></td>
+ </xsl:otherwise>
+ </xsl:choose>
</tr>
+ </xsl:if>
+ </xsl:for-each>
+ </tbody></table>
+ -->
+ <!-- And this is the simple version -->
+ <table><tbody>
+ <tr width="100%">
+ <td>
+ <xsl:for-each select="picture">
+ <img src="{.}"/><xsl:text> </xsl:text>
+ </xsl:for-each>
+ </td>
+ </tr>
+ </tbody></table>
+ <p>Date: <xsl:value-of select="java:java.util.Date.new()"/></p>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="picn">
+ <xsl:choose>
+ <xsl:when test="$pic=$maxp">1</xsl:when>
+ <xsl:when test="$pic=''">2</xsl:when>
+ <xsl:otherwise><xsl:value-of select="$pic+1"/></xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="picp">
+ <xsl:choose>
+ <xsl:when test="$pic=1 or $pic=''"><xsl:value-of select="$maxp"/></xsl:when>
+ <xsl:otherwise><xsl:value-of select="$pic - 1"/></xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="showpicindex">
+ <xsl:choose>
+ <xsl:when test="$pic=1 or $pic=''">1</xsl:when>
+ <xsl:otherwise><xsl:value-of select="$pic"/></xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <p>Picture <xsl:value-of select="$showpicindex"/> of <xsl:value-of select="$maxp"/>
+ <xsl:if test="$showpicindex > 1">
+ - <cl:link path="attributes/picture" value="{$picp}" coplet="Gallery-Petstore">« Previous</cl:link>
</xsl:if>
- </xsl:for-each>
- </table>
- -->
- <!-- And this is the simple version -->
- <table>
- <tr width="100%">
- <td>
- <xsl:for-each select="picture">
- <img src="{.}"/><xsl:text> </xsl:text>
- </xsl:for-each>
- </td>
- </tr>
- </table>
-</xsl:when>
-<xsl:otherwise>
- <xsl:variable name="picn">
- <xsl:choose>
- <xsl:when test="$pic=$maxp">1</xsl:when>
- <xsl:when test="$pic=''">2</xsl:when>
- <xsl:otherwise><xsl:value-of select="$pic+1"/></xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="picp">
- <xsl:choose>
- <xsl:when test="$pic=1 or $pic=''"><xsl:value-of select="$maxp"/></xsl:when>
- <xsl:otherwise><xsl:value-of select="$pic - 1"/></xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="showpicindex">
- <xsl:choose>
- <xsl:when test="$pic=1 or $pic=''">1</xsl:when>
- <xsl:otherwise><xsl:value-of select="$pic"/></xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-
- <p>Picture <xsl:value-of select="$showpicindex"/> of <xsl:value-of select="$maxp"/>
- <xsl:if test="$showpicindex > 1">
- - <cl:link path="attributes/picture" value="{$picp}">« Previous</cl:link>
- </xsl:if>
- <xsl:if test="$showpicindex < $maxp">
- - <cl:link path="attributes/picture" value="{$picn}">Next »</cl:link>
- </xsl:if>
- </p>
- <p><cl:link path="attributes/picture" value="{picture[position()=$showpicindex]}" coplet="GalleryViewer-1">Push to Viewer</cl:link></p>
- <img src="{picture[position()=$showpicindex]}"/>
-</xsl:otherwise>
-</xsl:choose>
+ <xsl:if test="$showpicindex < $maxp">
+ - <cl:link path="attributes/picture" value="{$picn}" coplet="Gallery-Petstore">Next »</cl:link>
+ </xsl:if>
+ </p>
+ <p><cl:link path="attributes/picture" value="{picture[position()=$showpicindex]}" coplet="GalleryViewer-1">Push to Viewer</cl:link></p>
+ <img src="{picture[position()=$showpicindex]}"/>
+ <p>Date: <xsl:value-of select="java:java.util.Date.new()"/></p>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:template>
</xsl:stylesheet>
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/gallery/picture.xsl
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/gallery/picture.xsl?rev=290527&r1=290526&r2=290527&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/gallery/picture.xsl (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/gallery/picture.xsl Tue Sep 20 11:56:14 2005
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!--
- Copyright 1999-2004 The Apache Software Foundation
+ Copyright 1999-2005 The Apache Software Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -17,10 +17,13 @@
<!-- $Id$
-->
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:java="http://xml.apache.org/xalan/java">
<!-- The current picture to display -->
<xsl:param name="pic"/>
+<xsl:param name="tpic"/>
<xsl:template match="pictures" xmlns:cl="http://apache.org/cocoon/portal/coplet/1.0">
<xsl:choose>
@@ -29,6 +32,9 @@
</xsl:when>
<xsl:otherwise>
<img src="{$pic}"/>
+ <p><cl:link path="temporaryAttributes/pictitle" value="{$pic}" coplet="GalleryViewer-1">Show file name</cl:link>
+ <br/><xsl:value-of select="$tpic"/></p>
+ <p>Date: <xsl:value-of select="java:java.util.Date.new()"/></p>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/gallery/sitemap.xmap
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/gallery/sitemap.xmap?rev=290527&r1=290526&r2=290527&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/gallery/sitemap.xmap (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/coplets/gallery/sitemap.xmap Tue Sep 20 11:56:14 2005
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!--
- Copyright 1999-2004 The Apache Software Foundation
+ Copyright 1999-2005 The Apache Software Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -19,12 +19,15 @@
<map:pipelines>
- <map:pipeline>
+ <map:pipeline>
<map:match pattern="images/*.jpg">
<map:read mime-type="image/jpg" src="samplepics/{1}.jpg"/>
</map:match>
-
+ </map:pipeline>
+ <!-- We are using the caching uri coplet adapter caching the
+ content anyway, so no need to use pipeline caching. -->
+ <map:pipeline type="noncaching">
<!-- this is a gallery coplet -->
<map:match pattern="browser">
<map:generate type="directory" src="{coplet:copletData/attributes/image-dir}">
@@ -37,13 +40,17 @@
<map:parameter name="pic" value="{coplet:attributes/picture}"/>
<map:parameter name="fullscreen" value="{coplet:aspectDatas/fullScreen}"/>
</map:transform>
- <map:transform type="portal-coplet"/>
+ <!-- This must be commented out if CachingURICopletAdapter is used in profiles/copletdata
+ due to links that needs to be cached untranslated.
+ <map:transform type="portal-coplet"/>
+ -->
<map:serialize type="xml"/>
</map:match>
<map:match pattern="viewer">
<map:generate src="picture.xml"/>
<map:transform type="xslt" src="picture.xsl">
<map:parameter name="pic" value="{coplet:attributes/picture}"/>
+ <map:parameter name="tpic" value="{coplet:temporaryAttributes/pictitle}"/>
</map:transform>
<map:serialize type="xml"/>
</map:match>
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/profiles/copletdata/portal.xml
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/profiles/copletdata/portal.xml?rev=290527&r1=290526&r2=290527&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/profiles/copletdata/portal.xml (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/samples/profiles/copletdata/portal.xml Tue Sep 20 11:56:14 2005
@@ -196,7 +196,11 @@
-->
<coplet-data id="Gallery" name="standard">
<title>Picture Gallery</title>
- <coplet-base-data>URICoplet</coplet-base-data>
+ <coplet-base-data>CachingURICoplet</coplet-base-data>
+ <attribute>
+ <name>buffer</name>
+ <value xsi:type="java:java.lang.Boolean">true</value>
+ </attribute>
<attribute>
<name>uri</name>
<value xsi:type="java:java.lang.String">cocoon:/coplets/gallery/browser</value>
@@ -216,7 +220,11 @@
</coplet-data>
<coplet-data id="GalleryViewer" name="standard">
<title>Gallery Viewer</title>
- <coplet-base-data>URICoplet</coplet-base-data>
+ <coplet-base-data>CachingURICoplet</coplet-base-data>
+ <attribute>
+ <name>buffer</name>
+ <value xsi:type="java:java.lang.Boolean">true</value>
+ </attribute>
<attribute>
<name>uri</name>
<value xsi:type="java:java.lang.String">cocoon:/coplets/gallery/viewer</value>
Modified: cocoon/branches/BRANCH_2_1_X/status.xml
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/status.xml?rev=290527&r1=290526&r2=290527&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/status.xml (original)
+++ cocoon/branches/BRANCH_2_1_X/status.xml Tue Sep 20 11:56:14 2005
@@ -197,6 +197,12 @@
<changes>
<release version="@version@" date="@date@">
+ <action dev="CZ" type="update" fixes-bug="32994" due-to="Michal Durdina" due-to-email="durdina@asset.sk">
+ Portal Block: Provide sample for caching uri coplet adapter (Gallery coplet).
+ </action>
+ <action dev="CZ" type="fix">
+ Portal Block: Add missing interface CopletInstanceEvent to FullScreenCopletEvent.
+ </action>
<action dev="JH" type="update" fixes-bug="35475" due-to="Mark Lundquist" due-to-email="mlundquist2@comcast.net">
CForms: Improved error message for wrong content type on upload.
</action>