[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/ZMI - StandardMacros.py:1.2 configure.zcml:1.8

Steve Alexander steve@cat-box.net
Tue, 22 Oct 2002 15:35:29 -0400


Update of /cvs-repository/Zope3/lib/python/Zope/App/ZMI
In directory cvs.zope.org:/tmp/cvs-serv30515/python/Zope/App/ZMI

Modified Files:
	configure.zcml 
Added Files:
	StandardMacros.py 
Log Message:
Changed standard_macros to provide macros aggregated from view_macros.pt
and also from dialog_macros.pt.

Introduced the notion of a "dialog", which is like a normal ZMI view, 
except that management tabs (and other such links to views) are missing.
This makes all the links on the Add-form work.
You make something a dialog by using the macro standard_macros/dialog
rather than standard_macros/page.



=== Zope3/lib/python/Zope/App/ZMI/StandardMacros.py 1.1 => 1.2 ===
--- /dev/null	Tue Oct 22 15:35:29 2002
+++ Zope3/lib/python/Zope/App/ZMI/StandardMacros.py	Tue Oct 22 15:34:59 2002
@@ -0,0 +1,42 @@
+##############################################################################
+#
+# Copyright (c) 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.
+# 
+##############################################################################
+"""Standard macros for page templates in the ZMI
+
+The macros are drawn from various different page templates.
+
+$Id$
+"""
+from ZMIViewUtility import ZMIViewUtility
+from Zope.App.PageTemplate.ViewPageTemplateFile import ViewPageTemplateFile
+
+class Macros:
+
+    macro_pages = ()
+
+    def __getitem__(self, key):
+        for page in self.macro_pages:
+            v = page.macros.get(key)
+            if v is not None:
+                return v
+        raise KeyError, key
+
+class StandardMacros(ZMIViewUtility, Macros):
+
+    __implements__ = ZMIViewUtility.__implements__
+
+    macro_pages = (
+            ViewPageTemplateFile('www/view_macros.pt'),
+            ViewPageTemplateFile('www/dialog_macros.pt')
+            )
+


=== Zope3/lib/python/Zope/App/ZMI/configure.zcml 1.7 => 1.8 ===
--- Zope3/lib/python/Zope/App/ZMI/configure.zcml:1.7	Tue Oct  1 08:49:08 2002
+++ Zope3/lib/python/Zope/App/ZMI/configure.zcml	Tue Oct 22 15:34:59 2002
@@ -9,7 +9,7 @@
 
   <browser:view name="standard_macros"
                 permission="Zope.View"
-                template="www/standard_macros.pt" />
+                factory=".StandardMacros." />
 
   <browser:view name="ZMIUtility"
                 permission="Zope.View"