[Zope3-checkins] CVS: Zope3/src/zope/app/browser/form - editview.py:1.4
Jim Fulton
jim@zope.com
Mon, 30 Dec 2002 18:27:48 -0500
Update of /cvs-repository/Zope3/src/zope/app/browser/form
In directory cvs.zope.org:/tmp/cvs-serv15551
Modified Files:
editview.py
Log Message:
Added support for supplying a menu id and title.
=== Zope3/src/zope/app/browser/form/editview.py 1.3 => 1.4 ===
--- Zope3/src/zope/app/browser/form/editview.py:1.3 Mon Dec 30 09:02:53 2002
+++ Zope3/src/zope/app/browser/form/editview.py Mon Dec 30 18:27:47 2002
@@ -30,6 +30,9 @@
from zope.app.pagetemplate.simpleviewclass import SimpleViewClass
from zope.app.browser.form.submit import Update
+from zope.app.publisher.browser.globalbrowsermenuservice \
+ import menuItemDirective
+
class EditView(BrowserView):
"""Simple edit-view base class
@@ -198,16 +201,26 @@
return schema, for_, bases, template, fields
-def edit(_context, name, schema, label,
- permission = 'zope.Public', layer = "default",
- class_ = None, for_ = None,
- template = None, omit=None, fields=None):
+def edit(_context, name, schema, permission, label='',
+ layer = "default",
+ class_ = None, for_ = None,
+ template = None, omit=None, fields=None,
+ menu=None, title='Edit'):
+
+
+ if menu:
+ actions = menuItemDirective(
+ _context, menu, for_ or schema, '@@' + name, title,
+ permission=permission)
+ else:
+ actions = []
+
(schema, for_, bases, template, fields,
) = _normalize(
_context, schema, for_, class_, template, 'edit.pt', fields, omit)
- return [
+ actions.append(
Action(
discriminator = ('http://namespaces.zope.org/form/edit',
name, for_, layer),
@@ -216,7 +229,9 @@
bases,
for_, fields),
)
- ]
+ )
+
+ return actions
def subedit(_context, name, schema, label,
permission = 'zope.Public', layer = "default",