[Zope-CVS] CVS: Products/PageDesign - PageDesign.py:1.8

Shane Hathaway shane@cvs.zope.org
Thu, 15 Aug 2002 23:35:07 -0400


Update of /cvs-repository/Products/PageDesign
In directory cvs.zope.org:/tmp/cvs-serv5111

Modified Files:
	PageDesign.py 
Log Message:
Look ma, no frames! ;-)


=== Products/PageDesign/PageDesign.py 1.7 => 1.8 ===
--- Products/PageDesign/PageDesign.py:1.7	Thu Aug 15 20:29:35 2002
+++ Products/PageDesign/PageDesign.py	Thu Aug 15 23:35:06 2002
@@ -67,7 +67,9 @@
     slots = SlotProvider()
 
     manage_options = (
-        {'label': 'Design', 'action': 'manage_main'},
+        {'label': 'Properties', 'action': 'manage_main'},
+        {'label': 'Edit', 'action': 'editForm'},
+        {'label': 'Preview', 'action': 'preview'},
         )
 
     security = ClassSecurityInfo()
@@ -115,6 +117,17 @@
     <!-- End page design footer -->
     '''
 
+    controls_html = '''
+    <!-- Page design controls -->
+    <div class="design-controls">
+      Page Design: %(title)s<br />
+      <b><a href="editForm">Edit</a> |
+      <a href="preview">Preview</a> |
+      <a href="manage_main">Close</a></b>
+    </div>
+    <!-- End page design controls -->
+    '''
+
     dialog_done_html = '''
     <html>
     <body>
@@ -328,7 +341,8 @@
             match = m
             m = end_of_body_search(s, match.end(0))
         index = match.start(0)
-        footer = self.footer_html
+        footer = (self.controls_html % {'title': self.title}) + (
+            self.footer_html)
         s = '%s%s%s' % (s[:index], footer, s[index:])
         return s
 
@@ -357,7 +371,7 @@
             kw['slots'] = sp
             kw['design'] = self
             res = template(**kw)
-            if editable:
+            if editable or kw['preview']:
                 res = self.insertEditScripts(res)
             return res
         finally:
@@ -369,13 +383,18 @@
     security.declareProtected(view, '__call__')
     def __call__(self, **kw):
         """Renders the design in non-edit mode."""
-        # kw['editable'] = 0
         return self.render(**kw)
 
     security.declareProtected(change_page_designs, 'editForm')
     def editForm(self, **kw):
         """Renders the design in edit mode."""
         kw['editable'] = 1
+        return self.render(**kw)
+
+    security.declareProtected(change_page_designs, 'preview')
+    def preview(self, **kw):
+        """Renders the design in preview mode."""
+        kw['preview'] = 1
         return self.render(**kw)