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

Stephan Richter srichter@cbu.edu
Mon, 4 Mar 2002 00:54:45 -0500


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

Modified Files:
      Tag: srichter-OFS_Formulator-branch
	ZPTPageEdit.py ZPTPageEval.py browser.zcml edit.pt 
Log Message:
Here are some of the changes:

- XML-RPC View for Folders; methods are far from being complete, however
  it is the proof of concept; it works.

- Experimental XUL code in folder that shows a tree, a menu and the limit 
  view.

- File can now be viewed like an Image. Since it also sets the right 
  content type, it is even more useful for some of the development.

- ZPTPages are the last content object to be "formulatorized". Now they 
  also entered the new generation code.

ToDo:

- Make tests.

- Update interfaces.

- Get a client side XML-RPC client talk from the browser with Zope to save
  values. 

- Get a tutorial going, so that the ZMI sprinters and developers can make
  use of the technology



=== Zope3/lib/python/Zope/App/OFS/ZPTPage/Views/Browser/ZPTPageEdit.py 1.1.2.1 => 1.1.2.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 1.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# 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.
-
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE
+# 
+##############################################################################
 """
-    Define view component for ZPT page editing.
+
+$Id$
 """
 
-from Zope.Publisher.Browser.AttributePublisher import AttributePublisher
+from Zope.App.Formulator.Form import Form
 from Zope.PageTemplate.PageTemplateFile import PageTemplateFile
 
 
-class ZPTPageEdit( AttributePublisher ):
-
-    __implements__ = AttributePublisher.__implements__
-    
-    def __init__( self, zptpage ):
-        self._zptpage = zptpage
-
-
-    def editAction(self, source, REQUEST=None):
-        zptpage = self.getContext()
-        zptpage.setSource(source)
-
-        if REQUEST is not None:
-            return self.index(REQUEST, msg='ZPT Page Edited.')
-
+class ZPTPageEdit(Form):
 
-    def getContext( self ):
-        return self._zptpage
+    __implements__ = Form.__implements__
 
-    index = PageTemplateFile('edit.pt')
+    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 = PageTemplateFile('edit.pt')


=== Zope3/lib/python/Zope/App/OFS/ZPTPage/Views/Browser/ZPTPageEval.py 1.1.2.1 => 1.1.2.2 ===
         try:
             self.REQUEST.RESPONSE.setHeader('content-type',
-                                            self.getContect.content_type)
+                                            self.getContext().content_type)
         except AttributeError:
             pass
 
         # Execute the template in a new security context.
         self.getContext()._cook()
-        return self.getContext().pt_render(extra_context=bound_names)
+        return self.getContext().pt_render(bound_names)
 
 
     def document_src(self, REQUEST=None, RESPONSE=None):


=== Zope3/lib/python/Zope/App/OFS/ZPTPage/Views/Browser/browser.zcml 1.1.2.1 => 1.1.2.2 ===
   <security:protectClass 
     name="Zope.App.OFS.ZPTPage.Views.Browser.ZPTPageEdit."
-    permission_id="Zope.View" methods="index, editAction" />
+    permission_id="Zope.View" methods="index, action" />
 
 
   <!-- Registering all the field views for the browser -->
+
+  <browser:view name="SourceFieldView"
+    for="Zope.App.OFS.ZPTPage.ZPTPage.IZPTPage."
+    factory="Zope.App.OFS.ZPTPage.ZPTPageFields.SourceField. Zope.App.Formulator.Widgets.Browser.TextAreaWidget." />
 
 </zopeConfigure>


=== Zope3/lib/python/Zope/App/OFS/ZPTPage/Views/Browser/edit.pt 1.1.2.1 => 1.1.2.2 ===
 
  
-      <p tal:content="options/msg | nothing">
+ 
+      <p tal:content="here/msg"
+         tal:condition="python: hasattr(here, 'msg')">
         Message will go here.
       </p>
 
-      <form action="editAction" method="post" enctype="multipart/form-data">
+      <p tal:content="container/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="action" method="post">
 
         <table class="EditTable">      
 	  <tbody>   
   
-	    <tr>
-	      <th class="EditAttributeName">Source</th>
-	      <td class="EditAttributeValue">
-        	<textarea name="source" cols="80" rows="10"
-		          tal:content="here/getSource">Source</textarea>
+	    <tr tal:repeat="fieldView python:container.getFieldViews(request)">
+	      <th class="EditAttributeName"
+                  tal:content="python: fieldView.getContext().getValue('title')">Title</th>
+	      <td class="EditAttributeValue"
+	          tal:content="structure fieldView/render"><input />
               </td>
-	    </tr>      
+	    </tr>
   
 	  </tbody>     
       </table>