source: waeup_product/trunk/Faculty.py @ 152

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

=studylevel + Title

  • Property svn:keywords set to Id
File size: 5.4 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
13##class FacultyFolder(BaseBTreeFolder): ###(
14##    """
15##    WAeUP container for the various WAeUP containers data
16##    """
17##    meta_type = 'Faculty Folder'
18##    portal_type = meta_type
19##    security = ClassSecurityInfo()
20##   
21##       
22##InitializeClass(FacultyFolder)
23##
24##def addFacultyFolder(container, id, REQUEST=None, **kw):
25##    """Add a Student."""
26##    ob = StudentsFolder(id, **kw)
27##    return CPSBase_adder(container, ob, REQUEST=REQUEST)
28#####
29#####)
30
31faculty_fti = { ###(
32    'title': 'WAeUP Faculty',
33    'description': '',
34    'content_icon': '',
35    'content_meta_type': 'Faculty',
36    'factory': 'addFaculty',
37    'immediate_view': 'cpsdocument_view',
38    'global_allow': True,
39    'filter_content_types': True,
40    'allowed_content_types': ('Department',),
41    'allow_discussion': False,
42##    'actions': (
43##         {'id': 'view',
44##          'name': 'action_view',
45##          'action': 'string:${object_url}/faculty_index_html',
46##          #'action': 'string:${object_url}/cpsdocument_view',
47##          'condition': '',
48##          'permission': ('View',),
49##          'category': 'object',
50##          'visible': True,},
51##         {'id': 'new_content',
52##          'name': 'Add Data',
53##          'action': 'string:${object_url}/folder_factories',
54##          'condition': "python:1 or len(object.contentItems()) == 0 ",
55##          'permission': ('Modify portal content',),
56##          'category': 'object',
57##          'visible': True,},
58##         {'id': 'contents',
59##          'name': 'action_folder_contents',
60##          'action': 'string:${object_url}/folder_contents',
61##          'condition': "python:1 or object.getTypeInfo().cps_proxy_type != 'document'",
62##          'permission': ('Modify portal content',),
63##          'category': 'object',
64##          'visible': True,},
65##         {'id': 'edit',
66##          'name': 'action_edit',
67##          'action': 'string:${object_url}/cpsdocument_edit_form',
68##          'condition': '',
69##          'permission': ('Modify portal content',),
70##          'category': 'object',
71##          'visible': True,},
72##    )
73}
74###)
75
76class Faculty(CPSDocument): ###(
77    """
78    WAeUP Faculty containing Departments
79    """
80    meta_type = 'Faculty'
81    portal_type = meta_type
82    security = ClassSecurityInfo()
83   
84InitializeClass(Faculty)
85
86def addFaculty(container, id, REQUEST=None, **kw):
87    """Add a Faculty."""
88    ob = Faculty(id, **kw)
89    return CPSBase_adder(container, ob, REQUEST=REQUEST)
90###)
91
92department_fti = { ###(
93    'title': 'WAeUP Department',
94    'description': '',
95    'content_icon': '',
96    'content_meta_type': 'Department',
97    'factory': 'addDepartment',
98    'immediate_view': 'cpsdocument_view',
99    'global_allow': True,
100    'filter_content_types': True,
101    'allowed_content_types': ('Course',),
102    'allow_discussion': False,
103}
104###)
105
106class Department(CPSDocument): ###(
107    """
108    WAeUP Department containing the courses and students
109    """
110    meta_type = 'Department'
111    portal_type = meta_type
112    security = ClassSecurityInfo()
113   
114InitializeClass(Department)
115
116def addDepartment(container, id, REQUEST=None, **kw):
117    """Add a Department."""
118    ob = Department(id, **kw)
119    return CPSBase_adder(container, ob, REQUEST=REQUEST)
120###)
121
122course_fti = { ###(
123    'title': 'WAeUP Course',
124    'description': '',
125    'content_icon': '',
126    'content_meta_type': 'Course',
127    'factory': 'addCourse',
128    'immediate_view': 'cpsdocument_view',
129    'global_allow': True,
130    'filter_content_types': True,
131    'allowed_content_types': (),
132    'allow_discussion': False,
133}
134###)
135
136class Course(CPSDocument): ###(
137    """
138    WAeUP Course 
139    """
140    meta_type = 'Course'
141    portal_type = meta_type
142    security = ClassSecurityInfo()
143
144    security.declareProtected(View,"Title")
145    def Title(self):
146        """compose title"""
147        content = self.getContent()
148        heading = getattr(content,'heading',None)
149        if heading is None:
150            return self.title
151        return heading
152   
153InitializeClass(Course)
154
155def addCourse(container, id, REQUEST=None, **kw):
156    """Add a Course."""
157    ob = Course(id, **kw)
158    return CPSBase_adder(container, ob, REQUEST=REQUEST)
159###)
160
161course_ticket_fti = { ###(
162    'title': 'WAeUP CourseTicket',
163    'description': '',
164    'content_icon': '',
165    'content_meta_type': 'CourseTicket',
166    'factory': 'addCourseTicket',
167    'immediate_view': 'cpsdocument_view',
168    'global_allow': True,
169    'filter_content_types': True,
170    'allowed_content_types': (),
171    'allow_discussion': False,
172}
173###)
174
175class CourseTicket(CPSDocument): ###(
176    """
177    WAeUP CourseTicket 
178    """
179    meta_type = 'CourseTicket'
180    portal_type = meta_type
181    security = ClassSecurityInfo()
182   
183InitializeClass(CourseTicket)
184
185def addCourseTicket(container, id, REQUEST=None, **kw):
186    """Add a CourseTicket."""
187    ob = CourseTicket(id, **kw)
188    return CPSBase_adder(container, ob, REQUEST=REQUEST)
189###)
Note: See TracBrowser for help on using the repository browser.