[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/demo/widget/ Added initial checkin for widget demos

Roger Ineichen roger at projekt01.ch
Sun Feb 27 18:48:06 EST 2005


Log message for revision 29330:
  Added initial checkin for widget demos
  We'll use the demo also in the onlinehelp

Changed:
  A   Zope3/trunk/src/zope/app/demo/widget/
  A   Zope3/trunk/src/zope/app/demo/widget/README.txt
  A   Zope3/trunk/src/zope/app/demo/widget/__init__.py
  A   Zope3/trunk/src/zope/app/demo/widget/app.py
  A   Zope3/trunk/src/zope/app/demo/widget/browser/
  A   Zope3/trunk/src/zope/app/demo/widget/browser/__init__.py
  A   Zope3/trunk/src/zope/app/demo/widget/browser/configure.zcml
  A   Zope3/trunk/src/zope/app/demo/widget/browser/demowidgetcontainer.gif
  A   Zope3/trunk/src/zope/app/demo/widget/browser/intwidget.zcml
  A   Zope3/trunk/src/zope/app/demo/widget/browser/popup.pt
  A   Zope3/trunk/src/zope/app/demo/widget/browser/test.pt
  A   Zope3/trunk/src/zope/app/demo/widget/browser/textareawidget.zcml
  A   Zope3/trunk/src/zope/app/demo/widget/browser/textwidget.zcml
  A   Zope3/trunk/src/zope/app/demo/widget/configure.zcml
  A   Zope3/trunk/src/zope/app/demo/widget/ftests.py
  A   Zope3/trunk/src/zope/app/demo/widget/help/
  A   Zope3/trunk/src/zope/app/demo/widget/help/README.txt
  A   Zope3/trunk/src/zope/app/demo/widget/help/__init__.py
  A   Zope3/trunk/src/zope/app/demo/widget/help/configure.zcml
  A   Zope3/trunk/src/zope/app/demo/widget/help/textwidget.txt
  A   Zope3/trunk/src/zope/app/demo/widget/interfaces/
  A   Zope3/trunk/src/zope/app/demo/widget/interfaces/__init__.py
  A   Zope3/trunk/src/zope/app/demo/widget/interfaces/intwidget.py
  A   Zope3/trunk/src/zope/app/demo/widget/interfaces/textareawidget.py
  A   Zope3/trunk/src/zope/app/demo/widget/interfaces/textwidget.py
  A   Zope3/trunk/src/zope/app/demo/widget/intwidget.py
  A   Zope3/trunk/src/zope/app/demo/widget/intwidget.zcml
  A   Zope3/trunk/src/zope/app/demo/widget/tests.py
  A   Zope3/trunk/src/zope/app/demo/widget/textareawidget.py
  A   Zope3/trunk/src/zope/app/demo/widget/textareawidget.zcml
  A   Zope3/trunk/src/zope/app/demo/widget/textwidget.py
  A   Zope3/trunk/src/zope/app/demo/widget/textwidget.zcml

-=-
Added: Zope3/trunk/src/zope/app/demo/widget/README.txt
===================================================================
--- Zope3/trunk/src/zope/app/demo/widget/README.txt	2005-02-27 23:40:26 UTC (rev 29329)
+++ Zope3/trunk/src/zope/app/demo/widget/README.txt	2005-02-27 23:48:05 UTC (rev 29330)
@@ -0,0 +1,23 @@
+===========
+Widget Demo
+===========
+
+This package demonstrates how to use fields and widgets.
+
+You can find the widgets samples also in the onlinehelp rubric: 
+Samples/Widgets.
+
+You also need the package zope.app.styleguide for to include the
+Style Guide.
+
+Description
+-----------
+
+We use IRead.. and IWrite interfaces in the sample for use a easy
+registration in the ZCML. The readonly attributes samples declared in the 
+IRead interfaces. The write samples are registred with a addform and editfrom.
+Ther is also a schemadisplay view registred called 'View' where you can see
+the readonly sample field.
+
+The sample fields are named like the attribute of the fields. The field in the
+sample objects have the same order like the attributes in the constructor.


Property changes on: Zope3/trunk/src/zope/app/demo/widget/README.txt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: Zope3/trunk/src/zope/app/demo/widget/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/demo/widget/__init__.py	2005-02-27 23:40:26 UTC (rev 29329)
+++ Zope3/trunk/src/zope/app/demo/widget/__init__.py	2005-02-27 23:48:05 UTC (rev 29330)
@@ -0,0 +1,17 @@
+##############################################################################
+#
+# Copyright (c) 2005 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Demo widget implementation
+
+$Id$
+"""


Property changes on: Zope3/trunk/src/zope/app/demo/widget/__init__.py
___________________________________________________________________
Name: svn:eol-style
   + native

Added: Zope3/trunk/src/zope/app/demo/widget/app.py
===================================================================
--- Zope3/trunk/src/zope/app/demo/widget/app.py	2005-02-27 23:40:26 UTC (rev 29329)
+++ Zope3/trunk/src/zope/app/demo/widget/app.py	2005-02-27 23:48:05 UTC (rev 29330)
@@ -0,0 +1,40 @@
+##############################################################################
+#
+# Copyright (c) 2005 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Demo widget implementation
+
+$Id$
+"""
+__docformat__ = 'restructuredtext'
+
+from persistent import Persistent
+from zope.interface import implements
+
+from zope.app.container.contained import Contained
+from zope.app.container.btree import BTreeContainer
+
+from zope.app.demo.widget.interfaces import IDemoWidgetContainerContained
+from zope.app.demo.widget.interfaces import IDemoWidgetContainer
+from zope.app.demo.widget.interfaces import IDemoWidget
+
+
+class DemoWidgetContainer(BTreeContainer):
+    """Demo widget container containing demo widget objects"""
+
+    implements(IDemoWidgetContainer)
+
+
+class DemoWidget(Persistent, Contained):
+    """Base class for demo widgets."""
+
+    implements(IDemoWidgetContainerContained)


Property changes on: Zope3/trunk/src/zope/app/demo/widget/app.py
___________________________________________________________________
Name: svn:eol-style
   + native

Added: Zope3/trunk/src/zope/app/demo/widget/browser/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/demo/widget/browser/__init__.py	2005-02-27 23:40:26 UTC (rev 29329)
+++ Zope3/trunk/src/zope/app/demo/widget/browser/__init__.py	2005-02-27 23:48:05 UTC (rev 29330)
@@ -0,0 +1,17 @@
+##############################################################################
+#
+# Copyright (c) 2005 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Demo widget implementation
+
+$Id$
+"""


Property changes on: Zope3/trunk/src/zope/app/demo/widget/browser/__init__.py
___________________________________________________________________
Name: svn:eol-style
   + native

Added: Zope3/trunk/src/zope/app/demo/widget/browser/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/demo/widget/browser/configure.zcml	2005-02-27 23:40:26 UTC (rev 29329)
+++ Zope3/trunk/src/zope/app/demo/widget/browser/configure.zcml	2005-02-27 23:48:05 UTC (rev 29330)
@@ -0,0 +1,36 @@
+<configure
+    xmlns="http://namespaces.zope.org/browser"
+    i18n_domain="zope">
+
+  <addMenuItem
+      title="Demo Widgets" 
+      class="zope.app.demo.widget.app.DemoWidgetContainer"
+      permission="zope.ManageContent"
+      />
+  
+  <containerViews
+       for="zope.app.demo.widget.interfaces.IDemoWidgetContainer"
+       contents="zope.ManageContent"
+       index="zope.View"
+       add="zope.ManageContent"
+       />
+
+  <icon
+      name="zmi_icon"
+      for="zope.app.demo.widget.interfaces.IDemoWidgetContainer"
+      file="demowidgetcontainer.gif"
+      />
+
+  <!-- popup edit view -->
+  <menuItem
+      title="Popup Edit" menu="zmi_views" 
+      for="zope.app.demo.widget.interfaces.IDemoWidget"
+      permission="zope.ManageContent"
+      action="javascript:popup('./popupEdit.html', 'popup', 'height=460,width=500,resizable=1,scrollbars=yes,location=no,status=no,toolbar=no,menubar=no')"
+      />
+
+  <include file="intwidget.zcml" />
+  <include file="textwidget.zcml" />
+  <include file="textareawidget.zcml" />
+
+</configure>


Property changes on: Zope3/trunk/src/zope/app/demo/widget/browser/configure.zcml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: Zope3/trunk/src/zope/app/demo/widget/browser/demowidgetcontainer.gif
===================================================================
(Binary files differ)


Property changes on: Zope3/trunk/src/zope/app/demo/widget/browser/demowidgetcontainer.gif
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: Zope3/trunk/src/zope/app/demo/widget/browser/intwidget.zcml
===================================================================
--- Zope3/trunk/src/zope/app/demo/widget/browser/intwidget.zcml	2005-02-27 23:40:26 UTC (rev 29329)
+++ Zope3/trunk/src/zope/app/demo/widget/browser/intwidget.zcml	2005-02-27 23:48:05 UTC (rev 29330)
@@ -0,0 +1,47 @@
+<configure
+    xmlns="http://namespaces.zope.org/browser"
+    i18n_domain="zope">
+
+  <addMenuItem
+      title="IntWidget"
+      description="Add a Demo IntWidget"
+      class="..intwidget.DemoIntWidget"
+      permission="zope.ManageContent"
+      view="addDemoIntWidget.html"
+      />
+
+  <addform
+      name="addDemoIntWidget.html"
+      label="Add a Demo IntWidget"
+      schema="..interfaces.IWriteDemoIntWidget"
+      content_factory="..intwidget.DemoIntWidget"
+      permission="zope.ManageContent"
+      />
+
+  <schemadisplay
+      name="index.html"
+      schema="..interfaces.IDemoIntWidget"
+      label="IntWidget Index"
+      permission="zope.ManageServices"
+      menu="zmi_views" title="View"
+      />
+
+  <editform
+      name="edit.html"
+      label="Edit"
+      for="..interfaces.IDemoIntWidget"
+      schema="..interfaces.IWriteDemoIntWidget"
+      menu="zmi_views" title="Edit"
+      permission="zope.ManageContent"
+      />
+
+  <editform
+      name="popupEdit.html"
+      label="Popup Edit"
+      for="..interfaces.IDemoIntWidget"
+      schema="..interfaces.IDemoIntWidget"
+      permission="zope.ManageContent"
+      template="popup.pt"
+      />
+
+</configure>


Property changes on: Zope3/trunk/src/zope/app/demo/widget/browser/intwidget.zcml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: Zope3/trunk/src/zope/app/demo/widget/browser/popup.pt
===================================================================
--- Zope3/trunk/src/zope/app/demo/widget/browser/popup.pt	2005-02-27 23:40:26 UTC (rev 29329)
+++ Zope3/trunk/src/zope/app/demo/widget/browser/popup.pt	2005-02-27 23:48:05 UTC (rev 29330)
@@ -0,0 +1,82 @@
+<metal:block define-macro="page"><metal:block define-slot="doctype"><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"></metal:block>
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" i18n:domain="zope">
+<head>
+<title metal:define-slot="title"
+       tal:content="string:Z3: ${context/zope:title_or_name}">Z3 UI</title>
+<style type="text/css" media="all"
+       tal:content="string:@import url(${context/++resource++zope3.css});">
+      @import url(zope3.css);
+</style>
+<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
+<metal:block define-slot="headers"></metal:block>
+<metal:block define-slot="style_slot"></metal:block>
+<metal:block define-slot="ecmascript_slot"></metal:block>  
+</head>
+  
+<body style="background:#DADADA;">
+  <div style="padding: 25px 25px 25px 25px;">
+		<table width="100%" height="380" border="0">
+			<tr>
+				<td valign="top" bgcolor="white">
+
+					<form action="." tal:attributes="action request/URL" method="post"
+								enctype="multipart/form-data">
+
+						<div metal:define-macro="formbody">
+
+							<h3 tal:condition="view/label"
+									tal:content="view/label"
+									metal:define-slot="heading">Edit something</h3>
+	
+							<p tal:define="status view/update"
+								tal:condition="status"
+								tal:content="status" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+							<p tal:condition="view/errors" i18n:translate="">
+								There are <strong tal:content="python:len(view.errors)" i18n:name="num_errors">6</strong> input errors.
+							</p>
+
+							<div metal:define-slot="extra_info" tal:replace="nothing"></div>
+
+							<div class="row"
+									 metal:define-slot="extra_top" tal:replace="nothing">
+								<div class="label">Extra top</div>
+								<div class="field">
+									<input type="text" style="width:100%" />
+								</div>
+							</div>
+
+<!-- start demo edit widget -->
+<div metal:use-macro="context/@@form_macros/widget_rows" />
+<!-- end demo edit widget -->
+
+							<div class="row"
+									 metal:define-slot="extra_bottom" tal:replace="nothing">
+								<div class="label">Extra bottom</div>
+								<div class="field">
+									<input type="text" style="width:100%" />
+								</div>
+							</div>
+							<div class="separator"></div>
+						</div>
+
+						<div class="row">
+							<div class="controls">
+								<input type="submit" value="Refresh" 
+											 i18n:attributes="value refresh-button" />
+								<input type="submit" name="UPDATE_SUBMIT" value="Change" 
+											 i18n:attributes="value submit-button"/>
+						</div>
+					</div>
+					<div class="row" metal:define-slot="extra_buttons" tal:replace="nothing"></div>
+					<div class="separator"></div>
+					</form>
+				</td>
+			</tr>
+		</table>
+  	<div align="right"><a href="javascript:window.close();">x close</a></div>
+	</div>
+</body>
+</html>
+</metal:block>
+


Property changes on: Zope3/trunk/src/zope/app/demo/widget/browser/popup.pt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: Zope3/trunk/src/zope/app/demo/widget/browser/test.pt
===================================================================
--- Zope3/trunk/src/zope/app/demo/widget/browser/test.pt	2005-02-27 23:40:26 UTC (rev 29329)
+++ Zope3/trunk/src/zope/app/demo/widget/browser/test.pt	2005-02-27 23:48:05 UTC (rev 29330)
@@ -0,0 +1,8 @@
+<html>
+<head>
+<title>Functional widget test view</title>
+</head>
+<body>
+<div metal:use-macro="context/@@form_macros/widget_rows" />
+</body>
+</html>


Property changes on: Zope3/trunk/src/zope/app/demo/widget/browser/test.pt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: Zope3/trunk/src/zope/app/demo/widget/browser/textareawidget.zcml
===================================================================
--- Zope3/trunk/src/zope/app/demo/widget/browser/textareawidget.zcml	2005-02-27 23:40:26 UTC (rev 29329)
+++ Zope3/trunk/src/zope/app/demo/widget/browser/textareawidget.zcml	2005-02-27 23:48:05 UTC (rev 29330)
@@ -0,0 +1,47 @@
+<configure
+    xmlns="http://namespaces.zope.org/browser"
+    i18n_domain="zope">
+
+  <addMenuItem
+      title="TextAreaWidget"
+      description="Add a Demo TextAreaWidget"
+      class="..textareawidget.DemoTextAreaWidget"
+      permission="zope.ManageContent"
+      view="addDemoTextAreaWidget.html"
+      />
+
+  <addform
+      name="addDemoTextAreaWidget.html"
+      label="Add a Demo TextWidget"
+      schema="..interfaces.IWriteDemoTextAreaWidget"
+      content_factory="..textareawidget.DemoTextAreaWidget"
+      permission="zope.ManageContent"
+      />
+
+  <schemadisplay
+      name="index.html"
+      schema="..interfaces.IDemoTextAreaWidget"
+      label="TextAreaWidget Index"
+      permission="zope.ManageServices"
+      menu="zmi_views" title="View"
+      />
+
+  <editform
+      name="edit.html"
+      label="Edit"
+      for="..interfaces.IDemoTextAreaWidget"
+      schema="..interfaces.IWriteDemoTextAreaWidget"
+      menu="zmi_views" title="Edit"
+      permission="zope.ManageContent"
+      />
+
+  <editform
+      name="popupEdit.html"
+      label="Popup Edit"
+      for="..interfaces.IDemoTextAreaWidget"
+      schema="..interfaces.IWriteDemoTextAreaWidget"
+      permission="zope.ManageContent"
+      template="popup.pt"
+      />
+
+</configure>


Property changes on: Zope3/trunk/src/zope/app/demo/widget/browser/textareawidget.zcml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: Zope3/trunk/src/zope/app/demo/widget/browser/textwidget.zcml
===================================================================
--- Zope3/trunk/src/zope/app/demo/widget/browser/textwidget.zcml	2005-02-27 23:40:26 UTC (rev 29329)
+++ Zope3/trunk/src/zope/app/demo/widget/browser/textwidget.zcml	2005-02-27 23:48:05 UTC (rev 29330)
@@ -0,0 +1,47 @@
+<configure
+    xmlns="http://namespaces.zope.org/browser"
+    i18n_domain="zope">
+
+  <addMenuItem
+      title="TextWidget"
+      description="Add a Demo TextWidget"
+      class="..textwidget.DemoTextWidget"
+      permission="zope.ManageContent"
+      view="addDemoTextWidget.html"
+      />
+
+  <addform
+      name="addDemoTextWidget.html"
+      label="Add a Demo TextWidget"
+      schema="..interfaces.IWriteDemoTextWidget"
+      content_factory="..textwidget.DemoTextWidget"
+      permission="zope.ManageContent"
+      />
+
+  <schemadisplay
+      name="index.html"
+      schema="..interfaces.IDemoTextWidget"
+      label="TextWidget Index"
+      permission="zope.ManageServices"
+      menu="zmi_views" title="View"
+      />
+
+  <editform
+      name="edit.html"
+      label="Edit"
+      for="..interfaces.IDemoTextWidget"
+      schema="..interfaces.IWriteDemoTextWidget"
+      menu="zmi_views" title="Edit"
+      permission="zope.ManageContent"
+      />
+
+  <editform
+      name="popupEdit.html"
+      label="Popup Edit"
+      for="..interfaces.IDemoTextWidget"
+      schema="..interfaces.IWriteDemoTextWidget"
+      permission="zope.ManageContent"
+      template="popup.pt"
+      />
+
+</configure>


Property changes on: Zope3/trunk/src/zope/app/demo/widget/browser/textwidget.zcml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: Zope3/trunk/src/zope/app/demo/widget/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/demo/widget/configure.zcml	2005-02-27 23:40:26 UTC (rev 29329)
+++ Zope3/trunk/src/zope/app/demo/widget/configure.zcml	2005-02-27 23:48:05 UTC (rev 29330)
@@ -0,0 +1,31 @@
+<configure
+    xmlns="http://namespaces.zope.org/zope"
+    xmlns:help="http://namespaces.zope.org/help"
+    xmlns:zcml="http://namespaces.zope.org/zcml"
+    i18n_domain="zope">
+
+  <content class="zope.app.demo.widget.app.DemoWidgetContainer">
+
+    <implements 
+        interface="zope.app.annotation.interfaces.IAttributeAnnotatable" />
+
+    <require permission="zope.View" 
+        interface="zope.app.container.interfaces.IReadContainer" />
+
+    <require permission="zope.ManageContent" 
+        interface="zope.app.container.interfaces.IWriteContainer" />
+
+  </content>
+
+  <!-- demo widgets -->
+  <include file="intwidget.zcml" />
+  <include file="textwidget.zcml" />
+  <include file="textareawidget.zcml" />
+
+  <!-- demo widget views -->
+  <include package=".browser" />
+
+  <!-- register the ftests as onlinhelp topics -->
+  <include package=".help" zcml:condition="have onlinehelp" />
+
+</configure>


Property changes on: Zope3/trunk/src/zope/app/demo/widget/configure.zcml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: Zope3/trunk/src/zope/app/demo/widget/ftests.py
===================================================================
--- Zope3/trunk/src/zope/app/demo/widget/ftests.py	2005-02-27 23:40:26 UTC (rev 29329)
+++ Zope3/trunk/src/zope/app/demo/widget/ftests.py	2005-02-27 23:48:05 UTC (rev 29330)
@@ -0,0 +1,27 @@
+##############################################################################
+#
+# Copyright (c) 2005 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Functional doc tests for demo widget implementation
+
+$Id$
+"""
+
+import unittest
+from zope.testing import doctest, doctestunit
+from zope.app.testing import functional
+
+def test_suite():
+    return functional.FunctionalDocFileSuite('./help/textwidget.txt')
+
+if __name__ == '__main__':
+    unittest.main(defaultTest='test_suite')


Property changes on: Zope3/trunk/src/zope/app/demo/widget/ftests.py
___________________________________________________________________
Name: svn:eol-style
   + native

Added: Zope3/trunk/src/zope/app/demo/widget/help/README.txt
===================================================================
--- Zope3/trunk/src/zope/app/demo/widget/help/README.txt	2005-02-27 23:40:26 UTC (rev 29329)
+++ Zope3/trunk/src/zope/app/demo/widget/help/README.txt	2005-02-27 23:48:05 UTC (rev 29330)
@@ -0,0 +1,5 @@
+=======
+Widgets
+=======
+
+This topic contains different widget samples.


Property changes on: Zope3/trunk/src/zope/app/demo/widget/help/README.txt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: Zope3/trunk/src/zope/app/demo/widget/help/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/demo/widget/help/__init__.py	2005-02-27 23:40:26 UTC (rev 29329)
+++ Zope3/trunk/src/zope/app/demo/widget/help/__init__.py	2005-02-27 23:48:05 UTC (rev 29330)
@@ -0,0 +1,17 @@
+##############################################################################
+#
+# Copyright (c) 2005 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Onlinhelp topics and functional tests for demo widgets.
+
+$Id$
+"""


Property changes on: Zope3/trunk/src/zope/app/demo/widget/help/__init__.py
___________________________________________________________________
Name: svn:eol-style
   + native

Added: Zope3/trunk/src/zope/app/demo/widget/help/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/demo/widget/help/configure.zcml	2005-02-27 23:40:26 UTC (rev 29329)
+++ Zope3/trunk/src/zope/app/demo/widget/help/configure.zcml	2005-02-27 23:48:05 UTC (rev 29330)
@@ -0,0 +1,22 @@
+<configure
+    xmlns="http://namespaces.zope.org/zope"
+    xmlns:help="http://namespaces.zope.org/help"
+    i18n_domain="zope">
+
+  <help:register
+      id="widgets"
+      parent="samples"
+      title="Widgets"
+      doc_path="README.txt"
+      class="zope.app.onlinehelp.onlinehelptopic.RESTOnlineHelpTopic"
+      />
+
+  <help:register
+      id="textwidget"
+      parent="samples/widgets"
+      title="TextWidget"
+      doc_path="textwidget.txt"
+      class="zope.app.onlinehelp.onlinehelptopic.RESTOnlineHelpTopic"
+      />
+
+</configure>


Property changes on: Zope3/trunk/src/zope/app/demo/widget/help/configure.zcml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: Zope3/trunk/src/zope/app/demo/widget/help/textwidget.txt
===================================================================
--- Zope3/trunk/src/zope/app/demo/widget/help/textwidget.txt	2005-02-27 23:40:26 UTC (rev 29329)
+++ Zope3/trunk/src/zope/app/demo/widget/help/textwidget.txt	2005-02-27 23:48:05 UTC (rev 29330)
@@ -0,0 +1,278 @@
+=================
+TextWidget sample
+=================
+
+Interface
+---------
+
+Add a interface with TextLine fields::
+
+  class IWriteDemoTextWidget(Interface):
+      """TextWidget demo write interface."""
+  
+      standard = TextLine(
+          title = _(u"standard"),
+          description=_(u"""zope.schema.TextLine field with only title and description."""),
+          )
+  
+      required = TextLine(
+          title = _(u"required"),
+          description=_(u"zope.schema.TextLine field with required = True."),
+          required=True)
+  
+      constraint = TextLine(
+          title = _(u"constraint"),
+          description=_(u"""zope.schema.TextLine field with """
+              """constraint = lambda x: x == u'constraint'."""),
+          constraint=lambda x: x == u'constraint')
+  
+      default = TextLine(
+          title = _(u"default"),
+          description=_(u"""zope.schema.TextLine field with """
+              """default = u'default'."""),
+          default=u'default')
+  
+      min_length = TextLine(
+          title = _(u"min_length"),
+          description=_(u"zope.schema.TextLine field with min_length = 5."),
+          min_length=5)
+  
+      max_length = TextLine(
+          title = _(u"max_length"),
+          description=_(u"zope.schema.TextLine field with max_length = 10"),
+          max_length=10)
+  
+      min_max = TextLine(
+          title = _(u"min_max"),
+          description=_(u"""zope.schema.TextLine field with min_lenght = 5 """
+              """and max_length = 10"""),
+          min_length=5,
+          max_length=10)
+
+Define a class::
+
+  class DemoTextWidget(DemoWidget):
+      """Demo TextWidget implementation."""
+  
+      implements(IDemoTextWidget)
+  
+      standard = FieldProperty(IDemoTextWidget['standard'])
+      required = FieldProperty(IDemoTextWidget['required'])
+      readonly = FieldProperty(IDemoTextWidget['readonly'])
+      constraint = FieldProperty(IDemoTextWidget['constraint'])
+      default = FieldProperty(IDemoTextWidget['default'])
+      min_length = FieldProperty(IDemoTextWidget['min_length'])
+      max_length = FieldProperty(IDemoTextWidget['max_length'])
+      min_max = FieldProperty(IDemoTextWidget['min_max'])
+
+Register the class::
+
+  <content class=".textwidget.DemoTextWidget">
+
+    <require permission="zope.View" 
+        interface=".interfaces.IDemoTextWidget"
+        />
+
+    <require permission="zope.ManageContent" 
+        set_schema=".interfaces.IDemoTextWidget"
+        />
+
+  </content>
+
+Register a addform::
+
+  <addMenuItem
+      title="TextWidget"
+      description="Add a Demo TextWidget"
+      class="..textwidget.DemoTextWidget"
+      permission="zope.ManageContent"
+      view="addDemoTextWidget.html"
+      />
+
+  <addform
+      name="addDemoTextWidget.html"
+      label="Add a Demo TextWidget"
+      schema="..interfaces.IWriteDemoTextWidget"
+      content_factory="..textwidget.DemoTextWidget"
+      permission="zope.ManageContent"
+      />
+
+Register a editform::
+
+  <editform
+      name="edit.html"
+      label="Edit"
+      for="..interfaces.IDemoTextWidget"
+      schema="..interfaces.IWriteDemoTextWidget"
+      menu="zmi_views" title="Edit"
+      permission="zope.ManageContent"
+      />
+
+Add a DemoWidgetContainer for test the widgets::
+
+  >>> print http(r"""
+  ... POST /@@contents.html HTTP/1.1
+  ... Authorization: Basic mgr:mgrpw
+  ... Content-Type: application/x-www-form-urlencoded
+  ... 
+  ... type_name=BrowserAdd__zope.app.demo.widget.app.DemoWidgetContainer&new_value=widgets""")
+  HTTP/1.1 303 See Other
+  ...
+
+Add a TextWidget using the addform::
+
+  >>> print http(r"""
+  ... POST /widgets/+/addDemoTextWidget.html HTTP/1.1
+  ... Authorization: Basic mgr:mgrpw
+  ... Content-Type: multipart/form-data; boundary=---------------------------7d513d22e30f9a
+  ... Referer: http://localhost:8081/widgets/+/addDemoTextWidget.html=
+  ... -----------------------------7d513d22e30f9a
+  ... Content-Disposition: form-data; name="field.standard"
+  ... 
+  ... demotext
+  ... -----------------------------7d513d22e30f9a
+  ... Content-Disposition: form-data; name="field.required"
+  ... 
+  ... demotext
+  ... -----------------------------7d513d22e30f9a
+  ... Content-Disposition: form-data; name="field.constraint"
+  ... 
+  ... constraint
+  ... -----------------------------7d513d22e30f9a
+  ... Content-Disposition: form-data; name="field.default"
+  ... 
+  ... default
+  ... -----------------------------7d513d22e30f9a
+  ... Content-Disposition: form-data; name="field.min_length"
+  ... 
+  ... aaaaaa
+  ... -----------------------------7d513d22e30f9a
+  ... Content-Disposition: form-data; name="field.max_length"
+  ... 
+  ... a
+  ... -----------------------------7d513d22e30f9a
+  ... Content-Disposition: form-data; name="field.min_max"
+  ... 
+  ... aaaaaa
+  ... -----------------------------7d513d22e30f9a
+  ... Content-Disposition: form-data; name="UPDATE_SUBMIT"
+  ... 
+  ... Add
+  ... -----------------------------7d513d22e30f9a
+  ... Content-Disposition: form-data; name="add_input_name"
+  ... 
+  ... demo
+  ... -----------------------------7d513d22e30f9a--
+  ... """)
+  HTTP/1.1 303 See Other
+  ...<h3>Add a Demo TextWidget</h3>
+        <div class="row">
+            <div class="label">
+              <label for="field.standard"
+                     title="zope.schema.TextLine field with only title and description.">standard</label>
+            </div>
+            <div class="field"><input class="textType" id="field.standard" name="field.standard" size="20" type="text" value="demotext"  /></div>
+        </div>
+        <div class="row">
+            <div class="label">
+              <label for="field.required"
+                     title="zope.schema.TextLine field with required = True.">required</label>
+            </div>
+            <div class="field"><input class="textType" id="field.required" name="field.required" size="20" type="text" value="demotext"  /></div>
+        </div>
+        <div class="row">
+            <div class="label">
+              <label for="field.constraint"
+                     title="zope.schema.TextLine field with constraint = lambda x: x == u'constraint'.">constraint</label>
+            </div>
+            <div class="field"><input class="textType" id="field.constraint" name="field.constraint" size="20" type="text" value="constraint"  /></div>
+        </div>
+        <div class="row">
+            <div class="label">
+              <label for="field.default"
+                     title="zope.schema.TextLine field with default = u'default'.">default</label>
+            </div>
+            <div class="field"><input class="textType" id="field.default" name="field.default" size="20" type="text" value="default"  /></div>
+        </div>
+        <div class="row">
+            <div class="label">
+              <label for="field.min_length"
+                     title="zope.schema.TextLine field with min_length = 5.">min_length</label>
+            </div>
+            <div class="field"><input class="textType" id="field.min_length" name="field.min_length" size="20" type="text" value="aaaaaa"  /></div>
+        </div>
+        <div class="row">
+            <div class="label">
+              <label for="field.max_length"
+                     title="zope.schema.TextLine field with max_length = 10">max_length</label>
+            </div>
+            <div class="field"><input class="textType" id="field.max_length" name="field.max_length" size="20" type="text" value="a"  /></div>
+        </div>
+        <div class="row">
+            <div class="label">
+              <label for="field.min_max"
+                     title="zope.schema.TextLine field with min_lenght = 5 and max_length = 10">min_max</label>
+            </div>
+            <div class="field"><input class="textType" id="field.min_max" name="field.min_max" size="20" type="text" value="aaaaaa"  /></div>
+        </div...
+
+Check the editform::
+
+  >>> print http(r"""
+  ... GET /widgets/demo/@@edit.html HTTP/1.1
+  ... Host: localhost:8081
+  ... Authorization: Basic mgr:mgrpw
+  ... Referer: http://localhost:8081/widgets/demo/@@contents.html
+  ... """)
+  HTTP/1.1 200 Ok
+  ...
+        <div class="row">
+            <div class="label">
+              <label for="field.standard"
+                     title="zope.schema.TextLine field with only title and description.">standard</label>
+            </div>
+            <div class="field"><input class="textType" id="field.standard" name="field.standard" size="20" type="text" value="demotext"  /></div>
+        </div>
+        <div class="row">
+            <div class="label">
+              <label for="field.required"
+                     title="zope.schema.TextLine field with required = True.">required</label>
+            </div>
+            <div class="field"><input class="textType" id="field.required" name="field.required" size="20" type="text" value="demotext"  /></div>
+        </div>
+        <div class="row">
+            <div class="label">
+              <label for="field.constraint"
+                     title="zope.schema.TextLine field with constraint = lambda x: x == u'constraint'.">constraint</label>
+            </div>
+            <div class="field"><input class="textType" id="field.constraint" name="field.constraint" size="20" type="text" value="constraint"  /></div>
+        </div>
+        <div class="row">
+            <div class="label">
+              <label for="field.default"
+                     title="zope.schema.TextLine field with default = u'default'.">default</label>
+            </div>
+            <div class="field"><input class="textType" id="field.default" name="field.default" size="20" type="text" value="default"  /></div>
+        </div>
+        <div class="row">
+            <div class="label">
+              <label for="field.min_length"
+                     title="zope.schema.TextLine field with min_length = 5.">min_length</label>
+            </div>
+            <div class="field"><input class="textType" id="field.min_length" name="field.min_length" size="20" type="text" value="aaaaaa"  /></div>
+        </div>
+        <div class="row">
+            <div class="label">
+              <label for="field.max_length"
+                     title="zope.schema.TextLine field with max_length = 10">max_length</label>
+            </div>
+            <div class="field"><input class="textType" id="field.max_length" name="field.max_length" size="20" type="text" value="a"  /></div>
+        </div>
+        <div class="row">
+            <div class="label">
+              <label for="field.min_max"
+                     title="zope.schema.TextLine field with min_lenght = 5 and max_length = 10">min_max</label>
+            </div>
+            <div class="field"><input class="textType" id="field.min_max" name="field.min_max" size="20" type="text" value="aaaaaa"  /></div>
+        </div>
+  ...


Property changes on: Zope3/trunk/src/zope/app/demo/widget/help/textwidget.txt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: Zope3/trunk/src/zope/app/demo/widget/interfaces/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/demo/widget/interfaces/__init__.py	2005-02-27 23:40:26 UTC (rev 29329)
+++ Zope3/trunk/src/zope/app/demo/widget/interfaces/__init__.py	2005-02-27 23:48:05 UTC (rev 29330)
@@ -0,0 +1,62 @@
+##############################################################################
+#
+# Copyright (c) 2005 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Interfaces for demo widget implementation
+
+$Id$
+"""
+from zope.interface import Interface
+from zope.schema import Field
+
+from zope.app.container.interfaces import IContained, IContainer
+from zope.app.container.constraints import ContainerTypesConstraint
+from zope.app.container.constraints import ItemTypePrecondition
+
+
+class IDemoWidget(Interface):
+    """Base interface for demo widget."""
+
+
+class IDemoWidgetContainer(IContainer):
+    """Interface for the demo widgets container.
+    
+    We use a precondition for to let just childs to be added which implements
+    the interface ITiksSampleContent
+    """
+
+    def __setitem__(name, object):
+        """Add a widget demo content"""
+
+    __setitem__.precondition = ItemTypePrecondition(IDemoWidget)
+
+
+class IDemoWidgetContainerContained(IContained):
+    """Constraint interface for let object contained in IDemoWidgetContainer.
+
+    """
+
+    __parent__ = Field(
+             constraint = ContainerTypesConstraint(IDemoWidgetContainer))
+
+
+from zope.app.demo.widget.interfaces.intwidget import IReadDemoIntWidget
+from zope.app.demo.widget.interfaces.intwidget import IWriteDemoIntWidget
+from zope.app.demo.widget.interfaces.intwidget import IDemoIntWidget
+
+from zope.app.demo.widget.interfaces.textareawidget import IReadDemoTextAreaWidget
+from zope.app.demo.widget.interfaces.textareawidget import IWriteDemoTextAreaWidget
+from zope.app.demo.widget.interfaces.textareawidget import IDemoTextAreaWidget
+
+from zope.app.demo.widget.interfaces.textwidget import IReadDemoTextWidget
+from zope.app.demo.widget.interfaces.textwidget import IWriteDemoTextWidget
+from zope.app.demo.widget.interfaces.textwidget import IDemoTextWidget


Property changes on: Zope3/trunk/src/zope/app/demo/widget/interfaces/__init__.py
___________________________________________________________________
Name: svn:eol-style
   + native

Added: Zope3/trunk/src/zope/app/demo/widget/interfaces/intwidget.py
===================================================================
--- Zope3/trunk/src/zope/app/demo/widget/interfaces/intwidget.py	2005-02-27 23:40:26 UTC (rev 29329)
+++ Zope3/trunk/src/zope/app/demo/widget/interfaces/intwidget.py	2005-02-27 23:48:05 UTC (rev 29330)
@@ -0,0 +1,81 @@
+##############################################################################
+#
+# Copyright (c) 2005 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Demo widget implementation
+
+$Id$
+"""
+__docformat__ = 'restructuredtext'
+
+from zope.interface import Interface
+from zope.schema import Int
+
+from zope.app.i18n import ZopeMessageIDFactory as _
+from zope.app.demo.widget.interfaces import IDemoWidget
+
+
+class IReadDemoIntWidget(Interface):
+    """Widget read interface."""
+
+    readonly = Int(
+        title = _(u"readonly"),
+        description=_(u"zope.schema.Int field with readonly = True."),
+        required=False,
+        readonly=True,
+        default=42)
+
+
+class IWriteDemoIntWidget(Interface):
+    """Widget write interface."""
+
+    standard = Int(
+        title = _(u"standard"),
+        description=_(u"""zope.schema.Int field with only title and description."""),
+        )
+
+    required = Int(
+        title = _(u"required"),
+        description=_(u"zope.schema.Int field with required = True."),
+        required=True)
+
+    constraint = Int(
+        title = _(u"constraint"),
+        description=_(u"""zope.schema.Int field with """
+            """constraint = lambda x: x == u'constraint'."""),
+        constraint=lambda x: x == 42)
+
+    default = Int(
+        title = _(u"default"),
+        description=_(u"""zope.schema.Int field with """
+            """default = u'default'."""),
+        default=42)
+
+    min = Int(
+        title = _(u"min"),
+        description=_(u"zope.schema.Int field with min = 5."),
+        min=5)
+
+    max = Int(
+        title = _(u"max"),
+        description=_(u"zope.schema.Int field with max = 10"),
+        max=10)
+
+    min_max = Int(
+        title = _(u"min_max"),
+        description=_(u"""zope.schema.Int field with min = 5 and max = 10"""),
+        min=5,
+        max=10)
+
+
+class IDemoIntWidget(IDemoWidget, IReadDemoIntWidget, IWriteDemoIntWidget):
+    """Widget interface inherites read and write interfaces."""


Property changes on: Zope3/trunk/src/zope/app/demo/widget/interfaces/intwidget.py
___________________________________________________________________
Name: svn:eol-style
   + native

Added: Zope3/trunk/src/zope/app/demo/widget/interfaces/textareawidget.py
===================================================================
--- Zope3/trunk/src/zope/app/demo/widget/interfaces/textareawidget.py	2005-02-27 23:40:26 UTC (rev 29329)
+++ Zope3/trunk/src/zope/app/demo/widget/interfaces/textareawidget.py	2005-02-27 23:48:05 UTC (rev 29330)
@@ -0,0 +1,82 @@
+##############################################################################
+#
+# Copyright (c) 2005 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Demo widget implementation
+
+$Id$
+"""
+__docformat__ = 'restructuredtext'
+
+from zope.interface import Interface
+from zope.schema import Text
+
+from zope.app.i18n import ZopeMessageIDFactory as _
+from zope.app.demo.widget.interfaces import IDemoWidget
+
+
+class IReadDemoTextAreaWidget(Interface):
+    """Widget read interface."""
+
+    readonly = Text(
+        title = _(u"readonly"),
+        description=_(u"zope.schema.Text field with readonly = True."),
+        required=False,
+        readonly=True,
+        default=u'readonly')
+
+class IWriteDemoTextAreaWidget(Interface):
+    """Widget write interface."""
+
+    standard = Text(
+        title = _(u"standard"),
+        description=_(u"""zope.schema.Text field with only title and description."""),
+        )
+
+    required = Text(
+        title = _(u"required"),
+        description=_(u"zope.schema.Text field with required = True."),
+        required=True)
+
+    constraint = Text(
+        title = _(u"constraint"),
+        description=_(u"""zope.schema.Text field with """
+            """constraint = lambda x: x == u'constraint'."""),
+        constraint=lambda x: x == u'constraint')
+
+    default = Text(
+        title = _(u"default"),
+        description=_(u"""zope.schema.Text field with """
+            """default = u'default'."""),
+        default=u'default')
+
+    min_length = Text(
+        title = _(u"min_length"),
+        description=_(u"zope.schema.Text field with min_length = 5."),
+        min_length=5)
+
+    max_length = Text(
+        title = _(u"max_length"),
+        description=_(u"zope.schema.Text field with max_length = 10"),
+        max_length=10)
+
+    min_max = Text(
+        title = _(u"min_max"),
+        description=_(u"""zope.schema.Text field with min_lenght = 5 """
+            """and max_length = 10"""),
+        min_length=5,
+        max_length=10)
+
+
+class IDemoTextAreaWidget(IDemoWidget, IReadDemoTextAreaWidget, 
+    IWriteDemoTextAreaWidget):
+    """Widget interface inherites read and write interfaces."""


Property changes on: Zope3/trunk/src/zope/app/demo/widget/interfaces/textareawidget.py
___________________________________________________________________
Name: svn:eol-style
   + native

Added: Zope3/trunk/src/zope/app/demo/widget/interfaces/textwidget.py
===================================================================
--- Zope3/trunk/src/zope/app/demo/widget/interfaces/textwidget.py	2005-02-27 23:40:26 UTC (rev 29329)
+++ Zope3/trunk/src/zope/app/demo/widget/interfaces/textwidget.py	2005-02-27 23:48:05 UTC (rev 29330)
@@ -0,0 +1,82 @@
+##############################################################################
+#
+# Copyright (c) 2005 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Demo widget implementation
+
+$Id$
+"""
+__docformat__ = 'restructuredtext'
+
+from zope.interface import Interface
+from zope.schema import TextLine
+
+from zope.app.i18n import ZopeMessageIDFactory as _
+from zope.app.demo.widget.interfaces import IDemoWidget
+
+
+class IReadDemoTextWidget(Interface):
+    """Widget read interface."""
+
+    readonly = TextLine(
+        title = _(u"readonly"),
+        description=_(u"zope.schema.TextLine field with readonly = True."),
+        required=False,
+        readonly=True,
+        default=u'readonly')
+
+
+class IWriteDemoTextWidget(Interface):
+    """Widget write interface."""
+
+    standard = TextLine(
+        title = _(u"standard"),
+        description=_(u"""zope.schema.TextLine field with only title and description."""),
+        )
+
+    required = TextLine(
+        title = _(u"required"),
+        description=_(u"zope.schema.TextLine field with required = True."),
+        required=True)
+
+    constraint = TextLine(
+        title = _(u"constraint"),
+        description=_(u"""zope.schema.TextLine field with """
+            """constraint = lambda x: x == u'constraint'."""),
+        constraint=lambda x: x == u'constraint')
+
+    default = TextLine(
+        title = _(u"default"),
+        description=_(u"""zope.schema.TextLine field with """
+            """default = u'default'."""),
+        default=u'default')
+
+    min_length = TextLine(
+        title = _(u"min_length"),
+        description=_(u"zope.schema.TextLine field with min_length = 5."),
+        min_length=5)
+
+    max_length = TextLine(
+        title = _(u"max_length"),
+        description=_(u"zope.schema.TextLine field with max_length = 10"),
+        max_length=10)
+
+    min_max = TextLine(
+        title = _(u"min_max"),
+        description=_(u"""zope.schema.TextLine field with min_lenght = 5 """
+            """and max_length = 10"""),
+        min_length=5,
+        max_length=10)
+
+
+class IDemoTextWidget(IDemoWidget, IReadDemoTextWidget, IWriteDemoTextWidget):
+    """Widget interface inherites read and write interfaces."""


Property changes on: Zope3/trunk/src/zope/app/demo/widget/interfaces/textwidget.py
___________________________________________________________________
Name: svn:eol-style
   + native

Added: Zope3/trunk/src/zope/app/demo/widget/intwidget.py
===================================================================
--- Zope3/trunk/src/zope/app/demo/widget/intwidget.py	2005-02-27 23:40:26 UTC (rev 29329)
+++ Zope3/trunk/src/zope/app/demo/widget/intwidget.py	2005-02-27 23:48:05 UTC (rev 29330)
@@ -0,0 +1,78 @@
+##############################################################################
+#
+# Copyright (c) 2005 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Demo widget implementation
+
+$Id$
+"""
+__docformat__ = 'restructuredtext'
+
+from persistent import Persistent
+from zope.interface import implements
+from zope.schema.fieldproperty import FieldProperty
+
+from zope.app.demo.widget.interfaces import IDemoIntWidget
+from zope.app.demo.widget.app import DemoWidget
+
+
+class DemoIntWidget(DemoWidget):
+    """Demo TextWidget implementation.
+    
+    >>> content = DemoIntWidget()
+    >>> content.standard
+
+    >>> content.required = 42
+    >>> content.required
+    42
+
+    >>> content.readonly = 42
+    >>> content.readonly
+    42
+
+    >>> content.default
+    42
+
+    >>> content.standard
+
+    >>> content.required = 42
+    >>> content.required
+    42
+
+    >>> content.constraint = 42
+    >>> content.constraint
+    42
+
+    >>> content.min = 6
+    >>> content.min
+    6
+
+    >>> content.max = 1
+    >>> content.max
+    1
+
+    >>> content.min_max = 6
+    >>> content.min_max
+    6
+    
+    """
+
+    implements(IDemoIntWidget)
+    
+    standard = FieldProperty(IDemoIntWidget['standard'])
+    required = FieldProperty(IDemoIntWidget['required'])
+    readonly = FieldProperty(IDemoIntWidget['readonly'])
+    constraint = FieldProperty(IDemoIntWidget['constraint'])
+    default = FieldProperty(IDemoIntWidget['default'])
+    min = FieldProperty(IDemoIntWidget['min'])
+    max = FieldProperty(IDemoIntWidget['max'])
+    min_max = FieldProperty(IDemoIntWidget['min_max'])
\ No newline at end of file


Property changes on: Zope3/trunk/src/zope/app/demo/widget/intwidget.py
___________________________________________________________________
Name: svn:eol-style
   + native

Added: Zope3/trunk/src/zope/app/demo/widget/intwidget.zcml
===================================================================
--- Zope3/trunk/src/zope/app/demo/widget/intwidget.zcml	2005-02-27 23:40:26 UTC (rev 29329)
+++ Zope3/trunk/src/zope/app/demo/widget/intwidget.zcml	2005-02-27 23:48:05 UTC (rev 29330)
@@ -0,0 +1,17 @@
+<configure
+    xmlns="http://namespaces.zope.org/zope"
+    i18n_domain="zope">
+
+  <content class=".intwidget.DemoIntWidget">
+
+    <require permission="zope.View" 
+        interface=".interfaces.IDemoIntWidget"
+        />
+
+    <require permission="zope.ManageContent" 
+        set_schema=".interfaces.IDemoIntWidget"
+        />
+
+  </content>
+
+</configure>


Property changes on: Zope3/trunk/src/zope/app/demo/widget/intwidget.zcml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: Zope3/trunk/src/zope/app/demo/widget/tests.py
===================================================================
--- Zope3/trunk/src/zope/app/demo/widget/tests.py	2005-02-27 23:40:26 UTC (rev 29329)
+++ Zope3/trunk/src/zope/app/demo/widget/tests.py	2005-02-27 23:48:05 UTC (rev 29330)
@@ -0,0 +1,32 @@
+##############################################################################
+#
+# Copyright (c) 2005 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Demo widget implementation
+
+$Id$
+"""
+
+import unittest
+from zope.testing.doctestunit import DocTestSuite
+from zope.testing.doctestunit import DocFileSuite
+
+
+def test_suite():
+    return unittest.TestSuite((
+        DocTestSuite('zope.app.demo.widget.intwidget'),
+        DocTestSuite('zope.app.demo.widget.textwidget'),
+        DocTestSuite('zope.app.demo.widget.textareawidget'),
+        ))
+
+if __name__ == '__main__':
+    unittest.main(defaultTest='test_suite')


Property changes on: Zope3/trunk/src/zope/app/demo/widget/tests.py
___________________________________________________________________
Name: svn:eol-style
   + native

Added: Zope3/trunk/src/zope/app/demo/widget/textareawidget.py
===================================================================
--- Zope3/trunk/src/zope/app/demo/widget/textareawidget.py	2005-02-27 23:40:26 UTC (rev 29329)
+++ Zope3/trunk/src/zope/app/demo/widget/textareawidget.py	2005-02-27 23:48:05 UTC (rev 29330)
@@ -0,0 +1,69 @@
+##############################################################################
+#
+# Copyright (c) 2005 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Demo widget implementation
+
+$Id$
+"""
+__docformat__ = 'restructuredtext'
+
+from persistent import Persistent
+from zope.interface import implements
+from zope.schema.fieldproperty import FieldProperty
+
+from zope.app.demo.widget.interfaces import IDemoTextAreaWidget
+from zope.app.demo.widget.app import DemoWidget
+
+
+class DemoTextAreaWidget(DemoWidget):
+    """Demo TextAreaWidget implementation.
+    
+    >>> content = DemoTextAreaWidget()
+    >>> content.standard
+
+    >>> content.required = u''
+    >>> content.required
+    u''
+
+    >>> content.readonly = u"Attention, the FieldProperty doesn't validate!"
+    >>> content.readonly
+    u"Attention, the FieldProperty doesn't validate!"
+
+    >>> content.constraint = u'constraint'
+    >>> content.constraint
+    u'constraint'
+
+    >>> content.min_length = u'aaaaaa'
+    >>> content.min_length
+    u'aaaaaa'
+
+    >>> content.max_length = u'a'
+    >>> content.max_length
+    u'a'
+
+    >>> content.min_max = u'aaaaaa'
+    >>> content.min_max
+    u'aaaaaa'
+    
+    """
+
+    implements(IDemoTextAreaWidget)
+    
+    standard = FieldProperty(IDemoTextAreaWidget['standard'])
+    required = FieldProperty(IDemoTextAreaWidget['required'])
+    readonly = FieldProperty(IDemoTextAreaWidget['readonly'])
+    constraint = FieldProperty(IDemoTextAreaWidget['constraint'])
+    default = FieldProperty(IDemoTextAreaWidget['default'])
+    min_length = FieldProperty(IDemoTextAreaWidget['min_length'])
+    max_length = FieldProperty(IDemoTextAreaWidget['max_length'])
+    min_max = FieldProperty(IDemoTextAreaWidget['min_max'])
\ No newline at end of file


Property changes on: Zope3/trunk/src/zope/app/demo/widget/textareawidget.py
___________________________________________________________________
Name: svn:eol-style
   + native

Added: Zope3/trunk/src/zope/app/demo/widget/textareawidget.zcml
===================================================================
--- Zope3/trunk/src/zope/app/demo/widget/textareawidget.zcml	2005-02-27 23:40:26 UTC (rev 29329)
+++ Zope3/trunk/src/zope/app/demo/widget/textareawidget.zcml	2005-02-27 23:48:05 UTC (rev 29330)
@@ -0,0 +1,19 @@
+<configure
+    xmlns="http://namespaces.zope.org/zope"
+    i18n_domain="zope">
+
+  <content class=".textareawidget.DemoTextAreaWidget">
+
+    <factory />
+
+    <require permission="zope.View" 
+        interface=".interfaces.IDemoTextAreaWidget"
+        />
+
+    <require permission="zope.ManageContent" 
+        set_schema=".interfaces.IDemoTextAreaWidget"
+        />
+
+  </content>
+
+</configure>


Property changes on: Zope3/trunk/src/zope/app/demo/widget/textareawidget.zcml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: Zope3/trunk/src/zope/app/demo/widget/textwidget.py
===================================================================
--- Zope3/trunk/src/zope/app/demo/widget/textwidget.py	2005-02-27 23:40:26 UTC (rev 29329)
+++ Zope3/trunk/src/zope/app/demo/widget/textwidget.py	2005-02-27 23:48:05 UTC (rev 29330)
@@ -0,0 +1,69 @@
+##############################################################################
+#
+# Copyright (c) 2005 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Demo widget implementation
+
+$Id$
+"""
+__docformat__ = 'restructuredtext'
+
+from persistent import Persistent
+from zope.interface import implements
+from zope.schema.fieldproperty import FieldProperty
+
+from zope.app.demo.widget.interfaces import IDemoTextWidget
+from zope.app.demo.widget.app import DemoWidget
+
+
+class DemoTextWidget(DemoWidget):
+    """Demo TextWidget implementation.
+
+    >>> content = DemoTextWidget()
+    >>> content.standard
+
+    >>> content.required = u''
+    >>> content.required
+    u''
+
+    >>> content.readonly = u"Attention, the FieldProperty doesn't validate!"
+    >>> content.readonly
+    u"Attention, the FieldProperty doesn't validate!"
+
+    >>> content.constraint = u'constraint'
+    >>> content.constraint
+    u'constraint'
+
+    >>> content.min_length = u'aaaaaa'
+    >>> content.min_length
+    u'aaaaaa'
+
+    >>> content.max_length = u'a'
+    >>> content.max_length
+    u'a'
+
+    >>> content.min_max = u'aaaaaa'
+    >>> content.min_max
+    u'aaaaaa'
+
+    """
+
+    implements(IDemoTextWidget)
+
+    standard = FieldProperty(IDemoTextWidget['standard'])
+    required = FieldProperty(IDemoTextWidget['required'])
+    readonly = FieldProperty(IDemoTextWidget['readonly'])
+    constraint = FieldProperty(IDemoTextWidget['constraint'])
+    default = FieldProperty(IDemoTextWidget['default'])
+    min_length = FieldProperty(IDemoTextWidget['min_length'])
+    max_length = FieldProperty(IDemoTextWidget['max_length'])
+    min_max = FieldProperty(IDemoTextWidget['min_max'])


Property changes on: Zope3/trunk/src/zope/app/demo/widget/textwidget.py
___________________________________________________________________
Name: svn:eol-style
   + native

Added: Zope3/trunk/src/zope/app/demo/widget/textwidget.zcml
===================================================================
--- Zope3/trunk/src/zope/app/demo/widget/textwidget.zcml	2005-02-27 23:40:26 UTC (rev 29329)
+++ Zope3/trunk/src/zope/app/demo/widget/textwidget.zcml	2005-02-27 23:48:05 UTC (rev 29330)
@@ -0,0 +1,17 @@
+<configure
+    xmlns="http://namespaces.zope.org/zope"
+    i18n_domain="zope">
+
+  <content class=".textwidget.DemoTextWidget">
+
+    <require permission="zope.View" 
+        interface=".interfaces.IDemoTextWidget"
+        />
+
+    <require permission="zope.ManageContent" 
+        set_schema=".interfaces.IDemoTextWidget"
+        />
+
+  </content>
+
+</configure>


Property changes on: Zope3/trunk/src/zope/app/demo/widget/textwidget.zcml
___________________________________________________________________
Name: svn:eol-style
   + native



More information about the Zope3-Checkins mailing list