source: main/waeup.kofa/trunk/src/waeup/kofa/students/interfaces.py @ 15980

Last change on this file since 15980 was 15889, checked in by Henrik Bettermann, 5 years ago

Make topMargin customizable.

  • Property svn:keywords set to Id
File size: 28.1 KB
RevLine 
[7191]1## $Id: interfaces.py 15889 2019-12-12 18:38:41Z 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##
[8409]18#from datetime import datetime
[7620]19from zope.component import getUtility
[15203]20from zope.interface import Attribute, Interface, invariant, Invalid
[6621]21from zope import schema
[7620]22from zc.sourcefactory.contextual import BasicContextualSourceFactory
[9217]23from waeup.kofa.browser.interfaces import IStudentNavigationBase
[7811]24from waeup.kofa.interfaces import (
[11450]25    IKofaObject, academic_sessions_vocab, validate_email, ICSVExporter,
[13125]26    ContextualDictSourceFactoryBase, IKofaUtils)
[7811]27from waeup.kofa.interfaces import MessageFactory as _
[8176]28from waeup.kofa.schema import TextLineChoice, FormattedDate, PhoneNumber
[7811]29from waeup.kofa.students.vocabularies import (
[7915]30    StudyLevelSource, contextual_reg_num_source, contextual_mat_num_source,
[9420]31    GenderSource, nats_vocab
[7915]32    )
[8160]33from waeup.kofa.payments.interfaces import (
[8174]34    IPaymentsContainer, IOnlinePayment)
[7915]35from waeup.kofa.university.vocabularies import (
[14642]36    CourseSource, StudyModeSource, CertificateSource,
37    SemesterSource, CourseCategorySource
[11450]38    )
[6621]39
[9864]40class PreviousPaymentCategorySource(ContextualDictSourceFactoryBase):
41    """A source that delivers all selectable categories of previous session
42    payments.
43    """
44    #: name of dict to deliver from kofa utils.
45    DICT_NAME = 'PREVIOUS_PAYMENT_CATEGORIES'
46
[9868]47class BalancePaymentCategorySource(ContextualDictSourceFactoryBase):
[9864]48    """A source that delivers all selectable items of balance payments.
49    """
50    #: name of dict to deliver from kofa utils.
[9868]51    DICT_NAME = 'BALANCE_PAYMENT_CATEGORIES'
[9864]52
[7620]53# VerdictSource can't be placed into the vocabularies module because it
54# requires importing IStudentsUtils which then leads to circular imports.
55class VerdictSource(BasicContextualSourceFactory):
56    """A verdicts source delivers all verdicts provided
57    in the portal.
58    """
59    def getValues(self, context):
[13125]60        verdicts_dict = getUtility(IKofaUtils).VERDICTS_DICT
[8820]61        return sorted(verdicts_dict.keys())
[7620]62
63    def getToken(self, context, value):
64        return value
65
66    def getTitle(self, context, value):
[13125]67        verdicts_dict = getUtility(IKofaUtils).VERDICTS_DICT
[8820]68        if value != '0':
69            return verdicts_dict[value] + ' (%s)' % value
[7688]70        return verdicts_dict[value]
[7620]71
[7681]72
[7150]73class IStudentsUtils(Interface):
74    """A collection of methods which are subject to customization.
75    """
[7841]76    def setReturningData(student):
77        """ This method defines what happens after school fee payment
78        depending on the student's senate verdict.
79
80        In the base configuration current level is always increased
81        by 100 no matter which verdict has been assigned.
82        """
83
[9148]84    def setPaymentDetails(category, student, previous_session=None,
[15664]85            previous_level=None, combi=None):
[8595]86        """Create Payment object and set the payment data of a student for
87        the payment category specified.
[12902]88        """
[7150]89
[12902]90    def increaseMatricInteger(student):
91        """Increase counter for matric numbers.
92
93        This counter can be a centrally stored attribute or an attribute of
94        faculties, departments or certificates. In the base package the counter
95        is as an attribute of the site configuration object.
[7150]96        """
97
[12902]98    def constructMatricNumber(student):
99        """Fetch the matric number counter which fits the student and
100        construct the new matric number of the student.
101
102        In the base package the counter is returned which is as an attribute
103        of the site configuration object.
104        """
105
[11589]106    def setMatricNumber(student):
107        """Set matriculation number of student.
108
109        If the student's matric number is unset a new matric number is
[12902]110        constructed according to the matriculation number construction rules
111        defined in the constructMatricNumber method. The new matric number is
112        set, the students catalog updated. The corresponding matric number
113        counter is increased by one.
[11589]114
115        This method is tested but not used in the base package. It can
116        be used in custom packages by adding respective views
[12902]117        and by customizing increaseMatricInteger and constructMatricNumber
118        according to the university's matriculation number construction rules.
[11589]119
[12902]120        The method can be disabled by setting the counter to zero.
[11589]121        """
122
[7186]123    def getAccommodation_details(student):
[7150]124        """Determine the accommodation dates of a student.
125        """
126
[7186]127    def selectBed(available_beds):
[7150]128        """Select a bed from a list of available beds.
129        In the standard configuration we select the first bed found,
130        but can also randomize the selection if we like.
131        """
132
[14655]133    def getDegreeClassNumber(level_obj):
134        """Get degree class number (used for SessionResultsPresentation
135        reports).
136        """
137
[9949]138    def getPDFCreator(context):
139        """Get some IPDFCreator instance suitable for use with `context`.
140        """
141
[7186]142    def renderPDF(view, subject='', filename='slip.pdf',):
[7150]143        """Render pdf slips for various pages.
144        """
145
[14655]146    def renderPDFAdmissionLetter(view, student=None, omit_fields=(),
[15880]147                                 pre_text=None, post_text=None,
[15889]148                                 topMargin = None,
[15880]149                                 letterhead_path=None):
[14655]150        """Render pdf admission letter.
[14157]151        """
152
[14583]153    def renderPDFTranscript(view, filename, student,
154                  studentview, note, signatures, sigs_in_footer,
155                  show_scans, topMargin, omit_fields,
156                  tableheader, no_passport):
157        """Render pdf slip of a transcripts.
158        """
159
[14702]160    def renderPDFCourseticketsOverview(
[15423]161                  view, name, session, data, lecturers, orientation,
[15246]162                  title_length, note):
[14583]163        """Render pdf slip of course tickets for a lecturer.
164        """
165
[14584]166    def warnCreditsOOR(studylevel, course=None):
167        """Return message if credits are out of range. In the base
168        package only maximum credits is set.
[14583]169        """
170
171    def getBedCoordinates(bedticket):
172        """Return descriptive bed coordinates.
173        This method can be used to customize the `display_coordinates`
174        property method in order to  display a
175        customary description of the bed space.
176        """
177
178    def clearance_disabled_message(student):
179        """Render message if clearance is disabled.
180        """
181
[7819]182class IStudentsContainer(IKofaObject):
[7096]183    """A students container contains university students.
[6692]184    """
185    def addStudent(student):
186        """Add an IStudent object and subcontainers.
187        """
188
[13736]189    unique_student_id = Attribute('A unique student id')
[8408]190
[9217]191class IStudentNavigation(IStudentNavigationBase):
[13003]192    """Interface needed for navigation and logging. This interface is
[13076]193    implemented by all content classes in the students section.
[6642]194    """
[13003]195    student = Attribute('Student object of context')
[7150]196
[8735]197    def writeLogMessage(view, message):
[13167]198        """Add an INFO message to students.log.
[8735]199        """
200
[7819]201class IStudentBase(IKofaObject):
[6631]202    """Representation of student base data.
[6621]203    """
[12997]204    history = Attribute('Object history, a list of messages')
205    state = Attribute('Registration state')
[13080]206    translated_state = Attribute('Real name of the registration state')
[12997]207    certcode = Attribute('Certificate code of any chosen study course')
208    depcode = Attribute('Department code of any chosen study course')
209    faccode = Attribute('Faculty code of any chosen study course')
210    entry_session = Attribute('Entry session')
211    current_session = Attribute('Current session')
212    current_level = Attribute('Current level')
213    current_mode = Attribute('Current mode')
214    current_verdict = Attribute('Current verdict')
[7364]215    fullname = Attribute('All name parts separated by hyphens')
[12997]216    display_fullname = Attribute('Fullname as displayed on pages')
[8969]217    is_postgrad = Attribute('True if postgraduate student')
[12997]218    is_special_postgrad = Attribute('True if special postgraduate student')
219    is_fresh = Attribute('True if fresh student')
220    before_payment = Attribute('True if no previous payment has to be made')
221    personal_data_expired = Attribute('True if personal data expired')
222    transcript_enabled = Attribute('True if transcript processing is enabled')
[13103]223    clearance_locked = Attribute('True if clearance form is locked')
[15163]224    studycourse_locked = Attribute(
225        'True if nobody is allowed to change studycourse, studylecel or '
226        'course ticket data, neither through the UI nor via import')
[6637]227
[13003]228    password = Attribute('Encrypted password')
229    temp_password = Attribute('Dictionary with user name, timestamp and encrypted password')
[15606]230    parents_password = Attribute('Dictionary with student_id, timestamp and encrypted password')
[13003]231
[8983]232    suspended = schema.Bool(
233        title = _(u'Account suspended'),
234        default = False,
[9035]235        required = False,
[8983]236        )
237
[9702]238    suspended_comment = schema.Text(
239        title = _(u"Reasons for Deactivation"),
240        required = False,
241        description = _(
242            u'This message will be shown if and only if deactivated '
243            'students try to login.'),
244        )
245
[13711]246    flash_notice = schema.TextLine(
247        title = _(u'Flash Notice'),
248        required = False,
249        readonly = False,
250        description = _(
251            u'This single-line message will be shown in a flash box.'),
252        )
253
[6665]254    student_id = schema.TextLine(
[7723]255        title = _(u'Student Id'),
[6849]256        required = False,
[6665]257        )
258
[7357]259    firstname = schema.TextLine(
[7723]260        title = _(u'First Name'),
[6621]261        required = True,
262        )
263
[7357]264    middlename = schema.TextLine(
[7723]265        title = _(u'Middle Name'),
[7357]266        required = False,
267        )
268
269    lastname = schema.TextLine(
[7723]270        title = _(u'Last Name (Surname)'),
[7357]271        required = True,
272        )
273
[6996]274    sex = schema.Choice(
[15790]275        title = _(u'Gender'),
[6996]276        source = GenderSource(),
277        required = True,
278        )
279
[6788]280    reg_number = TextLineChoice(
[7723]281        title = _(u'Registration Number'),
[6696]282        required = True,
283        readonly = False,
[6788]284        source = contextual_reg_num_source,
[6696]285        )
286
[6788]287    matric_number = TextLineChoice(
[7723]288        title = _(u'Matriculation Number'),
[6750]289        required = False,
290        readonly = False,
[6788]291        source = contextual_mat_num_source,
[6750]292        )
293
[6769]294    adm_code = schema.TextLine(
[7723]295        title = _(u'PWD Activation Code'),
[6769]296        required = False,
[8977]297        readonly = False,
[6769]298        )
299
[7133]300    email = schema.ASCIILine(
[7723]301        title = _(u'Email'),
[13345]302        required = False,
[7133]303        constraint=validate_email,
304        )
[15705]305
[8176]306    phone = PhoneNumber(
[7723]307        title = _(u'Phone'),
[7133]308        required = False,
309        )
310
[15609]311    parents_email = schema.ASCIILine(
312        title = _(u"Parents' Email"),
313        required = False,
314        constraint=validate_email,
315        )
316
[9334]317    def setTempPassword(user, password):
318        """Set a temporary password (LDAP-compatible) SSHA encoded for
319        officers.
320        """
321
322    def getTempPassword():
323        """Check if a temporary password has been set and if it
[12997]324        is not expired. Return the temporary password if valid,
[9334]325        None otherwise. Unset the temporary password if expired.
326        """
327
[15606]328    def setParentsPassword(password):
329        """Set a parents password (LDAP-compatible) SSHA encoded for
330        parents.
331        """
332
333    def getParentsPassword():
334        """Check if a parents password has been set and if it
335        is not expired.
336
337        Return the parents password if valid,
338        None otherwise. Unset the parents password if expired.
339        """
340
[9131]341    def transfer(certificate, current_session,
342        current_level, current_verdict):
343        """ Creates a new studycourse and backups the old one.
[12997]344        """
[9131]345
[12997]346    def revert_transfer():
347        """ Revert previous transfer.
[9131]348        """
349
[7993]350class IUGStudentClearance(IKofaObject):
351    """Representation of undergraduate student clearance data.
[6631]352    """
[9543]353    officer_comment = schema.Text(
354        title = _(u"Officer's Comment"),
355        required = False,
[6631]356        )
357
[6769]358    clr_code = schema.TextLine(
[7723]359        title = _(u'CLR Activation Code'),
[6769]360        required = False,
[8977]361        readonly = False,
[6769]362        )
363
[9543]364    date_of_birth = FormattedDate(
365        title = _(u'Date of Birth'),
366        required = True,
367        show_year = True,
368        )
369
[7523]370    nationality = schema.Choice(
[8069]371        vocabulary = nats_vocab,
[7723]372        title = _(u'Nationality'),
[7983]373        required = False,
[7523]374        )
375
[7993]376class IPGStudentClearance(IUGStudentClearance):
377    """Representation of postgraduate student clearance data.
378    """
379    employer = schema.TextLine(
380        title = _(u'Employer'),
381        required = False,
382        readonly = False,
383        )
384
[7819]385class IStudentPersonal(IKofaObject):
[6631]386    """Representation of student personal data.
387    """
[9543]388    personal_updated = schema.Datetime(
389        title = _(u'Updated'),
390        required = False,
391        readonly = False,
392        )
393
[6651]394    perm_address = schema.Text(
[7723]395        title = _(u'Permanent Address'),
[6631]396        required = False,
397        )
398
[8008]399class IStudent(IStudentBase,IUGStudentClearance,IPGStudentClearance,
[15163]400    IStudentPersonal):
[6631]401    """Representation of a student.
402    """
403
[9563]404class IStudentPersonalEdit(IStudentPersonal):
405    """Interface for editing personal data by students.
406    Here we can repeat the fields from IStudentPersonal and set the
407    `required` if necessary.
408    """
409
410    perm_address = schema.Text(
411        title = _(u'Permanent Address'),
412        required = True,
413        )
414
[6849]415class IStudentUpdateByRegNo(IStudent):
416    """Representation of a student. Skip regular reg_number validation.
417    """
418    reg_number = schema.TextLine(
[7723]419        title = _(u'Registration Number'),
[6849]420        required = False,
421        )
422
423class IStudentUpdateByMatricNo(IStudent):
424    """Representation of a student. Skip regular matric_number validation.
425    """
426    matric_number = schema.TextLine(
[7723]427        title = _(u'Matriculation Number'),
[6849]428        required = False,
429        )
430
[8779]431class IStudentRequestPW(IStudent):
[12999]432    """Representation of a student for first-time password request.
[8779]433    This interface is used when students use the requestpw page to
434    login for the the first time.
435    """
[8854]436    number = schema.TextLine(
437        title = _(u'Registr. or Matric. Number'),
[8779]438        required = True,
439        )
440
441    email = schema.ASCIILine(
442        title = _(u'Email Address'),
443        required = True,
444        constraint=validate_email,
445        )
446
[7819]447class IStudentStudyCourse(IKofaObject):
[12999]448    """Representation of student study course data.
[6633]449    """
[13002]450    next_session_allowed = Attribute('True if the student can proceed to next session')
451    is_postgrad = Attribute('True if student is postgraduate student')
452    is_current = Attribute('True if the study course is the current course of studies')
453    is_previous = Attribute('True if the study course is the previous course of studies')
454
[6648]455    certificate = schema.Choice(
[7723]456        title = _(u'Certificate'),
[6648]457        source = CertificateSource(),
[7209]458        required = False,
[6633]459        )
[6635]460
[6996]461    entry_mode = schema.Choice(
[7723]462        title = _(u'Entry Mode'),
[7681]463        source = StudyModeSource(),
[6996]464        required = True,
465        readonly = False,
466        )
467
468    entry_session = schema.Choice(
[7723]469        title = _(u'Entry Session'),
[6996]470        source = academic_sessions_vocab,
[7425]471        #default = datetime.now().year,
[6996]472        required = True,
473        readonly = False,
474        )
475
[6724]476    current_session = schema.Choice(
[7723]477        title = _(u'Current Session'),
[6744]478        source = academic_sessions_vocab,
[6724]479        required = True,
[6996]480        readonly = False,
[6724]481        )
482
483    current_level = schema.Choice(
[7723]484        title = _(u'Current Level'),
[6725]485        source = StudyLevelSource(),
486        required = False,
[6996]487        readonly = False,
[6724]488        )
489
490    current_verdict = schema.Choice(
[7723]491        title = _(u'Current Verdict'),
[7619]492        source = VerdictSource(),
[8820]493        default = '0',
[6725]494        required = False,
[6724]495        )
496
497    previous_verdict = schema.Choice(
[7723]498        title = _(u'Previous Verdict'),
[7619]499        source = VerdictSource(),
[8820]500        default = '0',
[6725]501        required = False,
[6724]502        )
503
[13002]504    def addStudentStudyLevel(cert, studylevel):
505        """Add a study level object.
506        """
507
508    def getTranscriptData():
509        """Get a sorted list of dicts with level and course ticket data.
510        This method is used for transcripts.
511        """
512
[9138]513class IStudentStudyCourseTransfer(IStudentStudyCourse):
[12999]514    """An interface used for student transfers.
[9138]515    """
516    certificate = schema.Choice(
517        title = _(u'Certificate'),
518        source = CertificateSource(),
519        required = True,
520        )
521
522    current_level = schema.Choice(
523        title = _(u'Current Level'),
524        source = StudyLevelSource(),
525        required = True,
526        readonly = False,
527        )
528
[9960]529    entry_session = schema.Choice(
530        title = _(u'Entry Session'),
531        source = academic_sessions_vocab,
532        #default = datetime.now().year,
533        required = False,
534        readonly = False,
535        )
536
537
[9138]538IStudentStudyCourseTransfer['certificate'].order = IStudentStudyCourse[
539    'certificate'].order
540IStudentStudyCourseTransfer['current_level'].order = IStudentStudyCourse[
541    'current_level'].order
542
[7951]543class IStudentVerdictUpdate(IKofaObject):
544    """A interface for verdict imports.
545    """
546    current_verdict = schema.Choice(
547        title = _(u'Current Verdict'),
548        source = VerdictSource(),
549        required = True,
550        )
551
552    current_session = schema.Choice(
553        title = _(u'Current Session'),
554        source = academic_sessions_vocab,
555        required = True,
556        )
557
558    current_level = schema.Choice(
559        title = _(u'Current Level'),
560        source = StudyLevelSource(),
561        required = True,
562        )
563
[9296]564    bypass_validation = schema.Bool(
565        title = _(u'Bypass validation'),
566        required = False,
567        )
568
569    validated_by = schema.TextLine(
570        title = _(u'Validated by'),
571        required = False,
572        )
573
[7819]574class IStudentStudyLevel(IKofaObject):
[12999]575    """A representation of student study level data.
[6774]576    """
[13002]577    certcode = Attribute('The certificate code of the study course')
578    is_current_level = Attribute('True if level is current level of the student')
579    level_title = Attribute('Level title from source')
580    getSessionString = Attribute('Session title from source')
[9235]581    number_of_tickets = Attribute('Number of tickets contained in this level')
[10553]582    passed_params = Attribute('Information about passed and failed courses')
[13002]583    gpa_params_rectified = Attribute('Corrected sessional GPA parameters')
584    gpa_params = Attribute('GPA parameters for this level.')
[14247]585    cumulative_params = Attribute(
586        'Cumulative GPA and other cumulative parameters for this level')
587    course_registration_forbidden = Attribute(
588        'Return error message if course registration is forbidden')
[6774]589
[12873]590    level = schema.Choice(
591        title = _(u'Level'),
592        source = StudyLevelSource(),
593        required = True,
594        readonly = False,
595        )
596
[6793]597    level_session = schema.Choice(
[7723]598        title = _(u'Session'),
[6793]599        source = academic_sessions_vocab,
[9437]600        required = True,
[6793]601        )
[6781]602
[6793]603    level_verdict = schema.Choice(
[7723]604        title = _(u'Verdict'),
[7619]605        source = VerdictSource(),
[8820]606        default = '0',
[6793]607        required = False,
608        )
609
[9161]610    validated_by = schema.TextLine(
611        title = _(u'Validated by'),
612        default = None,
613        required = False,
614        )
615
616    validation_date = schema.Datetime(
617        title = _(u'Validation Date'),
618        required = False,
619        readonly = False,
620        )
621
[9690]622    total_credits = schema.Int(
623        title = _(u'Total Credits'),
624        required = False,
625        readonly = True,
626        )
627
[14574]628    gpa = schema.TextLine(
[10479]629        title = _(u'Unrectified GPA'),
630        required = False,
631        readonly = True,
632        )
[9690]633
[15333]634    transcript_remark = schema.TextLine(
635        title = _(u'Transcript Remark'),
636        required = False,
637        readonly = False,
638        )
639
[8920]640    def addCourseTicket(ticket, course):
[8182]641        """Add a course ticket object.
642        """
643
[9501]644    def addCertCourseTickets(cert):
645        """Collect all certificate courses and create course
646        tickets automatically.
647        """
648
[14684]649    def updateCourseTicket(ticket, course):
650        """Updates a course ticket object and return code
651        if ticket has been invalidated.
652        """
653
[7819]654class ICourseTicket(IKofaObject):
[12999]655    """A representation of course ticket data.
[6781]656    """
[13003]657    certcode = Attribute('Certificate code of the study course')
658    level_session = Attribute('Session of the study level the ticket has been added to')
659    level = Attribute('Level value of the study level the ticket has been added to')
[14133]660    total_score = Attribute('Score')
661    grade = Attribute('Grade calculated from total score')
662    weight = Attribute('Weight calculated from total score')
[13003]663    removable_by_student = Attribute('True if student is allowed to remove the ticket')
664    editable_by_lecturer = Attribute('True if lecturer is allowed to edit the ticket')
[6781]665
[13003]666    code = Attribute('Code of the original course')
667
[9420]668    title = schema.TextLine(
669        title = _(u'Title'),
670        required = False,
671        )
672
673    fcode = schema.TextLine(
674        title = _(u'Faculty Code'),
675        required = False,
676        )
677
678    dcode = schema.TextLine(
679        title = _(u'Department Code'),
680        required = False,
681        )
682
683    semester = schema.Choice(
684        title = _(u'Semester/Term'),
685        source = SemesterSource(),
686        required = False,
687        )
688
[15203]689    ticket_session = schema.Choice(
690        title = _(u'Imported Session'),
691        source = academic_sessions_vocab,
692        required = False,
693        )
694
[9420]695    passmark = schema.Int(
696        title = _(u'Passmark'),
697        required = False,
698        )
699
700    credits = schema.Int(
701        title = _(u'Credits'),
702        required = False,
703        )
704
[7665]705    mandatory = schema.Bool(
[9320]706        title = _(u'Required'),
[6795]707        default = False,
708        required = False,
709        )
710
[14574]711    outstanding = schema.Bool(
712        title = _(u'Outstanding Course'),
713        default = False,
714        required = False,
715        )
716
[14642]717    course_category = schema.Choice(
718        title = _(u'Course Category'),
719        source = CourseCategorySource(),
720        required = False,
721        )
722
[6781]723    score = schema.Int(
[7723]724        title = _(u'Score'),
[9684]725        default = None,
[6781]726        required = False,
[10637]727        missing_value = None,
[6781]728        )
729
[7661]730    carry_over = schema.Bool(
[7723]731        title = _(u'Carry-over Course'),
[7661]732        default = False,
733        required = False,
734        )
735
[9420]736    automatic = schema.Bool(
737        title = _(u'Automatical Creation'),
738        default = False,
[9316]739        required = False,
740        )
741
[9420]742class ICourseTicketAdd(IKofaObject):
[7150]743    """An interface for adding course tickets.
[6795]744    """
745    course = schema.Choice(
[7723]746        title = _(u'Course'),
[6795]747        source = CourseSource(),
748        readonly = False,
749        )
750
[9420]751class ICourseTicketImport(ICourseTicket):
752    """An interface for importing course results and nothing more.
753    """
754    score = schema.Int(
755        title = _(u'Score'),
756        required = False,
757        readonly = False,
758        )
759
760    level_session = schema.Choice(
761        title = _(u'Level Session'),
762        source = academic_sessions_vocab,
763        required = False,
764        readonly = False,
765        )
766
[7819]767class IStudentAccommodation(IKofaObject):
[6635]768    """A container for student accommodation objects.
769    """
770
[13457]771    desired_hostel = schema.TextLine(
772        title = _(u'Desired Hostel'),
773        required = False,
774        )
775
[9423]776    def addBedTicket(bedticket):
777        """Add a bed ticket object.
778        """
779
780
[7819]781class IBedTicket(IKofaObject):
[12999]782    """A representation of accommodation booking data.
[6989]783    """
[13314]784    bed = Attribute('The bed object')
785    maint_payment_made = Attribute('True if maintenance payment is made')
[6996]786
[13012]787    display_coordinates = schema.TextLine(
788        title = _(u'Allocated Bed'),
789        required = False,
790        readonly = True,
791        )
792
[6996]793    bed_coordinates = schema.TextLine(
[9984]794        title = u'',
[9423]795        required = True,
[7014]796        readonly = False,
[6992]797        )
798
[6996]799    bed_type = schema.TextLine(
[9424]800        title = _(u'Requested Bed Type'),
[9423]801        required = True,
[7014]802        readonly = False,
[6996]803        )
804
[6992]805    booking_session = schema.Choice(
[7723]806        title = _(u'Session'),
[6992]807        source = academic_sessions_vocab,
808        required = True,
[13316]809        readonly = False
[6992]810        )
811
[8170]812    booking_date = schema.Datetime(
[7723]813        title = _(u'Booking Date'),
[6992]814        required = False,
[13316]815        readonly = False,
[6992]816        )
817
818    booking_code = schema.TextLine(
[7723]819        title = _(u'Booking Activation Code'),
[6992]820        required = False,
[13316]821        readonly = False,
[6992]822        )
823
[6994]824    def getSessionString():
[13012]825        """Returns the title of academic_sessions_vocab term of the session
826        when the bed was booked.
[6994]827        """
[6992]828
[6860]829class IStudentPaymentsContainer(IPaymentsContainer):
[6635]830    """A container for student payment objects.
831    """
832
[13736]833    certificate = Attribute('Certificate to determine the correct p_level value')
834
[6877]835class IStudentOnlinePayment(IOnlinePayment):
836    """A student payment via payment gateways.
837    """
838
[13736]839    certificate = Attribute('Certificate to determine the correct p_level value')
[13871]840    student = Attribute('Student')
[13736]841
[9148]842    p_current = schema.Bool(
843        title = _(u'Current Session Payment'),
844        default = True,
845        required = False,
846        )
847
[13733]848    p_level = schema.Choice(
[8268]849        title = _(u'Payment Level'),
[13733]850        source = StudyLevelSource(),
[8268]851        required = False,
852        )
[6877]853
[13871]854    def redeemTicket():
855        """Either create an appropriate access code or trigger an action
856        directly.
857        """
858
[8422]859    def doAfterStudentPayment():
860        """Process student after payment was made.
861        """
862
[8453]863    def doAfterStudentPaymentApproval():
864        """Process student after payment was approved.
865        """
866
[8420]867    def approveStudentPayment():
[8422]868        """Approve payment and process student.
[8420]869        """
870
[8268]871IStudentOnlinePayment['p_level'].order = IStudentOnlinePayment[
872    'p_session'].order
[8408]873
[9864]874class IStudentPreviousPayment(IKofaObject):
[9148]875    """An interface for adding previous session payments.
876    """
877
[9864]878    p_category = schema.Choice(
879        title = _(u'Payment Category'),
880        default = u'schoolfee',
881        source = PreviousPaymentCategorySource(),
882        required = True,
883        )
884
[9148]885    p_session = schema.Choice(
886        title = _(u'Payment Session'),
887        source = academic_sessions_vocab,
888        required = True,
889        )
890
891    p_level = schema.Choice(
892        title = _(u'Payment Level'),
893        source = StudyLevelSource(),
894        required = True,
895        )
896
[9864]897class IStudentBalancePayment(IKofaObject):
898    """An interface for adding balances.
899    """
900
[9868]901    p_category = schema.Choice(
[9864]902        title = _(u'Payment Category'),
903        default = u'schoolfee',
904        required = True,
[9868]905        source = BalancePaymentCategorySource(),
[9864]906        )
907
908    balance_session = schema.Choice(
909        title = _(u'Payment Session'),
910        source = academic_sessions_vocab,
911        required = True,
912        )
913
914    balance_level = schema.Choice(
915        title = _(u'Payment Level'),
916        source = StudyLevelSource(),
917        required = True,
918        )
919
920    balance_amount = schema.Float(
921        title = _(u'Balance Amount'),
[9874]922        default = None,
[9864]923        required = True,
924        readonly = False,
925        description = _(
926            u'Balance in Naira '),
927        )
928
[8408]929class ICSVStudentExporter(ICSVExporter):
930    """A regular ICSVExporter that additionally supports exporting
931      data from a given student object.
932    """
[9801]933    def get_filtered(site, **kw):
[9797]934        """Get a filtered set of students.
935        """
[8408]936
[12518]937    def get_selected(site, selected):
938        """Get set of selected students.
939        """
940
[8408]941    def export_student(student, filepath=None):
942        """Export data for a given student.
943        """
[9734]944
[9797]945    def export_filtered(site, filepath=None, **kw):
[12518]946        """Export data for filtered set of students.
[9734]947        """
[12518]948
949    def export_selected(site, filepath=None, **kw):
950        """Export data for selected set of students.
951        """
Note: See TracBrowser for help on using the repository browser.