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

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

Remove more fields from CBT application.

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