source: WAeUP_SRP/branches/srpp_branch/Accommodation.py @ 7508

Last change on this file since 7508 was 152, checked in by joachim, 19 years ago

=studylevel + Title

  • Property svn:keywords set to Id
File size: 2.3 KB
Line 
1#-*- mode: python; mode: fold -*-
2from Globals import InitializeClass
3from AccessControl import ClassSecurityInfo
4
5from Products.CMFCore.utils import UniqueObject, getToolByName
6from Products.CMFCore.permissions import View
7from Products.CMFCore.permissions import ModifyPortalContent
8from Products.CPSCore.CPSBase import CPSBase_adder, CPSBaseFolder
9#from Products.CPSCore.CPSBase import CPSBaseDocument as BaseDocument
10from Products.CPSDocument.CPSDocument import CPSDocument
11from Products.CPSCore.CPSBase import CPSBaseBTreeFolder as BaseBTreeFolder
12
13accofolder_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
27class AccoFolder(CPSDocument): ###(
28    """
29    WAeUP AccoFolder containing Accommodation halls
30    """
31    meta_type = 'AccoFolder'
32    portal_type = meta_type
33    security = ClassSecurityInfo()
34   
35
36InitializeClass(AccoFolder)
37
38def 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
44accommodation_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
58class 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   
75InitializeClass(Accommodation)
76
77def addAccommodation(container, id, REQUEST=None, **kw):
78    """Add a Accommodation."""
79    ob = Accommodation(id, **kw)
80    return CPSBase_adder(container, ob, REQUEST=REQUEST)
81###)
Note: See TracBrowser for help on using the repository browser.