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

Last change on this file since 17973 was 17964, checked in by Henrik Bettermann, 4 weeks ago

Implement African Institute of management and Leadership application.

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