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

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

Omit JAMB related fields.

  • Property svn:keywords set to Id
File size: 24.5 KB
RevLine 
[8926]1## $Id: interfaces.py 15500 2019-07-16 21:36:13Z 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',
[15500]132    'jamb_subjects_list',
133    'jamb_score',
134    'jamb_reg_number',
[15494]135    'programme_type',
136    'fst_sit_fname',
137    'fst_sit_no',
138    'fst_sit_date',
139    'fst_sit_type',
140    'fst_sit_results',
141    'scd_sit_fname',
142    'scd_sit_no',
143    'scd_sit_date',
144    'scd_sit_type',
145    'scd_sit_results',
146    'course2',
147    'screening_venue',
148    'screening_date',
149    'screening_score',
[15495]150    'bank_account_number',
151    'bank_account_name',
152    'bank_name',
153    'disabilities',
[15494]154    )
[13142]155CBT_OMIT_DISPLAY_FIELDS = OMIT_DISPLAY_FIELDS + CBT_OMIT_FIELDS
[13160]156CBT_OMIT_MANAGE_FIELDS = CBT_OMIT_FIELDS + ('special_application',)
157CBT_OMIT_EDIT_FIELDS = OMIT_DISPLAY_FIELDS + CBT_OMIT_FIELDS + (
158    'special_application',
[13142]159    'student_id',
160    'notice',
161    #'jamb_age',
162    #'jamb_subjects',
163    #'jamb_score',
164    #'jamb_reg_number',
[13157]165    )
[13142]166CBT_OMIT_PDF_FIELDS = CBT_OMIT_DISPLAY_FIELDS + ('phone',)
167
[13551]168# AFFIL is a subgroup of UG with the same interface.
169AFFIL_OMIT_FIELDS = (
170    'hq_type', 'hq_matric_no',
171    'hq_degree', 'hq_school',
172    'hq_session', 'hq_disc',
[14045]173    'jamb_subjects')
[13551]174AFFIL_OMIT_DISPLAY_FIELDS = OMIT_DISPLAY_FIELDS + AFFIL_OMIT_FIELDS
175AFFIL_OMIT_MANAGE_FIELDS = AFFIL_OMIT_FIELDS + ('special_application',)
176AFFIL_OMIT_EDIT_FIELDS = OMIT_DISPLAY_FIELDS + AFFIL_OMIT_FIELDS + (
177    'special_application',
178    'student_id',
179    'notice',
180    'screening_score',
181    'screening_venue',
182    'screening_date',
[13744]183    'aggregate',
[13551]184    )
[13559]185AFFIL_OMIT_PDF_FIELDS = AFFIL_OMIT_DISPLAY_FIELDS + ('phone',)
[13551]186
[9049]187# PUTME is a subgroup of UG with the same interface.
188PUTME_OMIT_FIELDS = (
189    'hq_type', 'hq_matric_no',
190    'hq_degree', 'hq_school',
[13554]191    'hq_session', 'hq_disc',
192    'jamb_subjects_list', 'programme_type')
[14045]193
[14828]194PUTME_OMIT_DISPLAY_FIELDS = OMIT_DISPLAY_FIELDS + PUTME_OMIT_FIELDS
195
[14045]196# temporary solution to display bank account fields only
197# for PUTME (ase) application
[14828]198#PUTME_OMIT_DISPLAY_FIELDS = (
199#    'locked', 'course_admitted', 'result_uploaded',
200#    'suspended', 'special_application') + PUTME_OMIT_FIELDS
[14045]201
[9049]202PUTME_OMIT_MANAGE_FIELDS = UG_OMIT_MANAGE_FIELDS + PUTME_OMIT_FIELDS
[14046]203
[14828]204PUTME_OMIT_EDIT_FIELDS = UG_OMIT_EDIT_FIELDS + PUTME_OMIT_FIELDS + (
205    'firstname', 'middlename', 'lastname', 'sex',
206    'course1', 'lga')
207
[14046]208# temporary solution to display bank account fields only
209# for PUTME (ase) application
[14828]210#PUTME_OMIT_EDIT_FIELDS = UG_OMIT_MANAGE_FIELDS  + (
211#    'locked', 'course_admitted', 'result_uploaded',
212#    'suspended', 'special_application',
213#    'student_id',
214#    'notice',
215#    'screening_score',
216#    'screening_venue',
217#    'screening_date',
218#    'jamb_age',
219#    'jamb_subjects',
220#    'jamb_score',
221#    'jamb_reg_number',
222#    'aggregate',
[14046]223#    'firstname', 'middlename', 'lastname', 'sex',
[14828]224#    'course1', 'lga') + PUTME_OMIT_FIELDS
[14046]225
[9073]226PUTME_OMIT_PDF_FIELDS = PUTME_OMIT_DISPLAY_FIELDS + ('phone',)
[9049]227PUTME_OMIT_RESULT_SLIP_FIELDS = PUTME_OMIT_DISPLAY_FIELDS + (
[9073]228    'phone',
[8926]229    'date_of_birth', 'sex',
[9072]230    'nationality', 'lga', #'perm_address',
[9049]231    'course2', 'screening_venue',
[8926]232    'screening_date')
233
[9054]234# PUDE is a subgroup of UG with the same interface.
235PUDE_OMIT_FIELDS = (
[13554]236    'jamb_subjects',
237    'jamb_score',
238    'jamb_age',
239    'aggregate',
240    'jamb_subjects_list',
[14045]241    'programme_type')
[9054]242PUDE_OMIT_DISPLAY_FIELDS = OMIT_DISPLAY_FIELDS + PUDE_OMIT_FIELDS
243PUDE_OMIT_MANAGE_FIELDS = UG_OMIT_MANAGE_FIELDS + PUDE_OMIT_FIELDS
244PUDE_OMIT_EDIT_FIELDS = set(UG_OMIT_EDIT_FIELDS + PUDE_OMIT_FIELDS + (
245    'firstname', 'middlename', 'lastname', 'sex',
246    'course1', 'lga'))
[9073]247PUDE_OMIT_PDF_FIELDS = PUDE_OMIT_DISPLAY_FIELDS + ('phone',)
[9054]248PUDE_OMIT_RESULT_SLIP_FIELDS = PUDE_OMIT_DISPLAY_FIELDS + (
[9073]249    'phone',
[9054]250    'date_of_birth', 'sex',
[9072]251    'nationality', 'lga', #'perm_address',
[9054]252    'course2', 'screening_venue',
253    'screening_date')
254
[9049]255# PG has its own interface
256PG_OMIT_DISPLAY_FIELDS = OMIT_DISPLAY_FIELDS
[9073]257PG_OMIT_PDF_FIELDS = PG_OMIT_DISPLAY_FIELDS + ('phone',)
[10851]258PG_OMIT_MANAGE_FIELDS = ('special_application',)
[9107]259PG_OMIT_EDIT_FIELDS = PG_OMIT_MANAGE_FIELDS + PG_OMIT_DISPLAY_FIELDS + (
[9159]260    'student_id', 'notice',
261    'screening_score', 'screening_venue',
262    'screening_date',)
[8926]263
[14003]264class IBankAccount(IKofaObject):
265
266    bank_name = schema.TextLine(
267        title = _(u'Bank Name'),
268        required = False,
269        readonly = False,
270        )
271
272    bank_account_name = schema.TextLine(
273        title = _(u'Bank Account Name'),
274        required = False,
275        readonly = False,
276        )
277
278    bank_account_number = schema.TextLine(
279        title = _(u'Bank Account Number'),
280        required = False,
281        readonly = False,
282        )
283
284class INigeriaUGApplicant(IApplicantBaseData, IBankAccount):
[8926]285    """An undergraduate applicant.
286
287    This interface defines the least common multiple of all fields
288    in ug application forms. In customized forms, fields can be excluded by
289    adding them to the UG_OMIT* tuples.
290    """
[10592]291
[15489]292    disabilities = schema.Choice(
[15495]293        title = _(u'Disability'),
[15489]294        source = DisabilitiesSource(),
295        required = False,
296        )
[8926]297    nationality = schema.Choice(
298        source = nats_vocab,
299        title = _(u'Nationality'),
[10386]300        required = False,
[8926]301        )
302    lga = schema.Choice(
303        source = LGASource(),
304        title = _(u'State/LGA (Nigerians only)'),
305        required = False,
306        )
[9072]307    #perm_address = schema.Text(
308    #    title = _(u'Permanent Address'),
309    #    required = False,
310    #    )
[8926]311    course1 = schema.Choice(
312        title = _(u'1st Choice Course of Study'),
313        source = AppCatCertificateSource(),
[10592]314        required = True,
[8926]315        )
316    course2 = schema.Choice(
317        title = _(u'2nd Choice Course of Study'),
318        source = AppCatCertificateSource(),
319        required = False,
320        )
[13555]321
322    programme_type = schema.Choice(
323        title = _(u'Programme Type'),
324        vocabulary = programme_types_vocab,
325        required = False,
326        )
327
[9049]328    hq_type = schema.Choice(
329        title = _(u'Qualification Obtained'),
330        required = False,
331        readonly = False,
332        vocabulary = high_qual,
333        )
334    hq_matric_no = schema.TextLine(
335        title = _(u'Former Matric Number'),
336        required = False,
337        readonly = False,
338        )
339    hq_degree = schema.Choice(
340        title = _(u'Class of Degree'),
341        required = False,
342        readonly = False,
343        vocabulary = high_grade,
344        )
345    hq_school = schema.TextLine(
346        title = _(u'Institution Attended'),
347        required = False,
348        readonly = False,
349        )
350    hq_session = schema.TextLine(
351        title = _(u'Years Attended'),
352        required = False,
353        readonly = False,
354        )
355    hq_disc = schema.TextLine(
356        title = _(u'Discipline'),
357        required = False,
358        readonly = False,
359        )
[8926]360    jamb_subjects = schema.Text(
361        title = _(u'Subjects and Scores'),
362        required = False,
363        )
[13160]364    jamb_subjects_list = schema.List(
365        title = _(u'JAMB Subjects'),
366        required = False,
[14010]367        defaultFactory=list,
[13160]368        value_type = schema.Choice(
369            vocabulary = jambsubjects
370            #source = JAMBSubjectSource(),
371            ),
372        )
[8926]373    jamb_score = schema.Int(
[9462]374        title = _(u'Total JAMB Score'),
[8926]375        required = False,
376        )
[13142]377    #jamb_age = schema.Int(
378    #    title = _(u'Age (provided by JAMB)'),
379    #    required = False,
380    #    )
381    jamb_reg_number = schema.TextLine(
382        title = _(u'JAMB Registration Number'),
[11740]383        required = False,
[15045]384        constraint=validate_jamb_reg_number,
[11740]385        )
[8926]386    notice = schema.Text(
387        title = _(u'Notice'),
388        required = False,
389        )
390    screening_venue = schema.TextLine(
391        title = _(u'Screening Venue'),
392        required = False,
393        )
394    screening_date = schema.TextLine(
395        title = _(u'Screening Date'),
396        required = False,
397        )
398    screening_score = schema.Int(
399        title = _(u'Screening Score (%)'),
400        required = False,
401        )
402    aggregate = schema.Int(
403        title = _(u'Aggregate Score (%)'),
404        description = _(u'(average of relative JAMB and PUTME scores)'),
405        required = False,
406        )
407    result_uploaded = schema.Bool(
408        title = _(u'Result uploaded'),
409        default = False,
[10385]410        required = False,
[8926]411        )
412    student_id = schema.TextLine(
413        title = _(u'Student Id'),
414        required = False,
415        readonly = False,
416        )
417    course_admitted = schema.Choice(
418        title = _(u'Admitted Course of Study'),
419        source = CertificateSource(),
420        required = False,
421        )
422    locked = schema.Bool(
423        title = _(u'Form locked'),
424        default = False,
[10385]425        required = False,
[8926]426        )
427
[10365]428INigeriaUGApplicant[
429    'locked'].order =  IApplicantBaseData['suspended'].order
430INigeriaUGApplicant[
431    'result_uploaded'].order =  INigeriaUGApplicant['suspended'].order
432
[8926]433class INigeriaPGApplicant(IApplicantBaseData):
434    """A postgraduate applicant.
435
436    This interface defines the least common multiple of all fields
437    in pg application forms. In customized forms, fields can be excluded by
438    adding them to the PG_OMIT* tuples.
439    """
440
441    nationality = schema.Choice(
442        source = nats_vocab,
443        title = _(u'Nationality'),
[9449]444        required = True,
[8926]445        )
446    lga = schema.Choice(
447        source = LGASource(),
448        title = _(u'State/LGA (Nigerians only)'),
449        required = False,
450        )
[9072]451    #perm_address = schema.Text(
452    #    title = _(u'Permanent Address'),
453    #    required = False,
454    #    )
[8926]455    course1 = schema.Choice(
456        title = _(u'1st Choice Course of Study'),
457        source = AppCatCertificateSource(),
458        required = True,
459        )
460    course2 = schema.Choice(
461        title = _(u'2nd Choice Course of Study'),
462        source = AppCatCertificateSource(),
463        required = False,
464        )
465    hq_type = schema.Choice(
466        title = _(u'Qualification Obtained'),
467        required = False,
468        readonly = False,
469        vocabulary = high_qual,
470        )
[13290]471    hq_fname = schema.TextLine(
472        title = _(u'Full Name'),
473        required = False,
474        readonly = False,
475        )
[8926]476    hq_matric_no = schema.TextLine(
477        title = _(u'Former Matric Number'),
478        required = False,
479        readonly = False,
480        )
481    hq_degree = schema.Choice(
482        title = _(u'Class of Degree'),
483        required = False,
484        readonly = False,
485        vocabulary = high_grade,
486        )
487    hq_school = schema.TextLine(
488        title = _(u'Institution Attended'),
489        required = False,
490        readonly = False,
491        )
492    hq_session = schema.TextLine(
493        title = _(u'Years Attended'),
494        required = False,
495        readonly = False,
496        )
497    hq_disc = schema.TextLine(
498        title = _(u'Discipline'),
499        required = False,
500        readonly = False,
501        )
[13140]502    fst_sit_fname = schema.TextLine(
503        title = _(u'Full Name'),
[8926]504        required = False,
505        readonly = False,
[13140]506        )
507    fst_sit_no = schema.TextLine(
508        title = _(u'Exam Number'),
509        required = False,
510        readonly = False,
511        )
512    fst_sit_date = FormattedDate(
513        title = _(u'Exam Date'),
514        required = False,
515        readonly = False,
516        show_year = True,
517        )
518    fst_sit_type = schema.Choice(
519        title = _(u'Exam Type'),
520        required = False,
521        readonly = False,
[8926]522        vocabulary = exam_types,
523        )
[13140]524    fst_sit_results = schema.List(
525        title = _(u'Exam Results'),
526        value_type = ResultEntryField(),
527        required = False,
528        readonly = False,
[14010]529        defaultFactory=list,
[13140]530        )
531    scd_sit_fname = schema.TextLine(
532        title = _(u'Full Name'),
533        required = False,
534        readonly = False,
535        )
536    scd_sit_no = schema.TextLine(
537        title = _(u'Exam Number'),
538        required = False,
539        readonly = False,
540        )
541    scd_sit_date = FormattedDate(
542        title = _(u'Exam Date'),
543        required = False,
544        readonly = False,
545        show_year = True,
546        )
547    scd_sit_type = schema.Choice(
548        title = _(u'Exam Type'),
549        required = False,
550        readonly = False,
551        vocabulary = exam_types,
552        )
553    scd_sit_results = schema.List(
554        title = _(u'Exam Results'),
555        value_type = ResultEntryField(),
556        required = False,
557        readonly = False,
[14010]558        defaultFactory=list,
[13140]559        )
560    # Replaced by first and second sitting
561    #pp_school = schema.Choice(
562    #    title = _(u'Qualification Obtained'),
563    #    required = False,
564    #    readonly = False,
565    #    vocabulary = exam_types,
566    #    )
[8926]567    presently_inst = schema.TextLine(
568        title = _(u'If yes, name of institution'),
569        required = False,
570        readonly = False,
571        )
572    nysc_year = schema.Int(
573        title = _(u'Nysc Year'),
574        required = False,
575        readonly = False,
576        )
577    nysc_lga = schema.Choice(
578        source = LGASource(),
579        title = _(u'Nysc Location'),
580        required = False,
581        )
582    employer = schema.TextLine(
583        title = _(u'Employer'),
584        required = False,
585        readonly = False,
586        )
587    emp_position = schema.TextLine(
588        title = _(u'Employer Position'),
589        required = False,
590        readonly = False,
591        )
592    emp_start = FormattedDate(
593        title = _(u'Start Date'),
594        required = False,
595        readonly = False,
596        show_year = True,
597        )
598    emp_end = FormattedDate(
599        title = _(u'End Date'),
600        required = False,
601        readonly = False,
602        show_year = True,
603        )
604    emp_reason = schema.TextLine(
605        title = _(u'Reason for Leaving'),
606        required = False,
607        readonly = False,
608        )
609    employer2 = schema.TextLine(
610        title = _(u'2nd Employer'),
611        required = False,
612        readonly = False,
613        )
614    emp2_position = schema.TextLine(
615        title = _(u'2nd Employer Position'),
616        required = False,
617        readonly = False,
618        )
619    emp2_start = FormattedDate(
620        title = _(u'Start Date'),
621        required = False,
622        readonly = False,
623        show_year = True,
624        )
625    emp2_end = FormattedDate(
626        title = _(u'End Date'),
627        required = False,
628        readonly = False,
629        show_year = True,
630        )
631    emp2_reason = schema.TextLine(
632        title = _(u'Reason for Leaving'),
633        required = False,
634        readonly = False,
635        )
636    notice = schema.Text(
637        title = _(u'Notice'),
638        required = False,
639        readonly = False,
640        )
[9159]641    screening_venue = schema.TextLine(
642        title = _(u'Screening Venue'),
643        required = False,
644        )
645    screening_date = schema.TextLine(
646        title = _(u'Screening Date'),
647        required = False,
648        )
649    screening_score = schema.Int(
650        title = _(u'Screening Score (%)'),
651        required = False,
652        )
[8926]653    student_id = schema.TextLine(
654        title = _(u'Student Id'),
655        required = False,
656        readonly = False,
657        )
658    course_admitted = schema.Choice(
659        title = _(u'Admitted Course of Study'),
660        source = CertificateSource(),
661        required = False,
662        readonly = False,
663        )
664    locked = schema.Bool(
665        title = _(u'Form locked'),
666        default = False,
[10385]667        required = False,
[8926]668        )
669
[10365]670INigeriaPGApplicant[
671    'locked'].order =  IApplicantBaseData['suspended'].order
672
[13277]673# PRE is used by Uniben
674#  med: "it is as named... PRE - DEGREE... much like a 1 year diploma programme"
675PRE_OMIT_FIELDS = tuple([
676    i for i in getFields(INigeriaPGApplicant).keys()
[14096]677        if i[:3] in ('hq_', 'emp', 'nys')]) + ('referees',)
[13277]678PRE_OMIT_DISPLAY_FIELDS = OMIT_DISPLAY_FIELDS + PRE_OMIT_FIELDS
679PRE_OMIT_MANAGE_FIELDS = PG_OMIT_MANAGE_FIELDS + PRE_OMIT_FIELDS
680PRE_OMIT_EDIT_FIELDS = set(PG_OMIT_EDIT_FIELDS + PRE_OMIT_FIELDS)
681PRE_OMIT_PDF_FIELDS = PRE_OMIT_DISPLAY_FIELDS
682PRE_OMIT_RESULT_SLIP_FIELDS = PRE_OMIT_DISPLAY_FIELDS
683
[8926]684class INigeriaApplicant(INigeriaUGApplicant, INigeriaPGApplicant):
685    """An interface for both types of applicants.
686
687    Attention: The INigeriaPGApplicant field seetings will be overwritten
688    by INigeriaPGApplicant field settings. If a field is defined
689    in both interfaces zope.schema validates only against the
690    constraints in INigeriaUGApplicant. This does not affect the forms
691    since they are build on either INigeriaUGApplicant or INigeriaPGApplicant.
692    """
693
694    def writeLogMessage(view, comment):
695        """Adds an INFO message to the log file
696        """
697
698    def createStudent():
699        """Create a student object from applicant data
700        and copy applicant object.
701        """
702
703class INigeriaUGApplicantEdit(INigeriaUGApplicant):
704    """An undergraduate applicant interface for edit forms.
705
706    Here we can repeat the fields from base data and set the
707    `required` and `readonly` attributes to True to further restrict
708    the data access. Or we can allow only certain certificates to be
709    selected by choosing the appropriate source.
710
711    We cannot omit fields here. This has to be done in the
712    respective form page.
713    """
714
715    email = schema.ASCIILine(
716        title = _(u'Email Address'),
717        required = True,
718        constraint=validate_email,
719        )
720    date_of_birth = FormattedDate(
721        title = _(u'Date of Birth'),
722        required = True,
723        show_year = True,
724        )
[13160]725    jamb_subjects_list = schema.List(
726        title = _(u'JAMB Subjects'),
727        description = _(u'Select four subjects.'),
[13155]728        required = True,
[13163]729        constraint = four_items,
[13160]730        value_type = schema.Choice(
731            vocabulary = jambsubjects
732            #source = JAMBSubjectSource(),
733            ),
[13155]734        )
[8926]735
736INigeriaUGApplicantEdit[
[13155]737    'date_of_birth'].order = INigeriaUGApplicant['date_of_birth'].order
[8926]738INigeriaUGApplicantEdit[
[13155]739    'email'].order = INigeriaUGApplicant['email'].order
740INigeriaUGApplicantEdit[
[13160]741    'jamb_subjects_list'].order = INigeriaUGApplicant['jamb_subjects_list'].order
[8926]742
743class INigeriaPGApplicantEdit(INigeriaPGApplicant):
744    """A postgraduate applicant interface for editing.
745
746    Here we can repeat the fields from base data and set the
747    `required` and `readonly` attributes to True to further restrict
748    the data access. Or we can allow only certain certificates to be
749    selected by choosing the appropriate source.
750
751    We cannot omit fields here. This has to be done in the
752    respective form page.
753    """
754
755    email = schema.ASCIILine(
756        title = _(u'Email Address'),
757        required = True,
758        constraint=validate_email,
759        )
760    date_of_birth = FormattedDate(
761        title = _(u'Date of Birth'),
762        required = True,
763        show_year = True,
764        )
765
766INigeriaPGApplicantEdit[
767    'date_of_birth'].order =  INigeriaPGApplicant['date_of_birth'].order
768INigeriaPGApplicantEdit[
769    'email'].order =  INigeriaPGApplicant['email'].order
770
771class INigeriaApplicantOnlinePayment(INigeriaOnlinePayment):
772    """An applicant payment via payment gateways.
773    """
774
[15472]775    p_split_data = schema.Text(
776        title = _(u'Split Payment Data'),
777        required = False,
778        readonly = False,
779        )
780
781
[8926]782class IPUTMEApplicantEdit(INigeriaUGApplicant):
783    """An undergraduate applicant interface for editing.
784
785    Here we can repeat the fields from base data and set the
786    `required` and `readonly` attributes to True to further restrict
787    the data access. Or we can allow only certain certificates to be
788    selected by choosing the appropriate source.
789
790    We cannot omit fields here. This has to be done in the
791    respective form page.
792    """
793    email = schema.ASCIILine(
794        title = _(u'Email Address'),
795        required = True,
796        constraint=validate_email,
797        )
798    date_of_birth = FormattedDate(
799        title = _(u'Date of Birth'),
800        required = True,
801        show_year = True,
802        )
[10386]803    nationality = schema.Choice(
804        source = nats_vocab,
805        title = _(u'Nationality'),
806        required = True,
807        )
[8926]808
809IPUTMEApplicantEdit[
810    'date_of_birth'].order =  INigeriaUGApplicant['date_of_birth'].order
811IPUTMEApplicantEdit[
812    'email'].order =  INigeriaUGApplicant['email'].order
[10386]813IPUTMEApplicantEdit[
814    'nationality'].order =  INigeriaUGApplicant['nationality'].order
[8926]815
816class INigeriaApplicantUpdateByRegNo(INigeriaApplicant):
817    """Representation of an applicant.
818
819    Skip regular reg_number validation if reg_number is used for finding
820    the applicant object.
821    """
822    reg_number = schema.TextLine(
823        title = u'Registration Number',
824        required = False,
825        )
Note: See TracBrowser for help on using the repository browser.