[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/OFS/Content/ZPTPage/Views/Browser - ZPTPageEdit.py:1.2 ZPTPageEval.py:1.2 __init__.py:1.2 browser.zcml:1.2 edit.pt:1.2

Jim Fulton jim@zope.com
Mon, 10 Jun 2002 19:28:38 -0400


Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/Content/ZPTPage/Views/Browser
In directory cvs.zope.org:/tmp/cvs-serv17445/lib/python/Zope/App/OFS/Content/ZPTPage/Views/Browser

Added Files:
	ZPTPageEdit.py ZPTPageEval.py __init__.py browser.zcml edit.pt 
Log Message:
Merged Zope-3x-branch into newly forked Zope3 CVS Tree.


=== Zope3/lib/python/Zope/App/OFS/Content/ZPTPage/Views/Browser/ZPTPageEdit.py 1.1 => 1.2 ===
+#
+# Copyright (c) 2001, 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.
+# 
+##############################################################################
+"""
+
+$Id$
+"""
+
+from Zope.App.Formulator.Form import Form
+from Zope.App.PageTemplate import ViewPageTemplateFile
+
+
+class ZPTPageEdit(Form):
+
+    __implements__ = Form.__implements__
+
+    name = 'editForm'     
+    title = 'Edit Form'
+    description = ('This edit form allows you to make changes to the ' +
+                   'source code of this ZPT Page.')
+
+    _fieldViewNames = ['SourceFieldView']
+    template = ViewPageTemplateFile('edit.pt')


=== Zope3/lib/python/Zope/App/OFS/Content/ZPTPage/Views/Browser/ZPTPageEval.py 1.1 => 1.2 ===
+#
+# Copyright (c) 2001, 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.
+# 
+##############################################################################
+"""Define view component for ZPT page eval results.
+
+$Id$
+"""
+
+from Zope.Publisher.Browser.BrowserView import BrowserView
+from Zope.Proxy.ContextWrapper import getWrapperContainer
+
+class ZPTPageEval(BrowserView):
+
+    def index(self, REQUEST=None, **kw):
+        """Call a Page Template"""
+
+        template = self.context
+
+        if REQUEST is not None:
+            REQUEST.getResponse().setHeader('content-type',
+                                            template.content_type)
+
+        return template.render(REQUEST, **kw)
+


=== Zope3/lib/python/Zope/App/OFS/Content/ZPTPage/Views/Browser/__init__.py 1.1 => 1.2 ===
+#
+# Copyright (c) 2001, 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.
+# 
+##############################################################################
+"""
+
+$Id$
+"""


=== Zope3/lib/python/Zope/App/OFS/Content/ZPTPage/Views/Browser/browser.zcml 1.1 => 1.2 ===
+   xmlns='http://namespaces.zope.org/zope'
+   xmlns:security='http://namespaces.zope.org/security'
+   xmlns:browser='http://namespaces.zope.org/browser'
+>
+
+  <!-- ZPT Page View Directives -->
+
+  <browser:defaultView
+      name="index.html"
+      for="Zope.App.OFS.Content.ZPTPage.ZPTPage.IZPTPage."
+      />
+
+  <browser:view
+      permission="Zope.View"
+      for="Zope.App.OFS.Content.ZPTPage.ZPTPage.IZPTPage."
+      factory=".ZPTPageEval.">
+      
+      <browser:page name="index.html" attribute="index" />
+  </browser:view>
+
+  <browser:view
+      permission="Zope.ManageContent"
+      for="Zope.App.OFS.Content.ZPTPage.ZPTPage.IZPTPage."
+      factory=".ZPTPageEdit." >
+
+      <browser:page name="editForm.html" attribute="index" />
+      <browser:page name="edit.html" attribute="action" />
+
+  </browser:view>
+
+  <!-- Registering all the field views for the browser -->
+
+  <browser:view
+      name="SourceFieldView"
+      for="Zope.App.OFS.Content.ZPTPage.ZPTPage.IZPTPage."
+      factory="Zope.App.OFS.Content.ZPTPage.ZPTPageFields.SourceField. 
+               Zope.App.Formulator.Widgets.Browser.TextAreaWidget." />
+
+</zopeConfigure>


=== Zope3/lib/python/Zope/App/OFS/Content/ZPTPage/Views/Browser/edit.pt 1.1 => 1.2 ===
+  <head>
+    <style metal:fill-slot="headers" type="text/css">
+      <!--
+      .ContentIcon {
+	  width: 20px;
+      }
+      
+      .ContentTitle {
+	  text-align: left;
+      }
+      -->
+    </style>
+  </head>
+
+  <body>
+    <div metal:fill-slot="body">
+
+ 
+ 
+      <p tal:content="context/msg"
+         tal:condition="python: hasattr(context, 'msg')">
+        Message will go here.
+      </p>
+
+      <p tal:content="view/description">
+        Description of the Form.
+      </p>
+
+
+      <div tal:condition="python: options.has_key('errors') and options['errors']">
+        Errors:
+        <div tal:repeat="error options/errors | nothing"
+             tal:content="error">Foo </div>
+      </div>
+
+      <form action="edit.html" method="post">
+
+        <table class="EditTable">      
+	  <tbody>   
+  
+	    <tr tal:repeat="fieldView python:view.getFieldViews(request)">
+	      <th class="EditAttributeName"
+                  tal:content="python: fieldView.context.getValue('title')">Title</th>
+	      <td class="EditAttributeValue"
+	          tal:content="structure fieldView/render"><input />
+              </td>
+	    </tr>
+  
+	  </tbody>     
+      </table>
+
+      <input type="submit" name="edit" value="Save Changes">
+
+      </form> 
+
+    </div>
+  </body>
+</html>
+
+