1 | #-*- mode: python; mode: fold -*- |
---|
2 | from Globals import InitializeClass |
---|
3 | from AccessControl import ClassSecurityInfo |
---|
4 | |
---|
5 | from Products.CMFCore.utils import UniqueObject, getToolByName |
---|
6 | from Products.CMFCore.permissions import View |
---|
7 | from Products.CMFCore.permissions import ModifyPortalContent |
---|
8 | from Products.CPSCore.CPSBase import CPSBase_adder, CPSBaseFolder |
---|
9 | #from Products.CPSCore.CPSBase import CPSBaseDocument as BaseDocument |
---|
10 | from Products.CPSDocument.CPSDocument import CPSDocument |
---|
11 | from Products.CPSCore.CPSBase import CPSBaseBTreeFolder as BaseBTreeFolder |
---|
12 | |
---|
13 | accofolder_fti = { ###( |
---|
14 | 'title': 'WAeUP AccoFolder', |
---|
15 | 'description': '', |
---|
16 | 'content_icon': '', |
---|
17 | 'content_meta_type': 'AccoFolder', |
---|
18 | 'factory': 'addAccoFolder', |
---|
19 | 'immediate_view': 'cpsdocument_view', |
---|
20 | 'global_allow': True, |
---|
21 | 'filter_content_types': True, |
---|
22 | 'allowed_content_types': ('Accommodation',), |
---|
23 | 'allow_discussion': False, |
---|
24 | } |
---|
25 | ###) |
---|
26 | |
---|
27 | class AccoFolder(CPSDocument): ###( |
---|
28 | """ |
---|
29 | WAeUP AccoFolder containing Accommodation halls |
---|
30 | """ |
---|
31 | meta_type = 'AccoFolder' |
---|
32 | portal_type = meta_type |
---|
33 | security = ClassSecurityInfo() |
---|
34 | |
---|
35 | |
---|
36 | InitializeClass(AccoFolder) |
---|
37 | |
---|
38 | def addAccoFolder(container, id, REQUEST=None, **kw): |
---|
39 | """Add a AccoFolder.""" |
---|
40 | ob = AccoFolder(id, **kw) |
---|
41 | return CPSBase_adder(container, ob, REQUEST=REQUEST) |
---|
42 | ###) |
---|
43 | |
---|
44 | accommodation_fti = { ###( |
---|
45 | 'title': 'WAeUP Accommodation', |
---|
46 | 'description': '', |
---|
47 | 'content_icon': '', |
---|
48 | 'content_meta_type': 'Accommodation', |
---|
49 | 'factory': 'addAccommodation', |
---|
50 | 'immediate_view': 'cpsdocument_view', |
---|
51 | 'global_allow': True, |
---|
52 | 'filter_content_types': True, |
---|
53 | 'allowed_content_types': (), |
---|
54 | 'allow_discussion': False, |
---|
55 | } |
---|
56 | ###) |
---|
57 | |
---|
58 | class Accommodation(CPSDocument): ###( |
---|
59 | """ |
---|
60 | WAeUP Accommodation containing Departments |
---|
61 | """ |
---|
62 | meta_type = 'Accommodation' |
---|
63 | portal_type = meta_type |
---|
64 | security = ClassSecurityInfo() |
---|
65 | |
---|
66 | security.declareProtected(View,"Title") |
---|
67 | def Title(self): |
---|
68 | """compose title""" |
---|
69 | content = self.getContent() |
---|
70 | heading = getattr(content,'heading',None) |
---|
71 | if heading is None: |
---|
72 | return self.title |
---|
73 | return heading |
---|
74 | |
---|
75 | InitializeClass(Accommodation) |
---|
76 | |
---|
77 | def addAccommodation(container, id, REQUEST=None, **kw): |
---|
78 | """Add a Accommodation.""" |
---|
79 | ob = Accommodation(id, **kw) |
---|
80 | return CPSBase_adder(container, ob, REQUEST=REQUEST) |
---|
81 | ###) |
---|