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

Last change on this file since 7084 was 6724, checked in by Henrik Bettermann, 13 years ago

Add more fields to IStudentStudyCourse and corresponding vocabs (work in progress) + some other minor changes.

File size: 6.6 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_modes,
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        """
65class IDepartment(IWAeUPObject):
66    """Representation of a department.
67    """
68    code = schema.TextLine(
69        title = u'Code',
70        default = u'NA',
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'Name 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        description = u'This code will become part of the URL.',
102        default = u'NA',
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(course):
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        required = True,
125        readonly = True,
126        )
127
128    title = schema.TextLine(
129        title = u'Title of course',
130        default = u'Unnamed',
131        required = True,
132        )
133
134    credits = schema.Int(
135        title = u'Credits',
136        default = 0,
137        required = False,
138        )
139
140    passmark = schema.Int(
141        title = u'Passmark',
142        default = 40,
143        required = False,
144        )
145
146    semester = schema.Choice(
147        title = u'Semester/Term',
148        default = 0,
149        vocabulary = semester,
150        required = True,
151        )
152
153    def longtitle():
154        """
155        Returns the long title of a course.
156        """
157
158class ICourseAdd(ICourse):
159    """Representation of a course.
160    """
161    code = schema.TextLine(
162        title = u'Code',
163        description = u'Enter unique course code which will become part of the URL.',
164        default = u'NA',
165        required = True,
166        readonly = False,
167        )
168
169ICourseAdd['code'].order =  ICourse['code'].order
170
171class ICertificate(IWAeUPObject):
172    """Representation of a certificate.
173    """
174    code = schema.TextLine(
175        title = u'Code',
176        default = u'NA',
177        required = True,
178        readonly = True,
179        )
180
181    title = schema.TextLine(
182        title = u'Title',
183        default = u'Unnamed',
184        required = True,
185        )
186
187    study_mode = schema.Choice(
188        title = u'Study Mode',
189        vocabulary = study_modes,
190        default = u'ug_ft',
191        required = True,
192        )
193
194    start_level = schema.Choice(
195        title = u'Start Level',
196        vocabulary = course_levels,
197        default = 100,
198        required = True,
199        )
200
201    end_level = schema.Choice(
202        title = u'End Level',
203        vocabulary = course_levels,
204        default = 500,
205        required = True,
206        )
207
208    application_category = schema.Choice(
209        title = u'Application Category',
210        vocabulary = application_categories,
211        default = u'basic',
212        required = True,
213        )
214
215    def longtitle():
216        """
217        Returns the long title of a certificate.
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'Enter unique certificate code which will become part of the URL.',
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(certificate):
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 provides some own
244       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        vocabulary = course_levels,
256        readonly = False,
257        )
258
259    core_or_elective = schema.Bool(
260        title = u'Is mandatory course (not elective)',
261        required = True,
262        default = True,
263        )
264
265    def getCourseCode():
266        """Return the code of the course referred to.
267
268        This is needed for cataloging.
269        """
270
271    def longtitle():
272        """
273        Returns the long title of a certificatecourse.
274        """
275
276
277class ICertificateCourseAdd(ICertificateCourse):
278    """A certificatecourse is referring a course and
279       provides some own attributes.
280    """
281    course = schema.Choice(
282        title = u'Course',
283        source = CourseSource(),
284        readonly = False,
285        )
286
287ICertificateCourseAdd['course'].order =  ICertificateCourse['course'].order
Note: See TracBrowser for help on using the repository browser.