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

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

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

  • Property svn:keywords set to Id
File size: 8.1 KB
RevLine 
[6621]1##
2## interfaces.py
[6788]3from zope.interface import Attribute, invariant
[6756]4from zope.interface.exceptions import Invalid
[6621]5from zope import schema
6from waeup.sirp.interfaces import IWAeUPObject
[6788]7from waeup.sirp.schema import TextLineChoice
[6795]8from waeup.sirp.university.vocabularies import CourseSource
[6648]9from waeup.sirp.students.vocabularies import (
[6788]10  CertificateSource, academic_sessions_vocab, verdicts, StudyLevelSource,
11  contextual_reg_num_source, contextual_mat_num_source,
[6648]12  )
[6860]13from waeup.sirp.payments.interfaces import IPaymentsContainer
[6621]14
[6692]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
[6642]55class IStudentNavigation(IWAeUPObject):
56    """Interface needed for student navigation.
57    """
58
59    def getStudent():
60        """Return student object.
61        """
62
[6756]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,
[6764]70        readonly = True
[6756]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
[6631]89class IStudentBase(IWAeUPObject):
90    """Representation of student base data.
[6621]91    """
[6637]92    history = Attribute('Object history, a list of messages.')
93    state = Attribute('Returns the registration state of a student')
[6699]94    password = Attribute('Encrypted password of a student')
[6814]95    certificate = Attribute('The certificate of any chosen study course')
[6637]96
97    def loggerInfo(ob_class, comment):
98        """Adds an INFO message to the log file
99        """
100
[6665]101    student_id = schema.TextLine(
102        title = u'Student ID',
[6849]103        required = False,
[6665]104        )
105
[6818]106    fullname = schema.TextLine(
[6631]107        title = u'Full Name',
[6818]108        default = None,
[6621]109        required = True,
110        )
111
[6788]112    reg_number = TextLineChoice(
[6696]113        title = u'Registration Number',
[6818]114        default = None,
[6696]115        required = True,
116        readonly = False,
[6788]117        source = contextual_reg_num_source,
[6696]118        )
119
[6788]120    matric_number = TextLineChoice(
[6750]121        title = u'Matriculation Number',
[6788]122        #default = u'',
[6750]123        required = False,
124        readonly = False,
[6788]125        source = contextual_mat_num_source,
[6750]126        )
127
[6769]128    adm_code = schema.TextLine(
[6771]129        title = u'PWD Access Code',
[6769]130        default = u'',
131        required = False,
132        readonly = True,
133        )
134
[6631]135class IStudentClearance(IWAeUPObject):
136    """Representation of student clearance data.
137    """
[6622]138
[6631]139    date_of_birth = schema.Date(
140        title = u'Date of Birth',
141        required = True,
142        )
143
[6695]144    clearance_locked = schema.Bool(
145        title = u'Clearance form locked',
146        default = False,
147        )
148
[6769]149    clr_code = schema.TextLine(
[6771]150        title = u'CLR Access Code',
[6769]151        default = u'',
152        required = False,
153        readonly = True,
154        )
155
[6631]156class IStudentPersonal(IWAeUPObject):
157    """Representation of student personal data.
158    """
159
[6651]160    perm_address = schema.Text(
[6631]161        title = u'Permanent Address',
162        required = False,
163        )
164
165class IStudent(IStudentBase,IStudentClearance,IStudentPersonal):
166    """Representation of a student.
167    """
168
[6849]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
[6633]189class IStudentStudyCourse(IWAeUPObject):
190    """A container for student study levels.
191
192    """
193
[6648]194    certificate = schema.Choice(
195        title = u'Certificate',
196        source = CertificateSource(),
197        default = None,
[6633]198        required = True,
199        )
[6635]200
[6724]201    current_session = schema.Choice(
202        title = u'Current Session',
[6744]203        source = academic_sessions_vocab,
[6724]204        default = None,
205        required = True,
206        )
207
208    current_level = schema.Choice(
209        title = u'Current Level',
[6725]210        source = StudyLevelSource(),
[6724]211        default = None,
[6725]212        required = False,
[6724]213        )
214
215    current_verdict = schema.Choice(
216        title = u'Current Verdict',
217        source = verdicts,
[6804]218        default = '0',
[6725]219        required = False,
[6724]220        )
221
222    previous_verdict = schema.Choice(
223        title = u'Previous Verdict',
224        source = verdicts,
[6805]225        default = '0',
[6725]226        required = False,
[6724]227        )
228
[6825]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
[6774]239class IStudentStudyLevel(IWAeUPObject):
240    """A container for course tickets.
241
242    """
243    level = Attribute('The level code')
[6793]244    validation_date = Attribute('The date of validation')
245    validated_by = Attribute('User Id of course adviser')
[6774]246
[6793]247    level_session = schema.Choice(
248        title = u'Session',
249        source = academic_sessions_vocab,
250        default = None,
251        required = True,
252        )
[6781]253
[6793]254    level_verdict = schema.Choice(
255        title = u'Verdict',
256        source = verdicts,
[6805]257        default = '0',
[6793]258        required = False,
259        )
260
[6781]261class ICourseTicket(IWAeUPObject):
262    """A course ticket.
263
264    """
[6783]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')
[6781]272
[6795]273    core_or_elective = schema.Bool(
274        title = u'Mandatory',
275        default = False,
276        required = False,
277        readonly = False,
278        )
279
[6781]280    score = schema.Int(
281        title = u'Score',
282        default = 0,
283        required = False,
284        readonly = False,
285        )
286
[6806]287    automatic = schema.Bool(
288        title = u'Automatical Creation',
289        default = False,
290        required = False,
291        readonly = True,
292        )
293
[6795]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
[6635]304class IStudentAccommodation(IWAeUPObject):
305    """A container for student accommodation objects.
306
307    """
308
[6860]309class IStudentPaymentsContainer(IPaymentsContainer):
[6635]310    """A container for student payment objects.
311
312    """
313
[6694]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.