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

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

Add StudentStudyCourseProcessor?.

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