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

Last change on this file since 17248 was 16745, checked in by Henrik Bettermann, 3 years ago

Change field types.

  • Property svn:keywords set to Id
File size: 24.6 KB
RevLine 
[8926]1## $Id: interfaces.py 16745 2021-12-15 11:27:49Z 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        )
[16745]373    jamb_score = schema.Float(
[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        )
[16745]398    screening_score = schema.Float(
[8926]399        title = _(u'Screening Score (%)'),
400        required = False,
401        )
[16745]402    aggregate = schema.Float(
[8926]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'),
[16167]580        description = _(u'Leave blank for exception letters.'),
[8926]581        required = False,
582        )
583    employer = schema.TextLine(
584        title = _(u'Employer'),
585        required = False,
586        readonly = False,
587        )
588    emp_position = schema.TextLine(
589        title = _(u'Employer Position'),
590        required = False,
591        readonly = False,
592        )
593    emp_start = FormattedDate(
594        title = _(u'Start Date'),
595        required = False,
596        readonly = False,
597        show_year = True,
598        )
599    emp_end = FormattedDate(
600        title = _(u'End Date'),
601        required = False,
602        readonly = False,
603        show_year = True,
604        )
605    emp_reason = schema.TextLine(
606        title = _(u'Reason for Leaving'),
607        required = False,
608        readonly = False,
609        )
610    employer2 = schema.TextLine(
611        title = _(u'2nd Employer'),
612        required = False,
613        readonly = False,
614        )
615    emp2_position = schema.TextLine(
616        title = _(u'2nd Employer Position'),
617        required = False,
618        readonly = False,
619        )
620    emp2_start = FormattedDate(
621        title = _(u'Start Date'),
622        required = False,
623        readonly = False,
624        show_year = True,
625        )
626    emp2_end = FormattedDate(
627        title = _(u'End Date'),
628        required = False,
629        readonly = False,
630        show_year = True,
631        )
632    emp2_reason = schema.TextLine(
633        title = _(u'Reason for Leaving'),
634        required = False,
635        readonly = False,
636        )
637    notice = schema.Text(
638        title = _(u'Notice'),
639        required = False,
640        readonly = False,
641        )
[9159]642    screening_venue = schema.TextLine(
643        title = _(u'Screening Venue'),
644        required = False,
645        )
646    screening_date = schema.TextLine(
647        title = _(u'Screening Date'),
648        required = False,
649        )
[16745]650    screening_score = schema.Float(
[9159]651        title = _(u'Screening Score (%)'),
652        required = False,
653        )
[8926]654    student_id = schema.TextLine(
655        title = _(u'Student Id'),
656        required = False,
657        readonly = False,
658        )
659    course_admitted = schema.Choice(
660        title = _(u'Admitted Course of Study'),
661        source = CertificateSource(),
662        required = False,
663        readonly = False,
664        )
665    locked = schema.Bool(
666        title = _(u'Form locked'),
667        default = False,
[10385]668        required = False,
[8926]669        )
670
[10365]671INigeriaPGApplicant[
672    'locked'].order =  IApplicantBaseData['suspended'].order
673
[13277]674# PRE is used by Uniben
675#  med: "it is as named... PRE - DEGREE... much like a 1 year diploma programme"
676PRE_OMIT_FIELDS = tuple([
677    i for i in getFields(INigeriaPGApplicant).keys()
[14096]678        if i[:3] in ('hq_', 'emp', 'nys')]) + ('referees',)
[13277]679PRE_OMIT_DISPLAY_FIELDS = OMIT_DISPLAY_FIELDS + PRE_OMIT_FIELDS
680PRE_OMIT_MANAGE_FIELDS = PG_OMIT_MANAGE_FIELDS + PRE_OMIT_FIELDS
681PRE_OMIT_EDIT_FIELDS = set(PG_OMIT_EDIT_FIELDS + PRE_OMIT_FIELDS)
682PRE_OMIT_PDF_FIELDS = PRE_OMIT_DISPLAY_FIELDS
683PRE_OMIT_RESULT_SLIP_FIELDS = PRE_OMIT_DISPLAY_FIELDS
684
[8926]685class INigeriaApplicant(INigeriaUGApplicant, INigeriaPGApplicant):
686    """An interface for both types of applicants.
687
688    Attention: The INigeriaPGApplicant field seetings will be overwritten
689    by INigeriaPGApplicant field settings. If a field is defined
690    in both interfaces zope.schema validates only against the
691    constraints in INigeriaUGApplicant. This does not affect the forms
692    since they are build on either INigeriaUGApplicant or INigeriaPGApplicant.
693    """
694
695    def writeLogMessage(view, comment):
696        """Adds an INFO message to the log file
697        """
698
699    def createStudent():
700        """Create a student object from applicant data
701        and copy applicant object.
702        """
703
704class INigeriaUGApplicantEdit(INigeriaUGApplicant):
705    """An undergraduate applicant interface for edit forms.
706
707    Here we can repeat the fields from base data and set the
708    `required` and `readonly` attributes to True to further restrict
709    the data access. Or we can allow only certain certificates to be
710    selected by choosing the appropriate source.
711
712    We cannot omit fields here. This has to be done in the
713    respective form page.
714    """
715
716    email = schema.ASCIILine(
717        title = _(u'Email Address'),
718        required = True,
719        constraint=validate_email,
720        )
721    date_of_birth = FormattedDate(
722        title = _(u'Date of Birth'),
723        required = True,
724        show_year = True,
725        )
[13160]726    jamb_subjects_list = schema.List(
727        title = _(u'JAMB Subjects'),
728        description = _(u'Select four subjects.'),
[13155]729        required = True,
[13163]730        constraint = four_items,
[13160]731        value_type = schema.Choice(
732            vocabulary = jambsubjects
733            #source = JAMBSubjectSource(),
734            ),
[13155]735        )
[8926]736
737INigeriaUGApplicantEdit[
[13155]738    'date_of_birth'].order = INigeriaUGApplicant['date_of_birth'].order
[8926]739INigeriaUGApplicantEdit[
[13155]740    'email'].order = INigeriaUGApplicant['email'].order
741INigeriaUGApplicantEdit[
[13160]742    'jamb_subjects_list'].order = INigeriaUGApplicant['jamb_subjects_list'].order
[8926]743
744class INigeriaPGApplicantEdit(INigeriaPGApplicant):
745    """A postgraduate applicant interface for editing.
746
747    Here we can repeat the fields from base data and set the
748    `required` and `readonly` attributes to True to further restrict
749    the data access. Or we can allow only certain certificates to be
750    selected by choosing the appropriate source.
751
752    We cannot omit fields here. This has to be done in the
753    respective form page.
754    """
755
756    email = schema.ASCIILine(
757        title = _(u'Email Address'),
758        required = True,
759        constraint=validate_email,
760        )
761    date_of_birth = FormattedDate(
762        title = _(u'Date of Birth'),
763        required = True,
764        show_year = True,
765        )
766
767INigeriaPGApplicantEdit[
768    'date_of_birth'].order =  INigeriaPGApplicant['date_of_birth'].order
769INigeriaPGApplicantEdit[
770    'email'].order =  INigeriaPGApplicant['email'].order
771
772class INigeriaApplicantOnlinePayment(INigeriaOnlinePayment):
773    """An applicant payment via payment gateways.
774    """
775
[15472]776    p_split_data = schema.Text(
777        title = _(u'Split Payment Data'),
778        required = False,
779        readonly = False,
780        )
781
782
[8926]783class IPUTMEApplicantEdit(INigeriaUGApplicant):
784    """An undergraduate applicant interface for editing.
785
786    Here we can repeat the fields from base data and set the
787    `required` and `readonly` attributes to True to further restrict
788    the data access. Or we can allow only certain certificates to be
789    selected by choosing the appropriate source.
790
791    We cannot omit fields here. This has to be done in the
792    respective form page.
793    """
794    email = schema.ASCIILine(
795        title = _(u'Email Address'),
796        required = True,
797        constraint=validate_email,
798        )
799    date_of_birth = FormattedDate(
800        title = _(u'Date of Birth'),
801        required = True,
802        show_year = True,
803        )
[10386]804    nationality = schema.Choice(
805        source = nats_vocab,
806        title = _(u'Nationality'),
807        required = True,
808        )
[8926]809
810IPUTMEApplicantEdit[
811    'date_of_birth'].order =  INigeriaUGApplicant['date_of_birth'].order
812IPUTMEApplicantEdit[
813    'email'].order =  INigeriaUGApplicant['email'].order
[10386]814IPUTMEApplicantEdit[
815    'nationality'].order =  INigeriaUGApplicant['nationality'].order
[8926]816
817class INigeriaApplicantUpdateByRegNo(INigeriaApplicant):
818    """Representation of an applicant.
819
820    Skip regular reg_number validation if reg_number is used for finding
821    the applicant object.
822    """
823    reg_number = schema.TextLine(
824        title = u'Registration Number',
825        required = False,
826        )
Note: See TracBrowser for help on using the repository browser.