source: main/waeup.sirp/trunk/src/waeup/sirp/university/interfaces.py @ 5983

Last change on this file since 5983 was 5977, checked in by Henrik Bettermann, 14 years ago

Implement a vocabulary module in university and move some vocabularies to it.

Rebuild the certificatepage page template.

Rename Course Reference to Course Referrer. It's very difficult to find a proper name for these 'certificatecourse' objects. But we have to clearly distinguish courses and referrers of courses as they are not the same.

File size: 6.7 KB
Line 
1"""Interfaces of academics specific objects.
2"""
3from zope import schema
4from zope.interface import Attribute
5from waeup.sirp.interfaces import (IWAeUPObject, IWAeUPContainer)
6                                   
7from waeup.sirp.university.vocabularies import (course_levels,
8                                                semester, CourseSource)                                   
9
10class IFaculty(IWAeUPContainer):
11    """Representation of a university faculty.
12    """
13    code = schema.TextLine(
14        title = u'Code',
15        description = u'Abbreviated code of the faculty',
16        default = u'NA',
17        required = True,
18        readonly = True,
19        )
20
21    title = schema.TextLine(
22        title = u'Name of Faculty',
23        default = u'Unnamed',
24        required = True,
25        )
26
27    title_prefix = schema.TextLine(
28        title = u'Title prefix',
29        default = u'faculty',
30        required = True,
31        )
32       
33class IFacultyAdd(IFaculty):
34    """Representation of a university faculty.
35    """
36    code = schema.TextLine(
37        title = u'Code',
38        description = u'Abbreviated code of the faculty',
39        default = u'NA',
40        required = True,
41        readonly = False,
42        )
43                 
44IFacultyAdd['code'].order =  IFaculty['code'].order           
45   
46class IFacultyContainer(IWAeUPContainer):
47    """A container for faculties.
48    """
49    def addFaculty(faculty):
50        """Add an IFactulty object.
51
52        Returns the key, under which the object was stored.
53        """
54class IDepartment(IWAeUPObject):
55    """Representation of a department.
56    """
57    code = schema.TextLine(
58        title = u'Code',
59        default = u'NA',
60        description = u'Abbreviated code of the department',
61        required = True,
62        readonly = True,
63        )
64
65    title = schema.TextLine(
66        title = u'Name of Department',
67        default = u'Unnamed',
68        required = True,
69        )
70
71    title_prefix = schema.TextLine(
72        title = u'Title prefix',
73        default = u'department',
74        required = True,
75        )
76
77    courses = Attribute("A container for courses.")
78    certificates = Attribute("A container for certificates.")
79
80class IDepartmentAdd(IDepartment):
81    """Representation of a university department.
82    """
83    code = schema.TextLine(
84        title = u'Code',
85        default = u'NA',
86        description = u'Abbreviated code of the department',
87        required = True,
88        readonly = False,
89        )
90                 
91IDepartmentAdd['code'].order =  IDepartment['code'].order         
92
93class ICourseContainer(IWAeUPContainer):
94    """A container for faculties.
95    """
96    def addCourse(faculty):
97        """Add an ICourse object.
98
99        Returns the key, under which the object was stored.
100        """
101
102class ICourse(IWAeUPObject):
103    """Representation of a course.
104    """
105    code = schema.TextLine(
106        title = u'Code',
107        default = u'NA',
108        description = u'Abbreviated code of the course',
109        required = True,
110        readonly = True,
111        )
112
113    title = schema.TextLine(
114        title = u'Title of course',
115        default = u'Unnamed',
116        required = True,
117        )
118
119    credits = schema.Int(
120        title = u'Credits',
121        default = 0,
122        required = False,
123        )
124   
125    passmark = schema.Int(
126        title = u'Passmark',
127        default = 40,
128        required = False,
129        )
130
131    semester = schema.Choice(
132        title = u'Semester/Term',
133        default = 0,
134        vocabulary = semester,
135        required = True,
136        )
137
138class ICourseAdd(ICourse):
139    """Representation of a course.
140    """
141    code = schema.TextLine(
142        title = u'Code',
143        default = u'NA',
144        description = u'Abbreviated code of the course',
145        required = True,
146        readonly = False,
147        )
148       
149ICourseAdd['code'].order =  ICourse['code'].order         
150
151class ICertificate(IWAeUPObject):
152    """Representation of a certificate.
153    """
154    code = schema.TextLine(
155        title = u'Code',
156        default = u'NA',
157        description = u'Abbreviated code of the certificate.',
158        required = True,
159        readonly = True,
160        )
161
162    #review_state = schema.Choice(
163    #    title = u'Review State',
164    #    default = 'unchecked',
165    #    values = ['unchecked', 'checked']
166    #    )
167
168    title = schema.TextLine(
169        title = u'Title',
170        default = u'Unnamed',
171        required = True,
172        )
173
174    study_mode = schema.TextLine(
175        title = u'Study Mode',
176        default = u'ug_ft',
177        required = True,
178        )
179
180    start_level = schema.Choice(
181        title = u'Start Level',
182        #source = LevelSource(),
183        vocabulary = course_levels,
184        default = 100,
185        required = True,
186        )
187   
188    end_level = schema.Choice(
189        title = u'End Level',
190        #source = LevelSource(),
191        vocabulary = course_levels,
192        default = 500,
193        required = True,
194        )
195   
196    application_category = schema.TextLine(
197        title = u'Application Category',
198        default = u'basic',
199        required = False,
200        )   
201
202class ICertificateAdd(ICertificate):
203    """Representation of a certificate.
204    """
205    code = schema.TextLine(
206        title = u'Code',
207        default = u'NA',
208        description = u'Abbreviated code of the certificate.',
209        required = True,
210        readonly = False,
211        )
212       
213ICertificateAdd['code'].order =  ICertificate['code'].order         
214   
215class ICertificateContainer(IWAeUPContainer):
216    """A container for certificates.
217    """
218    def addCertificate(faculty):
219        """Add an ICertificate object.
220
221        Returns the key, under which the object was stored.
222        """
223
224class ICertificateCourse(IWAeUPObject):
225    """A certificatecourse is referring a course and
226       provides some own attributes.
227    """
228    course = schema.Choice(
229        title = u'Course referrer',
230        source = CourseSource(),
231        readonly = True,
232        )
233   
234    level = schema.Choice(
235        title = u'Level',
236        required = True,
237        #source = LevelSource(),
238        vocabulary = course_levels,
239        readonly = False,
240        )
241
242    core_or_elective = schema.Bool(
243        title = u'Is mandatory course (not elective)',
244        required = True,
245        default = True,
246        )
247
248    def getCourseCode():
249        """Return the code of the course referred to.
250
251        This is needed for cataloging.
252        """
253       
254       
255class ICertificateCourseAdd(ICertificateCourse):
256    """A certificatecourse is referring a course and
257       provides some own attributes.
258    """
259    course = schema.Choice(
260        title = u'Course',
261        source = CourseSource(),
262        readonly = False,
263        )
264                 
265ICertificateCourseAdd['course'].order =  ICertificateCourse['course'].order                 
Note: See TracBrowser for help on using the repository browser.