source: WAeUP_SRP/branches/srpp_branch/Faculty.py @ 17718

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

=email add, Faculty + Department Title removed

  • Property svn:keywords set to Id
File size: 5.7 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   
84##    security.declareProtected(View,"Title")
85##    def Title(self):
86##        """compose title"""
87##        reg_nr = self.getId()[1:]
88##        return "Faculty of %s" % (self.title)
89
90InitializeClass(Faculty)
91
92def addFaculty(container, id, REQUEST=None, **kw):
93    """Add a Faculty."""
94    ob = Faculty(id, **kw)
95    return CPSBase_adder(container, ob, REQUEST=REQUEST)
96###)
97
98department_fti = { ###(
99    'title': 'WAeUP Department',
100    'description': '',
101    'content_icon': '',
102    'content_meta_type': 'Department',
103    'factory': 'addDepartment',
104    'immediate_view': 'cpsdocument_view',
105    'global_allow': True,
106    'filter_content_types': True,
107    'allowed_content_types': ('Course',),
108    'allow_discussion': False,
109}
110###)
111
112class Department(CPSDocument): ###(
113    """
114    WAeUP Department containing the courses and students
115    """
116    meta_type = 'Department'
117    portal_type = meta_type
118    security = ClassSecurityInfo()
119
120##    security.declareProtected(View,"Title")
121##    def Title(self):
122##        """compose title"""
123##        reg_nr = self.getId()[1:]
124##        return "Department of %s" % (self.title)
125
126InitializeClass(Department)
127
128def addDepartment(container, id, REQUEST=None, **kw):
129    """Add a Department."""
130    ob = Department(id, **kw)
131    return CPSBase_adder(container, ob, REQUEST=REQUEST)
132###)
133
134course_fti = { ###(
135    'title': 'WAeUP Course',
136    'description': '',
137    'content_icon': '',
138    'content_meta_type': 'Course',
139    'factory': 'addCourse',
140    'immediate_view': 'cpsdocument_view',
141    'global_allow': True,
142    'filter_content_types': True,
143    'allowed_content_types': (),
144    'allow_discussion': False,
145}
146###)
147
148class Course(CPSDocument): ###(
149    """
150    WAeUP Course 
151    """
152    meta_type = 'Course'
153    portal_type = meta_type
154    security = ClassSecurityInfo()
155
156    security.declareProtected(View,"Title")
157    def Title(self):
158        """compose title"""
159        content = self.getContent()
160        heading = getattr(content,'heading',None)
161        if heading is None:
162            return self.title
163        return heading
164   
165InitializeClass(Course)
166
167def addCourse(container, id, REQUEST=None, **kw):
168    """Add a Course."""
169    ob = Course(id, **kw)
170    return CPSBase_adder(container, ob, REQUEST=REQUEST)
171###)
172
173course_ticket_fti = { ###(
174    'title': 'WAeUP CourseTicket',
175    'description': '',
176    'content_icon': '',
177    'content_meta_type': 'CourseTicket',
178    'factory': 'addCourseTicket',
179    'immediate_view': 'cpsdocument_view',
180    'global_allow': True,
181    'filter_content_types': True,
182    'allowed_content_types': (),
183    'allow_discussion': False,
184}
185###)
186
187class CourseTicket(CPSDocument): ###(
188    """
189    WAeUP CourseTicket 
190    """
191    meta_type = 'CourseTicket'
192    portal_type = meta_type
193    security = ClassSecurityInfo()
194   
195InitializeClass(CourseTicket)
196
197def addCourseTicket(container, id, REQUEST=None, **kw):
198    """Add a CourseTicket."""
199    ob = CourseTicket(id, **kw)
200    return CPSBase_adder(container, ob, REQUEST=REQUEST)
201###)
Note: See TracBrowser for help on using the repository browser.