[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/OFS/Content/File/Views/Browser - FileUpload.py:1.1 configure.zcml:1.15 FileEdit.py:NONE edit.pt:NONE
Jim Fulton
jim@zope.com
Mon, 11 Nov 2002 16:05:46 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/Content/File/Views/Browser
In directory cvs.zope.org:/tmp/cvs-serv21821/Views/Browser
Modified Files:
configure.zcml
Added Files:
FileUpload.py
Removed Files:
FileEdit.py edit.pt
Log Message:
Changed to use (single-line) Line field for content type.
Changed to to use an automatically-generated editing form
when the content type begins with "text/".
Added an automatically-generated upload form that is customized with a
class to provide a custom widget (a file widget) for the data.
=== Added File Zope3/lib/python/Zope/App/OFS/Content/File/Views/Browser/FileUpload.py ===
##############################################################################
#
# 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.
#
##############################################################################
"""
$Id: FileUpload.py,v 1.1 2002/11/11 21:05:16 jim Exp $
"""
__metaclass__ = type
from Zope.App.Forms.Views.Browser.Widget import FileWidget
from Zope.App.Forms.Widget import CustomWidget
class FileUpload:
"""File editing mix-in that uses a file-upload widget.
"""
data = CustomWidget(FileWidget)
__doc__ = FileUpload.__doc__ + __doc__
=== Zope3/lib/python/Zope/App/OFS/Content/File/Views/Browser/configure.zcml 1.14 => 1.15 ===
--- Zope3/lib/python/Zope/App/OFS/Content/File/Views/Browser/configure.zcml:1.14 Mon Nov 4 17:11:00 2002
+++ Zope3/lib/python/Zope/App/OFS/Content/File/Views/Browser/configure.zcml Mon Nov 11 16:05:16 2002
@@ -1,7 +1,9 @@
<zopeConfigure
xmlns="http://namespaces.zope.org/zope"
xmlns:browser="http://namespaces.zope.org/browser"
- package="Zope.App.OFS.Content.File">
+ xmlns:form="http://namespaces.zope.org/form"
+ package="Zope.App.OFS.Content.File"
+ >
<!-- File View Directives -->
@@ -15,15 +17,20 @@
</browser:view>
-<browser:view
- for=".IFile."
- permission="Zope.View"
- factory=".Views.Browser.FileEdit.">
-
- <browser:page name="editForm.html" attribute="form" />
- <browser:page name="edit.html" attribute="action" />
-
-</browser:view>
+<form:edit
+ schema = ".IFile."
+ name = "edit.html"
+ label = "Change a file"
+ permission = "Zope.ManageContent"
+ />
+
+<form:edit
+ schema = ".IFile."
+ name = "upload.html"
+ label = "Upload a file"
+ permission = "Zope.ManageContent"
+ class = ".Views.Browser.FileUpload."
+ />
<!-- I18n File View Directives -->
@@ -46,10 +53,24 @@
<!-- File Menu Directives -->
<browser:menuItems menu="zmi_views" for=".IFile.">
- <browser:menuItem title="Edit" action="editForm.html" />
+ <browser:menuItem title="Edit" action="edit.html"
+ filter="python:context.contentType.startswith('text/')"
+ />
+ <browser:menuItem title="Upload" action="upload.html" />
<browser:menuItem title="Role Permissions"
action="AllRolePermissions.html" />
<browser:menuItem title="View" action="show.html" />
+</browser:menuItems>
+
+<browser:menuItems menu="zmi_views" for=".I18nFile.II18nFile">
+
+ <!-- Keep original edit view, for now -->
+ <browser:menuItem title="Edit" action="editForm.html" />
+
+ <!-- Supress the upload view from file -->
+ <browser:menuItem title="Upload" action="editForm.html"
+ filter="python: 0"/>
+
</browser:menuItems>
<browser:menuItem menu="add_content"
=== Removed File Zope3/lib/python/Zope/App/OFS/Content/File/Views/Browser/FileEdit.py ===
=== Removed File Zope3/lib/python/Zope/App/OFS/Content/File/Views/Browser/edit.pt ===