source: main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/applicants/interfaces.py @ 15492

Last change on this file since 15492 was 15489, checked in by Henrik Bettermann, 6 years ago

Add disabilites field.

  • Property svn:keywords set to Id
File size: 24.1 KB
RevLine 
[8926]1## $Id: interfaces.py 15489 2019-07-09 06:09:29Z henrik $
2##
3## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann
4## This program is free software; you can redistribute it and/or modify
5## it under the terms of the GNU General Public License as published by
6## the Free Software Foundation; either version 2 of the License, or
7## (at your option) any later version.
8##
9## This program is distributed in the hope that it will be useful,
10## but WITHOUT ANY WARRANTY; without even the implied warranty of
11## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12## GNU General Public License for more details.
13##
14## You should have received a copy of the GNU General Public License
15## along with this program; if not, write to the Free Software
16## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17##
18"""Customized interfaces of the university application package.
19"""
20
21from zope import schema
[13160]22from zope.component import getUtility
[13277]23from zope.schema import getFields
[8926]24from waeup.kofa.applicants.interfaces import (
[9049]25    contextual_reg_num_source,
[8926]26    IApplicantBaseData,
27    AppCatCertificateSource, CertificateSource)
28from waeup.kofa.schoolgrades import ResultEntryField
29from waeup.kofa.interfaces import (
[13160]30    SimpleKofaVocabulary,
31    academic_sessions_vocab,
32    validate_email,
33    SubjectSource,
[14003]34    IKofaUtils,
35    IKofaObject)
[8926]36from waeup.kofa.schema import FormattedDate, TextLineChoice
37from waeup.kofa.students.vocabularies import nats_vocab, GenderSource
38from kofacustom.nigeria.interfaces import (
[15489]39    LGASource, DisabilitiesSource,
40    high_qual, high_grade, exam_types, validate_jamb_reg_number)
[8926]41from kofacustom.nigeria.interfaces import MessageFactory as _
42from kofacustom.nigeria.payments.interfaces import INigeriaOnlinePayment
43
[13554]44programme_types_vocab = SimpleKofaVocabulary(
45    (_('Post UTME'), 'putme'),
46    (_('Post DE'), 'pude'),
[13945]47    (_('Admission Screening Exercise'), 'ase'),
[13554]48    (_('not applicable'), 'na'),
49    )
50
[13160]51jambsubjects = SimpleKofaVocabulary(
52    (_('Use of English'),'english_language'),
53    (_('Agricultural Science'),'agricultural_science'),
54    (_('Arabic'),'arabic'),
55    (_('Biology'),'biology'),
56    (_('Book Keeping'),'book_keeping'),
57    (_('Chemistry'),'chemistry'),
58    (_('Christian Religious Studies'),'christian_religious_studies'),
59    (_('Commerce'),'commerce'),
60    (_('Economics'),'economics'),
61    (_('Financial Accounting'),'financial_accounting'),
62    (_('Fine Art'),'fine_art'),
63    (_('Food and Nutrition'),'food_and_nutrition'),
64    (_('French'),'french'),
65    (_('Geography'),'geography'),
66    (_('German'),'german'),
67    (_('Government'),'government'),
68    (_('Hausa'),'hausa'),
69    (_('Home Economics'),'home_economics'),
70    (_('History'),'history'),
71    (_('Igbo'),'igbo'),
72    (_('Literature in English'),'literature_in_english'),
73    (_('Literature in Nigerian Languages'),'literature_in_nigerian_languages'),
74    (_('Mathematics'),'mathematics'),
75    (_('Music'),'music'),
76    (_('Physics'),'physics'),
77    (_('Yoruba'),'yoruba'),
78    )
79
[13163]80# Define a validation method for jamb subjects
81class NotExactNumberOfItems(schema.ValidationError):
82    __doc__ = u"Not exactly 4 items selected."
83
84def four_items(value):
[13561]85    if len(value) and len(value) != 4:
[13163]86        raise NotExactNumberOfItems(value)
87    return True
88
[13160]89class JAMBSubjectSource(SubjectSource):
90    """A source for school subjects used in exam documentation.
91    """
92
93    def getTitle(self, value):
94        subjects_dict = getUtility(IKofaUtils).EXAM_SUBJECTS_DICT
95        return "%s" % subjects_dict[value]
96
[9049]97# Fields to be omitted in all display forms. course_admitted is
[9072]98# rendered separately.
[9049]99
100OMIT_DISPLAY_FIELDS = ('locked', 'course_admitted',
[14045]101    'result_uploaded', 'suspended', 'special_application',
102    'bank_account_number',
103    'bank_account_name',
104    'bank_name')
[9049]105
106# UG students are all undergraduate students.
[13554]107UG_OMIT_DISPLAY_FIELDS = OMIT_DISPLAY_FIELDS + (
108    'jamb_subjects_list', 'programme_type')
[9073]109UG_OMIT_PDF_FIELDS = UG_OMIT_DISPLAY_FIELDS + ('phone',)
[13554]110UG_OMIT_MANAGE_FIELDS = (
111    'special_application',
112    'jamb_subjects_list',
113    'programme_type')
[9049]114UG_OMIT_EDIT_FIELDS = UG_OMIT_MANAGE_FIELDS + OMIT_DISPLAY_FIELDS + (
[13142]115    'student_id',
116    'notice',
117    'screening_score',
118    'screening_venue',
119    'screening_date',
[13160]120    'jamb_age',
[13142]121    'jamb_subjects',
122    'jamb_score',
123    'jamb_reg_number',
124    'aggregate')
[9049]125
[13142]126# CBT is a subgroup of UG with the same interface.
127CBT_OMIT_FIELDS = (
128    'hq_type', 'hq_matric_no',
129    'hq_degree', 'hq_school',
[13157]130    'hq_session', 'hq_disc',
[13554]131    'aggregate', 'jamb_subjects',
[14045]132    'programme_type')
[13142]133CBT_OMIT_DISPLAY_FIELDS = OMIT_DISPLAY_FIELDS + CBT_OMIT_FIELDS
[13160]134CBT_OMIT_MANAGE_FIELDS = CBT_OMIT_FIELDS + ('special_application',)
135CBT_OMIT_EDIT_FIELDS = OMIT_DISPLAY_FIELDS + CBT_OMIT_FIELDS + (
136    'special_application',
[13142]137    'student_id',
138    'notice',
139    'screening_score',
140    'screening_venue',
141    'screening_date',
142    #'jamb_age',
143    #'jamb_subjects',
144    #'jamb_score',
145    #'jamb_reg_number',
[13157]146    )
[13142]147CBT_OMIT_PDF_FIELDS = CBT_OMIT_DISPLAY_FIELDS + ('phone',)
148
[13551]149# AFFIL is a subgroup of UG with the same interface.
150AFFIL_OMIT_FIELDS = (
151    'hq_type', 'hq_matric_no',
152    'hq_degree', 'hq_school',
153    'hq_session', 'hq_disc',
[14045]154    'jamb_subjects')
[13551]155AFFIL_OMIT_DISPLAY_FIELDS = OMIT_DISPLAY_FIELDS + AFFIL_OMIT_FIELDS
156AFFIL_OMIT_MANAGE_FIELDS = AFFIL_OMIT_FIELDS + ('special_application',)
157AFFIL_OMIT_EDIT_FIELDS = OMIT_DISPLAY_FIELDS + AFFIL_OMIT_FIELDS + (
158    'special_application',
159    'student_id',
160    'notice',
161    'screening_score',
162    'screening_venue',
163    'screening_date',
[13744]164    'aggregate',
[13551]165    )
[13559]166AFFIL_OMIT_PDF_FIELDS = AFFIL_OMIT_DISPLAY_FIELDS + ('phone',)
[13551]167
[9049]168# PUTME is a subgroup of UG with the same interface.
169PUTME_OMIT_FIELDS = (
170    'hq_type', 'hq_matric_no',
171    'hq_degree', 'hq_school',
[13554]172    'hq_session', 'hq_disc',
173    'jamb_subjects_list', 'programme_type')
[14045]174
[14828]175PUTME_OMIT_DISPLAY_FIELDS = OMIT_DISPLAY_FIELDS + PUTME_OMIT_FIELDS
176
[14045]177# temporary solution to display bank account fields only
178# for PUTME (ase) application
[14828]179#PUTME_OMIT_DISPLAY_FIELDS = (
180#    'locked', 'course_admitted', 'result_uploaded',
181#    'suspended', 'special_application') + PUTME_OMIT_FIELDS
[14045]182
[9049]183PUTME_OMIT_MANAGE_FIELDS = UG_OMIT_MANAGE_FIELDS + PUTME_OMIT_FIELDS
[14046]184
[14828]185PUTME_OMIT_EDIT_FIELDS = UG_OMIT_EDIT_FIELDS + PUTME_OMIT_FIELDS + (
186    'firstname', 'middlename', 'lastname', 'sex',
187    'course1', 'lga')
188
[14046]189# temporary solution to display bank account fields only
190# for PUTME (ase) application
[14828]191#PUTME_OMIT_EDIT_FIELDS = UG_OMIT_MANAGE_FIELDS  + (
192#    'locked', 'course_admitted', 'result_uploaded',
193#    'suspended', 'special_application',
194#    'student_id',
195#    'notice',
196#    'screening_score',
197#    'screening_venue',
198#    'screening_date',
199#    'jamb_age',
200#    'jamb_subjects',
201#    'jamb_score',
202#    'jamb_reg_number',
203#    'aggregate',
[14046]204#    'firstname', 'middlename', 'lastname', 'sex',
[14828]205#    'course1', 'lga') + PUTME_OMIT_FIELDS
[14046]206
[9073]207PUTME_OMIT_PDF_FIELDS = PUTME_OMIT_DISPLAY_FIELDS + ('phone',)
[9049]208PUTME_OMIT_RESULT_SLIP_FIELDS = PUTME_OMIT_DISPLAY_FIELDS + (
[9073]209    'phone',
[8926]210    'date_of_birth', 'sex',
[9072]211    'nationality', 'lga', #'perm_address',
[9049]212    'course2', 'screening_venue',
[8926]213    'screening_date')
214
[9054]215# PUDE is a subgroup of UG with the same interface.
216PUDE_OMIT_FIELDS = (
[13554]217    'jamb_subjects',
218    'jamb_score',
219    'jamb_age',
220    'aggregate',
221    'jamb_subjects_list',
[14045]222    'programme_type')
[9054]223PUDE_OMIT_DISPLAY_FIELDS = OMIT_DISPLAY_FIELDS + PUDE_OMIT_FIELDS
224PUDE_OMIT_MANAGE_FIELDS = UG_OMIT_MANAGE_FIELDS + PUDE_OMIT_FIELDS
225PUDE_OMIT_EDIT_FIELDS = set(UG_OMIT_EDIT_FIELDS + PUDE_OMIT_FIELDS + (
226    'firstname', 'middlename', 'lastname', 'sex',
227    'course1', 'lga'))
[9073]228PUDE_OMIT_PDF_FIELDS = PUDE_OMIT_DISPLAY_FIELDS + ('phone',)
[9054]229PUDE_OMIT_RESULT_SLIP_FIELDS = PUDE_OMIT_DISPLAY_FIELDS + (
[9073]230    'phone',
[9054]231    'date_of_birth', 'sex',
[9072]232    'nationality', 'lga', #'perm_address',
[9054]233    'course2', 'screening_venue',
234    'screening_date')
235
[9049]236# PG has its own interface
237PG_OMIT_DISPLAY_FIELDS = OMIT_DISPLAY_FIELDS
[9073]238PG_OMIT_PDF_FIELDS = PG_OMIT_DISPLAY_FIELDS + ('phone',)
[10851]239PG_OMIT_MANAGE_FIELDS = ('special_application',)
[9107]240PG_OMIT_EDIT_FIELDS = PG_OMIT_MANAGE_FIELDS + PG_OMIT_DISPLAY_FIELDS + (
[9159]241    'student_id', 'notice',
242    'screening_score', 'screening_venue',
243    'screening_date',)
[8926]244
[14003]245class IBankAccount(IKofaObject):
246
247    bank_name = schema.TextLine(
248        title = _(u'Bank Name'),
249        required = False,
250        readonly = False,
251        )
252
253    bank_account_name = schema.TextLine(
254        title = _(u'Bank Account Name'),
255        required = False,
256        readonly = False,
257        )
258
259    bank_account_number = schema.TextLine(
260        title = _(u'Bank Account Number'),
261        required = False,
262        readonly = False,
263        )
264
265class INigeriaUGApplicant(IApplicantBaseData, IBankAccount):
[8926]266    """An undergraduate applicant.
267
268    This interface defines the least common multiple of all fields
269    in ug application forms. In customized forms, fields can be excluded by
270    adding them to the UG_OMIT* tuples.
271    """
[10592]272
[15489]273    disabilities = schema.Choice(
274        title = _(u'Disabilities'),
275        source = DisabilitiesSource(),
276        required = False,
277        )
[8926]278    nationality = schema.Choice(
279        source = nats_vocab,
280        title = _(u'Nationality'),
[10386]281        required = False,
[8926]282        )
283    lga = schema.Choice(
284        source = LGASource(),
285        title = _(u'State/LGA (Nigerians only)'),
286        required = False,
287        )
[9072]288    #perm_address = schema.Text(
289    #    title = _(u'Permanent Address'),
290    #    required = False,
291    #    )
[8926]292    course1 = schema.Choice(
293        title = _(u'1st Choice Course of Study'),
294        source = AppCatCertificateSource(),
[10592]295        required = True,
[8926]296        )
297    course2 = schema.Choice(
298        title = _(u'2nd Choice Course of Study'),
299        source = AppCatCertificateSource(),
300        required = False,
301        )
[13555]302
303    programme_type = schema.Choice(
304        title = _(u'Programme Type'),
305        vocabulary = programme_types_vocab,
306        required = False,
307        )
308
[9049]309    hq_type = schema.Choice(
310        title = _(u'Qualification Obtained'),
311        required = False,
312        readonly = False,
313        vocabulary = high_qual,
314        )
315    hq_matric_no = schema.TextLine(
316        title = _(u'Former Matric Number'),
317        required = False,
318        readonly = False,
319        )
320    hq_degree = schema.Choice(
321        title = _(u'Class of Degree'),
322        required = False,
323        readonly = False,
324        vocabulary = high_grade,
325        )
326    hq_school = schema.TextLine(
327        title = _(u'Institution Attended'),
328        required = False,
329        readonly = False,
330        )
331    hq_session = schema.TextLine(
332        title = _(u'Years Attended'),
333        required = False,
334        readonly = False,
335        )
336    hq_disc = schema.TextLine(
337        title = _(u'Discipline'),
338        required = False,
339        readonly = False,
340        )
[8926]341    jamb_subjects = schema.Text(
342        title = _(u'Subjects and Scores'),
343        required = False,
344        )
[13160]345    jamb_subjects_list = schema.List(
346        title = _(u'JAMB Subjects'),
347        required = False,
[14010]348        defaultFactory=list,
[13160]349        value_type = schema.Choice(
350            vocabulary = jambsubjects
351            #source = JAMBSubjectSource(),
352            ),
353        )
[8926]354    jamb_score = schema.Int(
[9462]355        title = _(u'Total JAMB Score'),
[8926]356        required = False,
357        )
[13142]358    #jamb_age = schema.Int(
359    #    title = _(u'Age (provided by JAMB)'),
360    #    required = False,
361    #    )
362    jamb_reg_number = schema.TextLine(
363        title = _(u'JAMB Registration Number'),
[11740]364        required = False,
[15045]365        constraint=validate_jamb_reg_number,
[11740]366        )
[8926]367    notice = schema.Text(
368        title = _(u'Notice'),
369        required = False,
370        )
371    screening_venue = schema.TextLine(
372        title = _(u'Screening Venue'),
373        required = False,
374        )
375    screening_date = schema.TextLine(
376        title = _(u'Screening Date'),
377        required = False,
378        )
379    screening_score = schema.Int(
380        title = _(u'Screening Score (%)'),
381        required = False,
382        )
383    aggregate = schema.Int(
384        title = _(u'Aggregate Score (%)'),
385        description = _(u'(average of relative JAMB and PUTME scores)'),
386        required = False,
387        )
388    result_uploaded = schema.Bool(
389        title = _(u'Result uploaded'),
390        default = False,
[10385]391        required = False,
[8926]392        )
393    student_id = schema.TextLine(
394        title = _(u'Student Id'),
395        required = False,
396        readonly = False,
397        )
398    course_admitted = schema.Choice(
399        title = _(u'Admitted Course of Study'),
400        source = CertificateSource(),
401        required = False,
402        )
403    locked = schema.Bool(
404        title = _(u'Form locked'),
405        default = False,
[10385]406        required = False,
[8926]407        )
408
[10365]409INigeriaUGApplicant[
410    'locked'].order =  IApplicantBaseData['suspended'].order
411INigeriaUGApplicant[
412    'result_uploaded'].order =  INigeriaUGApplicant['suspended'].order
413
[8926]414class INigeriaPGApplicant(IApplicantBaseData):
415    """A postgraduate applicant.
416
417    This interface defines the least common multiple of all fields
418    in pg application forms. In customized forms, fields can be excluded by
419    adding them to the PG_OMIT* tuples.
420    """
421
422    nationality = schema.Choice(
423        source = nats_vocab,
424        title = _(u'Nationality'),
[9449]425        required = True,
[8926]426        )
427    lga = schema.Choice(
428        source = LGASource(),
429        title = _(u'State/LGA (Nigerians only)'),
430        required = False,
431        )
[9072]432    #perm_address = schema.Text(
433    #    title = _(u'Permanent Address'),
434    #    required = False,
435    #    )
[8926]436    course1 = schema.Choice(
437        title = _(u'1st Choice Course of Study'),
438        source = AppCatCertificateSource(),
439        required = True,
440        )
441    course2 = schema.Choice(
442        title = _(u'2nd Choice Course of Study'),
443        source = AppCatCertificateSource(),
444        required = False,
445        )
446    hq_type = schema.Choice(
447        title = _(u'Qualification Obtained'),
448        required = False,
449        readonly = False,
450        vocabulary = high_qual,
451        )
[13290]452    hq_fname = schema.TextLine(
453        title = _(u'Full Name'),
454        required = False,
455        readonly = False,
456        )
[8926]457    hq_matric_no = schema.TextLine(
458        title = _(u'Former Matric Number'),
459        required = False,
460        readonly = False,
461        )
462    hq_degree = schema.Choice(
463        title = _(u'Class of Degree'),
464        required = False,
465        readonly = False,
466        vocabulary = high_grade,
467        )
468    hq_school = schema.TextLine(
469        title = _(u'Institution Attended'),
470        required = False,
471        readonly = False,
472        )
473    hq_session = schema.TextLine(
474        title = _(u'Years Attended'),
475        required = False,
476        readonly = False,
477        )
478    hq_disc = schema.TextLine(
479        title = _(u'Discipline'),
480        required = False,
481        readonly = False,
482        )
[13140]483    fst_sit_fname = schema.TextLine(
484        title = _(u'Full Name'),
[8926]485        required = False,
486        readonly = False,
[13140]487        )
488    fst_sit_no = schema.TextLine(
489        title = _(u'Exam Number'),
490        required = False,
491        readonly = False,
492        )
493    fst_sit_date = FormattedDate(
494        title = _(u'Exam Date'),
495        required = False,
496        readonly = False,
497        show_year = True,
498        )
499    fst_sit_type = schema.Choice(
500        title = _(u'Exam Type'),
501        required = False,
502        readonly = False,
[8926]503        vocabulary = exam_types,
504        )
[13140]505    fst_sit_results = schema.List(
506        title = _(u'Exam Results'),
507        value_type = ResultEntryField(),
508        required = False,
509        readonly = False,
[14010]510        defaultFactory=list,
[13140]511        )
512    scd_sit_fname = schema.TextLine(
513        title = _(u'Full Name'),
514        required = False,
515        readonly = False,
516        )
517    scd_sit_no = schema.TextLine(
518        title = _(u'Exam Number'),
519        required = False,
520        readonly = False,
521        )
522    scd_sit_date = FormattedDate(
523        title = _(u'Exam Date'),
524        required = False,
525        readonly = False,
526        show_year = True,
527        )
528    scd_sit_type = schema.Choice(
529        title = _(u'Exam Type'),
530        required = False,
531        readonly = False,
532        vocabulary = exam_types,
533        )
534    scd_sit_results = schema.List(
535        title = _(u'Exam Results'),
536        value_type = ResultEntryField(),
537        required = False,
538        readonly = False,
[14010]539        defaultFactory=list,
[13140]540        )
541    # Replaced by first and second sitting
542    #pp_school = schema.Choice(
543    #    title = _(u'Qualification Obtained'),
544    #    required = False,
545    #    readonly = False,
546    #    vocabulary = exam_types,
547    #    )
[8926]548    presently_inst = schema.TextLine(
549        title = _(u'If yes, name of institution'),
550        required = False,
551        readonly = False,
552        )
553    nysc_year = schema.Int(
554        title = _(u'Nysc Year'),
555        required = False,
556        readonly = False,
557        )
558    nysc_lga = schema.Choice(
559        source = LGASource(),
560        title = _(u'Nysc Location'),
561        required = False,
562        )
563    employer = schema.TextLine(
564        title = _(u'Employer'),
565        required = False,
566        readonly = False,
567        )
568    emp_position = schema.TextLine(
569        title = _(u'Employer Position'),
570        required = False,
571        readonly = False,
572        )
573    emp_start = FormattedDate(
574        title = _(u'Start Date'),
575        required = False,
576        readonly = False,
577        show_year = True,
578        )
579    emp_end = FormattedDate(
580        title = _(u'End Date'),
581        required = False,
582        readonly = False,
583        show_year = True,
584        )
585    emp_reason = schema.TextLine(
586        title = _(u'Reason for Leaving'),
587        required = False,
588        readonly = False,
589        )
590    employer2 = schema.TextLine(
591        title = _(u'2nd Employer'),
592        required = False,
593        readonly = False,
594        )
595    emp2_position = schema.TextLine(
596        title = _(u'2nd Employer Position'),
597        required = False,
598        readonly = False,
599        )
600    emp2_start = FormattedDate(
601        title = _(u'Start Date'),
602        required = False,
603        readonly = False,
604        show_year = True,
605        )
606    emp2_end = FormattedDate(
607        title = _(u'End Date'),
608        required = False,
609        readonly = False,
610        show_year = True,
611        )
612    emp2_reason = schema.TextLine(
613        title = _(u'Reason for Leaving'),
614        required = False,
615        readonly = False,
616        )
617    notice = schema.Text(
618        title = _(u'Notice'),
619        required = False,
620        readonly = False,
621        )
[9159]622    screening_venue = schema.TextLine(
623        title = _(u'Screening Venue'),
624        required = False,
625        )
626    screening_date = schema.TextLine(
627        title = _(u'Screening Date'),
628        required = False,
629        )
630    screening_score = schema.Int(
631        title = _(u'Screening Score (%)'),
632        required = False,
633        )
[8926]634    student_id = schema.TextLine(
635        title = _(u'Student Id'),
636        required = False,
637        readonly = False,
638        )
639    course_admitted = schema.Choice(
640        title = _(u'Admitted Course of Study'),
641        source = CertificateSource(),
642        required = False,
643        readonly = False,
644        )
645    locked = schema.Bool(
646        title = _(u'Form locked'),
647        default = False,
[10385]648        required = False,
[8926]649        )
650
[10365]651INigeriaPGApplicant[
652    'locked'].order =  IApplicantBaseData['suspended'].order
653
[13277]654# PRE is used by Uniben
655#  med: "it is as named... PRE - DEGREE... much like a 1 year diploma programme"
656PRE_OMIT_FIELDS = tuple([
657    i for i in getFields(INigeriaPGApplicant).keys()
[14096]658        if i[:3] in ('hq_', 'emp', 'nys')]) + ('referees',)
[13277]659PRE_OMIT_DISPLAY_FIELDS = OMIT_DISPLAY_FIELDS + PRE_OMIT_FIELDS
660PRE_OMIT_MANAGE_FIELDS = PG_OMIT_MANAGE_FIELDS + PRE_OMIT_FIELDS
661PRE_OMIT_EDIT_FIELDS = set(PG_OMIT_EDIT_FIELDS + PRE_OMIT_FIELDS)
662PRE_OMIT_PDF_FIELDS = PRE_OMIT_DISPLAY_FIELDS
663PRE_OMIT_RESULT_SLIP_FIELDS = PRE_OMIT_DISPLAY_FIELDS
664
[8926]665class INigeriaApplicant(INigeriaUGApplicant, INigeriaPGApplicant):
666    """An interface for both types of applicants.
667
668    Attention: The INigeriaPGApplicant field seetings will be overwritten
669    by INigeriaPGApplicant field settings. If a field is defined
670    in both interfaces zope.schema validates only against the
671    constraints in INigeriaUGApplicant. This does not affect the forms
672    since they are build on either INigeriaUGApplicant or INigeriaPGApplicant.
673    """
674
675    def writeLogMessage(view, comment):
676        """Adds an INFO message to the log file
677        """
678
679    def createStudent():
680        """Create a student object from applicant data
681        and copy applicant object.
682        """
683
684class INigeriaUGApplicantEdit(INigeriaUGApplicant):
685    """An undergraduate applicant interface for edit forms.
686
687    Here we can repeat the fields from base data and set the
688    `required` and `readonly` attributes to True to further restrict
689    the data access. Or we can allow only certain certificates to be
690    selected by choosing the appropriate source.
691
692    We cannot omit fields here. This has to be done in the
693    respective form page.
694    """
695
696    email = schema.ASCIILine(
697        title = _(u'Email Address'),
698        required = True,
699        constraint=validate_email,
700        )
701    date_of_birth = FormattedDate(
702        title = _(u'Date of Birth'),
703        required = True,
704        show_year = True,
705        )
[13160]706    jamb_subjects_list = schema.List(
707        title = _(u'JAMB Subjects'),
708        description = _(u'Select four subjects.'),
[13155]709        required = True,
[13163]710        constraint = four_items,
[13160]711        value_type = schema.Choice(
712            vocabulary = jambsubjects
713            #source = JAMBSubjectSource(),
714            ),
[13155]715        )
[8926]716
717INigeriaUGApplicantEdit[
[13155]718    'date_of_birth'].order = INigeriaUGApplicant['date_of_birth'].order
[8926]719INigeriaUGApplicantEdit[
[13155]720    'email'].order = INigeriaUGApplicant['email'].order
721INigeriaUGApplicantEdit[
[13160]722    'jamb_subjects_list'].order = INigeriaUGApplicant['jamb_subjects_list'].order
[8926]723
724class INigeriaPGApplicantEdit(INigeriaPGApplicant):
725    """A postgraduate applicant interface for editing.
726
727    Here we can repeat the fields from base data and set the
728    `required` and `readonly` attributes to True to further restrict
729    the data access. Or we can allow only certain certificates to be
730    selected by choosing the appropriate source.
731
732    We cannot omit fields here. This has to be done in the
733    respective form page.
734    """
735
736    email = schema.ASCIILine(
737        title = _(u'Email Address'),
738        required = True,
739        constraint=validate_email,
740        )
741    date_of_birth = FormattedDate(
742        title = _(u'Date of Birth'),
743        required = True,
744        show_year = True,
745        )
746
747INigeriaPGApplicantEdit[
748    'date_of_birth'].order =  INigeriaPGApplicant['date_of_birth'].order
749INigeriaPGApplicantEdit[
750    'email'].order =  INigeriaPGApplicant['email'].order
751
752class INigeriaApplicantOnlinePayment(INigeriaOnlinePayment):
753    """An applicant payment via payment gateways.
754    """
755
[15472]756    p_split_data = schema.Text(
757        title = _(u'Split Payment Data'),
758        required = False,
759        readonly = False,
760        )
761
762
[8926]763class IPUTMEApplicantEdit(INigeriaUGApplicant):
764    """An undergraduate applicant interface for editing.
765
766    Here we can repeat the fields from base data and set the
767    `required` and `readonly` attributes to True to further restrict
768    the data access. Or we can allow only certain certificates to be
769    selected by choosing the appropriate source.
770
771    We cannot omit fields here. This has to be done in the
772    respective form page.
773    """
774    email = schema.ASCIILine(
775        title = _(u'Email Address'),
776        required = True,
777        constraint=validate_email,
778        )
779    date_of_birth = FormattedDate(
780        title = _(u'Date of Birth'),
781        required = True,
782        show_year = True,
783        )
[10386]784    nationality = schema.Choice(
785        source = nats_vocab,
786        title = _(u'Nationality'),
787        required = True,
788        )
[8926]789
790IPUTMEApplicantEdit[
791    'date_of_birth'].order =  INigeriaUGApplicant['date_of_birth'].order
792IPUTMEApplicantEdit[
793    'email'].order =  INigeriaUGApplicant['email'].order
[10386]794IPUTMEApplicantEdit[
795    'nationality'].order =  INigeriaUGApplicant['nationality'].order
[8926]796
797class INigeriaApplicantUpdateByRegNo(INigeriaApplicant):
798    """Representation of an applicant.
799
800    Skip regular reg_number validation if reg_number is used for finding
801    the applicant object.
802    """
803    reg_number = schema.TextLine(
804        title = u'Registration Number',
805        required = False,
806        )
Note: See TracBrowser for help on using the repository browser.