CMFHBTreeFolder.py 3.47 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
##############################################################################
#
# 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
#
##############################################################################

from AccessControl.SecurityInfo import ClassSecurityInfo
16
from App.class_init import default__class_init__ as InitializeClass
17
from Products.HBTreeFolder2.HBTreeFolder2 import HBTreeFolder2Base
18
from Products.CMFCore.PortalFolder import PortalFolderBase
19

20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
_actions = ({'action': 'string:${object_url}',
           'id': 'view',
           'name': 'View',
           'permissions': ('View',)},
          {'action': 'string:${object_url}/folder_edit_form',
           'id': 'edit',
           'name': 'Edit',
           'permissions': ('Manage properties',)},
          {'action': 'string:${object_url}/folder_localrole_form',
           'id': 'localroles',
           'name': 'Local Roles',
           'permissions': ('Change local roles',)},
          {'action': 'string:${object_url}/folder_contents',
           'id': 'folderContents',
           'name': 'Folder contents',
           'permissions': ('List folder contents',)},
          {'action': 'string:${object_url}/folder_factories',
           'id': 'new',
           'name': 'New...',
           'permissions': ('Add portal content',),
           'visible': 0},
          {'action': 'string:${object_url}/folder_rename_form',
           'id': 'rename_items',
           'name': 'Rename items',
           'permissions': ('Add portal content',),
           'visible': 0})
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72

factory_type_information = ( { 'id'             : 'CMF HBTree Folder',
                               'meta_type'      : 'CMF HBTree Folder',
                               'description'    : """\
CMF folder designed to hold a lot of objects.""",
                               'icon'           : 'folder_icon.gif',
                               'product'        : 'CMFCore',
                               'factory'        : 'manage_addCMFHBTreeFolder',
                               'filter_content_types' : 0,
                               'immediate_view' : 'folder_edit_form',
                               'actions'        : _actions,
                               },
                           )


def manage_addCMFHBTreeFolder(dispatcher, id, title='', REQUEST=None):
    """Adds a new HBTreeFolder object with id *id*.
    """
    id = str(id)
    ob = CMFHBTreeFolder(id)
    ob.title = str(title)
    dispatcher._setObject(id, ob)
    ob = dispatcher._getOb(id)
    if REQUEST is not None:
        REQUEST['RESPONSE'].redirect(ob.absolute_url() + '/manage_main' )


73
class CMFHBTreeFolder(HBTreeFolder2Base, PortalFolderBase):
74 75 76 77 78 79
    """HBTree folder for CMF sites.
    """
    meta_type = 'CMF HBTree Folder'
    security = ClassSecurityInfo()

    def __init__(self, id, title=''):
80
        PortalFolderBase.__init__(self, id, title)
81 82 83
        HBTreeFolder2Base.__init__(self, id)

    def _checkId(self, id, allow_dup=0):
84
        PortalFolderBase._checkId(self, id, allow_dup)
85 86 87 88 89
        HBTreeFolder2Base._checkId(self, id, allow_dup)



InitializeClass(CMFHBTreeFolder)