[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/Formulator/Widgets/Browser - BrowserWidget.py:1.2 CheckBoxWidget.py:1.2 DateTimeWidget.py:1.2 FileWidget.py:1.2 IBrowserWidget.py:1.2 ItemsWidget.py:1.2 LinesTextAreaWidget.py:1.2 ListTextAreaWidget.py:1.2 ListWidget.py:1.2 MultiItemsWidget.py:1.2 MultiListWidget.py:1.2 MultipleCheckBoxWidget.py:1.2 PasswordWidget.py:1.2 RadioWidget.py:1.2 SingleItemsWidget.py:1.2 TextAreaWidget.py:1.2 TextWidget.py:1.2 __init__.py:1.2 browser.zcml:1.2 datetime.pt:1.2

Jim Fulton jim@zope.com
Mon, 10 Jun 2002 19:28:21 -0400


Update of /cvs-repository/Zope3/lib/python/Zope/App/Formulator/Widgets/Browser
In directory cvs.zope.org:/tmp/cvs-serv17445/lib/python/Zope/App/Formulator/Widgets/Browser

Added Files:
	BrowserWidget.py CheckBoxWidget.py DateTimeWidget.py 
	FileWidget.py IBrowserWidget.py ItemsWidget.py 
	LinesTextAreaWidget.py ListTextAreaWidget.py ListWidget.py 
	MultiItemsWidget.py MultiListWidget.py 
	MultipleCheckBoxWidget.py PasswordWidget.py RadioWidget.py 
	SingleItemsWidget.py TextAreaWidget.py TextWidget.py 
	__init__.py browser.zcml datetime.pt 
Log Message:
Merged Zope-3x-branch into newly forked Zope3 CVS Tree.


=== Zope3/lib/python/Zope/App/Formulator/Widgets/Browser/BrowserWidget.py 1.1 => 1.2 ===
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+# 
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (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.
+# 
+##############################################################################
+"""
+
+$Id$
+"""
+
+from IBrowserWidget import IBrowserWidget
+from Zope.App.Formulator.Widget import Widget
+from Zope.App.Formulator.IPropertyFieldAdapter import IPropertyFieldAdapter
+from Zope.ComponentArchitecture import getAdapter
+
+
+class BrowserWidget(Widget):
+    """A field widget that knows how to display itself as HTML.
+    """
+
+    __implements__ = IBrowserWidget
+
+    propertyNames = Widget.propertyNames + \
+                    ['tag', 'type', 'cssClass', 'hidden', 'extra']
+    
+    tag = 'input'
+    type = 'text'
+    cssClass = ''
+    hidden = 0
+    extra = ''
+
+    def getValueFromRequest(self, REQUEST):
+        """ """
+        return REQUEST.get('field_'+self.context.id, None)
+
+
+    def _getValueToInsert(self, REQUEST):
+        """ """
+        field = self.context
+        if REQUEST and (('field_'+field.id) in REQUEST):
+            return REQUEST['field_'+field.id]
+        else:
+            return getAdapter(field, IPropertyFieldAdapter).\
+                   getPropertyInContext()
+            
+
+    def render(self, REQUEST=None):
+        """Renders this widget as HTML using property values in field.
+        """
+        return renderElement(self.getValue('tag'),
+                             type = self.getValue('type'),
+                             name = self.context.id,
+                             value = self._getValueToInsert(REQUEST),
+                             cssClass = self.getValue('cssClass'),
+                             extra = self.getValue('extra'))
+
+        
+    def render_hidden(self, REQUEST=None):
+        """Renders this widget as a hidden field.
+        """
+        return renderElement(self.getValue('tag'),
+                             type = 'hidden',
+                             name = self.context.id,
+                             value = self._getValueToInsert(REQUEST),
+                             cssClass = self.getValue('cssClass'),
+                             extra = self.getValue('extra'))
+
+
+
+def renderTag(tag, **kw):
+    """Render the tag. Well, not all of it, as we may want to / it.
+    """
+    attr_list = []
+
+    kw['name'] = 'field_' + kw['name']
+
+    # special case handling for css_class
+    if 'cssClass' in kw:
+        if kw['cssClass'] != "":
+            attr_list.append('class="%s"' % kw['cssClass'])
+        del kw['cssClass']
+
+    # special case handling for extra 'raw' code
+    if 'extra' in kw:
+        extra = kw['extra'] # could be empty string but we don't care
+        del kw['extra']
+    else:
+        extra = ""
+
+    # handle other attributes
+    for key, value in kw.items():
+        if value == None:
+            value = key
+        attr_list.append('%s="%s"' % (key, str(value)))
+            
+    attr_str = " ".join(attr_list)
+    return "<%s %s %s" % (tag, attr_str, extra)
+
+
+def renderElement(tag, **kw):
+    if 'contents' in kw:
+        contents = kw['contents']
+        del kw['contents']
+        return "%s>%s</%s>" % (apply(renderTag, (tag,), kw), contents, tag)
+    else:
+        return apply(renderTag, (tag,), kw) + " />"
+    
+
+
+
+
+
+


=== Zope3/lib/python/Zope/App/Formulator/Widgets/Browser/CheckBoxWidget.py 1.1 => 1.2 ===


=== Zope3/lib/python/Zope/App/Formulator/Widgets/Browser/DateTimeWidget.py 1.1 => 1.2 ===


=== Zope3/lib/python/Zope/App/Formulator/Widgets/Browser/FileWidget.py 1.1 => 1.2 ===
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+# 
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (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.
+# 
+##############################################################################
+"""
+
+$Id$
+"""
+
+from TextWidget import TextWidget
+from Zope.App.Formulator.Widgets.Browser.BrowserWidget import renderElement
+
+
+class FileWidget(TextWidget):
+
+    __implements__ = TextWidget.__implements__
+
+    type = 'file'
+
+
+    def render(self, REQUEST=None):
+        """Renders this widget as HTML using property values in field.
+        """
+        displayMaxWidth = self.getValue('displayMaxWidth') or 0
+        if displayMaxWidth > 0:
+            return renderElement(self.getValue('tag'),
+                                 type = self.getValue('type'),
+                                 name = self.context.id,
+                                 cssClass = self.getValue('cssClass'),
+                                 size = self.getValue('displayWidth'),
+                                 maxlength = displayMaxWidth,
+                                 extra = self.getValue('extra'))
+        else:
+            return renderElement(self.getValue('tag'),
+                                 type = self.getValue('type'),
+                                 name = self.context.id,
+                                 cssClass = self.getValue('cssClass'),
+                                 size = self.getValue('displayWidth'),
+                                 extra = self.getValue('extra'))


=== Zope3/lib/python/Zope/App/Formulator/Widgets/Browser/IBrowserWidget.py 1.1 => 1.2 ===
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+# 
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (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.
+# 
+##############################################################################
+"""
+
+$Id$
+"""
+
+from Interface import Interface
+
+
+class IBrowserWidget(Interface):
+    """A field widget contains all the properties that are required
+       to represent a field. Properties include css_sheet, 
+       default value and so on.
+
+    """
+
+
+    def render(field, key, value, REQUEST):
+        """Renders this widget as HTML using property values in field.
+        """
+
+        
+    def render_hidden(field, key, value, REQUEST):
+        """Renders this widget as a hidden field.
+        """
+        


=== Zope3/lib/python/Zope/App/Formulator/Widgets/Browser/ItemsWidget.py 1.1 => 1.2 ===
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+# 
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (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.
+# 
+##############################################################################
+"""
+
+$Id$
+"""
+
+from Widget import Widget
+
+class ItemsWidget(Widget):
+    """A widget that has a number of items in it.
+    """
+    
+    items = []
+


=== Zope3/lib/python/Zope/App/Formulator/Widgets/Browser/LinesTextAreaWidget.py 1.1 => 1.2 ===
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+# 
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (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.
+# 
+##############################################################################
+"""
+
+$Id$
+"""
+
+from TextAreaWidget import TextAreaWidget
+
+
+class LinesTextAreaWidget(TextAreaWidget):
+
+    default = []
+
+    def render(self, REQUEST=None):
+        value = string.join(value, "\n")
+        return TextAreaWidget.render(self, REQUEST)


=== Zope3/lib/python/Zope/App/Formulator/Widgets/Browser/ListTextAreaWidget.py 1.1 => 1.2 ===
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+# 
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (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.
+# 
+##############################################################################
+"""
+
+$Id$
+"""
+
+from Zope.App.Formulator.Widgets.Browser.TextAreaWidget import TextAreaWidget
+from Zope.App.Formulator.Widgets.Browser.BrowserWidget import renderElement
+
+
+class ListTextAreaWidget(TextAreaWidget):
+    """ListTextArea widget
+    """
+
+    __implements__ = TextAreaWidget.__implements__
+
+    propertyNames = TextAreaWidget.propertyNames + \
+                     ['extra', 'default']
+
+    default = []
+    extra = ''
+
+    
+    def render(self, REQUEST=None):
+        """Renders this widget as HTML using property values in field.
+        """
+        lines = []
+        for element_text, element_value in value:
+            lines.append("%s | %s" % (element_text, element_value))
+        return Widget.TextAreaWidget.render(self, field, key,
+                                            string.join(lines, '\n'),
+                                            REQUEST)


=== Zope3/lib/python/Zope/App/Formulator/Widgets/Browser/ListWidget.py 1.1 => 1.2 ===
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+# 
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (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.
+# 
+##############################################################################
+"""
+
+$Id$
+"""
+
+from SingleItemsWidget import SingleItemsWidget
+
+
+class ListWidget(SingleItemsWidget):
+    """List widget.
+    """
+    __implements__ = SingleItemsWidget.__implements__
+
+    property_names = Widget.property_names +\
+                     ['firstItem', 'items', 'size', 'extra']
+    size = 5
+
+    def render(self, REQUEST=None):
+
+        renderedItems = self.renderItems(field, key, value, REQUEST)
+
+        return render_element('select',
+                              name='',
+                              cssClass=field.get_value('cssClass'),
+                              size=field.get_value('size'),
+                              contents=string.join(renderedItems, "\n"),
+                              extra=field.get_value('extra'))
+
+    
+    def renderItem(self, text, value, key, css_class):
+        return render_element('option', contents=text, value=value)
+
+
+    def renderSelectedItem(self, text, value, key, css_class):
+        return render_element('option', contents=text, value=value,
+                              selected=None)


=== Zope3/lib/python/Zope/App/Formulator/Widgets/Browser/MultiItemsWidget.py 1.1 => 1.2 ===
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+# 
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (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.
+# 
+##############################################################################
+"""
+
+$Id$
+"""
+
+from ItemsWidget import ItemsWidget
+from types import ListType
+
+        
+class MultiItemsWidget(ItemsWidget):
+    """A widget with a number of items that has multiple selectable
+    items.
+    """
+    default = []
+        
+    def render_items(self, field, key, value, REQUEST):
+        # need to deal with single item selects
+        if not isinstance(values, ListType):
+            value = [value]
+        items = field.get_value('items')
+        css_class = field.get_value('css_class')
+        rendered_items = []
+        for item in items:
+            try:
+                item_text, item_value = item
+            except ValueError:
+                item_text = item
+                item_value = item
+
+            if item_value in value:
+                rendered_item = self.render_selected_item(item_text,
+                                                          item_value,
+                                                          key,
+                                                          css_class)
+            else:
+                rendered_item = self.render_item(item_text,
+                                                 item_value,
+                                                 key,
+                                                 css_class)
+
+            rendered_items.append(rendered_item)
+
+        return rendered_items


=== Zope3/lib/python/Zope/App/Formulator/Widgets/Browser/MultiListWidget.py 1.1 => 1.2 ===
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+# 
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (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.
+# 
+##############################################################################
+"""
+
+$Id$
+"""
+
+from MultiItemsWidget import MultiItemsWidget
+
+
+class MultiListWidget(MultiItemsWidget):
+    """List widget with multiple select.
+    """
+    property_names = Widget.property_names +\
+                     ['items', 'size', 'extra']
+    
+    size = 5
+
+    def render(self, REQUEST=None):
+        rendered_items = self.render_items(field, key, value, REQUEST)
+
+        return render_element('select',
+                              name=key,
+                              multiple=None,
+                              css_class=field.get_value('css_class'),
+                              size=field.get_value('size'),
+                              contents=string.join(rendered_items, "\n"),
+                              extra=field.get_value('extra'))
+    
+    def render_item(self, text, value, key, css_class):
+        return render_element('option', contents=text, value=value)
+
+    def render_selected_item(self, text, value, key, css_class):
+        return render_element('option', contents=text, value=value,
+                              selected=None)
+    
+MultiListWidgetInstance = MultiListWidget()


=== Zope3/lib/python/Zope/App/Formulator/Widgets/Browser/MultipleCheckBoxWidget.py 1.1 => 1.2 ===
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+# 
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (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.
+# 
+##############################################################################
+"""
+
+$Id$
+"""
+
+from MultiItemsWidget import MultiItemsWidget
+
+
+class MultiCheckBoxWidget(MultiItemsWidget):
+    """multiple checkbox widget.
+    """
+    property_names = Widget.property_names +\
+                     ['items', 'orientation']
+    
+    orientation = "vertical"
+                                   
+    def render(self, REQUEST=None):
+        rendered_items = self.render_items(field, key, value, REQUEST)
+        orientation = field.get_value('orientation')
+        if orientation == 'horizontal':
+            return string.join(rendered_items, "&nbsp;&nbsp;")
+        else:
+            return string.join(rendered_items, "<br />")
+
+        
+    def render_item(self, text, value, key, css_class):
+        return render_element('input',
+                              type="checkbox",
+                              css_class=css_class,
+                              name=key,
+                              value=value) + text
+    
+
+    def render_selected_item(self, text, value, key, css_class):
+        return render_element('input',
+                              type="checkbox",
+                              css_class=css_class,
+                              name=key,
+                              value=value,
+                              checked=None) + text


=== Zope3/lib/python/Zope/App/Formulator/Widgets/Browser/PasswordWidget.py 1.1 => 1.2 ===
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+# 
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (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.
+# 
+##############################################################################
+"""
+
+$Id$
+"""
+
+from TextWidget import TextWidget
+
+
+class PasswordWidget(TextWidget):
+    
+    def render(self, REQUEST=None):
+        """Render password input field.
+        """
+        display_maxwidth = field.get_value('display_maxwidth') or 0
+        if display_maxwidth > 0:
+            return render_element("input",
+                                  type="password",
+                                  name=key,
+                                  css_class=field.get_value('css_class'),
+                                  value=value,
+                                  size=field.get_value('display_width'),
+                                  maxlength=display_maxwidth,
+                                  extra=field.get_value('extra'))
+        else:
+            return render_element("input",
+                                  type="password",
+                                  name=key,
+                                  css_class=field.get_value('css_class'),
+                                  value=value,
+                                  size=field.get_value('display_width'),
+                                  extra=field.get_value('extra'))


=== Zope3/lib/python/Zope/App/Formulator/Widgets/Browser/RadioWidget.py 1.1 => 1.2 ===
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+# 
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (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.
+# 
+##############################################################################
+"""
+
+$Id$
+"""
+
+from SingleItemsWidget import SingleItemsWidget
+
+
+class RadioWidget(SingleItemsWidget):
+    """radio buttons widget.
+    """
+    property_names = Widget.property_names +\
+                     ['first_item', 'items', 'orientation']
+    
+    orientation = "vertical"
+                                   
+    def render(self, REQUEST=None):
+        rendered_items = self.render_items(field, key, value, REQUEST)
+        orientation = field.get_value('orientation')
+        if orientation == 'horizontal':
+            return string.join(rendered_items, "&nbsp;&nbsp;")
+        else:
+            return string.join(rendered_items, "<br />")
+
+        
+    def render_item(self, text, value, key, css_class):
+        return render_element('input',
+                              type="radio",
+                              css_class=css_class,
+                              name=key,
+                              value=value) + text
+    
+
+    def render_selected_item(self, text, value, key, css_class):
+        return render_element('input',
+                              type="radio",
+                              css_class=css_class,
+                              name=key,
+                              value=value,
+                              checked=None) + text
+       


=== Zope3/lib/python/Zope/App/Formulator/Widgets/Browser/SingleItemsWidget.py 1.1 => 1.2 ===
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+# 
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (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.
+# 
+##############################################################################
+"""
+
+$Id$
+"""
+
+from ItemsWidget import ItemsWidget
+
+
+class SingleItemsWidget(ItemsWidget):
+    """A widget with a number of items that has only a single
+    selectable item.
+    """
+    default = ""
+    first_item = 0    
+
+
+    def render_items(self, field, key, value, REQUEST):
+        # get items
+        items = field.get_value('items')
+    
+        # check if we want to select first item
+        if not value and field.get_value('first_item') and len(items) > 0:
+            try:
+                text, value = items[0]
+            except ValueError:
+                value = items[0]
+                
+        css_class = field.get_value('css_class')
+        
+        # FIXME: what if we run into multiple items with same value?
+        rendered_items = []
+        for item in items:
+            try:
+                item_text, item_value = item
+            except ValueError:
+                item_text = item
+                item_value = item
+
+            if item_value == value:
+                rendered_item = self.render_selected_item(item_text,
+                                                          item_value,
+                                                          key,
+                                                          css_class)
+            else:
+                rendered_item = self.render_item(item_text,
+                                                 item_value,
+                                                 key,
+                                                 css_class)
+
+            rendered_items.append(rendered_item)
+
+        return rendered_items


=== Zope3/lib/python/Zope/App/Formulator/Widgets/Browser/TextAreaWidget.py 1.1 => 1.2 ===
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+# 
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (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.
+# 
+##############################################################################
+"""
+
+$Id$
+"""
+
+from Zope.App.Formulator.Widgets.Browser.BrowserWidget import BrowserWidget
+from Zope.App.Formulator.Widgets.Browser.BrowserWidget import renderElement
+
+
+class TextAreaWidget(BrowserWidget):
+    """Textarea widget
+    """
+    propertyNames = BrowserWidget.propertyNames +\
+                     ['width', 'height', 'extra']
+    
+    default = ""
+    width = 80
+    height = 15
+    extra=""
+    
+    def render(self, REQUEST=None):
+        return renderElement("textarea",
+                             name=self.context.id,
+                             css_class=self.getValue('cssClass'),
+                             cols=self.getValue('width'),
+                             rows=self.getValue('height'),
+                             contents=self._getValueToInsert(REQUEST),
+                             extra=self.getValue('extra'))


=== Zope3/lib/python/Zope/App/Formulator/Widgets/Browser/TextWidget.py 1.1 => 1.2 ===
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+# 
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (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.
+# 
+##############################################################################
+"""
+
+$Id$
+"""
+
+from Zope.App.Formulator.Widgets.Browser.BrowserWidget import BrowserWidget
+from Zope.App.Formulator.Widgets.Browser.BrowserWidget import renderElement
+
+
+class TextWidget(BrowserWidget):
+    """Text widget
+    """
+
+    __implements__ = BrowserWidget.__implements__
+
+    propertyNames = BrowserWidget.propertyNames + \
+                     ['displayWidth', 'displayMaxWidth', 'extra', 'default']
+
+    default = ''
+    displayWidth = 20
+    displayMaxWidth = ''
+    extra = ''
+
+    
+    def render(self, REQUEST=None):
+        """Renders this widget as HTML using property values in field.
+        """
+        displayMaxWidth = self.getValue('displayMaxWidth') or 0
+        if displayMaxWidth > 0:
+            return renderElement(self.getValue('tag'),
+                                 type = self.getValue('type'),
+                                 name = self.context.id,
+                                 value = self._getValueToInsert(REQUEST),
+                                 cssClass = self.getValue('cssClass'),
+                                 size = self.getValue('displayWidth'),
+                                 maxlength = displayMaxWidth,
+                                 extra = self.getValue('extra'))
+        else:
+            return renderElement(self.getValue('tag'),
+                                 type = self.getValue('type'),
+                                 name = self.context.id,
+                                 value = self._getValueToInsert(REQUEST),
+                                 cssClass = self.getValue('cssClass'),
+                                 size = self.getValue('displayWidth'),
+                                 extra = self.getValue('extra'))


=== Zope3/lib/python/Zope/App/Formulator/Widgets/Browser/__init__.py 1.1 => 1.2 ===
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+# 
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (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.
+# 
+##############################################################################


=== Zope3/lib/python/Zope/App/Formulator/Widgets/Browser/browser.zcml 1.1 => 1.2 ===
+   xmlns='http://namespaces.zope.org/zope'
+   xmlns:security='http://namespaces.zope.org/security'
+>
+
+  <content class=".FileWidget.">
+    <security:require
+        permission="Zope.ManageContent" 
+        attributes="render getContext" />
+  </content>
+  <content class=".TextAreaWidget.">
+    <security:require 
+          permission="Zope.ManageContent" 
+          attributes="render getContext" />
+  </content>
+  <content class=".TextWidget.">
+    <security:require
+          permission="Zope.ManageContent" 
+          attributes="render getContext" />
+  </content>
+
+</zopeConfigure>


=== Zope3/lib/python/Zope/App/Formulator/Widgets/Browser/datetime.pt 1.1 => 1.2 ===
+<input> / <input> / <input>  <input> : <input> : <input?
\ No newline at end of file