Author: jmorliaguet
Date: Tue Oct 25 22:46:22 2005
New Revision: 28636

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

- doc update (added a description of IPortlet)



Modified: z3lab/z3ecm/trunk/src/ecm/cpsskins/example1/README.txt
==============================================================================
--- z3lab/z3ecm/trunk/src/ecm/cpsskins/example1/README.txt      (original)
+++ z3lab/z3ecm/trunk/src/ecm/cpsskins/example1/README.txt      Tue Oct 25 
22:46:22 2005
@@ -5,7 +5,7 @@
 ========================
 
 :Author: Jean-Marc Orliaguet
-:Version: $Revision: 3 $
+:Version: $Revision: 4 $
 :Copyright: 2005 Nuxeo and Contributors.
 
 .. contents::
@@ -31,20 +31,38 @@
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 First you should make the interface of your portlet inherit from the IPortlet
-interface:
+interface. Here is the IPortlet definition::
 
-    >>> from cpsskins.interfaces import IPortlet
+    class IPortlet(IContent):
 
-    >>> class IHelloPortlet(IPortlet):
-    >>>     """The Hello portlet interface."""
+        identifier = Attribute("A unique identifier.")
+
+        title = TextLine(
+            title=_("Portlet's title"),
+            required=False)
+
+        def __call__(info):
+            """Return the portlet's data to display"""
+
+- 'identifier' is a unique identifier internally used by CPSSkins. You should
+  be careful *not to override the value of this attribute*.
+
+- 'title' is a human-readable label given to the portlet. It has no incidence
+  on the portlet's modes of operation. It is mostly used in the user interface.
 
-In cpsskins all portlets have a title. The 'title' field is declared in the
-IPortlet interface as::
+- def __call__(info) returns the markup that the portlet will display.
 
+  The 'info' parameter contains some contextual information that the portlet
+  can use or can set (this will be discussed in example3).
 
-    title = schema.TextLine(
-        title=_("Portlet's title"),
-        required=False)
+So the first thing to do is to import IPortlet:
+
+    >>> from cpsskins.interfaces import IPortlet
+
+Then define the interface for your portlet: 
+
+    >>> class IHelloPortlet(IPortlet):
+    >>>     """The Hello portlet interface."""
 
 Since the Hello portlet is not very configurable apart from its title the only
 field that will appear in the portlet's edit form will be the 'title' field
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to