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

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

Each study level (course list) belongs to a session, is validated by a course adviser and finally closed by assigning a verdict due import.

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