source: main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/applicants/interfaces.py @ 17546

Last change on this file since 17546 was 17074, checked in by Henrik Bettermann, 2 years ago

Not all fields are required.

  • Property svn:keywords set to Id
File size: 29.2 KB
RevLine 
[16142]1# -*- coding: utf-8 -*-
[10765]2## $Id: interfaces.py 17074 2022-08-22 10:11:19Z henrik $
3##
4## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann
5## This program is free software; you can redistribute it and/or modify
6## it under the terms of the GNU General Public License as published by
7## the Free Software Foundation; either version 2 of the License, or
8## (at your option) any later version.
9##
10## This program is distributed in the hope that it will be useful,
11## but WITHOUT ANY WARRANTY; without even the implied warranty of
12## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13## GNU General Public License for more details.
14##
15## You should have received a copy of the GNU General Public License
16## along with this program; if not, write to the Free Software
17## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18##
19"""Customized interfaces of the university application package.
20"""
21
[16558]22import re
[10765]23from zope import schema
[16165]24from zope.component import getUtility
25from zope.catalog.interfaces import ICatalog
[16142]26from zc.sourcefactory.basic import BasicSourceFactory
[10765]27from waeup.kofa.applicants.interfaces import (
28    IApplicantBaseData,
29    AppCatCertificateSource, CertificateSource)
30from waeup.kofa.schoolgrades import ResultEntryField
[16142]31from waeup.kofa.university.vocabularies import StudyModeSource
[10765]32from waeup.kofa.interfaces import (
[16142]33    SimpleKofaVocabulary, academic_sessions_vocab, validate_email,
34    IKofaObject)
[15863]35from waeup.kofa.schema import FormattedDate, TextLineChoice, PhoneNumber
[16142]36from waeup.kofa.students.vocabularies import (
37    nats_vocab, GenderSource, StudyLevelSource)
[15807]38from waeup.kofa.applicants.interfaces import (
[16281]39    contextual_reg_num_source, IApplicantBaseData, IApplicantRefereeReport,
40    contextual_email_source, IApplicantRegisterUpdate)
[16049]41from waeup.kofa.refereeentries import RefereeEntryField
[10765]42from kofacustom.nigeria.applicants.interfaces import (
[15838]43    LGASource, high_qual, high_grade, exam_types, DisabilitiesSource,
44    programme_types_vocab, jambsubjects, validate_jamb_reg_number,
[10765]45    INigeriaUGApplicant, INigeriaPGApplicant,
46    INigeriaApplicantOnlinePayment,
47    INigeriaUGApplicantEdit, INigeriaPGApplicantEdit,
48    INigeriaApplicantUpdateByRegNo,
49    IPUTMEApplicantEdit,
50    )
[15563]51from kofacustom.iuokada.interfaces import MessageFactory as _
52from kofacustom.iuokada.payments.interfaces import ICustomOnlinePayment
[10765]53
[16558]54# Define a validation method for JAMB reg numbers
55class NotJAMBRegNumber2(schema.ValidationError):
56    __doc__ = u"Your JAMB detail is not valid for this admission session, contact admission office for details."
57
58#: Regular expression to check jamb_reg_number formats.
59check_jamb_reg_number_2 = re.compile(r"^1\d{7}[A-Z]{2}$").match
[16957]60check_jamb_reg_number_3 = re.compile(r"^\d{12}[A-Z]{2}$").match
[16558]61
62def validate_jamb_reg_number_2(value):
63    if not check_jamb_reg_number_2(value):
64        raise NotJAMBRegNumber2(value)
65    return True
66
[16957]67def validate_jamb_reg_number_3(value):
68    if not check_jamb_reg_number_3(value):
69        raise NotJAMBRegNumber2(value)
70    return True
[16558]71
[16957]72
[15793]73sponsors_vocab = SimpleKofaVocabulary(
74    (_('Bauchi Government'), 'bauchi'),
75    (_('Company'), 'company'),
[15863]76    (_('Federal Government of Nigeria'), 'federalgov'),
77    #(_('Dangote Group'), 'dangote'),
[15793]78    (_('Kano Government'), 'kano'),
79    (_('Parent/Guardian'), 'parent'),
80    (_('Rosula Organization'), 'rosula'),
81    (_('Self'), 'self'),
[15863]82    #(_('Social Impact Project'), 'social'),
[15793]83    )
84
85heard_about_types_vocab = SimpleKofaVocabulary(
86    (_('Facebook/Twitter/Other Social Media'), 'socmedia'),
87    (_('From a Friend'), 'friend'),
88    (_('Newspaper Advertisement'), 'newspaper'),
89    (_('Radio Advertisement'), 'radio'),
90    (_('Television Advertisement'), 'television'),
[15863]91    (_('SMS'), 'sms'),
[15793]92    )
93
[15858]94subtype_vocab = SimpleKofaVocabulary(
[16566]95    (_('None'), 'none'),
[15858]96    (_('UTME'), 'utme'),
97    (_('Direct Entry'), 'de'),
[16612]98    (_('JUPEB'), 'jupeb'),
[15858]99    (_('Inter Uni Transfer'), 'transfer'),
100    )
101
[16062]102rating_vocab = SimpleKofaVocabulary(
103    (_('Excellent'), 'e'),
104    (_('Very good'), 'vg'),
105    (_('Good'), 'g'),
106    (_('Slightly above average'), 'saa'),
107    (_('Average'), 'a'),
108    (_('Below average'), 'ba'),
109    (_('Unable to assess'), 'unable'),
110    )
111
112
113overallpromise_vocab = SimpleKofaVocabulary(
[16063]114    (_('Very good (highest 10%)'), 'vg'),
[16062]115    (_('Above average (next 15%)'), 'aa'),
116    (_('Average (middle 20%)'), 'a'),
117    (_('Below average (middle 40%)'), 'ba'),
118    )
119
[16142]120DESTINATION_COST = {
[16147]121    'local': ('Local (Nigeria)', 15000.0, 1),
122    'overseas': ('Overseas', 25000.0, 2),
[16142]123    }
124
125class DestinationCostSource(BasicSourceFactory):
126    """A source that delivers continents and shipment costs.
127    """
128    def getValues(self):
129        sorted_items = sorted(DESTINATION_COST.items(),
130                              key=lambda element: element[1][2])
131        return [item[0] for item in sorted_items]
132
133    def getTitle(self, value):
134        return u"%s (₦ %s)" % (
135            DESTINATION_COST[value][0],
136            DESTINATION_COST[value][1])
137
[16165]138class TranscriptCertificateSource(CertificateSource):
139    """Include Department and Faculty in Title.
140    """
141    def getValues(self, context):
142        catalog = getUtility(ICatalog, name='certificates_catalog')
143        resultset = catalog.searchResults(code=(None, None))
144        resultlist = sorted(resultset, key=lambda
145            value: value.__parent__.__parent__.__parent__.code +
146            value.__parent__.__parent__.code +
147            value.code)
148        return resultlist
149
150    def getTitle(self, context, value):
151        """
152        """
153        try: title = "%s / %s / %s (%s)" % (
154            value.__parent__.__parent__.__parent__.title,
155            value.__parent__.__parent__.title,
156            value.title, value.code)
157        except AttributeError:
158            title = "NA / %s (%s)" % (value.title, value.code)
159        return title
160
[15838]161class ICustomUGApplicant(IApplicantBaseData):
[10765]162    """An undergraduate applicant.
163
164    This interface defines the least common multiple of all fields
165    in ug application forms. In customized forms, fields can be excluded by
166    adding them to the UG_OMIT* tuples.
167    """
168
[16281]169    email = TextLineChoice(
[16287]170        title = _(u'Email Address'),
171        required = True,
[16281]172        constraint=validate_email,
173        source = contextual_email_source,
174        )
175
[15858]176    subtype = schema.Choice(
177        title = _(u'Application Subtype'),
178        vocabulary = subtype_vocab,
179        required = False,
180        )
[16958]181   
182    ref_number = schema.TextLine(
183        title = _(u'Reference Number'),
184        required = False,
185        readonly = False,
186        description = _(u'Reference Number from JAMB Inter-University transfer form (if applicable)'),
187        )
[15838]188    disabilities = schema.Choice(
189        title = _(u'Disability'),
190        source = DisabilitiesSource(),
191        required = False,
192        )
193    nationality = schema.Choice(
194        source = nats_vocab,
195        title = _(u'Nationality'),
196        required = False,
197        )
198    lga = schema.Choice(
199        source = LGASource(),
200        title = _(u'State/LGA (Nigerians only)'),
201        required = False,
202        )
[15863]203    sponsor = schema.Choice(
204        title = _(u'Sponsor'),
205        vocabulary = sponsors_vocab,
206        required = False,
207        )
208    heard_about = schema.Choice(
209        title = _(u'How did you hear about IUO?'),
210        vocabulary = heard_about_types_vocab,
211        required = False,
212        )
[16287]213    perm_address = schema.Text(
214        title = _(u'Residential Address'),
215        required = True,
216        )
[15863]217    parents_name = schema.TextLine(
218        title = _(u'Full Name'),
219        required = False,
220        readonly = False,
221        )
222    parents_email = schema.ASCIILine(
223        title = _(u'Email Address'),
224        required = False,
225        constraint=validate_email,
226        )
227    parents_phone = PhoneNumber(
228        title = _(u'Phone'),
229        required = False,
230        )
[15838]231    course1 = schema.Choice(
232        title = _(u'1st Choice Course of Study'),
233        source = AppCatCertificateSource(),
234        required = True,
235        )
236    course2 = schema.Choice(
237        title = _(u'2nd Choice Course of Study'),
238        source = AppCatCertificateSource(),
239        required = False,
240        )
241    programme_type = schema.Choice(
242        title = _(u'Programme Type'),
243        vocabulary = programme_types_vocab,
244        required = False,
245        )
246    fst_sit_fname = schema.TextLine(
247        title = _(u'Full Name'),
248        required = False,
249        readonly = False,
250        )
251    fst_sit_no = schema.TextLine(
252        title = _(u'Exam Number'),
253        required = False,
254        readonly = False,
255        )
256    fst_sit_date = FormattedDate(
257        title = _(u'Exam Date'),
258        required = False,
259        readonly = False,
260        show_year = True,
261        )
262    fst_sit_type = schema.Choice(
263        title = _(u'Exam Type'),
264        required = False,
265        readonly = False,
266        vocabulary = exam_types,
267        )
268    fst_sit_results = schema.List(
269        title = _(u'Exam Results'),
270        value_type = ResultEntryField(),
271        required = False,
272        readonly = False,
273        defaultFactory=list,
274        )
275    scd_sit_fname = schema.TextLine(
276        title = _(u'Full Name'),
277        required = False,
278        readonly = False,
279        )
280    scd_sit_no = schema.TextLine(
281        title = _(u'Exam Number'),
282        required = False,
283        readonly = False,
284        )
285    scd_sit_date = FormattedDate(
286        title = _(u'Exam Date'),
287        required = False,
288        readonly = False,
289        show_year = True,
290        )
291    scd_sit_type = schema.Choice(
292        title = _(u'Exam Type'),
293        required = False,
294        readonly = False,
295        vocabulary = exam_types,
296        )
297    scd_sit_results = schema.List(
298        title = _(u'Exam Results'),
299        value_type = ResultEntryField(),
300        required = False,
301        readonly = False,
302        defaultFactory=list,
303        )
[15858]304    hq_type = schema.Choice(
305        title = _(u'Qualification Obtained'),
306        required = False,
307        readonly = False,
308        vocabulary = high_qual,
309        )
310    hq_matric_no = schema.TextLine(
311        title = _(u'Former Matric Number'),
312        required = False,
313        readonly = False,
314        )
315    hq_degree = schema.Choice(
316        title = _(u'Class of Degree'),
317        required = False,
318        readonly = False,
319        vocabulary = high_grade,
320        )
321    hq_school = schema.TextLine(
322        title = _(u'Institution Attended'),
323        required = False,
324        readonly = False,
325        )
326    hq_session = schema.TextLine(
327        title = _(u'Years Attended'),
328        required = False,
329        readonly = False,
330        )
331    hq_disc = schema.TextLine(
332        title = _(u'Discipline'),
333        required = False,
334        readonly = False,
335        )
[16533]336    jamb_fname = schema.TextLine(
337        title = _(u'Full Name'),
338        required = False,
339        readonly = False,
340        )
[15884]341    #jamb_subjects = schema.Text(
342    #    title = _(u'Subjects and Scores'),
343    #    required = False,
344    #    )
[15838]345    jamb_subjects_list = schema.List(
346        title = _(u'JAMB Subjects'),
347        required = False,
348        defaultFactory=list,
349        value_type = schema.Choice(
350            vocabulary = jambsubjects
351            #source = JAMBSubjectSource(),
352            ),
353        )
354    jamb_score = schema.Int(
355        title = _(u'Total JAMB Score'),
356        required = False,
357        )
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'),
364        required = False,
[16957]365        # constraint=validate_jamb_reg_number,
[16540]366        description = _(u'Use all CAPS when entering the field.'),
[15838]367        )
368    notice = schema.Text(
369        title = _(u'Notice'),
370        required = False,
371        )
372    screening_venue = schema.TextLine(
373        title = _(u'Screening Venue'),
374        required = False,
375        )
376    screening_date = schema.TextLine(
377        title = _(u'Screening Date'),
378        required = False,
379        )
380    screening_score = schema.Int(
381        title = _(u'Screening Score (%)'),
382        required = False,
383        )
384    aggregate = schema.Int(
385        title = _(u'Aggregate Score (%)'),
386        description = _(u'(average of relative JAMB and PUTME scores)'),
387        required = False,
388        )
389    result_uploaded = schema.Bool(
390        title = _(u'Result uploaded'),
391        default = False,
392        required = False,
393        )
394    student_id = schema.TextLine(
395        title = _(u'Student Id'),
396        required = False,
397        readonly = False,
398        )
399    course_admitted = schema.Choice(
400        title = _(u'Admitted Course of Study'),
401        source = CertificateSource(),
402        required = False,
403        )
404    locked = schema.Bool(
405        title = _(u'Form locked'),
406        default = False,
407        required = False,
408        )
[15793]409
[15807]410ICustomUGApplicant[
[15858]411    'subtype'].order =  ICustomUGApplicant['lga'].order
412ICustomUGApplicant[
[15838]413    'locked'].order =  ICustomUGApplicant['suspended'].order
[15807]414ICustomUGApplicant[
[15838]415    'result_uploaded'].order =  ICustomUGApplicant['suspended'].order
[15807]416
[10765]417class ICustomPGApplicant(INigeriaPGApplicant):
418    """A postgraduate applicant.
419
420    This interface defines the least common multiple of all fields
421    in pg application forms. In customized forms, fields can be excluded by
422    adding them to the PG_OMIT* tuples.
423    """
424
[16281]425    email = TextLineChoice(
[16287]426        title = _(u'Email Address'),
427        required = True,
[16281]428        constraint=validate_email,
429        source = contextual_email_source,
430        )
431
[16287]432    perm_address = schema.Text(
433        title = _(u'Residential Address'),
434        required = True,
435        )
436
[15809]437    sponsor = schema.Choice(
438        title = _(u'Sponsor'),
439        vocabulary = sponsors_vocab,
440        required = False,
441        )
[10765]442
[15809]443    heard_about = schema.Choice(
444        title = _(u'How did you hear about IU?'),
445        vocabulary = heard_about_types_vocab,
446        required = False,
447        )
448
[16049]449    nysc_number = schema.Int(
450        title = _(u'Nysc Number'),
451        required = False,
452        readonly = False,
453        )
454
455    referees = schema.List(
456        title = _(u'Referees'),
457        value_type = RefereeEntryField(),
458        required = False,
459        defaultFactory=list,
460        )
461
[15809]462ICustomPGApplicant[
[16049]463    'referees'].order =  INigeriaPGApplicant['emp2_reason'].order
464ICustomPGApplicant[
[15809]465    'sponsor'].order =  ICustomPGApplicant['lga'].order
466ICustomPGApplicant[
467    'heard_about'].order =  ICustomPGApplicant['lga'].order
468ICustomPGApplicant[
469    'sponsor'].order =  ICustomPGApplicant['lga'].order
470ICustomPGApplicant[
471    'lga'].order =  ICustomPGApplicant['nationality'].order
[16049]472ICustomPGApplicant[
473    'nysc_number'].order =  ICustomPGApplicant['nysc_year'].order
[16287]474ICustomPGApplicant[
475    'perm_address'].order =  ICustomPGApplicant['lga'].order
476ICustomPGApplicant[
477    'email'].order =  ICustomPGApplicant['lga'].order
[15809]478
[16142]479class ITranscriptApplicant(IKofaObject):
480    """A transcript applicant.
481    """
482
483    suspended = schema.Bool(
484        title = _(u'Account suspended'),
485        default = False,
486        required = False,
487        )
488
489    locked = schema.Bool(
490        title = _(u'Form locked'),
491        default = False,
492        required = False,
493        )
494
495    applicant_id = schema.TextLine(
496        title = _(u'Transcript Application Id'),
497        required = False,
498        readonly = False,
499        )
500
501    matric_number = schema.TextLine(
502        title = _(u'Matriculation Number'),
503        readonly = False,
504        required = True,
505        )
506
507    firstname = schema.TextLine(
508        title = _(u'First Name'),
509        required = True,
510        )
511
512    middlename = schema.TextLine(
513        title = _(u'Middle Name'),
514        required = False,
515        )
516
517    lastname = schema.TextLine(
518        title = _(u'Last Name (Surname)'),
519        required = True,
520        )
521
[16165]522    #date_of_birth = FormattedDate(
523    #    title = _(u'Date of Birth'),
524    #    required = False,
525    #    #date_format = u'%d/%m/%Y', # Use grok-instance-wide default
526    #    show_year = True,
527    #    )
[16142]528
529    sex = schema.Choice(
530        title = _(u'Gender'),
531        source = GenderSource(),
532        required = True,
533        )
534
[16165]535    #nationality = schema.Choice(
536    #    vocabulary = nats_vocab,
537    #    title = _(u'Nationality'),
538    #    required = False,
539    #    )
[16142]540
541    email = schema.ASCIILine(
542        title = _(u'Email Address'),
543        required = True,
544        constraint=validate_email,
545        )
546
[16165]547    #phone = PhoneNumber(
548    #    title = _(u'Phone'),
549    #    description = u'',
550    #    required = False,
551    #    )
[16142]552
[16165]553    #perm_address = schema.Text(
554    #    title = _(u'Current Local Address'),
555    #    required = False,
556    #    readonly = False,
557    #    )
[16142]558
559    dispatch_address = schema.Text(
560        title = _(u'Dispatch Addresses'),
561        description = u'Addresses to which transcripts should be posted. '
562                       'Addresses must involve same courier charges.',
563        required = False,
564        readonly = False,
565        )
566
567    charge = schema.Choice(
568        title = _(u'Courier Charge'),
569        source = DestinationCostSource(),
570        required = True,
571        )
572
[16165]573    #entry_mode = schema.Choice(
574    #    title = _(u'Entry Mode'),
575    #    source = StudyModeSource(),
576    #    required = False,
577    #    readonly = False,
578    #    )
[16142]579
[16165]580    #entry_session = schema.Choice(
581    #    title = _(u'Entry Session'),
582    #    source = academic_sessions_vocab,
583    #    required = False,
584    #    readonly = False,
585    #    )
[16142]586
587    end_session = schema.Choice(
[16165]588        title = _(u'Academic Session of Graduation'),
[16142]589        source = academic_sessions_vocab,
590        required = False,
591        readonly = False,
592        )
593
594    course_studied = schema.Choice(
[16165]595        title = _(u'Course of Study'),
596        source = TranscriptCertificateSource(),
597        description = u'Faculty / Department / Course',
[16142]598        required = False,
599        readonly = False,
600        )
601
[16165]602    #course_changed = schema.Choice(
603    #    title = _(u'Change of Study Course'),
604    #    description = u'If yes, select previous course of study.',
605    #    source = CertificateSource(),
606    #    readonly = False,
607    #    required = False,
608    #    )
[16142]609
[16165]610    #change_level = schema.Choice(
611    #    title = _(u'Change Level'),
612    #    description = u'If yes, select level at which you changed course of study.',
613    #    source = StudyLevelSource(),
614    #    required = False,
615    #    readonly = False,
616    #    )
[16142]617
618    no_copies = schema.Choice(
619        title = _(u'Number of Copies'),
620        description = u'Must correspond with the number of dispatch addresses above.',
621        values=[1, 2, 3, 4],
622        required = False,
623        readonly = False,
624        default = 1,
625        )
626
627class ICustomApplicant(ICustomUGApplicant, ICustomPGApplicant,
628    ITranscriptApplicant):
[10765]629    """An interface for both types of applicants.
630
631    Attention: The ICustomPGApplicant field seetings will be overwritten
632    by ICustomPGApplicant field settings. If a field is defined
633    in both interfaces zope.schema validates only against the
634    constraints in ICustomUGApplicant. This does not affect the forms
635    since they are build on either ICustomUGApplicant or ICustomPGApplicant.
636    """
637
638    def writeLogMessage(view, comment):
639        """Adds an INFO message to the log file
640        """
641
642    def createStudent():
643        """Create a student object from applicant data
644        and copy applicant object.
645        """
646
[15858]647class ICustomUGApplicantEdit(ICustomUGApplicant):
[10765]648    """An undergraduate applicant interface for edit forms.
649
650    Here we can repeat the fields from base data and set the
651    `required` and `readonly` attributes to True to further restrict
652    the data access. Or we can allow only certain certificates to be
653    selected by choosing the appropriate source.
654
655    We cannot omit fields here. This has to be done in the
656    respective form page.
657    """
658
[17066]659    middlename = schema.TextLine(
660        title = _(u'Middle Name'),
[17074]661        required = False,
[17066]662        )
[16105]663    phone = PhoneNumber(
664        title = _(u'Phone'),
665        description = u'',
666        required = True,
667        )
[16281]668    email = TextLineChoice(
[16287]669        title = _(u'Email Address'),
[16105]670        constraint=validate_email,
[16281]671        source = contextual_email_source,
[16544]672        required = True,
[16105]673        )
[17066]674    subtype = schema.Choice(
675        title = _(u'Application Subtype'),
676        vocabulary = subtype_vocab,
677        required = True,
678        )       
[16105]679    date_of_birth = FormattedDate(
680        title = _(u'Date of Birth'),
681        required = True,
682        show_year = True,
683        )
[17066]684    nationality = schema.Choice(
685        source = nats_vocab,
686        title = _(u'Nationality'),
687        required = True,
688        )
[16544]689    parents_name = schema.TextLine(
690        title = _(u'Full Name'),
691        required = True,
692        readonly = False,
693        )
694    parents_email = schema.ASCIILine(
695        title = _(u'Email Address'),
696        required = True,
697        constraint=validate_email,
698        )
699    parents_phone = PhoneNumber(
700        title = _(u'Phone'),
701        required = True,
702        )
[17066]703    course1 = schema.Choice(
704        title = _(u'1st Choice Course of Study'),
705        source = AppCatCertificateSource(),
706        required = True,
707        )
708    course2 = schema.Choice(
709        title = _(u'2nd Choice Course of Study'),
710        source = AppCatCertificateSource(),
711        required = False,
712        )
[16502]713    fst_sit_fname = schema.TextLine(
714        title = _(u'Full Name'),
[17066]715        required = True,
[16502]716        readonly = False,
717        )
[17066]718    fst_sit_no = schema.TextLine(
719        title = _(u'Exam Number'),
720        required = True,
721        readonly = False,
722        )
723    fst_sit_date = FormattedDate(
724        title = _(u'Exam Date'),
725        required = True,
726        readonly = False,
727        show_year = True,
728        )
729    fst_sit_type = schema.Choice(
730        title = _(u'Exam Type'),
731        required = True,
732        readonly = False,
733        vocabulary = exam_types,
734        )
735    fst_sit_results = schema.List(
736        title = _(u'Exam Results'),
737        value_type = ResultEntryField(),
738        required = True,
739        readonly = False,
740        defaultFactory=list,
741        )
[16502]742    scd_sit_fname = schema.TextLine(
743        title = _(u'Full Name'),
[17074]744        required = False,
[17066]745        readonly = False,
746        )
747    scd_sit_no = schema.TextLine(
748        title = _(u'Exam Number'),
[17074]749        required = False,
[17066]750        readonly = False,
751        )
752    scd_sit_date = FormattedDate(
753        title = _(u'Exam Date'),
[17074]754        required = False,
[17066]755        readonly = False,
756        show_year = True,
757        )
758    scd_sit_type = schema.Choice(
759        title = _(u'Exam Type'),
[17074]760        required = False,
[17066]761        readonly = False,
762        vocabulary = exam_types,
763        )
764    scd_sit_results = schema.List(
765        title = _(u'Exam Results'),
766        value_type = ResultEntryField(),
[17074]767        required = False,
[17066]768        readonly = False,
769        defaultFactory=list,
770        )
771    hq_type = schema.Choice(
772        title = _(u'Qualification Obtained'),
[16502]773        required = False,
774        readonly = False,
[17066]775        vocabulary = high_qual,
[16502]776        )
[17066]777    hq_matric_no = schema.TextLine(
778        title = _(u'Former Matric Number'),
779        required = False,
780        readonly = False,
781        )
782    hq_degree = schema.Choice(
783        title = _(u'Class of Degree'),
784        required = False,
785        readonly = False,
786        vocabulary = high_grade,
787        )
788    hq_school = schema.TextLine(
789        title = _(u'Institution Attended'),
790        required = False,
791        readonly = False,
792        )
793    hq_session = schema.TextLine(
794        title = _(u'Years Attended'),
795        required = False,
796        readonly = False,
797        )
798    hq_disc = schema.TextLine(
799        title = _(u'Discipline'),
800        required = False,
801        readonly = False,
802        )
[16533]803    jamb_fname = schema.TextLine(
804        title = _(u'Full Name'),
805        description = _(u'As it is written on your JAMB result slip.'),
[17068]806        required = False,
[16533]807        readonly = False,
808        )
[17066]809    jamb_subjects_list = schema.List(
810        title = _(u'JAMB Subjects'),
[17068]811        required = False,
[17066]812        defaultFactory=list,
813        value_type = schema.Choice(
814            vocabulary = jambsubjects
815            #source = JAMBSubjectSource(),
816            ),
817        )
[16544]818    jamb_score = schema.Int(
819        title = _(u'Total JAMB Score'),
[17068]820        required = False,
[16544]821        )
822
823    jamb_reg_number = schema.TextLine(
824        title = _(u'JAMB Registration Number'),
[17068]825        required = False,
[16957]826        # constraint=validate_jamb_reg_number_2, # temporarily in 2021
827        constraint=validate_jamb_reg_number_3,
[16544]828        description = _(u'Use all CAPS when entering the field.'),
829        )
830
[16105]831ICustomUGApplicantEdit[
[17066]832    'middlename'].order = ICustomUGApplicant['middlename'].order
833ICustomUGApplicantEdit[
834    'nationality'].order = ICustomUGApplicant['nationality'].order
835ICustomUGApplicantEdit[
[16105]836    'date_of_birth'].order = ICustomUGApplicant['date_of_birth'].order
837ICustomUGApplicantEdit[
838    'email'].order = ICustomUGApplicant['email'].order
839ICustomUGApplicantEdit[
[17066]840    'subtype'].order = ICustomUGApplicant['subtype'].order
841ICustomUGApplicantEdit[
[16105]842    'phone'].order =  ICustomUGApplicantEdit['email'].order
843
[17066]844
[15858]845class ICustomPGApplicantEdit(ICustomPGApplicant):
[10765]846    """A postgraduate applicant interface for editing.
847
848    Here we can repeat the fields from base data and set the
849    `required` and `readonly` attributes to True to further restrict
850    the data access. Or we can allow only certain certificates to be
851    selected by choosing the appropriate source.
852
853    We cannot omit fields here. This has to be done in the
854    respective form page.
855    """
856
[16105]857    phone = PhoneNumber(
858        title = _(u'Phone'),
859        description = u'',
860        required = True,
861        )
[16281]862    email = TextLineChoice(
[16287]863        title = _(u'Email Address'),
[17066]864        required = True,
[16105]865        constraint=validate_email,
[16281]866        source = contextual_email_source,
[16105]867        )
868    date_of_birth = FormattedDate(
869        title = _(u'Date of Birth'),
870        required = True,
871        show_year = True,
872        )
873
874ICustomPGApplicantEdit[
875    'date_of_birth'].order = ICustomPGApplicant['date_of_birth'].order
876ICustomPGApplicantEdit[
877    'email'].order = ICustomPGApplicant['email'].order
878ICustomPGApplicantEdit[
879    'phone'].order =  ICustomPGApplicantEdit['email'].order
880
[16281]881class ICustomApplicantRegisterUpdate(IApplicantRegisterUpdate):
882    """This is a representation of an applicant for first-time registration.
883    This interface is used when applicants use the registration page to
884    update their records.
885    """
886
887    email = TextLineChoice(
[16287]888        title = _(u'Email Address'),
[16281]889        required = False,
890        constraint=validate_email,
891        source = contextual_email_source,
892        )
893
[10765]894class ICustomApplicantOnlinePayment(INigeriaApplicantOnlinePayment):
895    """An applicant payment via payment gateways.
896
897    """
898
899class IPUTMEApplicantEdit(IPUTMEApplicantEdit):
900    """An undergraduate applicant interface for editing.
901
902    Here we can repeat the fields from base data and set the
903    `required` and `readonly` attributes to True to further restrict
904    the data access. Or we can allow only certain certificates to be
905    selected by choosing the appropriate source.
906
907    We cannot omit fields here. This has to be done in the
908    respective form page.
909    """
910
911class ICustomApplicantUpdateByRegNo(INigeriaApplicantUpdateByRegNo):
912    """Representation of an applicant.
913
914    Skip regular reg_number validation if reg_number is used for finding
915    the applicant object.
916    """
[16062]917
918class ICustomApplicantRefereeReport(IApplicantRefereeReport):
919    """A referee report.
920    """
921
922    duration = schema.Text(
923        title = _(u'How long and in what capacity have you known the candidate?'),
924        required = False,
925        )
926
927    itellectual = schema.Choice(
928        title = _(u'Intellectual Capacity'),
929        required = False,
930        readonly = False,
931        vocabulary = rating_vocab,
932        )
933
934    persistent = schema.Choice(
935        title = _(u'Capacity for Persistent and Independent Academic Study'),
936        required = False,
937        readonly = False,
938        vocabulary = rating_vocab,
939        )
940
941    imaginative = schema.Choice(
942        title = _(u'Ability for Imaginative Thought'),
943        required = False,
944        readonly = False,
945        vocabulary = rating_vocab,
946        )
947
948    productive = schema.Choice(
949        title = _(u'Promise of Productive Scholarship'),
950        required = False,
951        readonly = False,
952        vocabulary = rating_vocab,
953        )
954
955    previous = schema.Choice(
956        title = _(u'Quality of Previous Work'),
957        required = False,
958        readonly = False,
959        vocabulary = rating_vocab,
960        )
961
962    expression = schema.Choice(
963        title = _(u'Oral and Written Expression in English'),
964        required = False,
965        readonly = False,
966        vocabulary = rating_vocab,
967        )
968
969    personality = schema.Text(
970        title = _(u'Please comment on the candidate\'s personality '
971            'with particular reference to his/her moral character, emotional '
972            'and physical stabilty'),
973        required = False,
974        )
975
976    promise = schema.Choice(
977        title = _(u'Candidate\'s overall promise'),
978        required = False,
979        readonly = False,
980        vocabulary = overallpromise_vocab,
981        )
982
983    report = schema.Text(
984        title = _(u'Any other relevant information which would help '
985            'in determining the candidate\'s suitability?'),
986        required = False,
987        )
988
989    objection = schema.Text(
990        title = _(u'Have you any objection to the contents of this '
991            'evaluation being disclosed to any award-given body if '
992            'the need arises?'),
993        required = False,
994        )
Note: See TracBrowser for help on using the repository browser.