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

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

Implement title_prefix vocabulary. Remove redundant getName method and replace by the longtitle property.

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