cziegeler 2003/12/12 05:46:13
Modified: src/blocks/portal/conf portal.samplesxconf
src/blocks/portal/samples/coplets/gallery picture.xsl
src/blocks/portal/samples/profiles/copletdata portal.xml
src/blocks/portal/samples/coplets sitemap.xmap
src/blocks/portal/samples/news/content/xdocs
portal-intro.xml
Added: src/blocks/portal/samples/coplets/gallery/samplepics
dog1.jpg dog2.jpg cat2.jpg bird1.jpg bird2.jpg
cat1.jpg
src/blocks/portal/samples/coplets/gallery gallery.xsl
picture.xml
Log:
Remove the dependency to the petstore example
Make the gallery coplet completly configurable
Revision Changes Path
1.10 +1 -0 cocoon-2.1/src/blocks/portal/conf/portal.samplesxconf
Index: portal.samplesxconf
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/conf/portal.samplesxconf,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- portal.samplesxconf 12 Dec 2003 10:13:34 -0000 1.9
+++ portal.samplesxconf 12 Dec 2003 13:46:12 -0000 1.10
@@ -155,6 +155,7 @@
class="org.apache.cocoon.portal.layout.impl.CopletLayout">
<renderers default="window">
<renderer name="window"/>
+ <renderer name="nowindow"/>
</renderers>
</layout>
<layout name="link"
1.1
cocoon-2.1/src/blocks/portal/samples/coplets/gallery/samplepics/dog1.jpg
<<Binary file>>
1.1
cocoon-2.1/src/blocks/portal/samples/coplets/gallery/samplepics/dog2.jpg
<<Binary file>>
1.1
cocoon-2.1/src/blocks/portal/samples/coplets/gallery/samplepics/cat2.jpg
<<Binary file>>
1.1
cocoon-2.1/src/blocks/portal/samples/coplets/gallery/samplepics/bird1.jpg
<<Binary file>>
1.1
cocoon-2.1/src/blocks/portal/samples/coplets/gallery/samplepics/bird2.jpg
<<Binary file>>
1.1
cocoon-2.1/src/blocks/portal/samples/coplets/gallery/samplepics/cat1.jpg
<<Binary file>>
1.2 +9 -74
cocoon-2.1/src/blocks/portal/samples/coplets/gallery/picture.xsl
Index: picture.xsl
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/blocks/portal/samples/coplets/gallery/picture.xsl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- picture.xsl 11 Dec 2003 16:05:01 -0000 1.1
+++ picture.xsl 12 Dec 2003 13:46:13 -0000 1.2
@@ -4,83 +4,18 @@
-->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-<!-- The current picture (index) to display -->
+<!-- The current picture 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:when test="$pic=''">
+ <p>Please choose a picture in the gallery.</p>
+ </xsl:when>
+ <xsl:otherwise>
+ <img src="{$pic}"/>
+ </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.1
cocoon-2.1/src/blocks/portal/samples/coplets/gallery/gallery.xsl
Index: gallery.xsl
===================================================================
<?xml version="1.0"?>
<!-- $Id: gallery.xsl,v 1.1 2003/12/12 13:46:13 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"/>
<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>
<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:template>
</xsl:stylesheet>
1.1
cocoon-2.1/src/blocks/portal/samples/coplets/gallery/picture.xml
Index: picture.xml
===================================================================
<?xml version="1.0"?>
<pictures/>
1.11 +11 -11
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.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- portal.xml 12 Dec 2003 12:37:13 -0000 1.10
+++ portal.xml 12 Dec 2003 13:46:13 -0000 1.11
@@ -150,9 +150,18 @@
<name>uri</name>
<value xsi:type="java:java.lang.String"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">cocoon:/news/portal-bottom.html</value>
</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>
<attribute>
<name>image-dir</name>
- <value xsi:type="java:java.lang.String"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">../../petstore/images</value>
+ <value xsi:type="java:java.lang.String"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">gallery/samplepics</value>
</attribute>
<attribute>
<name>image-include</name>
@@ -160,16 +169,7 @@
</attribute>
<attribute>
<name>image-uri-prefix</name>
- <value xsi:type="java:java.lang.String"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">../petstore/images</value>
- </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>
+ <value xsi:type="java:java.lang.String"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">coplets/gallery/images</value>
</attribute>
</coplet-data>
<coplet-data id="GalleryViewer" name="standard">
1.4 +9 -13 cocoon-2.1/src/blocks/portal/samples/coplets/sitemap.xmap
Index: sitemap.xmap
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/blocks/portal/samples/coplets/sitemap.xmap,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- sitemap.xmap 12 Dec 2003 12:37:13 -0000 1.3
+++ sitemap.xmap 12 Dec 2003 13:46:13 -0000 1.4
@@ -6,6 +6,10 @@
<map:pipeline>
+ <map:match pattern="gallery/images/*.jpg">
+ <map:read mime-type="image/jpg" src="gallery/samplepics/{1}.jpg"/>
+ </map:match>
+
<!-- this is a gallery coplet -->
<map:match pattern="gallery">
<map:generate type="directory"
src="{coplet:copletData/attributes/image-dir}">
@@ -14,26 +18,18 @@
<map:transform src="gallery/dir2pic.xsl">
<map:parameter name="dirprefix"
value="{coplet:copletData/attributes/image-uri-prefix}"/>
</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 type="xslt" src="gallery/gallery.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:generate src="gallery/picture.xml"/>
<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:parameter name="pic" value="{coplet:attributes/picture}"/>
</map:transform>
- <map:transform type="portal-coplet"/>
<map:serialize type="xml"/>
</map:match>
1.5 +1 -1
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.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- portal-intro.xml 12 Dec 2003 10:13:34 -0000 1.4
+++ portal-intro.xml 12 Dec 2003 13:46:13 -0000 1.5
@@ -15,7 +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>
+ <li>The Coplets tab show some more coplets.</li>
</ul>
<note>THIS IS A SAMPLE PORTAL. It demonstrates several features of
the portal engine, so it's not optimized for production. Make sure