[Zope3-checkins] CVS: Zope3/src/zope/app/form/browser - macros.py:1.1 widget_macros.pt:1.1 add.pt:1.2 addwizard.pt:1.2 configure.zcml:1.5 display.pt:1.2 edit.pt:1.4 editwizard.pt:1.2 subedit.pt:1.2

Garrett Smith garrett at mojave-corp.com
Mon May 3 22:01:55 EDT 2004


Update of /cvs-repository/Zope3/src/zope/app/form/browser
In directory cvs.zope.org:/tmp/cvs-serv14704/src/zope/app/form/browser

Modified Files:
	add.pt addwizard.pt configure.zcml display.pt edit.pt 
	editwizard.pt subedit.pt 
Added Files:
	macros.py widget_macros.pt 
Log Message:
Replaced widget implementation in various forms (edit, display, etc.) with the
use of a macro per

  http://dev.zope.org/Zope3/CleanupOfSchemaAndWidgets


=== Added File Zope3/src/zope/app/form/browser/macros.py ===
##############################################################################
#
# Copyright (c) 2003 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.
#
##############################################################################
"""API Documentation macros

$Id: macros.py,v 1.1 2004/05/04 02:01:24 garrett Exp $
"""
from zope.app.basicskin.standardmacros import StandardMacros


class FormMacros(StandardMacros):
    
    macro_pages = ('widget_macros',)


=== Added File Zope3/src/zope/app/form/browser/widget_macros.pt ===
<html>
  <body>
    <metal:block define-macro="widget_rows">
      <div class="row" tal:repeat="widget view/widgets">
        <div class="label" tal:content="structure widget/label">Name</div>
        <div class="field" tal:content="structure widget">
          <input type="text" style="width:100%"/>
        </div>
        <div class="error" tal:define="error widget/error"
          tal:condition="error" tal:content="structure error">
          The Error
        </div>
      </div>
    </metal:block>
  </body>
</html>

=== Zope3/src/zope/app/form/browser/add.pt 1.1 => 1.2 ===
--- Zope3/src/zope/app/form/browser/add.pt:1.1	Sat Mar 13 20:11:34 2004
+++ Zope3/src/zope/app/form/browser/add.pt	Mon May  3 22:01:24 2004
@@ -31,18 +31,8 @@
             <div class="label"><input type="text" style="width:100%" /></div>
         </div>
         
-        <div class="row" 
-          metal:define-macro="widget_rows" tal:repeat="widget view/widgets">
-          <div class="label" tal:content="structure widget/label">Name</div>
-          <div class="field" tal:content="structure widget">
-            <input type="text" style="width:100%"/>
-          </div>
-          <div class="error" tal:define="error widget/error"
-            tal:condition="error" tal:content="structure error">
-            The Error
-          </div>
-        </div>
-        
+        <div metal:use-macro="context/@@form_macros/widget_rows" />
+                
         <div class="separator"></div>
         
         <div class="row"


=== Zope3/src/zope/app/form/browser/addwizard.pt 1.1 => 1.2 ===
--- Zope3/src/zope/app/form/browser/addwizard.pt:1.1	Sat Mar 13 20:11:34 2004
+++ Zope3/src/zope/app/form/browser/addwizard.pt	Mon May  3 22:01:24 2004
@@ -37,13 +37,9 @@
           <div class="label">Extra top</div>
           <div class="label"><input type="text" style="width:100%" /></div>
       </div>
-      <div class="row"
-           metal:define-macro="widget_rows" tal:repeat="widget view/widgets"
-           tal:content="structure widget/row">
-          <div class="label">Name</div>
-          <div class="field"><input type="text" style="width:100%" /></div>
-          <div class="error">Error message</div>
-      </div>
+      
+      <div metal:use-macro="context/@@form_macros/widget_rows" />
+
       <div class="row"
            metal:define-slot="extra_bottom" tal:replace="nothing">
           <div class="label">Extra bottom</div>


=== Zope3/src/zope/app/form/browser/configure.zcml 1.4 => 1.5 ===
--- Zope3/src/zope/app/form/browser/configure.zcml:1.4	Sat Apr 24 19:19:42 2004
+++ Zope3/src/zope/app/form/browser/configure.zcml	Mon May  3 22:01:24 2004
@@ -1,4 +1,23 @@
-<configure xmlns="http://namespaces.zope.org/zope">
+<configure 
+  xmlns="http://namespaces.zope.org/zope"
+  xmlns:browser="http://namespaces.zope.org/browser">
+  
+  <!-- Form Macros -->
+  
+  <browser:page
+      for="*"
+      name="form_macros"
+      permission="zope.Public"
+      class=".macros.FormMacros"
+      allowed_interface="zope.interface.common.mapping.IItemMapping" 
+      />
+      
+  <browser:page 
+      for="*"
+      name="widget_macros"
+      permission="zope.Public"
+      template="widget_macros.pt"
+      />
 
   <!-- Views for Widget Errors -->
 


=== Zope3/src/zope/app/form/browser/display.pt 1.1 => 1.2 ===
--- Zope3/src/zope/app/form/browser/display.pt:1.1	Sat Mar 13 20:11:34 2004
+++ Zope3/src/zope/app/form/browser/display.pt	Mon May  3 22:01:24 2004
@@ -18,17 +18,9 @@
         <div class="label">Extra top</div>
         <div class="field"><input type="text" style="width:100%" /></div>
     </div>
-        <div class="row" metal:define-macro="widget_rows" 
-	    		         tal:repeat="widget view/widgets">
-             <div class="label" tal:content="structure widget/label">Name</div>
-             <div class="field" tal:content="structure widget">
-                    <input type="text" style="width:100%"/>
-             </div>
-             <div class="error" tal:define="error widget/error"
-			 	tal:condition="error" tal:content="structure error">
-				The Error
-             </div>
-    </div>
+
+    <div metal:use-macro="context/@@form_macros/widget_rows" />
+
     <div class="row"
          metal:define-slot="extra_bottom" tal:replace="nothing">
         <div class="label">Extra bottom</div>


=== Zope3/src/zope/app/form/browser/edit.pt 1.3 => 1.4 ===
--- Zope3/src/zope/app/form/browser/edit.pt:1.3	Tue Apr 20 07:01:11 2004
+++ Zope3/src/zope/app/form/browser/edit.pt	Mon May  3 22:01:24 2004
@@ -32,19 +32,11 @@
           <div class="label">Extra top</div>
           <div class="field"><input type="text" style="width:100%" /></div>
         </div>
-        <div class="row" metal:define-macro="widget_rows" 
-	    		         tal:repeat="widget view/widgets">
-             <div class="label" tal:content="structure widget/label">Name</div>
-             <div class="field" tal:content="structure widget">
-                    <input type="text" style="width:100%"/>
-             </div>
-             <div class="error" 
-                 tal:define="error widget/error"
-                 tal:condition="error" tal:content="structure error">
-               The Error
-             </div>
-        </div>
+        
+        <div metal:use-macro="context/@@form_macros/widget_rows" />
+        
         <div class="separator"></div>
+        
         <div class="row"
              metal:define-slot="extra_bottom" tal:replace="nothing">
           <div class="label">Extra bottom</div>


=== Zope3/src/zope/app/form/browser/editwizard.pt 1.1 => 1.2 ===
--- Zope3/src/zope/app/form/browser/editwizard.pt:1.1	Sat Mar 13 20:11:34 2004
+++ Zope3/src/zope/app/form/browser/editwizard.pt	Mon May  3 22:01:24 2004
@@ -25,17 +25,9 @@
             <div class="label">Extra top</div>
             <div class="field"><input type="text" style="width:100%" /></div>
         </div>
-        <div class="row" metal:define-macro="widget_rows" 
-	    		         tal:repeat="widget view/widgets">
-             <div class="label" tal:content="structure widget/label">Name</div>
-             <div class="field" tal:content="structure widget">
-                    <input type="text" style="width:100%"/>
-             </div>
-             <div class="error" tal:define="error widget/error"
-			 	tal:condition="error" tal:content="structure error">
-				The Error
-             </div>
-        </div>
+        
+        <div metal:use-macro="context/@@form_macros/widget_rows" />
+        
         <div tal:replace="structure view/renderHidden">
           <!-- type=hidden input controls for passing state without session -->
           <input type="hidden" name="example" value="foo" />


=== Zope3/src/zope/app/form/browser/subedit.pt 1.1 => 1.2 ===
--- Zope3/src/zope/app/form/browser/subedit.pt:1.1	Sat Mar 13 20:11:34 2004
+++ Zope3/src/zope/app/form/browser/subedit.pt	Mon May  3 22:01:24 2004
@@ -32,17 +32,9 @@
       <div class="label">Extra top</div>
       <div class="field"><input type="text" style="width:100%" /></div>
   </div>
-    <div class="row" metal:define-macro="widget_rows" 
-                     tal:repeat="widget view/widgets">
-         <div class="label" tal:content="structure widget/label">Name</div>
-         <div class="field" tal:content="structure widget">
-                <input type="text" style="width:100%"/>
-         </div>
-		 <div class="error" tal:define="error widget/error"
-			tal:condition="error" tal:content="structure error">
-			The Error
-		 </div>
-  </div>
+  
+  <div metal:use-macro="context/@@form_macros/widget_rows" />
+  
   <div class="row"
        metal:define-slot="extra_bottom" tal:replace="nothing">
       <div class="label">Extra bottom</div>




More information about the Zope3-Checkins mailing list