cocoon-docs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@cocoon.apache.org
Subject [Cocoon Wiki] Updated: PortalEngine
Date Thu, 21 Oct 2004 15:15:24 GMT
   Date: 2004-10-21T08:15:24
   Editor: HelmaVanDerLinden <h.vanderlinden@mi.unimaas.nl>
   Wiki: Cocoon Wiki
   Page: PortalEngine
   URL: http://wiki.apache.org/cocoon/PortalEngine

   no comment

Change Log:

------------------------------------------------------------------------------
@@ -11,32 +11,41 @@
 
 ----
 
+'''Q:''' I notice there are two portal blocks, portal (Portal Engine) and portal-fw (Portal
Framework), what's the difference?
+
+'''A:''' First of all, the portal-fw block is considered obsolete and is replaced by the
portal block. If you plan on using the portal-fw block, consider
+the following: 
+
+They both use the authentication framework (authentication-fw block) and therefore provide
the same functionality. However, the 
+(newer) portal block can be used with a different authentication mechanism if required while
the portal-fw block is tied to the 
+authentication framework.
+
 '''Q:''' In {{{row.xsl}}} and {{{column.xsl}}}, included with the portal framework, attributes
{{{bgcolor}}}, {{{width}}}, {{{border}}} etc. are checked for and built into the resulting
table if specified.  How do I specify them?
 
 '''A:''' In your layout xml file, like this example:
 
-{{{
-  <composite-layout name="column">
-            
-    <!-- LEFT COLUMN -->
-    <item>
-      
-      <!-- **** Set width to 70% **** -->
-      <parameter name="width" value="70%"/>
-
-      <!-- **** Use a red background **** -->
-      <parameter name="bgcolor" value="red"/>
-
-
-      <coplet-layout name="coplet">
-        <coplet-instance-data>Coplet-1</coplet-instance-data>
-      </coplet-layout>
-    </item>
-    <!-- RIGHT COLUMN -->
-    <item>
-      <!-- [...] -->
-    </item>
-  </composite-layout>
+{{{
+  <composite-layout name="column">
+            
+    <!-- LEFT COLUMN -->
+    <item>
+      
+      <!-- **** Set width to 70% **** -->
+      <parameter name="width" value="70%"/>
+
+      <!-- **** Use a red background **** -->
+      <parameter name="bgcolor" value="red"/>
+
+
+      <coplet-layout name="coplet">
+        <coplet-instance-data>Coplet-1</coplet-instance-data>
+      </coplet-layout>
+    </item>
+    <!-- RIGHT COLUMN -->
+    <item>
+      <!-- [...] -->
+    </item>
+  </composite-layout>
 }}}
 
 ----
@@ -45,53 +54,53 @@
 
 '''A:''' The way you do it is very similar.  In your layout file, pass a {{{<parameter/>}}}
like this:
 
-{{{
-      <coplet-layout name="coplet" layout-renderer-name="hangingbox">
-        <parameter name="class" value="important"/>
-        <coplet-instance-data>LoginDetails-1</coplet-instance-data>
-      </coplet-layout>
+{{{
+      <coplet-layout name="coplet" layout-renderer-name="hangingbox">
+        <parameter name="class" value="important"/>
+        <coplet-instance-data>LoginDetails-1</coplet-instance-data>
+      </coplet-layout>
 }}}
 
 You can then pick up this value in your window renderer xsl, like this:
 
-{{{
-<xsl:template match="window">
-
-  <xsl:variable name="class">
-    <xsl:choose>
-      <xsl:when test="normalize-space(@class)">
-        <xsl:text>window </xsl:text>
-        <xsl:value-of select="normalize-space(@class)"/>
-      </xsl:when>
-      <xsl:otherwise>
-        <xsl:text>window</xsl:text>
-      </xsl:otherwise>
-    </xsl:choose>
-  </xsl:variable>
-
-  <div>
-    <xsl:attribute name="class">
-      <xsl:value-of select="$class"></xsl:value-of>
-    </xsl:attribute>
-
-    <!-- [SNIP] -->
-
-  </div>
-</xsl:template>
+{{{
+<xsl:template match="window">
+
+  <xsl:variable name="class">
+    <xsl:choose>
+      <xsl:when test="normalize-space(@class)">
+        <xsl:text>window </xsl:text>
+        <xsl:value-of select="normalize-space(@class)"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:text>window</xsl:text>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <div>
+    <xsl:attribute name="class">
+      <xsl:value-of select="$class"></xsl:value-of>
+    </xsl:attribute>
+
+    <!-- [SNIP] -->
+
+  </div>
+</xsl:template>
 }}}
 
 In this case, coplet windows by default get created as {{{<div class="window"></div>}}},
but if you set for example {{{<parameter name="class" value="important"/>}}} then your
window will be rendered as {{{<div class="window important"></div>}}}.  This can
be picked up in your site's CSS file like this:
 
-{{{
-  .window {
-    border: 1px solid black;
-  }
-  
-  .window.important {
-    border: 4px solid red;
-    background: yellow;
-    /* Ugh, good job this is just an example... :-) */
-  }
+{{{
+  .window {
+    border: 1px solid black;
+  }
+  
+  .window.important {
+    border: 4px solid red;
+    background: yellow;
+    /* Ugh, good job this is just an example... :-) */
+  }
 }}}
 
 ----
@@ -100,37 +109,37 @@
 
 '''A:''' Use the parameter selector to test the value of {{{aspectDatas/fullscreen}}} in
the sitemap for your coplet.  For example:
 
-{{{
-  <map:select type="parameter">
-    <map:parameter name="parameter-selector-test"
-     value="{coplet:aspectDatas/fullScreen}"/>
-    <map:when test="false">
-      <map:transform type="filter">
-        <map:parameter name="element-name" value="row"/>
-        <map:parameter name="count" value="5"/>
-        <map:parameter name="blocknr" value="{coplet:attributes/page}"/>
-      </map:transform>
-    </map:when>
-    <map:otherwise>
-      <map:transform type="filter">
-        <map:parameter name="element-name" value="row"/>
-        <map:parameter name="count" value="50"/>
-        <map:parameter name="blocknr" value="{coplet:attributes/page}"/>
-      </map:transform>
-    </map:otherwise>
-  </map:select>
+{{{
+  <map:select type="parameter">
+    <map:parameter name="parameter-selector-test"
+     value="{coplet:aspectDatas/fullScreen}"/>
+    <map:when test="false">
+      <map:transform type="filter">
+        <map:parameter name="element-name" value="row"/>
+        <map:parameter name="count" value="5"/>
+        <map:parameter name="blocknr" value="{coplet:attributes/page}"/>
+      </map:transform>
+    </map:when>
+    <map:otherwise>
+      <map:transform type="filter">
+        <map:parameter name="element-name" value="row"/>
+        <map:parameter name="count" value="50"/>
+        <map:parameter name="blocknr" value="{coplet:attributes/page}"/>
+      </map:transform>
+    </map:otherwise>
+  </map:select>
 }}}
 
 Note also from the above example that the coplet attribute {{{page}}} is being used to indicate
the current page.  By using a coplet attribute, different coplets can cut and paste the same
code, but they all remember their own value of {{{page}}}.  When your coplet generates the
links for each page, it should use the cl:links tags, something like this:
 
-{{{
-<xsl:for-each select="sql:block">
-  <cl:link class="activepage"
-           path="attributes/page"
-           value="{@sql:id}">
-    <xsl:value-of select="@sql:id" />
-  </cl:link>
-</xsl:for-each>
+{{{
+<xsl:for-each select="sql:block">
+  <cl:link class="activepage"
+           path="attributes/page"
+           value="{@sql:id}">
+    <xsl:value-of select="@sql:id" />
+  </cl:link>
+</xsl:for-each>
 }}}
 
 ----
@@ -143,40 +152,40 @@
 
 This will set the value of the "page" attribute of the current coplet to 1:
 
-{{{
-<cl:link class="activepage"
-         path="attributes/page"
-         value="{@sql:id}">
-
-  Go to page 1
-
-</cl:link>
+{{{
+<cl:link class="activepage"
+         path="attributes/page"
+         value="{@sql:id}">
+
+  Go to page 1
+
+</cl:link>
 }}}
 
 As you can see, the content of the {{{cl:link}}} tag becomes the clickable part of the anchor
tag, the above will get transformed into something like {{{<a href="..">Go to page 1</a>}}}.
 
 To set more than one value, use {{{cl:links}}}, with an additional {{{cl:content}}} tag to
set the clickable part of the anchor:
 
-{{{
-<cl:links>
-  <!-- set an attribute on this coplet -->
-  <cl:link path="attributes/data"
-           value="123"/>
-
-  <!-- set an attribute on some other coplet -->
-  <cl:link coplet="AnotherCoplet-1"
-           path="attributes/data"
-           value="456"/>
-
-  <!-- select the first tab on the main layout -->
-  <!-- N.B. uses a 0-based index -->
-  <cl:link layout="main" 
-           path="aspectDatas/tab"
-           value="0"/>
-
-  <!-- the bit that the user clicks -->
-  <cl:content>Click me!</cl:content>
-</cl:links>
+{{{
+<cl:links>
+  <!-- set an attribute on this coplet -->
+  <cl:link path="attributes/data"
+           value="123"/>
+
+  <!-- set an attribute on some other coplet -->
+  <cl:link coplet="AnotherCoplet-1"
+           path="attributes/data"
+           value="456"/>
+
+  <!-- select the first tab on the main layout -->
+  <!-- N.B. uses a 0-based index -->
+  <cl:link layout="main" 
+           path="aspectDatas/tab"
+           value="0"/>
+
+  <!-- the bit that the user clicks -->
+  <cl:content>Click me!</cl:content>
+</cl:links>
 }}}
 
 ----
@@ -194,28 +203,28 @@
 '''A:''' In cocoon.xconf, find the entry for the left navbar tab renderer.  It has a value
for "store" which is set to "session".  Simply change it to "temporary".  Now, whenever the
page containing that tab container is rendered, it will switch back to the first tab.
 Be warned though, this might not be quite what you want.  If you have a coplet on tab 2 of
your (now temporary) layout, and you click a link in it to adjust some parameter in it, it
will still revert to the first tab.  So when you render the link you will have to also explicitly
switch to the tab which you are already on (if you see what I mean).
 
-{{{
-  <renderer class="org.apache.cocoon.portal.layout.renderer.impl.AspectRenderer"
-   logger="portal" name="leftnav">
-    <aspects>
-      <aspect type="xslt">
-        <parameter name="style" value="{global:skin}styles/leftnav.xsl"/>
-      </aspect>
-      <aspect type="parameter">
-        <parameter name="tag-name" value="leftnav-layout"/>
-      </aspect>
-      <aspect type="history"/>
-      <aspect type="tab-content">
-         <parameter name="root-tag" value="false"/>
-
-         <!-- Don't remember the selected tab
-              between invocations -->
-         <parameter name="store" value="temporary"/>
-
-
-      </aspect>
-    </aspects>
-  </renderer>
+{{{
+  <renderer class="org.apache.cocoon.portal.layout.renderer.impl.AspectRenderer"
+   logger="portal" name="leftnav">
+    <aspects>
+      <aspect type="xslt">
+        <parameter name="style" value="{global:skin}styles/leftnav.xsl"/>
+      </aspect>
+      <aspect type="parameter">
+        <parameter name="tag-name" value="leftnav-layout"/>
+      </aspect>
+      <aspect type="history"/>
+      <aspect type="tab-content">
+         <parameter name="root-tag" value="false"/>
+
+         <!-- Don't remember the selected tab
+              between invocations -->
+         <parameter name="store" value="temporary"/>
+
+
+      </aspect>
+    </aspects>
+  </renderer>
 }}} 
 
 ----
@@ -224,31 +233,31 @@
 
 '''A:''' In your copletdata xml file, you need to set the "sizable" attribute on your coplet
to false.  Like this:
 
-{{{
-   <!-- Line wrapping adjusted to make the Wiki
-        slightly easier to read -->
-   <coplet-data id="LoginDetails" name="standard">
-      <title>box.logindetails.heading</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/logindetails/coplet</value>
-      </attribute>
-
-
-      <aspect>
-        <name>sizable</name>
-        <value
-   xsi:type="java:java.lang.Boolean"
-   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-  >false</value>
-      </aspect>
-
-
-   </coplet-data>
+{{{
+   <!-- Line wrapping adjusted to make the Wiki
+        slightly easier to read -->
+   <coplet-data id="LoginDetails" name="standard">
+      <title>box.logindetails.heading</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/logindetails/coplet</value>
+      </attribute>
+
+
+      <aspect>
+        <name>sizable</name>
+        <value
+   xsi:type="java:java.lang.Boolean"
+   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  >false</value>
+      </aspect>
+
+
+   </coplet-data>
 }}}
 
 You will another little tip in the above example, my window renderer stylesheet renders the
title element inside {{{<i18n:text></i18n:text>}}} tags, so my coplet title bars
are also internationalized.
@@ -259,38 +268,38 @@
 
 '''A:''' The coplet attribute "aspectDatas/fullScreen" tells you.  In the sitemap for the
particular coplet, do something like this:
 
-{{{
-    <map:transform src="generatelist.xsl">
-      <map:parameter name="fullscreen" 
-        value="{coplet:aspectDatas/fullScreen}"/>
-    </map:transform>
+{{{
+    <map:transform src="generatelist.xsl">
+      <map:parameter name="fullscreen" 
+        value="{coplet:aspectDatas/fullScreen}"/>
+    </map:transform>
 }}}
 
 Then, at the top of your xsl file, you can declare a parameter to receive the information:
 
-{{{
-  <xsl:param name="fullscreen"/>
+{{{
+  <xsl:param name="fullscreen"/>
 }}}
 
 The parameter will be set to {{{true}}} or {{{false}}} depending on the rendering mode. 
You can use this parameter in an {{{xsl:if}}} or {{{xsl:choice}}} block like this:
 
-{{{
-  <xsl:if test="$fullscreen='true'">
-    <!-- Do some extra thing if we are in fullscreen mode -->
-  </xsl:if>
+{{{
+  <xsl:if test="$fullscreen='true'">
+    <!-- Do some extra thing if we are in fullscreen mode -->
+  </xsl:if>
 }}}
 
 or
 
-{{{
-  <xsl:choice>
-    <xsl:when test="$fullscreen='true'">
-      <!-- fullscreen stuff -->
-    </xsl:when>
-    <xsl:otherwise>
-      <!-- normal window stuff -->
-    </xsl:otherwise>
-  </xsl:choice>
+{{{
+  <xsl:choice>
+    <xsl:when test="$fullscreen='true'">
+      <!-- fullscreen stuff -->
+    </xsl:when>
+    <xsl:otherwise>
+      <!-- normal window stuff -->
+    </xsl:otherwise>
+  </xsl:choice>
 }}}
 
 ----
@@ -328,43 +337,43 @@
 
 For example, if you want a round window border instead of the standard, add a new renderer:
 [[BR]]
-{{{
-  <renderer class="org.apache.cocoon.portal.layout.renderer.impl.AspectRenderer" 
-   logger="portal" name="round-window">
-   <aspects>
-     <aspect type="xslt">
-       <parameter name="style" value="{global:skin}styles/round-window.xsl"/>
-     </aspect>
-     <aspect type="parameter">
-       <parameter name="tag-name" value="window"/>
-     </aspect>
-     <aspect type="window">
-       <parameter name="root-tag" value="false"/>
-     </aspect>
-     <aspect type="coplet-full-screen"/>
-     <aspect type="coplet-sizing"/>
-     <aspect type="history"/>
-     <aspect type="coplet-cinclude"/>
-   </aspects>
-  </renderer>
+{{{
+  <renderer class="org.apache.cocoon.portal.layout.renderer.impl.AspectRenderer" 
+   logger="portal" name="round-window">
+   <aspects>
+     <aspect type="xslt">
+       <parameter name="style" value="{global:skin}styles/round-window.xsl"/>
+     </aspect>
+     <aspect type="parameter">
+       <parameter name="tag-name" value="window"/>
+     </aspect>
+     <aspect type="window">
+       <parameter name="root-tag" value="false"/>
+     </aspect>
+     <aspect type="coplet-full-screen"/>
+     <aspect type="coplet-sizing"/>
+     <aspect type="history"/>
+     <aspect type="coplet-cinclude"/>
+   </aspects>
+  </renderer>
 }}}
 [[BR]]
 then add it in the coplet definition:
 [[BR]]
-{{{
-  <layout class="org.apache.cocoon.portal.layout.impl.CopletLayout" name="coplet">
-    <renderers default="window">
-      <renderer name="window"/>
-      <renderer name="nowindow"/>
-      <renderer name="round-window"/>
-   </renderers>
-  </layout> 
+{{{
+  <layout class="org.apache.cocoon.portal.layout.impl.CopletLayout" name="coplet">
+    <renderers default="window">
+      <renderer name="window"/>
+      <renderer name="nowindow"/>
+      <renderer name="round-window"/>
+   </renderers>
+  </layout> 
 }}}
 [[BR]]
 and finally, switch the coplet renderer in your layout/portal.xml with the famous:
 [[BR]]
-{{{
-  <coplet-layout name="coplet" layout-renderer-name="round-window">
+{{{
+  <coplet-layout name="coplet" layout-renderer-name="round-window">
 }}}
 [[BR]]
 AlexRomayev compliments of LaurentTrillaud

Mime
View raw message