Author: jmorliaguet
Date: Wed Oct 26 10:14:45 2005
New Revision: 28642

Modified:
   z3lab/z3ecm/trunk/src/ecm/Makefile
   z3lab/z3ecm/trunk/src/ecm/cpsskins/README.txt
   z3lab/z3ecm/trunk/src/ecm/cpsskins/example2/README.txt
Log:

- doc update



Modified: z3lab/z3ecm/trunk/src/ecm/Makefile
==============================================================================
--- z3lab/z3ecm/trunk/src/ecm/Makefile  (original)
+++ z3lab/z3ecm/trunk/src/ecm/Makefile  Wed Oct 26 10:14:45 2005
@@ -10,5 +10,6 @@
 
 
 .PHONY: cpsskins
-cpsskins: cpsskins/README.html cpsskins/example1/README.html \
+cpsskins: cpsskins/README.html \
+          cpsskins/example1/README.html \
           cpsskins/example2/README.html

Modified: z3lab/z3ecm/trunk/src/ecm/cpsskins/README.txt
==============================================================================
--- z3lab/z3ecm/trunk/src/ecm/cpsskins/README.txt       (original)
+++ z3lab/z3ecm/trunk/src/ecm/cpsskins/README.txt       Wed Oct 26 10:14:45 2005
@@ -5,7 +5,7 @@
 ===========================
 
 :Author: Jean-Marc Orliaguet
-:Version: $Revision: 2 $
+:Version: $Revision: 3 $
 :Copyright: 2005 Nuxeo and Contributors.
 
 .. contents::
@@ -52,16 +52,17 @@
 ~~~~~~~~~~~~~~~~~
 Some developer or a group of developers create:
 
-- a tree
-- a hill
-- a "tree painting filter"
+- a tree *portlet* that generates some information about its structure
+- a tree *widget* that transforms the information into HTML
+- a hill *portlet* that draws a hill in HTML
+- a "tree painting *filter*"
 
 composition phase
 ~~~~~~~~~~~~~~~~~
 
-- a page designer opens a new page, then drags the hill and the tree onto the
-  page canvas, associates a "tree painting filter" to the tree and moves the
-  tree just above the hill.
+- the page designer opens a new page, then drags the hill and the tree portlet
+  onto the page canvas, associates a tree widget and a "tree painting
+  filter" to the tree then moves the tree just above the hill.
 
 
 Target audience

Modified: z3lab/z3ecm/trunk/src/ecm/cpsskins/example2/README.txt
==============================================================================
--- z3lab/z3ecm/trunk/src/ecm/cpsskins/example2/README.txt      (original)
+++ z3lab/z3ecm/trunk/src/ecm/cpsskins/example2/README.txt      Wed Oct 26 
10:14:45 2005
@@ -5,7 +5,7 @@
 ========================
 
 :Author: Jean-Marc Orliaguet
-:Version: $Revision: 1 $
+:Version: $Revision: 2 $
 :Copyright: 2005 Nuxeo and Contributors.
 
 Prerequisites
@@ -103,22 +103,59 @@
 Step 2: defining the portlet's factory
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-TODO
+The Text portlet's factory class is very much like the HelloPortlet class of
+example1.
 
+The main difference is that a extra 'text' parameter is passed to the class
+constructor.
 
-Step 3: creating the portlet's markup
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+The __call__ method is also slightly different since it uses the value of the
+'text' field to generate the markup. This is done with::
 
-TODO
+    def __call__(self, info):
+        return unicode(self.text)
 
+But when a Text portlet is first instanciated the 'text' value is an empty
+string. Since you don't want the portlet to be invisible you should add a
+condition to make sure that the portlet always returns some markup::
 
-Step 4: registrering the portlet
+    def __call__(self, info):
+        return unicode(self.text) or u"Please enter some text."
+
+Remember that portlets are expected to return unicode strings as markup.
+
+Here is the final portlet factory::
+
+    >>> class TextPortlet(Persistent):
+    ...     """The Text portlet displays some text entered by the user.
+    ...     """
+    ...     implements(ITextPortlet)
+
+    ...     def __init__(self, title='', text=''):
+    ...         self.title = title
+    ...         self.text = text
+
+    ...     def __call__(self, info):
+    ...         return unicode(self.text) or u"Please enter some text."
+
+
+
+Step 3: registrering the portlet
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-TODO
+Finally register your portlet::
+
+  <cpsskins:portlet
+      name="ecm.cpsskins.example2"
+      title="Example2: Text portlet"
+      description="This portlet displays some text or HTML."
+      factory=".text.TextPortlet"
+      schema=".text.ITextPortlet"
+      icon="text-icon.png"
+  />
 
 
-Step 5: testing the portlet
+Step 4: testing the portlet
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 You can now make sure that your portlet works as expected:
@@ -141,6 +178,6 @@
 
 .. figure:: example2.png
 
-   fig.4: The Text portlet displayed on the page canvas.
+   fig.3: The Text portlet displayed on the page canvas.
 
 .. footer:: copyright 2005 - Nuxeo and Contributors
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to