source: main/waeup.uniben/trunk/src/waeup/uniben/applicants/interfaces.py @ 18014

Last change on this file since 18014 was 18014, checked in by Henrik Bettermann, 8 hours ago

Revise DESTINATION_COST. Keep old items.

  • Property svn:keywords set to Id
File size: 29.1 KB
RevLine 
[13814]1# -*- coding: utf-8 -*-
[7853]2## $Id: interfaces.py 18014 2025-02-12 01:22:42Z henrik $
3##
4## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann
5## This program is free software; you can redistribute it and/or modify
6## it under the terms of the GNU General Public License as published by
7## the Free Software Foundation; either version 2 of the License, or
8## (at your option) any later version.
9##
10## This program is distributed in the hope that it will be useful,
11## but WITHOUT ANY WARRANTY; without even the implied warranty of
12## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13## GNU General Public License for more details.
14##
15## You should have received a copy of the GNU General Public License
16## along with this program; if not, write to the Free Software
17## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18##
19"""Customized interfaces of the university application package.
20"""
21
[13831]22#from grok import getSite
[17659]23import re
[8012]24from zope import schema
[16771]25from zope.interface import invariant, Invalid
[16152]26from zope.component import getUtility
27from zope.catalog.interfaces import ICatalog
[13814]28from zc.sourcefactory.basic import BasicSourceFactory
[8051]29from waeup.kofa.applicants.interfaces import (
[8053]30    IApplicantBaseData,
[8051]31    AppCatCertificateSource, CertificateSource)
[16078]32from waeup.kofa.university.vocabularies import StudyModeSource
33from waeup.kofa.students.vocabularies import (
34    nats_vocab, GenderSource, StudyLevelSource)
[8051]35from waeup.kofa.schoolgrades import ResultEntryField
[8530]36from waeup.kofa.interfaces import (
[13814]37    SimpleKofaVocabulary, academic_sessions_vocab, validate_email,
[16131]38    IKofaObject, ContextualDictSourceFactoryBase)
[13814]39from waeup.kofa.schema import FormattedDate, TextLineChoice, PhoneNumber
[15490]40from waeup.kofa.students.vocabularies import (
41    nats_vocab, GenderSource)
[14106]42from waeup.kofa.refereeentries import RefereeEntryField
[8530]43from waeup.kofa.applicants.interfaces import contextual_reg_num_source
[15490]44from kofacustom.nigeria.interfaces import DisabilitiesSource
[8928]45from kofacustom.nigeria.applicants.interfaces import (
46    LGASource, high_qual, high_grade, exam_types,
[14140]47    programme_types_vocab, jambsubjects,
[8928]48    INigeriaUGApplicant, INigeriaPGApplicant,
49    INigeriaApplicantOnlinePayment,
[9006]50    INigeriaUGApplicantEdit, INigeriaPGApplicantEdit,
51    INigeriaApplicantUpdateByRegNo,
52    IPUTMEApplicantEdit,
[14140]53    IBankAccount,
[8928]54    )
[8020]55from waeup.uniben.interfaces import MessageFactory as _
[8247]56from waeup.uniben.payments.interfaces import ICustomOnlinePayment
[7853]57
[17659]58
59# Define a validation method for JAMB reg numbers
60class NotMatricRegNumber(schema.ValidationError):
61    __doc__ = u"Invalid matriculation number"
62
63#: Regular expression to check matric_number formats.
64check_matric_number = re.compile(r"^[^0-9\s][^\s]*$").match
65
66def validate_matric_number(value):
67    if not check_matric_number(value):
68        raise NotMatricRegNumber(value)
69    return True
70
[16152]71class TranscriptCertificateSource(CertificateSource):
72    """Include Department and Faculty in Title.
73    """
74    def getValues(self, context):
75        catalog = getUtility(ICatalog, name='certificates_catalog')
76        resultset = catalog.searchResults(code=(None, None))
77        resultlist = sorted(resultset, key=lambda
78            value: value.__parent__.__parent__.__parent__.code +
79            value.__parent__.__parent__.code +
80            value.code)
81        return resultlist
[13814]82
[16152]83    def getTitle(self, context, value):
84        """
85        """
86        try: title = "%s / %s / %s (%s)" % (
87            value.__parent__.__parent__.__parent__.title,
88            value.__parent__.__parent__.title,
89            value.title, value.code)
90        except AttributeError:
91            title = "NA / %s (%s)" % (value.title, value.code)
92        return title
93
[13814]94REGISTRATION_CATS = {
95    'corporate': ('Corporate Registration', 250000, 1),
96    'group': ('Group Registration', 200000, 2),
97    'individual': ('Individual Registration', 45000, 3),
98    'student': ('Student Registration', 5000, 4),
[13824]99    'fullpage': ('Full Page Advert', 250000, 5),
100    'halfpage': ('Half Page Advert', 150000, 6),
101    'quarterpage': ('Quarter Page Advert', 100000, 7),
[13814]102    }
103
104class RegTypesSource(BasicSourceFactory):
105    """A source that delivers all kinds of registrations.
106    """
107    def getValues(self):
108        sorted_items = sorted(REGISTRATION_CATS.items(),
109                              key=lambda element: element[1][2])
110        return [item[0] for item in sorted_items]
111
112    def getTitle(self, value):
113        return u"%s @ ₦ %s" % (
114            REGISTRATION_CATS[value][0],
115            REGISTRATION_CATS[value][1])
116
[16131]117DESTINATION_COST = {
[16144]118    #'none': ('To the moon', 1000000000.0, 1),
[18014]119    'nigeria': ('Within Nigeria (deprecated)', 20000.0, 1),
120    'africa': ('Within Africa (deprecated)', 30000.0, 2),
121    'inter': ('International (deprecated)', 35000.0, 3),
122    'cert_nigeria': ('Certified Copy - Within Nigeria (deprecated)', 13000.0, 4),
123    'cert_africa': ('Certified Copy - Within Africa (deprecated)', 23000.0, 5),
124    'cert_inter': ('Certified Copy - International (deprecated)', 28000.0, 6),
125    'nigeria2': ('Local (Within Nigeria)', 25000.0, 1),
126    'inter2': ('International', 35000.0, 3),
[16131]127    }
128
129class DestinationCostSource(BasicSourceFactory):
130    """A source that delivers continents and shipment costs.
131    """
132    def getValues(self):
133        sorted_items = sorted(DESTINATION_COST.items(),
134                              key=lambda element: element[1][2])
135        return [item[0] for item in sorted_items]
136
[16151]137    def getToken(self, value):
138        return value
139
[16131]140    def getTitle(self, value):
141        return u"%s (₦ %s)" % (
142            DESTINATION_COST[value][0],
143            DESTINATION_COST[value][1])
144
[16151]145class OrderSource(BasicSourceFactory):
146    """
147    """
148    def getValues(self):
149        return ['o', 'c']
150
151    def getToken(self, value):
152        return value
153
154    def getTitle(self, value):
155        if value == 'o':
156            return _('Original')
157        if value == 'c':
158            return _('Certified True Copy')
159
[16804]160class ProficiencySource(BasicSourceFactory):
161    """
162    """
163    def getValues(self):
[16809]164        return ['n', 'c', 'p']
[16804]165
166    def getToken(self, value):
167        return value
168
169    def getTitle(self, value):
[16809]170        if value == 'n':
171            return _('none')
[16804]172        if value == 'c':
173            return _('conversational')
[16807]174        if value == 'p':
[16804]175            return _('professional')
176
[16807]177class PreferredSessionSource(BasicSourceFactory):
178    """
179    """
180    def getValues(self):
181        return ['m', 'e', 'w']
182
183    def getToken(self, value):
184        return value
185
186    def getTitle(self, value):
187        if value == 'm':
188            return _('morning')
189        if value == 'e':
190            return _('evening')
191        if value == 'w':
192            return _('weekend')
193
[13814]194class IUnibenRegistration(IKofaObject):
195    """A Uniben registrant.
196    """
197
198    suspended = schema.Bool(
199        title = _(u'Account suspended'),
200        default = False,
201        required = False,
202        )
203
204    locked = schema.Bool(
205        title = _(u'Form locked'),
206        default = False,
207        required = False,
208        )
209
210    applicant_id = schema.TextLine(
211        title = _(u'Registrant Id'),
212        required = False,
213        readonly = False,
214        )
215
216    firstname = schema.TextLine(
217        title = _(u'First Name'),
218        required = True,
219        )
220
221    middlename = schema.TextLine(
222        title = _(u'Middle Name'),
223        required = False,
224        )
225
226    lastname = schema.TextLine(
227        title = _(u'Last Name (Surname)'),
228        required = True,
229        )
230
[13819]231    sex = schema.Choice(
232        title = _(u'Sex'),
233        source = GenderSource(),
234        required = True,
[13814]235        )
236
237    nationality = schema.Choice(
238        vocabulary = nats_vocab,
239        title = _(u'Nationality'),
240        required = False,
241        )
242
243    email = schema.ASCIILine(
244        title = _(u'Email Address'),
245        required = True,
246        constraint=validate_email,
247        )
248
249    phone = PhoneNumber(
250        title = _(u'Phone'),
251        description = u'',
252        required = False,
253        )
254
[13819]255    #perm_address = schema.Text(
256    #    title = _(u'Current Local Address'),
257    #    required = False,
258    #    readonly = False,
259    #    )
260
261    institution = schema.TextLine(
262        title = _(u'Institution/Organisation'),
[13814]263        required = False,
264        readonly = False,
265        )
266
[13828]267    city = schema.TextLine(
268        title = _(u'City'),
269        required = False,
270        readonly = False,
271        )
272
[13819]273    lga = schema.Choice(
274        source = LGASource(),
275        title = _(u'State/LGA'),
276        required = False,
277        )
278
[13831]279    matric_number = schema.TextLine(
280        title = _(u'Uniben Matriculation Number'),
281        required = False,
282        readonly = False,
283        )
284
[13814]285    registration_cats = schema.List(
286        title = _(u'Registration Categories'),
287        value_type = schema.Choice(source=RegTypesSource()),
288        required = True,
[14020]289        defaultFactory=list,
[13814]290        )
291
[13831]292#    @invariant
293#    def matric_number_exists(applicant):
294#        if applicant.matric_number:
295#            catalog = getUtility(ICatalog, name='students_catalog')
296#            accommodation_session = getSite()['hostels'].accommodation_session
297#            student = catalog.searchResults(matric_number=(
298#                applicant.matric_number, applicant.matric_number))
299#            if len(student) != 1:
300#                raise Invalid(_("Matriculation number not found."))
[13814]301
[16078]302class ITranscriptApplicant(IKofaObject):
303    """A transcript applicant.
304    """
305
306    suspended = schema.Bool(
307        title = _(u'Account suspended'),
308        default = False,
309        required = False,
310        )
311
312    locked = schema.Bool(
313        title = _(u'Form locked'),
314        default = False,
315        required = False,
316        )
317
318    applicant_id = schema.TextLine(
[16131]319        title = _(u'Transcript Application Id'),
[16078]320        required = False,
321        readonly = False,
322        )
323
[16131]324    student_id = schema.TextLine(
325        title = _(u'Kofa Student Id'),
326        required = False,
[16078]327        readonly = False,
[16131]328        )
329
330    matric_number = schema.TextLine(
331        title = _(u'Matriculation Number'),
332        readonly = False,
[16078]333        required = True,
[17659]334        constraint = validate_matric_number,
[16078]335        )
336
337    firstname = schema.TextLine(
[16151]338        title = _(u'First Name in School'),
[16078]339        required = True,
340        )
341
342    middlename = schema.TextLine(
[16151]343        title = _(u'Middle Name in School'),
[16078]344        required = False,
345        )
346
347    lastname = schema.TextLine(
[16151]348        title = _(u'Surname in School'),
[16078]349        required = True,
350        )
351
352    date_of_birth = FormattedDate(
353        title = _(u'Date of Birth'),
[17597]354        required = False,
[16078]355        #date_format = u'%d/%m/%Y', # Use grok-instance-wide default
356        show_year = True,
357        )
358
359    sex = schema.Choice(
360        title = _(u'Gender'),
361        source = GenderSource(),
362        required = True,
363        )
364
[16151]365    #nationality = schema.Choice(
366    #    vocabulary = nats_vocab,
367    #    title = _(u'Nationality'),
368    #    required = False,
369    #    )
[16078]370
371    email = schema.ASCIILine(
372        title = _(u'Email Address'),
373        required = True,
374        constraint=validate_email,
375        )
376
377    phone = PhoneNumber(
378        title = _(u'Phone'),
379        description = u'',
380        required = False,
381        )
382
[16151]383    #perm_address = schema.Text(
384    #    title = _(u'Current Local Address'),
385    #    required = False,
386    #    readonly = False,
387    #    )
388
[16153]389    collected = schema.Bool(
390        title = _(u'Have you collected transcript before?'),
391        default = False,
[17597]392        required = False,
[16153]393        )
394
[16151]395    entry_session = schema.Choice(
396        title = _(u'Academic Session of Entry'),
397        source = academic_sessions_vocab,
[17597]398        required = False,
[16078]399        readonly = False,
400        )
401
[16151]402    end_session = schema.Choice(
403        title = _(u'Academic Session of Graduation'),
404        source = academic_sessions_vocab,
[17597]405        required = False,
[16078]406        readonly = False,
407        )
408
409    entry_mode = schema.Choice(
[16151]410        title = _(u'Mode of Entry'),
[16078]411        source = StudyModeSource(),
[17597]412        required = False,
[16078]413        readonly = False,
414        )
415
416    course_studied = schema.Choice(
[16151]417        title = _(u'Course of Study'),
[16152]418        source = TranscriptCertificateSource(),
[16201]419        description = u'Faculty / Department / Course',
[16376]420        required = True,
[16078]421        readonly = False,
422        )
423
424    course_changed = schema.Choice(
[16151]425        title = _(u'Change of Study Course / Transfer'),
[16078]426        description = u'If yes, select previous course of study.',
[16152]427        source = TranscriptCertificateSource(),
[16078]428        readonly = False,
429        required = False,
430        )
431
[16153]432    spillover_level = schema.Choice(
433        title = _(u'Spill-over'),
434        description = u'Any spill-over? If yes, select session of spill-over.',
435        source = academic_sessions_vocab,
436        required = False,
437        readonly = False,
438        )
[16151]439
440    purpose = schema.TextLine(
441        title = _(u'Transcript Purpose'),
[16078]442        required = False,
[16151]443        )
444
445    order = schema.Choice(
446        source = OrderSource(),
447        title = _(u'Type of Order'),
[17597]448        required = False,
[16151]449        )
450
451    dispatch_address = schema.Text(
452        title = _(u'Recipient Body'),
[17659]453        description = u'Addresses to which transcripts should be posted. '
[16151]454                       'All addresses must involve same courier charges.',
[16307]455        required = True,
[16078]456        readonly = False,
457        )
458
[17659]459    dispatch_email = schema.ASCIILine(
460        title = _(u'Recipient Email Address'),
461        required = False,
462        constraint=validate_email,
463        )
464
465    dispatch_phone = PhoneNumber(
466        title = _(u'Recipient Phone'),
467        description = u'',
468        required = False,
469        )
470
[16151]471    charge = schema.Choice(
[16182]472        title = _(u'Transcript Charge'),
[16151]473        source = DestinationCostSource(),
[17597]474        required = False,
[16198]475        readonly = False,
[16151]476        )
477
[16078]478    no_copies = schema.Choice(
479        title = _(u'Number of Copies'),
480        description = u'Must correspond with the number of dispatch addresses above.',
481        values=[1, 2, 3, 4],
[17597]482        required = False,
[16078]483        readonly = False,
484        default = 1,
485        )
486
[16471]487    courier_tno = schema.TextLine(
488        title = _(u'Courier Tracking Number'),
489        required = False,
490        )
491
492    proc_date = FormattedDate(
493        title = _(u'Processing Date'),
494        required = False,
495        #date_format = u'%d/%m/%Y', # Use grok-instance-wide default
496        show_year = True,
497        )
498
[16771]499    @invariant
500    def type_of_order(applicant):
[16775]501        if not applicant.collected and applicant.order != 'o':
502            raise Invalid(_("If you haven't collected transcript before, type of order must be 'original'."))
[16772]503        if applicant.order == 'o' and applicant.charge.startswith('cert_'):
504            raise Invalid(_("You've selected the wrong transcript charge."))
505        if applicant.order == 'c' and not applicant.charge.startswith('cert_'):
506            raise Invalid(_("You've selected the wrong transcript charge."))
[16471]507
[16804]508class IFrenchApplicant(IKofaObject):
509    """A transcript applicant.
510    """
[16771]511
[16804]512    suspended = schema.Bool(
513        title = _(u'Account suspended'),
514        default = False,
515        required = False,
516        )
517
518    locked = schema.Bool(
519        title = _(u'Form locked'),
520        default = False,
521        required = False,
522        )
523
524    applicant_id = schema.TextLine(
525        title = _(u'Applicant Id'),
526        required = False,
527        readonly = False,
528        )
529
530    firstname = schema.TextLine(
531        title = _(u'First Name'),
532        required = True,
533        )
534
535    middlename = schema.TextLine(
536        title = _(u'Middle Name'),
537        required = False,
538        )
539
540    lastname = schema.TextLine(
541        title = _(u'Surname'),
542        required = True,
543        )
544
545    date_of_birth = FormattedDate(
546        title = _(u'Date of Birth'),
547        required = False,
548        #date_format = u'%d/%m/%Y', # Use grok-instance-wide default
549        show_year = True,
550        )
551
552    sex = schema.Choice(
553        title = _(u'Gender'),
554        source = GenderSource(),
555        required = True,
556        )
557
558    nationality = schema.Choice(
559        vocabulary = nats_vocab,
560        title = _(u'Nationality'),
561        required = False,
562        )
563
564    email = schema.ASCIILine(
565        title = _(u'Email Address'),
566        required = True,
567        constraint=validate_email,
568        )
569
570    phone = PhoneNumber(
571        title = _(u'Phone'),
572        description = u'',
573        required = False,
574        )
575
576    work = schema.TextLine(
577        title = _(u'Place of Work'),
578        required = False,
579        )
580
581    hq_obtained = schema.Choice(
582        title = _(u'Highest Qualification Obtained'),
583        required = False,
584        readonly = False,
585        vocabulary = high_qual,
586        )
587
588    hq_date = FormattedDate(
589        title = _(u'Highest Qualification Date'),
590        required = False,
591        readonly = False,
592        show_year = True,
593        )
[16807]594
595    pref_session = schema.Choice(
596        source = PreferredSessionSource(),
597        title = _(u'Preferred Session'),
598        required = False,
599        )
600
[16804]601    proficiency = schema.Choice(
602        source = ProficiencySource(),
603        title = _(u'Level of Proficiency'),
604        required = False,
605        )
606
607    guarantor = schema.TextLine(
608        title = _(u'Name of Guarantor'),
609        required = False,
610        )
611
[16945]612    course_admitted = schema.Choice(
613        title = _(u'Admitted Course of Study'),
614        source = CertificateSource(),
615        required = False,
616        )
617
[17964]618class IAfrimalApplicant(IKofaObject):
619    """An AFRIMAL applicant.
620    """
621
622    suspended = schema.Bool(
623        title = _(u'Account suspended'),
624        default = False,
625        required = False,
626        )
627
628    locked = schema.Bool(
629        title = _(u'Form locked'),
630        default = False,
631        required = False,
632        )
633
634    applicant_id = schema.TextLine(
635        title = _(u'Applicant Id'),
636        required = False,
637        readonly = False,
638        )
639
640    firstname = schema.TextLine(
641        title = _(u'First Name'),
642        required = True,
643        )
644
645    middlename = schema.TextLine(
646        title = _(u'Middle Name'),
647        required = False,
648        )
649
650    lastname = schema.TextLine(
651        title = _(u'Surname'),
652        required = True,
653        )
654
655    date_of_birth = FormattedDate(
656        title = _(u'Date of Birth'),
657        required = False,
658        #date_format = u'%d/%m/%Y', # Use grok-instance-wide default
659        show_year = True,
660        )
661
662    sex = schema.Choice(
663        title = _(u'Gender'),
664        source = GenderSource(),
665        required = True,
666        )
667
668    nationality = schema.Choice(
669        vocabulary = nats_vocab,
670        title = _(u'Nationality'),
671        required = False,
672        )
673
674    email = schema.ASCIILine(
675        title = _(u'Email Address'),
676        required = True,
677        constraint=validate_email,
678        )
679
680    phone = PhoneNumber(
681        title = _(u'Phone'),
682        description = u'',
683        required = False,
684        )
685
686    hq_obtained = schema.Choice(
687        title = _(u'Highest Qualification Obtained'),
688        required = False,
689        readonly = False,
690        vocabulary = high_qual,
691        )
692
693    current_employer = schema.TextLine(
694        title = _(u'Current Employer'),
695        required = False,
696        )
697
698    course1 = schema.Choice(
699        title = _(u'Course of Study'),
700        source = AppCatCertificateSource(),
701        required = True,
702        )
703
704    course_admitted = schema.Choice(
705        title = _(u'Admitted Course of Study'),
706        source = CertificateSource(),
707        required = False,
708        )
709
[14140]710class ICustomUGApplicant(IApplicantBaseData, IBankAccount):
[8012]711    """An undergraduate applicant.
712
[8519]713    This interface defines the least common multiple of all fields
714    in ug application forms. In customized forms, fields can be excluded by
715    adding them to the UG_OMIT* tuples.
[8012]716    """
717
[15490]718    disabilities = schema.Choice(
719        title = _(u'Disabilities'),
720        source = DisabilitiesSource(),
721        required = False,
722        )
[14140]723    nationality = schema.Choice(
724        source = nats_vocab,
725        title = _(u'Nationality'),
726        required = False,
727        )
728    lga = schema.Choice(
729        source = LGASource(),
730        title = _(u'State/LGA (Nigerians only)'),
731        required = False,
732        )
733    #perm_address = schema.Text(
734    #    title = _(u'Permanent Address'),
735    #    required = False,
736    #    )
737    course1 = schema.Choice(
738        title = _(u'1st Choice Course of Study'),
739        source = AppCatCertificateSource(),
740        required = True,
741        )
742    course2 = schema.Choice(
743        title = _(u'2nd Choice Course of Study'),
744        source = AppCatCertificateSource(),
745        required = False,
746        )
747
748    programme_type = schema.Choice(
749        title = _(u'Programme Type'),
750        vocabulary = programme_types_vocab,
751        required = False,
752        )
753
754    hq_type = schema.Choice(
755        title = _(u'Qualification Obtained'),
756        required = False,
757        readonly = False,
758        vocabulary = high_qual,
759        )
760    hq_matric_no = schema.TextLine(
761        title = _(u'Former Matric Number'),
762        required = False,
763        readonly = False,
764        )
765    hq_degree = schema.Choice(
766        title = _(u'Class of Degree'),
767        required = False,
768        readonly = False,
769        vocabulary = high_grade,
770        )
771    hq_school = schema.TextLine(
772        title = _(u'Institution Attended'),
773        required = False,
774        readonly = False,
775        )
776    hq_session = schema.TextLine(
777        title = _(u'Years Attended'),
778        required = False,
779        readonly = False,
780        )
781    hq_disc = schema.TextLine(
782        title = _(u'Discipline'),
783        required = False,
784        readonly = False,
785        )
[14141]786    fst_sit_fname = schema.TextLine(
787        title = _(u'Full Name'),
788        required = False,
789        readonly = False,
790        )
791    fst_sit_no = schema.TextLine(
792        title = _(u'Exam Number'),
793        required = False,
794        readonly = False,
795        )
796    fst_sit_date = FormattedDate(
797        title = _(u'Exam Date'),
798        required = False,
799        readonly = False,
800        show_year = True,
801        )
802    fst_sit_type = schema.Choice(
803        title = _(u'Exam Type'),
804        required = False,
805        readonly = False,
806        vocabulary = exam_types,
807        )
808    fst_sit_results = schema.List(
809        title = _(u'Exam Results'),
810        value_type = ResultEntryField(),
811        required = False,
812        readonly = False,
813        defaultFactory=list,
814        )
815    scd_sit_fname = schema.TextLine(
816        title = _(u'Full Name'),
817        required = False,
818        readonly = False,
819        )
820    scd_sit_no = schema.TextLine(
821        title = _(u'Exam Number'),
822        required = False,
823        readonly = False,
824        )
825    scd_sit_date = FormattedDate(
826        title = _(u'Exam Date'),
827        required = False,
828        readonly = False,
829        show_year = True,
830        )
831    scd_sit_type = schema.Choice(
832        title = _(u'Exam Type'),
833        required = False,
834        readonly = False,
835        vocabulary = exam_types,
836        )
837    scd_sit_results = schema.List(
838        title = _(u'Exam Results'),
839        value_type = ResultEntryField(),
840        required = False,
841        readonly = False,
842        defaultFactory=list,
843        )
[17538]844    jamb_reg_number = schema.TextLine(
845        title = _(u'JAMB Registration Number'),
846        required = False,
847        )
[14140]848    jamb_subjects = schema.Text(
849        title = _(u'Subjects and Scores'),
850        required = False,
851        )
852    jamb_subjects_list = schema.List(
853        title = _(u'JAMB Subjects'),
854        required = False,
855        defaultFactory=list,
856        value_type = schema.Choice(
857            vocabulary = jambsubjects
858            #source = JAMBSubjectSource(),
859            ),
860        )
[16744]861    jamb_score = schema.Float(
[14140]862        title = _(u'Total JAMB Score'),
863        required = False,
864        )
865    #jamb_age = schema.Int(
866    #    title = _(u'Age (provided by JAMB)'),
867    #    required = False,
868    #    )
[17538]869    course_admitted = schema.Choice(
870        title = _(u'Admitted Course of Study'),
871        source = CertificateSource(),
[14140]872        required = False,
873        )
874    notice = schema.Text(
875        title = _(u'Notice'),
876        required = False,
877        )
878    screening_venue = schema.TextLine(
879        title = _(u'Screening Venue'),
880        required = False,
881        )
882    screening_date = schema.TextLine(
883        title = _(u'Screening Date'),
884        required = False,
885        )
[16744]886    screening_score = schema.Float(
[14140]887        title = _(u'Screening Score (%)'),
888        required = False,
889        )
[16744]890    aggregate = schema.Float(
[14140]891        title = _(u'Aggregate Score (%)'),
[16742]892        description = _(u'(average of relative JAMB and PUTME scores)'),
[14140]893        required = False,
894        )
895    result_uploaded = schema.Bool(
896        title = _(u'Result uploaded'),
897        default = False,
898        required = False,
899        )
900    student_id = schema.TextLine(
901        title = _(u'Student Id'),
902        required = False,
903        readonly = False,
904        )
905    locked = schema.Bool(
906        title = _(u'Form locked'),
907        default = False,
908        required = False,
909        )
910
911ICustomUGApplicant[
912    'locked'].order =  IApplicantBaseData['suspended'].order
913ICustomUGApplicant[
914    'result_uploaded'].order =  ICustomUGApplicant['suspended'].order
915
[8928]916class ICustomPGApplicant(INigeriaPGApplicant):
[7853]917    """A postgraduate applicant.
918
[8519]919    This interface defines the least common multiple of all fields
920    in pg application forms. In customized forms, fields can be excluded by
921    adding them to the PG_OMIT* tuples.
[7866]922    """
923
[14106]924    referees = schema.List(
925        title = _(u'Referees'),
926        value_type = RefereeEntryField(),
927        required = False,
928        defaultFactory=list,
929        )
[8012]930
[14106]931ICustomPGApplicant[
932    'referees'].order =  INigeriaPGApplicant['emp2_reason'].order
933
[13814]934class ICustomApplicant(ICustomUGApplicant, ICustomPGApplicant,
[17964]935    IUnibenRegistration, ITranscriptApplicant, IFrenchApplicant,
936    IAfrimalApplicant):
[8012]937    """An interface for both types of applicants.
938
[8928]939    Attention: The ICustomPGApplicant field seetings will be overwritten
940    by ICustomPGApplicant field settings. If a field is defined
[8727]941    in both interfaces zope.schema validates only against the
[8928]942    constraints in ICustomUGApplicant. This does not affect the forms
943    since they are build on either ICustomUGApplicant or ICustomPGApplicant.
[8012]944    """
945
[8743]946    def writeLogMessage(view, comment):
[8053]947        """Adds an INFO message to the log file
948        """
949
950    def createStudent():
[8668]951        """Create a student object from applicant data
[8053]952        and copy applicant object.
953        """
954
[14212]955class ICustomUGApplicantEdit(ICustomUGApplicant):
[8727]956    """An undergraduate applicant interface for edit forms.
[8012]957
958    Here we can repeat the fields from base data and set the
959    `required` and `readonly` attributes to True to further restrict
960    the data access. Or we can allow only certain certificates to be
961    selected by choosing the appropriate source.
962
963    We cannot omit fields here. This has to be done in the
964    respective form page.
965    """
966
[14212]967    email = schema.ASCIILine(
968        title = _(u'Email Address'),
969        required = True,
970        constraint=validate_email,
971        )
972    date_of_birth = FormattedDate(
973        title = _(u'Date of Birth'),
974        required = True,
975        show_year = True,
976        )
977
978ICustomUGApplicantEdit[
979    'date_of_birth'].order = ICustomUGApplicant['date_of_birth'].order
980ICustomUGApplicantEdit[
981    'email'].order = ICustomUGApplicant['email'].order
982
[9056]983class ICustomPGApplicantEdit(INigeriaPGApplicantEdit):
[7866]984    """A postgraduate applicant interface for editing.
985
986    Here we can repeat the fields from base data and set the
987    `required` and `readonly` attributes to True to further restrict
988    the data access. Or we can allow only certain certificates to be
989    selected by choosing the appropriate source.
990
991    We cannot omit fields here. This has to be done in the
992    respective form page.
[8017]993    """
[8454]994
[14106]995    referees = schema.List(
996        title = _(u'Referees'),
997        value_type = RefereeEntryField(),
998        required = False,
999        defaultFactory=list,
1000        )
[13814]1001
[14106]1002ICustomPGApplicantEdit[
1003    'referees'].order =  INigeriaPGApplicantEdit['emp2_reason'].order
1004
[8928]1005class ICustomApplicantOnlinePayment(INigeriaApplicantOnlinePayment):
[8247]1006    """An applicant payment via payment gateways.
1007
1008    """
[8530]1009
[14153]1010class IPUTMEApplicantEdit(ICustomUGApplicant):
[8530]1011    """An undergraduate applicant interface for editing.
1012
1013    Here we can repeat the fields from base data and set the
1014    `required` and `readonly` attributes to True to further restrict
1015    the data access. Or we can allow only certain certificates to be
1016    selected by choosing the appropriate source.
1017
1018    We cannot omit fields here. This has to be done in the
1019    respective form page.
1020    """
1021
[14153]1022    email = schema.ASCIILine(
1023        title = _(u'Email Address'),
1024        required = True,
1025        constraint=validate_email,
1026        )
1027    date_of_birth = FormattedDate(
1028        title = _(u'Date of Birth'),
1029        required = True,
1030        show_year = True,
1031        )
1032    nationality = schema.Choice(
1033        source = nats_vocab,
1034        title = _(u'Nationality'),
1035        required = True,
1036        )
1037
1038IPUTMEApplicantEdit[
1039    'date_of_birth'].order =  ICustomUGApplicant['date_of_birth'].order
1040IPUTMEApplicantEdit[
1041    'email'].order =  ICustomUGApplicant['email'].order
1042IPUTMEApplicantEdit[
1043    'nationality'].order =  ICustomUGApplicant['nationality'].order
1044
[9056]1045class ICustomApplicantUpdateByRegNo(INigeriaApplicantUpdateByRegNo):
[8582]1046    """Representation of an applicant.
1047
1048    Skip regular reg_number validation if reg_number is used for finding
1049    the applicant object.
1050    """
Note: See TracBrowser for help on using the repository browser.