[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/OFS/Content/File/Views/Browser - FileEdit.py:1.2 FileView.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:29 -0400


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

Added Files:
	FileEdit.py FileView.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/File/Views/Browser/FileEdit.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.
+# 
+##############################################################################
+"""
+Revision information: 
+$Id$
+"""
+
+from Zope.App.Formulator.Form import Form
+from Zope.App.PageTemplate import ViewPageTemplateFile
+
+
+
+class FileEdit(Form):
+
+    __implements__ = Form.__implements__
+
+    name = 'editForm'     
+    title = 'Edit Form'
+    description = ('This edit form allows you to make changes to the ' +
+                   'properties of this file.')
+
+    _fieldViewNames = ['ContentTypeFieldView', 'DataFieldView']
+    template = ViewPageTemplateFile('edit.pt')
+


=== Zope3/lib/python/Zope/App/OFS/Content/File/Views/Browser/FileView.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.Publisher.Browser.BrowserView import BrowserView
+
+
+class FileView(BrowserView):
+
+    def __call__(self):
+        """Call the File"""
+        request = self.request
+        if request is not None:
+            request.getResponse().setHeader('Content-Type',
+                                       self.context.getContentType())
+            request.getResponse().setHeader('Content-Length',
+                                       self.context.getSize())
+
+        return self.context.getData()


=== Zope3/lib/python/Zope/App/OFS/Content/File/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/File/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'
+>
+
+  <!-- File View Directives -->
+
+  <browser:defaultView 
+      name="view"
+      for="Zope.App.OFS.Content.File.IFile."
+      permission="Zope.View"
+      factory=".FileView." />
+
+  <browser:view
+      name="edit"
+      for="Zope.App.OFS.Content.File.IFile."
+      permission="Zope.View"
+      factory=".FileEdit.">
+
+    <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="DataFieldView"
+      for="Zope.App.OFS.Content.File.IFile."
+      factory="Zope.App.OFS.Content.File.FileFields.DataField. 
+               Zope.App.Formulator.Widgets.Browser.TextAreaWidget." />
+
+  <browser:view
+      name="ContentTypeFieldView"
+      for="Zope.App.OFS.Content.File.IFile."
+      factory="Zope.App.OFS.Content.File.FileFields.ContentTypeField. 
+               Zope.App.Formulator.Widgets.Browser.TextWidget." />
+
+</zopeConfigure>


=== Zope3/lib/python/Zope/App/OFS/Content/File/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="action" 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>
+
+