Author: jmorliaguet
Date: Tue Apr 11 20:48:46 2006
New Revision: 2822

Modified:
   cpsskins/branches/jmo-perspectives/configuration/widgets/metaconfigure.py
   cpsskins/branches/jmo-perspectives/configuration/widgets/metadirectives.py
   cpsskins/branches/jmo-perspectives/configuration/widgets/widget.py
   cpsskins/branches/jmo-perspectives/doc/portlet-rendering.txt
   cpsskins/branches/jmo-perspectives/standard/filters/widget/widgets.zcml
Log:

- widget names are now dotted names in order to create a namespace for the
  widget provider



Modified: 
cpsskins/branches/jmo-perspectives/configuration/widgets/metaconfigure.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/configuration/widgets/metaconfigure.py   
(original)
+++ cpsskins/branches/jmo-perspectives/configuration/widgets/metaconfigure.py   
Tue Apr 11 20:48:46 2006
@@ -29,10 +29,10 @@
 
 _ = MessageFactory("cpsskins")
 
-def widget(_context=None, type=None, title=None, view=None, for_=None):
+def widget(_context=None, name=None, title=None, view=None, for_=None):
 
-    if not type:
-        raise ConfigurationError("Must specify the widget type.")
+    if not name:
+        raise ConfigurationError("Must specify the widget's name.")
 
     if not title:
         raise ConfigurationError("Must specify a widget title.")
@@ -41,10 +41,10 @@
         raise ConfigurationError("Must specify a widget view.")
 
     # register widgets
-    provideUtility(configuration.Widget(type=type, title=title, view=view),
-                   configuration.IWidget, type)
+    provideUtility(configuration.Widget(name=name, title=title, view=view),
+                   configuration.IWidget, name)
 
     # zope:adapter
     adapter(_context=_context, factory=(view,), provides=IWidgetView,
-            for_=(for_, IBrowserRequest), name=type)
+            for_=(for_, IBrowserRequest), name=name)
 

Modified: 
cpsskins/branches/jmo-perspectives/configuration/widgets/metadirectives.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/configuration/widgets/metadirectives.py  
(original)
+++ cpsskins/branches/jmo-perspectives/configuration/widgets/metadirectives.py  
Tue Apr 11 20:48:46 2006
@@ -20,17 +20,17 @@
 from zope.configuration.fields import GlobalObject
 from zope.interface import Interface
 from zope.i18nmessageid import MessageFactory
-from zope.schema import TextLine
+from zope.schema import TextLine, DottedName
 
 _ = MessageFactory("cpsskins")
 
 class IWidgetDirective(Interface):
 
-    type = TextLine(
-        title=_(u"Type"),
+    name = DottedName(
+        title=_(u"Name"),
         description=_(u"The widget type's name."),
         required=False,
-        default=u'',
+        min_dots=1,
         )
 
     title = TextLine(

Modified: cpsskins/branches/jmo-perspectives/configuration/widgets/widget.py
==============================================================================
--- cpsskins/branches/jmo-perspectives/configuration/widgets/widget.py  
(original)
+++ cpsskins/branches/jmo-perspectives/configuration/widgets/widget.py  Tue Apr 
11 20:48:46 2006
@@ -36,7 +36,7 @@
         title=_(u"Widget title"),
         )
 
-    type = Attribute(u"Widget type")
+    name = Attribute(u"Widget's name")
 
     factory = Attribute(u"Widget factory")
 
@@ -45,8 +45,8 @@
     """
     implements(IWidget)
 
-    def __init__(self, type=u'', title=u'', view=None):
-        self.type = type
+    def __init__(self, name=u'', title=u'', view=None):
+        self.name = name
         self.title = title
         self.view = view
 

Modified: cpsskins/branches/jmo-perspectives/doc/portlet-rendering.txt
==============================================================================
--- cpsskins/branches/jmo-perspectives/doc/portlet-rendering.txt        
(original)
+++ cpsskins/branches/jmo-perspectives/doc/portlet-rendering.txt        Tue Apr 
11 20:48:46 2006
@@ -75,13 +75,13 @@
     >>> verifyClass(IFormat, Widget)
     True
 
-    >>> widget = Widget([u'plain'])
+    >>> widget = Widget([u'standard.plain_html'])
 
 
 3) The portlet is finally rendered by passing the data to the filter
    (here a widget filter):
 
-    >>> rendered = u'<div><h1>Test of HTML</h1></div>'
+    >>> rendered = u'<h1>Test of HTML</h1>'
 
 the widget filter adapts the data structure for providing a view:
 
@@ -110,31 +110,31 @@
 
     a) vertical menu
     ----------------
-    >>> widget = Widget([u'vertical_menu'])
+    >>> widget = Widget([u'standard.vertical_menu'])
     >>> test_render(widget, rendered, info)
     u'<ul class="verticalMenu"><li><a href="@@urlA.html">Item A</a></li><li><a 
href="@@urlB.html">Item B</a></li></ul>'
 
     b) horizontal tabs
     ------------------
-    >>> widget = Widget([u'horizontal_tabs'])
+    >>> widget = Widget([u'standard.horizontal_tabs'])
     >>> test_render(widget, rendered, info)
     u'<ul class="horizontalTabs"><li><a href="@@urlA.html">Item 
A</a></li><li><a href="@@urlB.html">Item B</a></li></ul>'
 
     c) Menu bar
     -------------------
-    >>> widget = Widget([u'menu_bar'])
+    >>> widget = Widget([u'standard.menu_bar'])
     >>> test_render(widget, rendered, info)
     u'<div class="menuBar"><a href="@@urlA.html">Item A</a><a 
href="@@urlB.html">Item B</a></div>'
 
     d) Horizontal trail
     -------------------
-    >>> widget = Widget([u'horizontal_trail'])
+    >>> widget = Widget([u'standard.horizontal_trail'])
     >>> test_render(widget, rendered, info)
     u'<div class="horizontalTrail"><a href="@@urlA.html">Item A</a><span 
class="sep">&gt;</span><a href="@@urlB.html">Item B</a><span 
class="sep">&gt;</span></div>'
 
     e) Drop-down list
     -----------------
-    >>> widget = Widget([u'dropdown_list'])
+    >>> widget = Widget([u'standard.dropdown_list'])
     >>> test_render(widget, rendered, info)
     u'<form action="@@cpsskins_redirect" method="post"><select 
onchange="submit()" name="url"><option value="./"></option><option 
value="@@urlA.html">Item A</option><option value="@@urlB.html">Item 
B</option></select></form>'
 
@@ -148,37 +148,37 @@
     ------------
     >>> from cpsskins.standard.ds.metadata import MetaData
     >>> info.metadata = MetaData(title=u'Example frame box')
-    >>> widget = Widget([u'frame_box'])
+    >>> widget = Widget([u'standard.frame_box'])
     >>> test_render(widget, rendered, info)
     u'<fieldset><legend>Example frame box</legend><div><h1>Test of 
HTML</h1></div></fieldset>'
 
     b) horizontal scrollbar
     -----------------------
-    >>> widget = Widget([u'horizontal_scrollbar'])
+    >>> widget = Widget([u'standard.horizontal_scrollbar'])
     >>> test_render(widget, rendered, info)
     u'<div style="overflow-x:scroll;"><h1>Test of HTML</h1></div>'
 
     c) table frame
     --------------
-    >>> widget = Widget([u'table_frame'])
+    >>> widget = Widget([u'standard.table_frame'])
     >>> test_render(widget, rendered, info)
     u'<table summary=""><tr><h1>Test of HTML</h1></tr></table>'
 
     d) table cell
     --------------
-    >>> widget = Widget([u'table_cell'])
+    >>> widget = Widget([u'standard.table_cell'])
     >>> test_render(widget, rendered, info)
     u'<td style="vertical-align:top;"><h1>Test of HTML</h1></td>'
 
     e) div frame (tableless renderering)
     ------------------------------------
-    >>> widget = Widget([u'div_frame'])
+    >>> widget = Widget([u'standard.div_frame'])
     >>> test_render(widget, rendered, info)
     u'<div><h1>Test of HTML</h1><br style="clear:left"/></div><div 
style="clear:left"></div>'
 
     f) div cell (tableless rendering)
     ---------------------------------
-    >>> widget = Widget([u'div_cell'])
+    >>> widget = Widget([u'standard.div_cell'])
     >>> test_render(widget, rendered, info)
     u'<div style="float:left;overflow-x:hidden"><h1>Test of HTML</h1></div>'
 
@@ -191,7 +191,7 @@
 
     a) image
     --------
-    >>> widget = Widget([u'image'])
+    >>> widget = Widget([u'standard.image'])
     >>> test_render(widget, rendered, info)
     u'<img src="/some/image.png" alt="" style="border: none" />'
 

Modified: 
cpsskins/branches/jmo-perspectives/standard/filters/widget/widgets.zcml
==============================================================================
--- cpsskins/branches/jmo-perspectives/standard/filters/widget/widgets.zcml     
(original)
+++ cpsskins/branches/jmo-perspectives/standard/filters/widget/widgets.zcml     
Tue Apr 11 20:48:46 2006
@@ -5,27 +5,27 @@
   <!-- Plain widget views -->
 
   <widget
-      type="plain_html"
+      name="standard.plain_html"
       view=".widgets.BasicHTMLView"
       title="Basic HTML view"
   />
 
   <widget
-      type="plain_image"
+      name="standard.plain_image"
       view=".widgets.BasicImageView"
       for="cpsskins.standard.ds.image.IImage"
       title="Basic image view"
   />
 
   <widget
-      type="plain_item"
+      name="standard.plain_item"
       view=".widgets.BasicItemView"
       for="cpsskins.standard.ds.item.IItem"
       title="Basic item view"
   />
 
   <widget
-      type="plain_items"
+      name="standard.plain_items"
       view=".widgets.BasicItemsView"
       for="cpsskins.standard.ds.items.IItems"
       title="Basic items view"
@@ -35,7 +35,7 @@
   <!-- Page widget views -->
 
   <widget
-      type="page_body"
+      name="standard.page_body"
       title="Page body"
       view=".widgets.PageBody"
   />
@@ -44,13 +44,13 @@
   <!-- Frame widget views -->
 
   <widget
-      type="table_frame"
+      name="standard.table_frame"
       title="Table frame"
       view=".widgets.TableFrame"
   />
 
   <widget
-      type="div_frame"
+      name="standard.div_frame"
       title="Div frame"
       view=".widgets.DivFrame"
   />
@@ -59,19 +59,19 @@
   <!-- Cell widget views -->
 
   <widget
-      type="table_cell"
+      name="standard.table_cell"
       title="Table cell"
       view=".widgets.TableCell"
   />
 
   <widget
-      type="div_cell"
+      name="standard.div_cell"
       title="Div cell"
       view=".widgets.DivCell"
   />
 
   <widget
-      type="horizontal_scrollbar"
+      name="standard.horizontal_scrollbar"
       title="Horizontal scroll bar"
       view=".widgets.HorizontalScrollBar"
   />
@@ -80,35 +80,35 @@
   <!-- Menu widget views -->
 
   <widget
-      type="vertical_menu"
+      name="standard.vertical_menu"
       title="Vertical menu"
       view=".widgets.VerticalMenu"
       for="cpsskins.standard.ds.items.IItems"
   />
 
   <widget
-      type="horizontal_tabs"
+      name="standard.horizontal_tabs"
       title="Horizontal tabs"
       view=".widgets.HorizontalTabs"
       for="cpsskins.standard.ds.items.IItems"
   />
 
   <widget
-      type="menu_bar"
+      name="standard.menu_bar"
       title="Menu bar"
       view=".widgets.MenuBar"
       for="cpsskins.standard.ds.items.IItems"
   />
 
   <widget
-      type="horizontal_trail"
+      name="standard.horizontal_trail"
       title="Horizontal trail"
       view=".widgets.HorizontalTrail"
       for="cpsskins.standard.ds.items.IItems"
   />
 
   <widget
-      type="dropdown_list"
+      name="standard.dropdown_list"
       title="Drop-down list"
       view=".widgets.DropDownList"
       for="cpsskins.standard.ds.items.IItems"
@@ -118,7 +118,7 @@
   <!-- Plain views -->
 
   <widget
-      type="frame_box"
+      name="standard.frame_box"
       title="Frame box"
       view=".widgets.FrameBox"
   />
@@ -127,7 +127,7 @@
   <!-- Calendar widget views -->
 
   <widget
-      type="monthly_calendar"
+      name="standard.monthly_calendar"
       title="Monthly calendar"
       view=".widgets.MonthlyCalendar"
   />
@@ -136,7 +136,7 @@
   <!-- Image widget views -->
 
   <widget
-      type="image"
+      name="standard.image"
       title="Image"
       view=".widgets.Image"
       for="cpsskins.standard.ds.image.IImage"
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to