Back to index

plone3  3.1.7
ZopeVersionHistory.py
Go to the documentation of this file.
00001 ##############################################################################
00002 #
00003 # Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
00004 # 
00005 # This software is subject to the provisions of the Zope Public License,
00006 # Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
00007 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
00008 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00009 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
00010 # FOR A PARTICULAR PURPOSE
00011 # 
00012 ##############################################################################
00013 
00014 __version__='$Revision: 1.2 $'[11:-2]
00015 
00016 from Globals import DTMLFile, InitializeClass
00017 import OFS, AccessControl, Acquisition
00018 import VersionHistory
00019 
00020 class ZopeVersionHistory(
00021     VersionHistory.VersionHistory,
00022     AccessControl.Role.RoleManager,
00023     OFS.SimpleItem.Item,
00024     ):
00025     """The ZopeVersionHistory build on the core VersionHistory class to 
00026        provide the Zope management interface and other product trappings."""
00027 
00028     security = AccessControl.ClassSecurityInfo()
00029     security.setDefaultAccess('deny')
00030 
00031     meta_type = 'Version History'
00032 
00033     manage_options=(
00034         ( {'label': 'Contents',    'action':'manage_main',
00035            'help': ('ZopeVersionControl', 'VersionHistory-Manage.stx')},
00036           {'label': 'Properties', 'action':'manage_properties_form',
00037            'help': ('ZopeVersionControl', 'VersionHistory-Properties.stx')},
00038         ) +
00039         AccessControl.Role.RoleManager.manage_options +
00040         OFS.SimpleItem.Item.manage_options
00041         )
00042 
00043     icon='misc_/ZopeVersionControl/VersionHistory.gif'
00044 
00045     security.declareProtected('View management screens', 'manage_main')
00046     manage_main = DTMLFile('dtml/VersionHistoryManageMain', globals())
00047     manage_main._setName('manage_main')
00048     manage = manage_main
00049 
00050     security.declareProtected(
00051         'View management screens', 'manage_properties_form'
00052         )
00053     manage_properties_form = DTMLFile(
00054         'dtml/VersionHistoryProperties', globals()
00055         )
00056 
00057     security.declareProtected('Manage repositories', 'manage_edit')
00058     def manage_edit(self, REQUEST=None):
00059         """Change object properties."""
00060         if REQUEST is not None:
00061             message="Saved changes."
00062             return self.manage_properties_form(
00063                 self, REQUEST, manage_tabs_message=message
00064                 )
00065 
00066     def __getitem__(self, name):
00067         activity = self._branches.get(name)
00068         if activity is not None:
00069             return activity.__of__(self)
00070         raise KeyError, name
00071 
00072     security.declarePrivate('objectIds')
00073     def objectIds(self, spec=None):
00074         return self._branches.keys()
00075 
00076     security.declarePrivate('objectValues')
00077     def objectValues(self, spec=None):
00078         return self._branches.values()
00079 
00080     security.declarePrivate('objectItems')
00081     def objectItems(self, spec=None):
00082         return self._branches.items()
00083 
00084 InitializeClass(ZopeVersionHistory)
00085 
00086