cziegeler 2003/12/11 08:05:01
Modified: src/blocks/portal/samples/profiles/copletdata portal.xml
src/blocks/portal/samples/news/content/xdocs
portal-intro.xml
src/blocks/portal/samples/profiles/copletinstancedata
portal.xml
src/blocks/portal/samples sitemap.xmap
src/blocks/portal/samples/profiles/layout portal.xml
Added: src/blocks/portal/samples/coplets sitemap.xmap
src/blocks/portal/samples/coplets/gallery dir2pic.xsl
picture.xsl
Log:
Adding new gallery and inter-coplet communication example
Revision Changes Path
1.8 +16 -0
cocoon-2.1/src/blocks/portal/samples/profiles/copletdata/portal.xml
Index: portal.xml
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/blocks/portal/samples/profiles/copletdata/portal.xml,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- portal.xml 29 Sep 2003 11:37:49 -0000 1.7
+++ portal.xml 11 Dec 2003 16:05:01 -0000 1.8
@@ -152,5 +152,21 @@
</attribute>
</coplet-data>
+ <coplet-data id="Gallery" name="standard">
+ <title>Picture Gallery</title>
+ <coplet-base-data>URICoplet</coplet-base-data>
+ <attribute>
+ <name>uri</name>
+ <value xsi:type="java:java.lang.String"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">cocoon:/coplets/gallery</value>
+ </attribute>
+ </coplet-data>
+ <coplet-data id="GalleryViewer" name="standard">
+ <title>Gallery Viewer</title>
+ <coplet-base-data>URICoplet</coplet-base-data>
+ <attribute>
+ <name>uri</name>
+ <value xsi:type="java:java.lang.String"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">cocoon:/coplets/galleryviewer</value>
+ </attribute>
+ </coplet-data>
</coplets>
1.1 cocoon-2.1/src/blocks/portal/samples/coplets/sitemap.xmap
Index: sitemap.xmap
===================================================================
<?xml version="1.0"?>
<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
<map:pipelines>
<map:pipeline>
<!-- this is a gallery coplet -->
<map:match pattern="gallery">
<map:generate type="directory" src="../../petstore/images">
<map:parameter name="include" value=".jpg"/>
</map:generate>
<map:transform src="gallery/dir2pic.xsl">
<map:parameter name="dirprefix" value="../petstore/images"/>
</map:transform>
<map:transform type="xslt" src="gallery/picture.xsl">
<map:parameter name="pic" value="{coplet:attributes/picture}"/>
<map:parameter name="fullscreen"
value="{coplet:aspectDatas/fullScreen}"/>
</map:transform>
<map:transform type="portal-coplet"/>
<map:serialize type="xml"/>
</map:match>
<map:match pattern="galleryviewer">
<map:generate type="directory" src="../../petstore/images">
<map:parameter name="include" value=".jpg"/>
</map:generate>
<map:transform src="gallery/dir2pic.xsl">
<map:parameter name="dirprefix" value="../petstore/images"/>
</map:transform>
<map:transform type="xslt" src="gallery/picture.xsl">
<map:parameter name="pic" value="{coplet:attributes/picture}"/>
<map:parameter name="fullscreen"
value="{coplet:aspectDatas/fullScreen}"/>
<map:parameter name="navigation" value="false"/>
</map:transform>
<map:transform type="portal-coplet"/>
<map:serialize type="xml"/>
</map:match>
</map:pipeline>
</map:pipelines>
</map:sitemap>
1.3 +1 -0
cocoon-2.1/src/blocks/portal/samples/news/content/xdocs/portal-intro.xml
Index: portal-intro.xml
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/blocks/portal/samples/news/content/xdocs/portal-intro.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- portal-intro.xml 9 Dec 2003 10:21:56 -0000 1.2
+++ portal-intro.xml 11 Dec 2003 16:05:01 -0000 1.3
@@ -15,6 +15,7 @@
<ul>
<li>The TabDemo1 shows a tab inside a tab, which is useful for
structuring content.</li>
<li>The TabDemo2 shows the same content as TabDemo2 but with just
a different stylesheet for the tab.</li>
+ <li>The Coplets tab show some more coplets. You need to also have
the petstore example installed!</li>
</ul>
<p>For more information <fork href="http://cocoon.apache.org">visit
the Cocoon Homepage</fork>.</p>
</s1>
1.1
cocoon-2.1/src/blocks/portal/samples/coplets/gallery/dir2pic.xsl
Index: dir2pic.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:dir="http://apache.org/cocoon/directory/2.0">
<xsl:param name="dirprefix"/>
<xsl:template match="/">
<pictures>
<xsl:for-each select="dir:directory/dir:file">
<picture><xsl:value-of select="$dirprefix"/>/<xsl:value-of
select="@name"/></picture>
</xsl:for-each>
</pictures>
</xsl:template>
</xsl:stylesheet>
1.1
cocoon-2.1/src/blocks/portal/samples/coplets/gallery/picture.xsl
Index: picture.xsl
===================================================================
<?xml version="1.0"?>
<!-- $Id: picture.xsl,v 1.1 2003/12/11 16:05:01 cziegeler Exp $
-->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- The current picture (index) to display -->
<xsl:param name="pic"/>
<!-- Is this full screen? -->
<xsl:param name="fullscreen"/>
<!-- Should we print next/prev links? -->
<xsl:param name="navigation"/>
<xsl:template match="pictures"
xmlns:cl="http://apache.org/cocoon/portal/coplet/1.0">
<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">
<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>
</tr>
</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>
<xsl:if test="$navigation!='false'">
<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="{$showpicindex}"
coplet="GalleryViewer-1">Push to Viewer</cl:link></p>
</xsl:if>
<img src="{picture[position()=$showpicindex]}"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
1.5 +7 -0
cocoon-2.1/src/blocks/portal/samples/profiles/copletinstancedata/portal.xml
Index: portal.xml
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/blocks/portal/samples/profiles/copletinstancedata/portal.xml,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- portal.xml 29 Sep 2003 11:37:49 -0000 1.4
+++ portal.xml 11 Dec 2003 16:05:01 -0000 1.5
@@ -60,4 +60,11 @@
<coplet-instance-data id="Portal-Bottom-1" name="standard">
<coplet-data>Portal-Bottom</coplet-data>
</coplet-instance-data>
+
+ <coplet-instance-data id="Gallery-Petstore" name="standard">
+ <coplet-data>Gallery</coplet-data>
+ </coplet-instance-data>
+ <coplet-instance-data id="GalleryViewer-1" name="standard">
+ <coplet-data>GalleryViewer</coplet-data>
+ </coplet-instance-data>
</coplets>
1.17 +3 -0 cocoon-2.1/src/blocks/portal/samples/sitemap.xmap
Index: sitemap.xmap
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/samples/sitemap.xmap,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- sitemap.xmap 11 Dec 2003 14:59:03 -0000 1.16
+++ sitemap.xmap 11 Dec 2003 16:05:01 -0000 1.17
@@ -128,6 +128,9 @@
<map:match pattern="news/**">
<map:mount check-reload="yes" src="news/" uri-prefix="news"/>
</map:match>
+ <map:match pattern="coplets/**">
+ <map:mount check-reload="yes" src="coplets/" uri-prefix="coplets"/>
+ </map:match>
<!-- Test pipeline for layout engine -->
<map:match pattern="portal">
1.14 +14 -0
cocoon-2.1/src/blocks/portal/samples/profiles/layout/portal.xml
Index: portal.xml
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/blocks/portal/samples/profiles/layout/portal.xml,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- portal.xml 11 Dec 2003 14:41:33 -0000 1.13
+++ portal.xml 11 Dec 2003 16:05:01 -0000 1.14
@@ -216,4 +216,18 @@
</named-item>
</composite-layout>
</named-item>
+ <named-item name="Coplets">
+ <composite-layout name="column">
+ <item>
+ <coplet-layout name="coplet">
+
<coplet-instance-data>Gallery-Petstore</coplet-instance-data>
+ </coplet-layout>
+ </item>
+ <item>
+ <coplet-layout name="coplet">
+
<coplet-instance-data>GalleryViewer-1</coplet-instance-data>
+ </coplet-layout>
+ </item>
+ </composite-layout>
+ </named-item>
</composite-layout>