source: waeup_product/trunk/Students.py @ 140

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

=migrate + editing of folders

  • Property svn:keywords set to Id
File size: 4.9 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
13class StudentsFolder(BaseBTreeFolder): ###(
14    """
15    WAeUP container for the various WAeUP containers data
16    """
17    meta_type = 'Students Folder'
18    portal_type = meta_type
19    security = ClassSecurityInfo()
20   
21       
22InitializeClass(StudentsFolder)
23
24def addStudentsFolder(container, id, REQUEST=None, **kw):
25    """Add a Student."""
26    ob = StudentsFolder(id, **kw)
27    return CPSBase_adder(container, ob, REQUEST=REQUEST)
28###)
29
30student_fti = { ###(
31    'title': 'WAeUP Student',
32    'description': '',
33    'content_icon': 'student.gif',
34    'content_meta_type': 'Student',
35    'factory': 'addStudent',
36    'immediate_view': 'cpsdocument_view',
37    'global_allow': True,
38    'filter_content_types': True,
39    'allowed_content_types': ('Jamb','StudentPersonal'),
40    'allow_discussion': False,
41}
42
43###)
44
45class Student(CPSDocument): ###(
46    """
47    WAeUP Student container for the various student data
48    """
49    meta_type = 'Student'
50    portal_type = meta_type
51    security = ClassSecurityInfo()
52   
53    security.declareProtected(View,"getTitle")
54    def getTitle(self):
55        """compose title"""
56        content = self.PERSONAL.getContent()
57        return "%s %s" % (content.firstname,content.lastname)
58       
59InitializeClass(Student)
60
61def addStudent(container, id, REQUEST=None, **kw):
62    """Add a Student."""
63    ob = Student(id, **kw)
64    return CPSBase_adder(container, ob, REQUEST=REQUEST)
65
66###)
67
68studentpersonal_fti = { ###(
69    'title': 'WAeUP StudentPersonal',
70    'description': '',
71    'content_icon': 'student.gif',
72    'content_meta_type': 'StudentPersonal',
73    'factory': 'addStudent',
74    'immediate_view': 'student_personal_index_html',
75    'global_allow': True,
76    'filter_content_types': True,
77    'allowed_content_types': (),
78    'allow_discussion': False,
79}
80
81###)
82
83class StudentPersonal(CPSDocument): ###(
84    """
85    WAeUP Student container for the various student data
86    """
87    meta_type = 'StudentPersonal'
88    portal_type = meta_type
89    security = ClassSecurityInfo()
90   
91InitializeClass(StudentPersonal)
92
93def addStudentPersonal(container, id, REQUEST=None, **kw):
94    """Add a Students personal data."""
95    ob = StudentPersonal(id, **kw)
96    return CPSBase_adder(container, ob, REQUEST=REQUEST)
97
98###)
99
100jamb_fti = { ###(
101    'title': 'WAeUP Jamb',
102    'description': '',
103    'content_icon': '',
104    'content_meta_type': 'Jamb',
105    'factory': 'addJamb',
106    'immediate_view': 'cpsdocument_view',
107    'global_allow': True,
108    'filter_content_types': True,
109    'allowed_content_types': ('Course',),
110    'allow_discussion': False,
111}
112###)
113
114class Jamb(CPSDocument): ###(
115    """
116    WAeUP Jamb containing the courses and students
117    """
118    meta_type = 'Jamb'
119    portal_type = meta_type
120    security = ClassSecurityInfo()
121   
122InitializeClass(Jamb)
123
124def addJamb(container, id, REQUEST=None, **kw):
125    """Add a Jamb."""
126    ob = Jamb(id, **kw)
127    return CPSBase_adder(container, ob, REQUEST=REQUEST)
128###)
129
130study_level_fti = { ###(
131    'title': 'WAeUP StudyLevel',
132    'description': '',
133    'content_icon': '',
134    'content_meta_type': 'StudyLevel',
135    'factory': 'addStudyLevel',
136    'immediate_view': 'cpsdocument_view',
137    'global_allow': True,
138    'filter_content_types': True,
139    'allowed_content_types': ('Course',),
140    'allow_discussion': False,
141}
142###)
143
144class StudyLevel(CPSDocument): ###(
145    """
146    WAeUP StudyLevel containing the courses and students
147    """
148    meta_type = 'StudyLevel'
149    portal_type = meta_type
150    security = ClassSecurityInfo()
151   
152InitializeClass(StudyLevel)
153
154def addStudyLevel(container, id, REQUEST=None, **kw):
155    """Add a StudyLevel."""
156    ob = StudyLevel(id, **kw)
157    return CPSBase_adder(container, ob, REQUEST=REQUEST)
158###)
159
160semester_fti = { ###(
161    'title': 'WAeUP Semester',
162    'description': '',
163    'content_icon': '',
164    'content_meta_type': 'Semester',
165    'factory': 'addSemester',
166    'immediate_view': 'cpsdocument_view',
167    'global_allow': True,
168    'filter_content_types': True,
169    'allowed_content_types': ('Course',),
170    'allow_discussion': False,
171}
172###)
173
174class Semester(CPSDocument): ###(
175    """
176    WAeUP Semester containing the courses and students
177    """
178    meta_type = 'Semester'
179    portal_type = meta_type
180    security = ClassSecurityInfo()
181   
182InitializeClass(Semester)
183
184def addSemester(container, id, REQUEST=None, **kw):
185    """Add a Semester."""
186    ob = Semester(id, **kw)
187    return CPSBase_adder(container, ob, REQUEST=REQUEST)
188###)
189
Note: See TracBrowser for help on using the repository browser.