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

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

Replace fullname form field by first-, middle- and lastname form fields.

We don't need a studentaddpage.pt.

  • Property svn:keywords set to Id
File size: 11.7 KB
RevLine 
[7191]1## $Id: interfaces.py 7357 2011-12-16 06:40:31Z henrik $
[6621]2##
[7191]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##
[6996]18from datetime import datetime
[7256]19from zope.interface import Attribute, Interface
[6621]20from zope import schema
[7221]21from waeup.sirp.interfaces import (
[7321]22    ISIRPObject, academic_sessions_vocab, validate_email)
[6788]23from waeup.sirp.schema import TextLineChoice
[6874]24from waeup.sirp.university.vocabularies import CourseSource, study_modes
[6648]25from waeup.sirp.students.vocabularies import (
[7214]26  CertificateSource, verdicts, StudyLevelSource,
[6996]27  contextual_reg_num_source, contextual_mat_num_source, GenderSource,
[6648]28  )
[6877]29from waeup.sirp.payments.interfaces import IPaymentsContainer, IOnlinePayment
[6621]30
[7150]31class IStudentsUtils(Interface):
32    """A collection of methods which are subject to customization.
33
34    """
[7186]35    def getPaymentDetails(category, student):
[7150]36        """Get the payment dates of a student for the payment category
37        specified.
38
39        """
40
[7186]41    def getAccommodation_details(student):
[7150]42        """Determine the accommodation dates of a student.
43
44        """
45
[7186]46    def selectBed(available_beds):
[7150]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
[7186]53    def renderPDF(view, subject='', filename='slip.pdf',):
[7150]54        """Render pdf slips for various pages.
55
56        """
57
[7321]58class IStudentsContainer(ISIRPObject):
[7096]59    """A students container contains university students.
[6692]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
[7321]97class IStudentNavigation(ISIRPObject):
[6642]98    """Interface needed for student navigation.
[7150]99
[6642]100    """
101    def getStudent():
102        """Return student object.
[7150]103
[6642]104        """
105
[7321]106class IStudentBase(ISIRPObject):
[6631]107    """Representation of student base data.
[7150]108
[6621]109    """
[7062]110    history = Attribute('Object history, a list of messages')
[6637]111    state = Attribute('Returns the registration state of a student')
[6699]112    password = Attribute('Encrypted password of a student')
[7203]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')
[7062]116    current_session = Attribute('The current session of the student')
[7357]117    fullname = Attribute('The fullname of an applicant')
[6637]118
119    def loggerInfo(ob_class, comment):
[7150]120        """Adds an INFO message to the log file.
121
[6637]122        """
123
[6665]124    student_id = schema.TextLine(
[7240]125        title = u'Student Id',
[6849]126        required = False,
[6665]127        )
128
[7357]129    firstname = schema.TextLine(
130        title = u'First Name',
[6621]131        required = True,
132        )
133
[7357]134    middlename = schema.TextLine(
135        title = u'Middle Name',
136        required = False,
137        )
138
139    lastname = schema.TextLine(
140        title = u'Last Name (Surname)',
141        required = True,
142        )
143
[6996]144    sex = schema.Choice(
145        title = u'Sex',
146        source = GenderSource(),
147        default = u'm',
148        required = True,
149        )
150
[6788]151    reg_number = TextLineChoice(
[6696]152        title = u'Registration Number',
[6818]153        default = None,
[6696]154        required = True,
155        readonly = False,
[6788]156        source = contextual_reg_num_source,
[6696]157        )
158
[6788]159    matric_number = TextLineChoice(
[6750]160        title = u'Matriculation Number',
[6788]161        #default = u'',
[6750]162        required = False,
163        readonly = False,
[6788]164        source = contextual_mat_num_source,
[6750]165        )
166
[6769]167    adm_code = schema.TextLine(
[6935]168        title = u'PWD Activation Code',
[6769]169        default = u'',
170        required = False,
171        readonly = True,
172        )
173
[7133]174    email = schema.ASCIILine(
175        title = u'Email',
176        required = False,
177        constraint=validate_email,
178        )
[7325]179    phone = schema.TextLine(
[7133]180        title = u'Phone',
[7331]181        description = u'',
[7133]182        required = False,
183        )
184
[7321]185class IStudentClearance(ISIRPObject):
[6631]186    """Representation of student clearance data.
[7150]187
[6631]188    """
189    date_of_birth = schema.Date(
190        title = u'Date of Birth',
191        required = True,
192        )
193
[6695]194    clearance_locked = schema.Bool(
195        title = u'Clearance form locked',
196        default = False,
197        )
198
[6769]199    clr_code = schema.TextLine(
[6935]200        title = u'CLR Activation Code',
[6769]201        default = u'',
202        required = False,
203        readonly = True,
204        )
205
[7321]206class IStudentPersonal(ISIRPObject):
[6631]207    """Representation of student personal data.
[7150]208
[6631]209    """
[6651]210    perm_address = schema.Text(
[6631]211        title = u'Permanent Address',
212        required = False,
213        )
214
215class IStudent(IStudentBase,IStudentClearance,IStudentPersonal):
216    """Representation of a student.
[7150]217
[6631]218    """
219
[6849]220class IStudentUpdateByRegNo(IStudent):
221    """Representation of a student. Skip regular reg_number validation.
[7150]222
[6849]223    """
224    reg_number = schema.TextLine(
225        title = u'Registration Number',
226        default = None,
227        required = False,
228        )
229
230class IStudentUpdateByMatricNo(IStudent):
231    """Representation of a student. Skip regular matric_number validation.
[7150]232
[6849]233    """
234    matric_number = schema.TextLine(
235        title = u'Matriculation Number',
236        default = None,
237        required = False,
238        )
239
[7321]240class IStudentStudyCourse(ISIRPObject):
[6633]241    """A container for student study levels.
242
243    """
[6648]244    certificate = schema.Choice(
245        title = u'Certificate',
246        source = CertificateSource(),
247        default = None,
[7209]248        required = False,
[6633]249        )
[6635]250
[6996]251
252    entry_mode = schema.Choice(
253        title = u'Entry Mode',
254        vocabulary = study_modes,
255        default = u'ug_ft',
256        required = True,
257        readonly = False,
258        )
259
260    entry_session = schema.Choice(
261        title = u'Entry Session',
262        source = academic_sessions_vocab,
263        default = datetime.now().year,
264        required = True,
265        readonly = False,
266        )
267
[6724]268    current_session = schema.Choice(
269        title = u'Current Session',
[6744]270        source = academic_sessions_vocab,
[6724]271        default = None,
272        required = True,
[6996]273        readonly = False,
[6724]274        )
275
276    current_level = schema.Choice(
277        title = u'Current Level',
[6725]278        source = StudyLevelSource(),
[6724]279        default = None,
[6725]280        required = False,
[6996]281        readonly = False,
[6724]282        )
283
284    current_verdict = schema.Choice(
285        title = u'Current Verdict',
286        source = verdicts,
[6804]287        default = '0',
[6725]288        required = False,
[6724]289        )
290
291    previous_verdict = schema.Choice(
292        title = u'Previous Verdict',
293        source = verdicts,
[6805]294        default = '0',
[6725]295        required = False,
[6724]296        )
297
[6825]298class IStudentStudyCourseImport(IStudentStudyCourse):
299    """A container for student study levels.
300
301    """
302    current_level = schema.Int(
303        title = u'Current Level',
304        default = None,
305        )
306
[7321]307class IStudentStudyLevel(ISIRPObject):
[6774]308    """A container for course tickets.
309
310    """
311    level = Attribute('The level code')
[6793]312    validation_date = Attribute('The date of validation')
313    validated_by = Attribute('User Id of course adviser')
[6774]314
[6793]315    level_session = schema.Choice(
316        title = u'Session',
317        source = academic_sessions_vocab,
318        default = None,
319        required = True,
320        )
[6781]321
[6793]322    level_verdict = schema.Choice(
323        title = u'Verdict',
324        source = verdicts,
[6805]325        default = '0',
[6793]326        required = False,
327        )
328
[7321]329class ICourseTicket(ISIRPObject):
[6781]330    """A course ticket.
331
332    """
[6783]333    code = Attribute('code of the original course')
334    title = Attribute('title of the original course')
335    credits = Attribute('credits of the original course')
336    passmark = Attribute('passmark of the original course')
337    semester = Attribute('semester of the original course')
338    faculty = Attribute('faculty of the original course')
339    department = Attribute('department of the original course')
[7304]340    fcode = Attribute('faculty code of the original course')
341    dcode = Attribute('department code of the original course')
[6781]342
[6795]343    core_or_elective = schema.Bool(
344        title = u'Mandatory',
345        default = False,
346        required = False,
347        readonly = False,
348        )
349
[6781]350    score = schema.Int(
351        title = u'Score',
352        default = 0,
353        required = False,
354        readonly = False,
355        )
356
[6806]357    automatic = schema.Bool(
358        title = u'Automatical Creation',
359        default = False,
360        required = False,
361        readonly = True,
362        )
363
[6795]364class ICourseTicketAdd(ICourseTicket):
[7150]365    """An interface for adding course tickets.
[6795]366
367    """
368    course = schema.Choice(
369        title = u'Course',
370        source = CourseSource(),
371        readonly = False,
372        )
373
[7321]374class IStudentAccommodation(ISIRPObject):
[6635]375    """A container for student accommodation objects.
376
377    """
378
[7321]379class IBedTicket(ISIRPObject):
[6989]380    """A ticket for accommodation booking.
381
382    """
[6996]383    bed = Attribute('The bed object.')
384
385    bed_coordinates = schema.TextLine(
386        title = u'Bed Coordinates',
[6992]387        default = None,
388        required = False,
[7014]389        readonly = False,
[6992]390        )
391
[6996]392    bed_type = schema.TextLine(
393        title = u'Bed Type',
394        default = None,
395        required = False,
[7014]396        readonly = False,
[6996]397        )
398
[6992]399    booking_session = schema.Choice(
400        title = u'Session',
401        source = academic_sessions_vocab,
402        default = None,
403        required = True,
[7014]404        readonly = True,
[6992]405        )
406
407    booking_date = schema.Datetime(
408        title = u'Booking Date',
409        required = False,
[7014]410        readonly = True,
[6992]411        )
412
413    booking_code = schema.TextLine(
414        title = u'Booking Activation Code',
415        default = u'',
416        required = False,
[7014]417        readonly = True,
[6992]418        )
419
[6994]420    def getSessionString():
[7150]421        """Returns the the title of academic_sessions_vocab term.
422
[6994]423        """
[6992]424
[6860]425class IStudentPaymentsContainer(IPaymentsContainer):
[6635]426    """A container for student payment objects.
427
428    """
429
[6877]430class IStudentOnlinePayment(IOnlinePayment):
431    """A student payment via payment gateways.
432
433    """
434    p_session = schema.Choice(
435        title = u'Payment Session',
436        source = academic_sessions_vocab,
437        required = False,
438        )
439
440IStudentOnlinePayment['p_session'].order = IStudentOnlinePayment[
441    'p_item'].order
442
[6694]443# Interfaces for students only
444
445class IStudentClearanceEdit(IStudentClearance):
446    """Interface needed for restricted editing of student clearance data.
[7150]447
[6694]448    """
449
450class IStudentPersonalEdit(IStudentPersonal):
451    """Interface needed for restricted editing of student personal data.
[7150]452
[6694]453    """
Note: See TracBrowser for help on using the repository browser.