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

Last change on this file since 6632 was 6561, checked in by uli, 13 years ago

Clean up.

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 (
8    course_levels,
9    semester,
10    application_categories,
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        default = u'NA',
23        required = True,
24        readonly = True,
25        )
26
27    title = schema.TextLine(
28        title = u'Name of faculty',
29        default = u'Unnamed',
30        required = True,
31        )
32
33    title_prefix = schema.Choice(
34        title = u'Name prefix',
35        default = u'faculty',
36        vocabulary = inst_types,
37        required = True,
38        )
39
40    def longtitle():
41        """
42        Returns the long title of a faculty.
43        """
44
45class IFacultyAdd(IFaculty):
46    """Representation of a university faculty.
47    """
48    code = schema.TextLine(
49        title = u'Code',
50        description = u'This code will become part of the URL.',
51        default = u'NA',
52        required = True,
53        readonly = False,
54        )
55
56IFacultyAdd['code'].order =  IFaculty['code'].order
57
58class IFacultyContainer(IWAeUPContainer):
59    """A container for faculties.
60    """
61    def addFaculty(faculty):
62        """Add an IFactulty object.
63
64        Returns the key, under which the object was stored.
65        """
66class IDepartment(IWAeUPObject):
67    """Representation of a department.
68    """
69    code = schema.TextLine(
70        title = u'Code',
71        default = u'NA',
72        required = True,
73        readonly = True,
74        )
75
76    title = schema.TextLine(
77        title = u'Name of department',
78        default = u'Unnamed',
79        required = True,
80        )
81
82    title_prefix = schema.Choice(
83        title = u'Name prefix',
84        vocabulary = inst_types,
85        default = u'department',
86        required = True,
87        )
88
89    courses = Attribute("A container for courses.")
90    certificates = Attribute("A container for certificates.")
91
92    def longtitle():
93        """
94        Returns the long title of a department.
95        """
96
97class IDepartmentAdd(IDepartment):
98    """Representation of a university department.
99    """
100    code = schema.TextLine(
101        title = u'Code',
102        description = u'This code will become part of the URL.',
103        default = u'NA',
104        required = True,
105        readonly = False,
106        )
107
108IDepartmentAdd['code'].order =  IDepartment['code'].order
109
110class ICourseContainer(IWAeUPContainer):
111    """A container for faculties.
112    """
113    def addCourse(faculty):
114        """Add an ICourse object.
115
116        Returns the key, under which the object was stored.
117        """
118
119class ICourse(IWAeUPObject):
120    """Representation of a course.
121    """
122    code = schema.TextLine(
123        title = u'Code',
124        default = u'NA',
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
154    def longtitle():
155        """
156        Returns the long title of a course.
157        """
158
159class ICourseAdd(ICourse):
160    """Representation of a course.
161    """
162    code = schema.TextLine(
163        title = u'Code',
164        description = u'Enter unique course code which will become part of the URL.',
165        default = u'NA',
166        required = True,
167        readonly = False,
168        )
169
170ICourseAdd['code'].order =  ICourse['code'].order
171
172class ICertificate(IWAeUPObject):
173    """Representation of a certificate.
174    """
175    code = schema.TextLine(
176        title = u'Code',
177        default = u'NA',
178        required = True,
179        readonly = True,
180        )
181
182    title = schema.TextLine(
183        title = u'Title',
184        default = u'Unnamed',
185        required = True,
186        )
187
188    study_mode = schema.Choice(
189        title = u'Study Mode',
190        vocabulary = study_mode,
191        default = u'ug_ft',
192        required = True,
193        )
194
195    start_level = schema.Choice(
196        title = u'Start Level',
197        vocabulary = course_levels,
198        default = 100,
199        required = True,
200        )
201
202    end_level = schema.Choice(
203        title = u'End Level',
204        vocabulary = course_levels,
205        default = 500,
206        required = True,
207        )
208
209    application_category = schema.Choice(
210        title = u'Application Category',
211        vocabulary = application_categories,
212        default = u'basic',
213        required = True,
214        )
215
216    def longtitle():
217        """
218        Returns the long title of a certificate.
219        """
220
221class ICertificateAdd(ICertificate):
222    """Representation of a certificate.
223    """
224    code = schema.TextLine(
225        title = u'Code',
226        default = u'NA',
227        description = u'Enter unique certificate code which will become part of the URL.',
228        required = True,
229        readonly = False,
230        )
231
232ICertificateAdd['code'].order =  ICertificate['code'].order
233
234class ICertificateContainer(IWAeUPContainer):
235    """A container for certificates.
236    """
237    def addCertificate(faculty):
238        """Add an ICertificate object.
239
240        Returns the key, under which the object was stored.
241        """
242
243class ICertificateCourse(IWAeUPObject):
244    """A certificatecourse is referring a course and provides some own
245       attributes.
246    """
247    course = schema.Choice(
248        title = u'Course referrer',
249        source = CourseSource(),
250        readonly = True,
251        )
252
253    level = schema.Choice(
254        title = u'Level',
255        required = True,
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    def longtitle():
273        """
274        Returns the long title of a certificatecourse.
275        """
276
277
278class ICertificateCourseAdd(ICertificateCourse):
279    """A certificatecourse is referring a course and
280       provides some own attributes.
281    """
282    course = schema.Choice(
283        title = u'Course',
284        source = CourseSource(),
285        readonly = False,
286        )
287
288ICertificateCourseAdd['course'].order =  ICertificateCourse['course'].order
Note: See TracBrowser for help on using the repository browser.