source: main/waeup.sirp/trunk/src/waeup/sirp/students/interfaces.py @ 6860

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

Inherit StudentPaymentsContainer? from PaymentsContainer? in payments module (to be added).

  • Property svn:keywords set to Id
File size: 8.1 KB
Line 
1##
2## interfaces.py
3from zope.interface import Attribute, invariant
4from zope.interface.exceptions import Invalid
5from zope import schema
6from waeup.sirp.interfaces import IWAeUPObject
7from waeup.sirp.schema import TextLineChoice
8from waeup.sirp.university.vocabularies import CourseSource
9from waeup.sirp.students.vocabularies import (
10  CertificateSource, academic_sessions_vocab, verdicts, StudyLevelSource,
11  contextual_reg_num_source, contextual_mat_num_source,
12  )
13from waeup.sirp.payments.interfaces import IPaymentsContainer
14
15class IStudentsContainer(IWAeUPObject):
16    """An students container contains university students.
17
18    """
19
20    def addStudent(student):
21        """Add an IStudent object and subcontainers.
22
23        """
24
25    def archive(id=None):
26        """Create on-dist archive of students.
27
28        If id is `None`, all students are archived.
29
30        If id contains a single id string, only the respective
31        students are archived.
32
33        If id contains a list of id strings all of the respective
34        students types are saved to disk.
35        """
36
37    def clear(id=None, archive=True):
38        """Remove students of type given by 'id'.
39
40        Optionally archive the students.
41
42        If id is `None`, all students are archived.
43
44        If id contains a single id string, only the respective
45        students are archived.
46
47        If id contains a list of id strings all of the respective
48        student types are saved to disk.
49
50        If `archive` is ``False`` none of the archive-handling is done
51        and respective students are simply removed from the
52        database.
53        """
54
55class IStudentNavigation(IWAeUPObject):
56    """Interface needed for student navigation.
57    """
58
59    def getStudent():
60        """Return student object.
61        """
62
63class IStudentPasswordSetting(IWAeUPObject):
64    """Data needed for password setting.
65    """
66    name = schema.TextLine(
67        title = u'Full Name',
68        default = u'Nobody',
69        required = True,
70        readonly = True
71        )
72
73    password = schema.Password(
74        title = u'New password',
75        required = False,
76        )
77
78    password_repeat = schema.Password(
79        title = u'Retype new password',
80        required = False,
81        )
82
83    @invariant
84    def passwords_match(obj):
85        if obj.password == obj.password_repeat:
86            return
87        raise Invalid('passwords do not match')
88
89class IStudentBase(IWAeUPObject):
90    """Representation of student base data.
91    """
92    history = Attribute('Object history, a list of messages.')
93    state = Attribute('Returns the registration state of a student')
94    password = Attribute('Encrypted password of a student')
95    certificate = Attribute('The certificate of any chosen study course')
96
97    def loggerInfo(ob_class, comment):
98        """Adds an INFO message to the log file
99        """
100
101    student_id = schema.TextLine(
102        title = u'Student ID',
103        required = False,
104        )
105
106    fullname = schema.TextLine(
107        title = u'Full Name',
108        default = None,
109        required = True,
110        )
111
112    reg_number = TextLineChoice(
113        title = u'Registration Number',
114        default = None,
115        required = True,
116        readonly = False,
117        source = contextual_reg_num_source,
118        )
119
120    matric_number = TextLineChoice(
121        title = u'Matriculation Number',
122        #default = u'',
123        required = False,
124        readonly = False,
125        source = contextual_mat_num_source,
126        )
127
128    adm_code = schema.TextLine(
129        title = u'PWD Access Code',
130        default = u'',
131        required = False,
132        readonly = True,
133        )
134
135class IStudentClearance(IWAeUPObject):
136    """Representation of student clearance data.
137    """
138
139    date_of_birth = schema.Date(
140        title = u'Date of Birth',
141        required = True,
142        )
143
144    clearance_locked = schema.Bool(
145        title = u'Clearance form locked',
146        default = False,
147        )
148
149    clr_code = schema.TextLine(
150        title = u'CLR Access Code',
151        default = u'',
152        required = False,
153        readonly = True,
154        )
155
156class IStudentPersonal(IWAeUPObject):
157    """Representation of student personal data.
158    """
159
160    perm_address = schema.Text(
161        title = u'Permanent Address',
162        required = False,
163        )
164
165class IStudent(IStudentBase,IStudentClearance,IStudentPersonal):
166    """Representation of a student.
167    """
168
169class IStudentUpdateByRegNo(IStudent):
170    """Representation of a student. Skip regular reg_number validation.
171    """
172
173    reg_number = schema.TextLine(
174        title = u'Registration Number',
175        default = None,
176        required = False,
177        )
178
179class IStudentUpdateByMatricNo(IStudent):
180    """Representation of a student. Skip regular matric_number validation.
181    """
182
183    matric_number = schema.TextLine(
184        title = u'Matriculation Number',
185        default = None,
186        required = False,
187        )
188
189class IStudentStudyCourse(IWAeUPObject):
190    """A container for student study levels.
191
192    """
193
194    certificate = schema.Choice(
195        title = u'Certificate',
196        source = CertificateSource(),
197        default = None,
198        required = True,
199        )
200
201    current_session = schema.Choice(
202        title = u'Current Session',
203        source = academic_sessions_vocab,
204        default = None,
205        required = True,
206        )
207
208    current_level = schema.Choice(
209        title = u'Current Level',
210        source = StudyLevelSource(),
211        default = None,
212        required = False,
213        )
214
215    current_verdict = schema.Choice(
216        title = u'Current Verdict',
217        source = verdicts,
218        default = '0',
219        required = False,
220        )
221
222    previous_verdict = schema.Choice(
223        title = u'Previous Verdict',
224        source = verdicts,
225        default = '0',
226        required = False,
227        )
228
229class IStudentStudyCourseImport(IStudentStudyCourse):
230    """A container for student study levels.
231
232    """
233
234    current_level = schema.Int(
235        title = u'Current Level',
236        default = None,
237        )
238
239class IStudentStudyLevel(IWAeUPObject):
240    """A container for course tickets.
241
242    """
243    level = Attribute('The level code')
244    validation_date = Attribute('The date of validation')
245    validated_by = Attribute('User Id of course adviser')
246
247    level_session = schema.Choice(
248        title = u'Session',
249        source = academic_sessions_vocab,
250        default = None,
251        required = True,
252        )
253
254    level_verdict = schema.Choice(
255        title = u'Verdict',
256        source = verdicts,
257        default = '0',
258        required = False,
259        )
260
261class ICourseTicket(IWAeUPObject):
262    """A course ticket.
263
264    """
265    code = Attribute('code of the original course')
266    title = Attribute('title of the original course')
267    credits = Attribute('credits of the original course')
268    passmark = Attribute('passmark of the original course')
269    semester = Attribute('semester of the original course')
270    faculty = Attribute('faculty of the original course')
271    department = Attribute('department of the original course')
272
273    core_or_elective = schema.Bool(
274        title = u'Mandatory',
275        default = False,
276        required = False,
277        readonly = False,
278        )
279
280    score = schema.Int(
281        title = u'Score',
282        default = 0,
283        required = False,
284        readonly = False,
285        )
286
287    automatic = schema.Bool(
288        title = u'Automatical Creation',
289        default = False,
290        required = False,
291        readonly = True,
292        )
293
294class ICourseTicketAdd(ICourseTicket):
295    """An interface for adding course tickets
296
297    """
298    course = schema.Choice(
299        title = u'Course',
300        source = CourseSource(),
301        readonly = False,
302        )
303
304class IStudentAccommodation(IWAeUPObject):
305    """A container for student accommodation objects.
306
307    """
308
309class IStudentPaymentsContainer(IPaymentsContainer):
310    """A container for student payment objects.
311
312    """
313
314# Interfaces for students only
315
316class IStudentClearanceEdit(IStudentClearance):
317    """Interface needed for restricted editing of student clearance data.
318    """
319
320class IStudentPersonalEdit(IStudentPersonal):
321    """Interface needed for restricted editing of student personal data.
322    """
Note: See TracBrowser for help on using the repository browser.