/
OrderedFolder.py
49 lines (40 loc) · 1.53 KB
/
OrderedFolder.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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
46
47
48
49
##############################################################################
#
# Copyright (c) 2003 Zope Foundation and Contributors.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (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.
#
##############################################################################
""" 'Folder' with order support.
"""
from App.special_dtml import DTMLFile
from zope.interface import implementer
from OFS.Folder import Folder
from OFS.interfaces import IOrderedFolder
from OFS.OrderSupport import OrderSupport
manage_addOrderedFolderForm = DTMLFile('dtml/addOrderedFolder', globals())
def manage_addOrderedFolder(self, id, title='', createPublic=0, createUserF=0,
REQUEST=None):
"""Add a new ordered Folder object with id *id*.
"""
ob = OrderedFolder(id)
ob.title = title
self._setObject(id, ob)
ob = self._getOb(id)
if REQUEST:
return self.manage_main(self, REQUEST)
@implementer(IOrderedFolder)
class OrderedFolder(OrderSupport, Folder):
""" Extends the default Folder by order support.
"""
meta_type = 'Folder (Ordered)'
zmi_icon = 'icon-folder2'
manage_options = (
OrderSupport.manage_options +
Folder.manage_options[1:]
)