source: main/waeup.sirp/branches/henrik-bootstrap/src/waeup/sirp/students/interfaces.py @ 11088

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

Entry sessions must not have a default value.

  • Property svn:keywords set to Id
File size: 12.2 KB
Line 
1## $Id: interfaces.py 7425 2011-12-21 11:39:53Z henrik $
2##
3## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann
4## This program is free software; you can redistribute it and/or modify
5## it under the terms of the GNU General Public License as published by
6## the Free Software Foundation; either version 2 of the License, or
7## (at your option) any later version.
8##
9## This program is distributed in the hope that it will be useful,
10## but WITHOUT ANY WARRANTY; without even the implied warranty of
11## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12## GNU General Public License for more details.
13##
14## You should have received a copy of the GNU General Public License
15## along with this program; if not, write to the Free Software
16## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17##
18from datetime import datetime
19from zope.interface import Attribute, Interface
20from zope import schema
21from waeup.sirp.interfaces import (
22    ISIRPObject, academic_sessions_vocab, validate_email)
23from waeup.sirp.schema import TextLineChoice
24from waeup.sirp.university.vocabularies import CourseSource, study_modes
25from waeup.sirp.students.vocabularies import (
26  CertificateSource, verdicts, StudyLevelSource,
27  contextual_reg_num_source, contextual_mat_num_source, GenderSource,
28  )
29from waeup.sirp.payments.interfaces import IPaymentsContainer, IOnlinePayment
30
31class IStudentsUtils(Interface):
32    """A collection of methods which are subject to customization.
33
34    """
35    def getPaymentDetails(category, student):
36        """Get the payment dates of a student for the payment category
37        specified.
38
39        """
40
41    def getAccommodation_details(student):
42        """Determine the accommodation dates of a student.
43
44        """
45
46    def selectBed(available_beds):
47        """Select a bed from a list of available beds.
48
49        In the standard configuration we select the first bed found,
50        but can also randomize the selection if we like.
51        """
52
53    def renderPDF(view, subject='', filename='slip.pdf',):
54        """Render pdf slips for various pages.
55
56        """
57
58class IStudentsContainer(ISIRPObject):
59    """A students container contains university students.
60
61    """
62    def addStudent(student):
63        """Add an IStudent object and subcontainers.
64
65        """
66
67    def archive(id=None):
68        """Create on-dist archive of students.
69
70        If id is `None`, all students are archived.
71
72        If id contains a single id string, only the respective
73        students are archived.
74
75        If id contains a list of id strings all of the respective
76        students types are saved to disk.
77        """
78
79    def clear(id=None, archive=True):
80        """Remove students of type given by 'id'.
81
82        Optionally archive the students.
83
84        If id is `None`, all students are archived.
85
86        If id contains a single id string, only the respective
87        students are archived.
88
89        If id contains a list of id strings all of the respective
90        student types are saved to disk.
91
92        If `archive` is ``False`` none of the archive-handling is done
93        and respective students are simply removed from the
94        database.
95        """
96
97class IStudentNavigation(ISIRPObject):
98    """Interface needed for student navigation.
99
100    """
101    def getStudent():
102        """Return student object.
103
104        """
105
106class IStudentBase(ISIRPObject):
107    """Representation of student base data.
108
109    """
110    history = Attribute('Object history, a list of messages')
111    state = Attribute('Returns the registration state of a student')
112    password = Attribute('Encrypted password of a student')
113    certcode = Attribute('The certificate code of any chosen study course')
114    depcode = Attribute('The department code of any chosen study course')
115    faccode = Attribute('The faculty code of any chosen study course')
116    current_session = Attribute('The current session of the student')
117    fullname = Attribute('All name parts separated by hyphens')
118    display_fullname = Attribute('The fullname of an applicant')
119
120    def loggerInfo(ob_class, comment):
121        """Adds an INFO message to the log file.
122
123        """
124
125    student_id = schema.TextLine(
126        title = u'Student Id',
127        required = False,
128        )
129
130    firstname = schema.TextLine(
131        title = u'First Name',
132        required = True,
133        )
134
135    middlename = schema.TextLine(
136        title = u'Middle Name',
137        required = False,
138        )
139
140    lastname = schema.TextLine(
141        title = u'Last Name (Surname)',
142        required = True,
143        )
144
145    sex = schema.Choice(
146        title = u'Sex',
147        source = GenderSource(),
148        default = u'm',
149        required = True,
150        )
151
152    reg_number = TextLineChoice(
153        title = u'Registration Number',
154        default = None,
155        required = True,
156        readonly = False,
157        source = contextual_reg_num_source,
158        )
159
160    matric_number = TextLineChoice(
161        title = u'Matriculation Number',
162        #default = u'',
163        required = False,
164        readonly = False,
165        source = contextual_mat_num_source,
166        )
167
168    adm_code = schema.TextLine(
169        title = u'PWD Activation Code',
170        default = u'',
171        required = False,
172        readonly = True,
173        )
174
175    email = schema.ASCIILine(
176        title = u'Email',
177        required = False,
178        constraint=validate_email,
179        )
180    phone = schema.TextLine(
181        title = u'Phone',
182        description = u'',
183        required = False,
184        )
185
186class IStudentClearance(ISIRPObject):
187    """Representation of student clearance data.
188
189    """
190    date_of_birth = schema.Date(
191        title = u'Date of Birth',
192        required = True,
193        )
194
195    clearance_locked = schema.Bool(
196        title = u'Clearance form locked',
197        default = False,
198        )
199
200    clr_code = schema.TextLine(
201        title = u'CLR Activation Code',
202        default = u'',
203        required = False,
204        readonly = True,
205        )
206
207class IStudentPersonal(ISIRPObject):
208    """Representation of student personal data.
209
210    """
211    perm_address = schema.Text(
212        title = u'Permanent Address',
213        required = False,
214        )
215
216class IStudent(IStudentBase,IStudentClearance,IStudentPersonal):
217    """Representation of a student.
218
219    """
220
221class IStudentUpdateByRegNo(IStudent):
222    """Representation of a student. Skip regular reg_number validation.
223
224    """
225    reg_number = schema.TextLine(
226        title = u'Registration Number',
227        default = None,
228        required = False,
229        )
230
231class IStudentUpdateByMatricNo(IStudent):
232    """Representation of a student. Skip regular matric_number validation.
233
234    """
235    matric_number = schema.TextLine(
236        title = u'Matriculation Number',
237        default = None,
238        required = False,
239        )
240
241class IStudentStudyCourse(ISIRPObject):
242    """A container for student study levels.
243
244    """
245    certificate = schema.Choice(
246        title = u'Certificate',
247        source = CertificateSource(),
248        default = None,
249        required = False,
250        )
251
252
253    entry_mode = schema.Choice(
254        title = u'Entry Mode',
255        vocabulary = study_modes,
256        default = u'ug_ft',
257        required = True,
258        readonly = False,
259        )
260
261    entry_session = schema.Choice(
262        title = u'Entry Session',
263        source = academic_sessions_vocab,
264        #default = datetime.now().year,
265        default = None,
266        required = True,
267        readonly = False,
268        )
269
270    current_session = schema.Choice(
271        title = u'Current Session',
272        source = academic_sessions_vocab,
273        default = None,
274        required = True,
275        readonly = False,
276        )
277
278    current_level = schema.Choice(
279        title = u'Current Level',
280        source = StudyLevelSource(),
281        default = None,
282        required = False,
283        readonly = False,
284        )
285
286    current_verdict = schema.Choice(
287        title = u'Current Verdict',
288        source = verdicts,
289        default = '0',
290        required = False,
291        )
292
293    previous_verdict = schema.Choice(
294        title = u'Previous Verdict',
295        source = verdicts,
296        default = '0',
297        required = False,
298        )
299
300class IStudentStudyCourseImport(IStudentStudyCourse):
301    """A container for student study levels.
302
303    """
304    current_level = schema.Int(
305        title = u'Current Level',
306        default = None,
307        )
308
309class IStudentStudyLevel(ISIRPObject):
310    """A container for course tickets.
311
312    """
313    level = Attribute('The level code')
314    validation_date = Attribute('The date of validation')
315    validated_by = Attribute('User Id of course adviser')
316
317    level_session = schema.Choice(
318        title = u'Session',
319        source = academic_sessions_vocab,
320        default = None,
321        required = True,
322        )
323
324    level_verdict = schema.Choice(
325        title = u'Verdict',
326        source = verdicts,
327        default = '0',
328        required = False,
329        )
330
331class ICourseTicket(ISIRPObject):
332    """A course ticket.
333
334    """
335    code = Attribute('code of the original course')
336    title = Attribute('title of the original course')
337    credits = Attribute('credits of the original course')
338    passmark = Attribute('passmark of the original course')
339    semester = Attribute('semester of the original course')
340    faculty = Attribute('faculty of the original course')
341    department = Attribute('department of the original course')
342    fcode = Attribute('faculty code of the original course')
343    dcode = Attribute('department code of the original course')
344
345    core_or_elective = schema.Bool(
346        title = u'Mandatory',
347        default = False,
348        required = False,
349        readonly = False,
350        )
351
352    score = schema.Int(
353        title = u'Score',
354        default = 0,
355        required = False,
356        readonly = False,
357        )
358
359    automatic = schema.Bool(
360        title = u'Automatical Creation',
361        default = False,
362        required = False,
363        readonly = True,
364        )
365
366class ICourseTicketAdd(ICourseTicket):
367    """An interface for adding course tickets.
368
369    """
370    course = schema.Choice(
371        title = u'Course',
372        source = CourseSource(),
373        readonly = False,
374        )
375
376class IStudentAccommodation(ISIRPObject):
377    """A container for student accommodation objects.
378
379    """
380
381class IBedTicket(ISIRPObject):
382    """A ticket for accommodation booking.
383
384    """
385    bed = Attribute('The bed object.')
386
387    bed_coordinates = schema.TextLine(
388        title = u'Bed Coordinates',
389        default = None,
390        required = False,
391        readonly = False,
392        )
393
394    bed_type = schema.TextLine(
395        title = u'Bed Type',
396        default = None,
397        required = False,
398        readonly = False,
399        )
400
401    booking_session = schema.Choice(
402        title = u'Session',
403        source = academic_sessions_vocab,
404        default = None,
405        required = True,
406        readonly = True,
407        )
408
409    booking_date = schema.Datetime(
410        title = u'Booking Date',
411        required = False,
412        readonly = True,
413        )
414
415    booking_code = schema.TextLine(
416        title = u'Booking Activation Code',
417        default = u'',
418        required = False,
419        readonly = True,
420        )
421
422    def getSessionString():
423        """Returns the the title of academic_sessions_vocab term.
424
425        """
426
427class IStudentPaymentsContainer(IPaymentsContainer):
428    """A container for student payment objects.
429
430    """
431
432class IStudentOnlinePayment(IOnlinePayment):
433    """A student payment via payment gateways.
434
435    """
436    p_session = schema.Choice(
437        title = u'Payment Session',
438        source = academic_sessions_vocab,
439        required = False,
440        )
441
442IStudentOnlinePayment['p_session'].order = IStudentOnlinePayment[
443    'p_item'].order
444
445# Interfaces for students only
446
447class IStudentClearanceEdit(IStudentClearance):
448    """Interface needed for restricted editing of student clearance data.
449
450    """
451
452class IStudentPersonalEdit(IStudentPersonal):
453    """Interface needed for restricted editing of student personal data.
454
455    """
456
457class IStudentChangePassword(ISIRPObject):
458    """Interface needed for change pasword page.
459
460    """
461
462    reg_number = schema.TextLine(
463        title = u'Registration Number',
464        default = None,
465        required = True,
466        readonly = False,
467        )
468
469    email = schema.ASCIILine(
470        title = u'Email',
471        required = True,
472        constraint=validate_email,
473        )
Note: See TracBrowser for help on using the repository browser.