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

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

Don't use a general StudentBaseEditFormPage? for students, use dedicated forms instead for password editing and file upload. The files upload page is only used for the passport picture in the base package.

  • Property svn:keywords set to Id
File size: 10.0 KB
RevLine 
[6621]1##
2## interfaces.py
[6996]3from datetime import datetime
[6788]4from zope.interface import Attribute, invariant
[6756]5from zope.interface.exceptions import Invalid
[6621]6from zope import schema
[6915]7from waeup.sirp.interfaces import IWAeUPObject, academic_sessions_vocab
[6788]8from waeup.sirp.schema import TextLineChoice
[6874]9from waeup.sirp.university.vocabularies import CourseSource, study_modes
[6648]10from waeup.sirp.students.vocabularies import (
[6788]11  CertificateSource, academic_sessions_vocab, verdicts, StudyLevelSource,
[6996]12  contextual_reg_num_source, contextual_mat_num_source, GenderSource,
[6648]13  )
[6877]14from waeup.sirp.payments.interfaces import IPaymentsContainer, IOnlinePayment
[6621]15
[6692]16class IStudentsContainer(IWAeUPObject):
[7096]17    """A students container contains university students.
[6692]18
19    """
20
21    def addStudent(student):
22        """Add an IStudent object and subcontainers.
23
24        """
25
26    def archive(id=None):
27        """Create on-dist archive of students.
28
29        If id is `None`, all students are archived.
30
31        If id contains a single id string, only the respective
32        students are archived.
33
34        If id contains a list of id strings all of the respective
35        students types are saved to disk.
36        """
37
38    def clear(id=None, archive=True):
39        """Remove students of type given by 'id'.
40
41        Optionally archive the students.
42
43        If id is `None`, all students are archived.
44
45        If id contains a single id string, only the respective
46        students are archived.
47
48        If id contains a list of id strings all of the respective
49        student types are saved to disk.
50
51        If `archive` is ``False`` none of the archive-handling is done
52        and respective students are simply removed from the
53        database.
54        """
55
[6642]56class IStudentNavigation(IWAeUPObject):
57    """Interface needed for student navigation.
58    """
59
60    def getStudent():
61        """Return student object.
62        """
63
[6756]64class IStudentPasswordSetting(IWAeUPObject):
65    """Data needed for password setting.
66    """
67
68    password = schema.Password(
69        title = u'New password',
70        required = False,
71        )
72
73    password_repeat = schema.Password(
74        title = u'Retype new password',
75        required = False,
76        )
77
78    @invariant
79    def passwords_match(obj):
80        if obj.password == obj.password_repeat:
81            return
82        raise Invalid('passwords do not match')
83
[6631]84class IStudentBase(IWAeUPObject):
85    """Representation of student base data.
[6621]86    """
[7062]87    history = Attribute('Object history, a list of messages')
[6637]88    state = Attribute('Returns the registration state of a student')
[6699]89    password = Attribute('Encrypted password of a student')
[6814]90    certificate = Attribute('The certificate of any chosen study course')
[7062]91    current_session = Attribute('The current session of the student')
[6637]92
93    def loggerInfo(ob_class, comment):
94        """Adds an INFO message to the log file
95        """
96
[6665]97    student_id = schema.TextLine(
98        title = u'Student ID',
[6849]99        required = False,
[6665]100        )
101
[6818]102    fullname = schema.TextLine(
[6631]103        title = u'Full Name',
[6818]104        default = None,
[6621]105        required = True,
106        )
107
[6996]108    sex = schema.Choice(
109        title = u'Sex',
110        source = GenderSource(),
111        default = u'm',
112        required = True,
113        )
114
[6788]115    reg_number = TextLineChoice(
[6696]116        title = u'Registration Number',
[6818]117        default = None,
[6696]118        required = True,
119        readonly = False,
[6788]120        source = contextual_reg_num_source,
[6696]121        )
122
[6788]123    matric_number = TextLineChoice(
[6750]124        title = u'Matriculation Number',
[6788]125        #default = u'',
[6750]126        required = False,
127        readonly = False,
[6788]128        source = contextual_mat_num_source,
[6750]129        )
130
[6769]131    adm_code = schema.TextLine(
[6935]132        title = u'PWD Activation Code',
[6769]133        default = u'',
134        required = False,
135        readonly = True,
136        )
137
[6631]138class IStudentClearance(IWAeUPObject):
139    """Representation of student clearance data.
140    """
[6622]141
[6631]142    date_of_birth = schema.Date(
143        title = u'Date of Birth',
144        required = True,
145        )
146
[6695]147    clearance_locked = schema.Bool(
148        title = u'Clearance form locked',
149        default = False,
150        )
151
[6769]152    clr_code = schema.TextLine(
[6935]153        title = u'CLR Activation Code',
[6769]154        default = u'',
155        required = False,
156        readonly = True,
157        )
158
[6631]159class IStudentPersonal(IWAeUPObject):
160    """Representation of student personal data.
161    """
162
[6651]163    perm_address = schema.Text(
[6631]164        title = u'Permanent Address',
165        required = False,
166        )
167
168class IStudent(IStudentBase,IStudentClearance,IStudentPersonal):
169    """Representation of a student.
170    """
171
[6849]172class IStudentUpdateByRegNo(IStudent):
173    """Representation of a student. Skip regular reg_number validation.
174    """
175
176    reg_number = schema.TextLine(
177        title = u'Registration Number',
178        default = None,
179        required = False,
180        )
181
182class IStudentUpdateByMatricNo(IStudent):
183    """Representation of a student. Skip regular matric_number validation.
184    """
185
186    matric_number = schema.TextLine(
187        title = u'Matriculation Number',
188        default = None,
189        required = False,
190        )
191
[6633]192class IStudentStudyCourse(IWAeUPObject):
193    """A container for student study levels.
194
195    """
196
[6648]197    certificate = schema.Choice(
198        title = u'Certificate',
199        source = CertificateSource(),
200        default = None,
[6633]201        required = True,
202        )
[6635]203
[6996]204
205    entry_mode = schema.Choice(
206        title = u'Entry Mode',
207        vocabulary = study_modes,
208        default = u'ug_ft',
209        required = True,
210        readonly = False,
211        )
212
213    entry_session = schema.Choice(
214        title = u'Entry Session',
215        source = academic_sessions_vocab,
216        default = datetime.now().year,
217        required = True,
218        readonly = False,
219        )
220
[6724]221    current_session = schema.Choice(
222        title = u'Current Session',
[6744]223        source = academic_sessions_vocab,
[6724]224        default = None,
225        required = True,
[6996]226        readonly = False,
[6724]227        )
228
229    current_level = schema.Choice(
230        title = u'Current Level',
[6725]231        source = StudyLevelSource(),
[6724]232        default = None,
[6725]233        required = False,
[6996]234        readonly = False,
[6724]235        )
236
237    current_verdict = schema.Choice(
238        title = u'Current Verdict',
239        source = verdicts,
[6804]240        default = '0',
[6725]241        required = False,
[6724]242        )
243
244    previous_verdict = schema.Choice(
245        title = u'Previous Verdict',
246        source = verdicts,
[6805]247        default = '0',
[6725]248        required = False,
[6724]249        )
250
[6825]251class IStudentStudyCourseImport(IStudentStudyCourse):
252    """A container for student study levels.
253
254    """
255
256    current_level = schema.Int(
257        title = u'Current Level',
258        default = None,
259        )
260
[6774]261class IStudentStudyLevel(IWAeUPObject):
262    """A container for course tickets.
263
264    """
265    level = Attribute('The level code')
[6793]266    validation_date = Attribute('The date of validation')
267    validated_by = Attribute('User Id of course adviser')
[6774]268
[6793]269    level_session = schema.Choice(
270        title = u'Session',
271        source = academic_sessions_vocab,
272        default = None,
273        required = True,
274        )
[6781]275
[6793]276    level_verdict = schema.Choice(
277        title = u'Verdict',
278        source = verdicts,
[6805]279        default = '0',
[6793]280        required = False,
281        )
282
[6781]283class ICourseTicket(IWAeUPObject):
284    """A course ticket.
285
286    """
[6783]287    code = Attribute('code of the original course')
288    title = Attribute('title of the original course')
289    credits = Attribute('credits of the original course')
290    passmark = Attribute('passmark of the original course')
291    semester = Attribute('semester of the original course')
292    faculty = Attribute('faculty of the original course')
293    department = Attribute('department of the original course')
[6781]294
[6795]295    core_or_elective = schema.Bool(
296        title = u'Mandatory',
297        default = False,
298        required = False,
299        readonly = False,
300        )
301
[6781]302    score = schema.Int(
303        title = u'Score',
304        default = 0,
305        required = False,
306        readonly = False,
307        )
308
[6806]309    automatic = schema.Bool(
310        title = u'Automatical Creation',
311        default = False,
312        required = False,
313        readonly = True,
314        )
315
[6795]316class ICourseTicketAdd(ICourseTicket):
317    """An interface for adding course tickets
318
319    """
320    course = schema.Choice(
321        title = u'Course',
322        source = CourseSource(),
323        readonly = False,
324        )
325
[6635]326class IStudentAccommodation(IWAeUPObject):
327    """A container for student accommodation objects.
328
329    """
330
[6989]331class IBedTicket(IWAeUPObject):
332    """A ticket for accommodation booking.
333
334    """
335
[6996]336    bed = Attribute('The bed object.')
337
338    bed_coordinates = schema.TextLine(
339        title = u'Bed Coordinates',
[6992]340        default = None,
341        required = False,
[7014]342        readonly = False,
[6992]343        )
344
[6996]345    bed_type = schema.TextLine(
346        title = u'Bed Type',
347        default = None,
348        required = False,
[7014]349        readonly = False,
[6996]350        )
351
[6992]352    booking_session = schema.Choice(
353        title = u'Session',
354        source = academic_sessions_vocab,
355        default = None,
356        required = True,
[7014]357        readonly = True,
[6992]358        )
359
360    booking_date = schema.Datetime(
361        title = u'Booking Date',
362        required = False,
[7014]363        readonly = True,
[6992]364        )
365
366    booking_code = schema.TextLine(
367        title = u'Booking Activation Code',
368        default = u'',
369        required = False,
[7014]370        readonly = True,
[6992]371        )
372
[6994]373    def getSessionString():
374        """Returns the the title of academic_sessions_vocab term
375        """
[6992]376
[6860]377class IStudentPaymentsContainer(IPaymentsContainer):
[6635]378    """A container for student payment objects.
379
380    """
381
[6877]382class IStudentOnlinePayment(IOnlinePayment):
383    """A student payment via payment gateways.
384
385    """
386
387    p_session = schema.Choice(
388        title = u'Payment Session',
389        source = academic_sessions_vocab,
390        required = False,
391        )
392
393IStudentOnlinePayment['p_session'].order = IStudentOnlinePayment[
394    'p_item'].order
395
[6694]396# Interfaces for students only
397
398class IStudentClearanceEdit(IStudentClearance):
399    """Interface needed for restricted editing of student clearance data.
400    """
401
402class IStudentPersonalEdit(IStudentPersonal):
403    """Interface needed for restricted editing of student personal data.
404    """
Note: See TracBrowser for help on using the repository browser.