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

Last change on this file since 6814 was 6814, checked in by uli, 13 years ago

Make student certificates better accessible, for instance by catalog.

  • Property svn:keywords set to Id
File size: 7.3 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    name = schema.TextLine(
106        title = u'Full Name',
107        default = u'Nobody',
108        required = True,
109        )
110
111    reg_number = TextLineChoice(
112        title = u'Registration Number',
113        #default = u'',
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 IStudentStudyLevel(IWAeUPObject):
209    """A container for course tickets.
210
211    """
212    level = Attribute('The level code')
213    validation_date = Attribute('The date of validation')
214    validated_by = Attribute('User Id of course adviser')
215
216    level_session = schema.Choice(
217        title = u'Session',
218        source = academic_sessions_vocab,
219        default = None,
220        required = True,
221        )
222
223    level_verdict = schema.Choice(
224        title = u'Verdict',
225        source = verdicts,
226        default = '0',
227        required = False,
228        )
229
230class ICourseTicket(IWAeUPObject):
231    """A course ticket.
232
233    """
234    code = Attribute('code of the original course')
235    title = Attribute('title of the original course')
236    credits = Attribute('credits of the original course')
237    passmark = Attribute('passmark of the original course')
238    semester = Attribute('semester of the original course')
239    faculty = Attribute('faculty of the original course')
240    department = Attribute('department of the original course')
241
242    core_or_elective = schema.Bool(
243        title = u'Mandatory',
244        default = False,
245        required = False,
246        readonly = False,
247        )
248
249    score = schema.Int(
250        title = u'Score',
251        default = 0,
252        required = False,
253        readonly = False,
254        )
255
256    automatic = schema.Bool(
257        title = u'Automatical Creation',
258        default = False,
259        required = False,
260        readonly = True,
261        )
262
263class ICourseTicketAdd(ICourseTicket):
264    """An interface for adding course tickets
265
266    """
267    course = schema.Choice(
268        title = u'Course',
269        source = CourseSource(),
270        readonly = False,
271        )
272
273class IStudentAccommodation(IWAeUPObject):
274    """A container for student accommodation objects.
275
276    """
277
278class IStudentPayments(IWAeUPObject):
279    """A container for student payment objects.
280
281    """
282
283# Interfaces for students only
284
285class IStudentClearanceEdit(IStudentClearance):
286    """Interface needed for restricted editing of student clearance data.
287    """
288
289class IStudentPersonalEdit(IStudentPersonal):
290    """Interface needed for restricted editing of student personal data.
291    """
Note: See TracBrowser for help on using the repository browser.