About Files Zip for Plone
PloneFilesZip provides a tool that let users download all files from a folder (recursively) in a ZIP archive
Files Zip for Plone has been designed by the INGENIWEB team.
Files Zip for Plone 1.1.0RC3 is licensed under the GNU GPL license.
Do you like this product? You can support its authors by clicking the button below:
Screenshots
Screenshots
An user is visiting a folder where content provide files that can be downloaded. The ZIP folder icon is in the document actions.
He clicks the ZIP icons and reads the amount of content objects that will provide files and images if he clicks the dondload.
Readme
PloneFilesZip
By the Ingeniweb team.
About
Adds a document action to folders (and folderish contents) that enables to download all files and images from archetypes based contents available from that folder in a ZIP file.
Optionally, the user may get the DC metadata of the contents that provide files in XML-RDF format in the ZIP file.
Zip archives inner structure
All files in the Zip archives are recorded in the path
[rel_path "/"] content_id "/" field_id "/" file_name
All DC metadata in the Zip archives are recorded in the path
[rel_path "/"] content_id ".rdf"
With :
- rel_path -- The relative path to the folderish that contains the content object.
- content_id -- The id of a content that has a FileField or ImageField.
- field_id -- The name of the FileField or ImageField.
- file_name -- The original file name (as recorded in the field). An extension is provided if the original filename doesn't have one.
Requirements
- Plone 2.0.5 or Plone 2.1 +
- Archetypes 1.3.3 +
- Any AT based content type with a FileField, ImageField, or AttachmentField. (ATContenTypes do the job)
Optional products
- ATContentTypes 0.2 +, on Plone 2.0.x
- AttachmentField 1.3 + and AttachmentField based content types like PloneExFile
- LinguaPlone 0.7 +. If LinguaPlone is detected, the user downloads the files from contents in preferred language.
Warning
FileSystemStorage users must upgrade to a version later than 2005/10/20.
Configuring
After installing PloneZipFiles using the usual quick installer, you must open the 'portal_fileszip' tool in ZMI and follow the instructions from the "Overview" tab.
You may configure from the "PloneFilesZip Settings" control panel too.
Customizing
Custom fields
You can create and register your own retrivers for your custom fields. See 'retrivers.py' to see how we handle FileFields, ImageFields and AttachmentFields.
Basically, you just need to provide a class that implements the 'IFileRetriever' and register it like this
try:
from Products.PloneZipFiles import HAS_PLONE_FILES_ZIP
except ImportError, e:
HAS_PLONE_FILES_ZIP = False
...
if HAS_PLONE_FILES_ZIP:
from Products.PloneZipFiles.interfaces import IFieldRetriever
from Products.PloneZipFiles.registry import GlobalRegistry
class MyFieldRetriever:
__implements__ = Products.IFieldRetriever
field_type = 'my_field'
def __init__(self, field, content):
...
def fileName(self):
...
def mimeType(self):
...
def fileBody(self):
...
GlobalRegistry.register(MyFieldRetriever)
See 'interfaces.py' for details about methods signatures and docs.
Custom types
Most AT based content don't need to provide specific support for PloneFilesZip. Anyway, if your content type does not support the standard AT schema interface (means that 'your_content.Schema().fields()' does not provide all fields), your code must include and register a custom type retriever like this
try:
from Products.PloneZipFiles import HAS_PLONE_FILES_ZIP
except ImportError, e:
HAS_PLONE_FILES_ZIP = False
...
if HAS_PLONE_FILES_ZIP:
from Products.PloneZipFiles.interfaces import ITypeRetriever
from Products.PloneZipFiles.registry import GlobalRegistry
class MyTypeRetriever:
__implements__ = Products.ITypeRetriever
meta_type = 'my_type'
def __init__(self, content):
...
def getFieldRetrievers(self):
...
GlobalRegistry.register(MyFieldRetriever)
See 'interfaces.py' for details about methods signatures and docs.
You can find an example of type retriever in the latest PloneArticle product.
Custom inner structure policies
You can customize the way the files are organized into your zip archive.
you have to implement and register a ZipStructurePolicy class that implements a getZipFilePath method, that builds inner file path from document container path, file name and field path
container_path is the absolute path of the plone document where the file is stored field_path is the relative path of the file field into the document object
you will include in your product a plone zip policy module like this
from Products.PloneFilesZip.interfaces import IZipStructurePolicy
from Products.PloneFilesZip.policies import AbstractZipStructurePolicy, PolicyRegistry
class MyZipStructurePolicy(AbstractZipStructurePolicy):
'''
The inner structure of the zip file
corresponds to the inner structure of the objects.
'''
__implements__ = (IZipStructurePolicy,)
id = 'my_policy_id'
label = "Policy title"
label_msgid = 'my_policy_title_i18n_msgid'
help = "Policy help text"
help_msgid = "my_policy_help_i18n_msgid"
def getZipFilePath(self,
container_path=None,
file_name=None,
field_path=None,):
...
PolicyRegistry.registerPolicy(MyZipStructurePolicy)
See 'interfaces.py' for details about methods signatures and docs.
Copyright and license
Copyright (c) 2006 Ingeniweb SAS
This software is subject to the provisions of the GNU General Public License, Version 2.0 (GPL). A copy of the GPL 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
See the .../PloneFilesZip/LICENSE file that comes with this product.
Testing
Please read .../PloneFilesZipe/tests/README.txt
Download
Get PloneFilesZip from its SVN repository:
svn co http://svn.plone.org/svn/collective/PloneFilesZip/trunk PloneFilesZip
Credits
- Gilles Lenfant, main developer
- Arthur Albano, Brasilian-Portugese translation
- Thomas Desvenain, policies developer
Feedback
Contributions are welcome too:
- Report success/problems with other File like fields and storages (please provide configuration info, test cases and tracebacks with bug reports).
- Provide translations for your native language.
Download
Released versions
Released versions of Files Zip for Plone are available here. The current version is 1.1.0RC3.
CVS version
The repository contains the up-to-date versions of our source code. In order to get the HEAD branch of PloneFilesZip, use :
svn co http://svn.plone.org/svn/collective/PloneFilesZip/trunk
You can also browse the CVS with your browser.
Documentation
Readme
Please take time the read the Readme
F.A.Q
FAQ
- Q: Why can't we see the amount of data yhat will be downloaded before
- clicking the "Download" button ?
- A: Because we need to build the ZIP archive before the intermediate
- template for this. This might be resources expensive.
- Q: I installed PloneFileZip but the icon doesn't show in the document
- actions of a folder that has files and images. What's going on ?
- A: You probably forgot to tweak PloneFilesZip. Go in ZMI and open
- "Properties" tab of the "portal_fileszip" object. Select one or more portal types. You can do this in the configlet too.
- Q: I want to show the download icon only under some conditions. I
- don't want to enable any user to download content. How do I do this?
- A: In ZMI, go in the "Actions" tab of the "portal_fileszip"
- object. Change the "Condition" and/or "Permission" associated with the "zip" action.
Q: What about security ?
- A: When building the ZIP file, PloneFilesZip includes only the files
- in content objects the user is allowed to view.
Q: The structure of the zip file looks strange. Why ?
- A: Please read the README.txt at the root of PloneFilesZip. This is
- done intentionally to prevent potential duplicate file names in the zip file. In example, imagine you have a custom content type with two FileFields, an a user fills both fields with two files with the same name. In that case, the zip file would contain only the second. The zip inner format policy ensures you got both files even if they have the same name.
- Q: I made an AT content type with a FileField an an ImageField. This
- content type doesn't show in the "Properties" tab of the "portal_fileszip" object in ZMI, neither in the configlet. What's going on ?
- A: Did you build a content with standard AT schema ? Did you change
- the schema with ATSchemaEditorNG or such AT extension ? If the answer is "yes", you should consider to develop and register a custom type retriever. More details in the README.tx that comes with PloneFilesZip.
- Q: Most of my users are Windows users, my Plone site publishes in
- UTF-8, the file names have strange characters in the zip archive.
- A: You should check and change the "zipCharset" property in in the
- "Properties" tab of the "portal_fileszip" object in ZMI or in the configlet. Using "cp1252" may suit your needs.
- Q: I made an AT based content type with a non standard file like
- field. It doesn't work. What can I do ?
- A: You should develop and register a dedicated field retriever. This
- requires some AT skills. More details in the README.tx that comes with PloneFilesZip. You may subclass retrievers from PloneFilesZip/retrievers.py
Q: Got an IOError when downloading. What's going on ?
- A: If the exception message is "No space left on device", you have not
- enough room in your system TMP folder. The Zip file is built in the server using the "tempfile" packge. Please read your system documentation and the "tempfile" package doc http://docs.python.org/lib/module-tempfile.html.
Links
History
Files Zip for Plone changes
1.1.0RC2 - 2007/02/02
Fix a bug in file retrieving. Append arg (full=True) while creating BaseUnit to make sure we get the entire file and not a chunk file (clebeaupin)
Fix a bug on DeepZipStructurePolicy:getZipFilePath (add **kwargs on method) (clebeaupin)
1.1.0RC1 - 2007/02/01
- Add policy "ContentZipStructurePolicy"
- In regards to the new policies, files are renamed if they are duplicated in the same inner archive directory
- Add policies to manage zip structure. Policy can be configured in configlet
1.0.0 - 2006/10/16
- Added a configlet
1.0.0RC1 - 2006/09/24
- First public release
Files Zip for Plone ChangeLog is also available for detailed informations.
Contact
- You can report bugs using the bugtracker.
- To get Open Source support for this component, use support@ingeniweb.com.
- To get commercial support for this component, ask sales@ingeniweb.com.
- To host a Zope/Plone server or instance, take a look at IngeniHosting.
- For Zope, Plone or Files Zip for Plone training, ask sales@ingeniweb.com.