From f143581e6c74c3dc22c63b46dd7c1347f039e039 Mon Sep 17 00:00:00 2001 From: david <> Date: Tue, 5 Nov 2002 17:43:10 +0000 Subject: [PATCH] CMF integration now working, albeit imperfectly. --- LDP/lampadas/PloneCVSFile/OMF.py | 2 ++ LDP/lampadas/PloneCVSFile/PloneCVSFile.py | 25 +++++++++++----- LDP/lampadas/PloneCVSFile/__init__.py | 36 +++++++++++------------ LDP/lampadas/PloneCVSFile/version.txt | 2 +- 4 files changed, 39 insertions(+), 26 deletions(-) diff --git a/LDP/lampadas/PloneCVSFile/OMF.py b/LDP/lampadas/PloneCVSFile/OMF.py index fb5e05b2..0e57bc0f 100644 --- a/LDP/lampadas/PloneCVSFile/OMF.py +++ b/LDP/lampadas/PloneCVSFile/OMF.py @@ -9,6 +9,8 @@ class OMF(DefaultDublinCoreImpl): """Mix-in class that provides OMF metadata, based on Dublin Core. """ + __implements__ = DefaultDublinCoreImpl.__implements__ + security = ClassSecurityInfo() def __init__(self, diff --git a/LDP/lampadas/PloneCVSFile/PloneCVSFile.py b/LDP/lampadas/PloneCVSFile/PloneCVSFile.py index 11d0df70..309615bd 100644 --- a/LDP/lampadas/PloneCVSFile/PloneCVSFile.py +++ b/LDP/lampadas/PloneCVSFile/PloneCVSFile.py @@ -25,6 +25,7 @@ from Products.CMFCore.DynamicType import DynamicType # OFS imports from OFS.SimpleItem import SimpleItem +from OFS import Image # OMF imports from OMF import OMF @@ -117,20 +118,25 @@ def manage_lampadas(self, action, REQUEST=None): # CVSFile class ################################################################ -class PloneCVSFile(CVSFile, PortalContent, OMF): +# PortalContent brings in: DynamicType, CMFCatalogAware, SimpleItem + +class PloneCVSFile(CVSFile, Image.File, PortalContent, OMF): """Extended from CVSFile """ - def __init__(self, id, title='', description='', relativeFilePath='foo.html'): - CVSFile.__init__(self, id, title, description, relativeFilePath) - OMF.__init__(self) - # , title=title, description-description) + __implements__ = (CVSFile.__implements__, + PortalContent.__implements__, + OMF.__implements__) + + isPortalContent = 1 + _isPortalContent = 1 meta_type = 'CMF CVS File' # This is the name Zope will use for the Product in # the "addProduct" list - __implements__ = ICVSFile + _isDiscussable = 1 + # This tuple defines a dictionary for each tab in the management interface # label = label of tab, action = url it links to @@ -166,7 +172,7 @@ class PloneCVSFile(CVSFile, PortalContent, OMF): # CMF ATTRIBUTES - portal_type = 'CVS File' + portal_type = 'CMF CVS File' set = _security.setPermissionDefault set('Edit CVS File', ('Owner', 'Manager', 'Authenticated')) set('FTP Access', ('Owner', 'Manager', 'Authenticated')) @@ -177,6 +183,11 @@ class PloneCVSFile(CVSFile, PortalContent, OMF): manage_metadata = DTMLFile('dtml/omf_metadata', globals()) + def __init__(self, id, title='', description='', relativeFilePath='foo.html'): + CVSFile.__init__(self, id, title, description, relativeFilePath) + Image.File.__init__(self, id, title, relativeFilePath) + OMF.__init__(self) + def inCMF(self): """Return true if this object is in a CMF portal. """ diff --git a/LDP/lampadas/PloneCVSFile/__init__.py b/LDP/lampadas/PloneCVSFile/__init__.py index 5bae9659..d00dc02a 100644 --- a/LDP/lampadas/PloneCVSFile/__init__.py +++ b/LDP/lampadas/PloneCVSFile/__init__.py @@ -8,36 +8,36 @@ from Products.ExternalFile.CreationDialog import manage_add_via_gui, \ create_standard_formpart, create_externalfile_formpart from Products.CMFCore.DirectoryView import registerDirectory -from Products.CMFCore import utils +from Products.CMFCore import utils, CMFCorePermissions from socket import gethostname factory_type_information = ( {'id': 'CMF CVS File', - 'content_icon': 'www/fish.gif', 'meta_type': 'CMF CVS File', + 'description': 'A file in a CVS repository.', + 'content_icon': 'file_icon.gif', + 'icon': 'file_icon.gif', 'product': 'PloneCVSFile', 'factory': 'addPloneCVSFile', - 'immediate_view': 'index_html', + 'immediate_view': 'metadata_edit_form', 'actions': ({'id': 'view', 'name': 'View', - 'action': 'wikipage_view', - 'permissions': ('View CVS File',)}, - {'id': 'comment', - 'name': 'Comment', - 'action': 'wikipage_comment_form', - 'permissions': ('Add CVS File Comment',)}, + 'action': 'file_view', + 'permissions': (CMFCorePermissions.View,)}, + {'id': 'download', + 'name': 'Download', + 'action': '', + 'permissions': (CMFCorePermissions.View,)}, {'id': 'edit', 'name': 'Edit', - 'action': 'wikipage_edit_form', - 'permissions': ('Edit CVS File',)}, - {'id': 'create', - 'name': 'Create', - 'category': 'folder', - 'action':'wikipage_create_form', - 'permissions': ('Create CVS File',), - 'visible': 0 }, - ), + 'action': 'file_edit_form', + 'permissions': (CMFCorePermissions.ModifyPortalContent,)}, + {'id': 'metadata', + 'name': 'Metadata', + 'action': 'metadata_edit_form', + 'permissions': (CMFCorePermissions.ModifyPortalContent,)}, + ) }, ) diff --git a/LDP/lampadas/PloneCVSFile/version.txt b/LDP/lampadas/PloneCVSFile/version.txt index 828ad2e8..3a2e0c64 100644 --- a/LDP/lampadas/PloneCVSFile/version.txt +++ b/LDP/lampadas/PloneCVSFile/version.txt @@ -1,2 +1,2 @@ -0.0.18 +0.0.19