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

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

Provide longtitle for all university instances. Use lontitle in breadcrumbs. Show faculty and department on certificatecoursepage.

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