[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/Forms/Browser - EditView.py:1.7 edit.pt:1.4 subedit.pt:1.3

Steve Alexander steve@cat-box.net
Sun, 22 Dec 2002 16:09:03 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/App/Forms/Browser
In directory cvs.zope.org:/tmp/cvs-serv5659/lib/python/Zope/App/Forms/Browser

Modified Files:
	EditView.py edit.pt subedit.pt 
Log Message:
Added optional attributes to the form:subedit directive.
These are 'fulledit' which gives the path appended to
context/@@absolute_url where a full edit form can be found, and 
'fulledit_label' which is the label for this link. The default is
'Full edit'.


=== Zope3/lib/python/Zope/App/Forms/Browser/EditView.py 1.6 => 1.7 ===
--- Zope3/lib/python/Zope/App/Forms/Browser/EditView.py:1.6	Sat Dec 21 10:32:46 2002
+++ Zope3/lib/python/Zope/App/Forms/Browser/EditView.py	Sun Dec 22 16:08:32 2002
@@ -127,17 +127,23 @@
 
 
 def EditViewFactory(name, schema, label, permission, layer,
-                    template, default_template, bases, for_, fields):
+                    template, default_template, bases, for_, fields,
+                    fulledit_path=None, fulledit_label=None):
 
     class_  = SimpleViewClass(
         template,
         used_for = schema, bases = bases
         )
-
     class_.schema = schema
     class_.label = label
     class_.fieldNames = fields
 
+    class_.fulledit_path = fulledit_path
+    if fulledit_path and (fulledit_label is None):
+        fulledit_label = "Full edit"
+        
+    class_.fulledit_label = fulledit_label
+
     class_.generated_form = ViewPageTemplateFile(default_template)
 
     defineChecker(class_,
@@ -216,12 +222,13 @@
 def subedit(_context, name, schema, label,
               permission = 'Zope.Public', layer = "default",
               class_ = None, for_ = None,
-              template = None, omit=None, fields=None):
+              template = None, omit=None, fields=None,
+              fulledit=None, fulledit_label=None):
 
     (schema, for_, bases, template, fields,
      ) = _normalize(
         _context, schema, for_, class_, template, 'subedit.pt', fields, omit)
-
+    
     return [
         Action(
         discriminator = ('http://namespaces.zope.org/form/subedit',
@@ -229,7 +236,7 @@
         callable = EditViewFactory,
         args = (name, schema, label, permission, layer, template, 'subedit.pt',
                 bases,
-                for_, fields),
+                for_, fields, fulledit, fulledit_label),
         )
         ]
 


=== Zope3/lib/python/Zope/App/Forms/Browser/edit.pt 1.3 => 1.4 ===
--- Zope3/lib/python/Zope/App/Forms/Browser/edit.pt:1.3	Sun Dec  1 05:22:33 2002
+++ Zope3/lib/python/Zope/App/Forms/Browser/edit.pt	Sun Dec 22 16:08:32 2002
@@ -1,4 +1,4 @@
-<html metal:use-macro="views/standard_macros/page">
+<html metal:use-macro="views/standard_macros/dialog">
   <body>
   <div metal:fill-slot="body">
 


=== Zope3/lib/python/Zope/App/Forms/Browser/subedit.pt 1.2 => 1.3 ===
--- Zope3/lib/python/Zope/App/Forms/Browser/subedit.pt:1.2	Wed Dec 11 08:55:59 2002
+++ Zope3/lib/python/Zope/App/Forms/Browser/subedit.pt	Sun Dec 22 16:08:32 2002
@@ -1,10 +1,15 @@
 <div metal:define-macro="formbody">
-
   <span tal:condition="view/label"
       tal:content="view/label"
       metal:define-slot="heading"
-      >Edit something</span>
-
+      >
+Edit something
+  </span>
+  <p tal:condition="view/fulledit_label">
+    <a tal:attributes="href
+         string:${context/@@absolute_url}/${view/fulledit_path}"
+       tal:content="view/fulledit_label">Full edit</a>
+  </p>
   <p tal:define="status view/update"
      tal:condition="status"
      tal:content="status" />