Author: jmorliaguet
Date: Tue Oct 25 23:36:19 2005
New Revision: 28638

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

- saving work in progress



Modified: z3lab/z3ecm/trunk/src/ecm/Makefile
==============================================================================
--- z3lab/z3ecm/trunk/src/ecm/Makefile  (original)
+++ z3lab/z3ecm/trunk/src/ecm/Makefile  Tue Oct 25 23:36:19 2005
@@ -10,4 +10,5 @@
 
 
 .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/example2/README.txt
==============================================================================
--- z3lab/z3ecm/trunk/src/ecm/cpsskins/example2/README.txt      (original)
+++ z3lab/z3ecm/trunk/src/ecm/cpsskins/example2/README.txt      Tue Oct 25 
23:36:19 2005
@@ -1,2 +1,94 @@
 
-This portlet displays some text specified by the user.
+.. header:: cpsskins developer tutorial
+
+Example 2: Text portlet
+========================
+
+:Author: Jean-Marc Orliaguet
+:Version: $Revision: 1 $
+:Copyright: 2005 Nuxeo and Contributors.
+
+Description
+-----------
+
+The Text portlet displays some text specified by the user.
+
+Prerequisites
+-------------
+
+You have read the 'example1' section of this tutorial.
+
+
+Steps in developing the Text portlet
+-------------------------------------
+
+You may take a look the `<text.py>`_ file while going through the steps.
+
+
+Step 1: defining the portlet's interface
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The Text portlet is very similar to the Hello portlet. It only differs by the
+fact that instead of displaying the canonical 'Hello world' it can be used to
+display any portion of text or HTML entered by the user.
+
+Portlets can be edited using an edit form. This is being done by
+right-clicking on the portlet in page authoring mode and by selecting the
+'Edit' menu item.
+
+The edit form looks like this::
+
+.. edit-form.png
+
+   The Text portlet's edit form.
+
+
+Here is a description of the steps needed to create such a form.
+
+Create an 'ITextPortlet' interface inheriting from IPortlet, and extend it
+with a Text schema field::
+
+    >>> from zope.schema import Text
+
+    >>> from cpsskins.interfaces import IPortlet
+
+    >>> class ITextPortlet(IPortlet):
+    ...     """Interface for the Text portlet.
+    ...     """
+    ...     text = Text(
+    ...         title=u"Some text",
+    ...         description=u"Please enter some text. You may also use HTML."
+    ...         required=False)
+
+
+The 'text' field will refer to the text entered by the user. In the edit form
+it will be presented as a text input area, but remember that the schema field
+only defines the type of data not its presentation. However CPSSkins uses some
+of the information that you will specify to create a visual representation of
+the fields.
+
+Here are the most common field options:
+
+title
+~~~~~
+The 'title' (here: "Some text") corresponds to the label displayed next to
+the text area. Keep it as short and as self-explanatory as possible.
+
+description
+~~~~~~~~~~~
+
+If you need to explain in details what the field is about write a description
+instead. The description will be displayed as a form hint. By clicking on the
+[?] sign next to the field title, the user will see a hint window pop up
+containing the description (here: "Please enter some text.").
+
+required
+~~~~~~~~
+If you set this option to True, the user will be asked to fill in a field 
value.
+A red (*) sign will be displayed next to the field title. Do not set this to
+True unless the field's value really is required.
+
+For a comprehensive description of the schema field options see
+zope/schema/README.txt in the Zope3 distribution.
+
+

Modified: z3lab/z3ecm/trunk/src/ecm/cpsskins/example2/text.py
==============================================================================
--- z3lab/z3ecm/trunk/src/ecm/cpsskins/example2/text.py (original)
+++ z3lab/z3ecm/trunk/src/ecm/cpsskins/example2/text.py Tue Oct 25 23:36:19 2005
@@ -26,7 +26,10 @@
 class ITextPortlet(IPortlet):
     """Interface for the Text portlet.
     """
-    text = Text(title=u"Some text")
+    text = Text(
+        title=u"Some text",
+        description=u"Please enter some text. You may also use HTML",
+        required=False)
 
 class TextPortlet(Persistent):
     """The Text portlet displays some text entered by the user.
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to