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

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

Add ref_number field.

  • Property svn:keywords set to Id
File size: 26.8 KB
Line 
1# -*- coding: utf-8 -*-
2## $Id: interfaces.py 16958 2022-06-13 10:47:28Z 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
22import re
23from zope import schema
24from zope.component import getUtility
25from zope.catalog.interfaces import ICatalog
26from zc.sourcefactory.basic import BasicSourceFactory
27from waeup.kofa.applicants.interfaces import (
28    IApplicantBaseData,
29    AppCatCertificateSource, CertificateSource)
30from waeup.kofa.schoolgrades import ResultEntryField
31from waeup.kofa.university.vocabularies import StudyModeSource
32from waeup.kofa.interfaces import (
33    SimpleKofaVocabulary, academic_sessions_vocab, validate_email,
34    IKofaObject)
35from waeup.kofa.schema import FormattedDate, TextLineChoice, PhoneNumber
36from waeup.kofa.students.vocabularies import (
37    nats_vocab, GenderSource, StudyLevelSource)
38from waeup.kofa.applicants.interfaces import (
39    contextual_reg_num_source, IApplicantBaseData, IApplicantRefereeReport,
40    contextual_email_source, IApplicantRegisterUpdate)
41from waeup.kofa.refereeentries import RefereeEntryField
42from kofacustom.nigeria.applicants.interfaces import (
43    LGASource, high_qual, high_grade, exam_types, DisabilitiesSource,
44    programme_types_vocab, jambsubjects, validate_jamb_reg_number,
45    INigeriaUGApplicant, INigeriaPGApplicant,
46    INigeriaApplicantOnlinePayment,
47    INigeriaUGApplicantEdit, INigeriaPGApplicantEdit,
48    INigeriaApplicantUpdateByRegNo,
49    IPUTMEApplicantEdit,
50    )
51from kofacustom.iuokada.interfaces import MessageFactory as _
52from kofacustom.iuokada.payments.interfaces import ICustomOnlinePayment
53
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
60check_jamb_reg_number_3 = re.compile(r"^\d{12}[A-Z]{2}$").match
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
67def validate_jamb_reg_number_3(value):
68    if not check_jamb_reg_number_3(value):
69        raise NotJAMBRegNumber2(value)
70    return True
71
72
73sponsors_vocab = SimpleKofaVocabulary(
74    (_('Bauchi Government'), 'bauchi'),
75    (_('Company'), 'company'),
76    (_('Federal Government of Nigeria'), 'federalgov'),
77    #(_('Dangote Group'), 'dangote'),
78    (_('Kano Government'), 'kano'),
79    (_('Parent/Guardian'), 'parent'),
80    (_('Rosula Organization'), 'rosula'),
81    (_('Self'), 'self'),
82    #(_('Social Impact Project'), 'social'),
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'),
91    (_('SMS'), 'sms'),
92    )
93
94subtype_vocab = SimpleKofaVocabulary(
95    (_('None'), 'none'),
96    (_('UTME'), 'utme'),
97    (_('Direct Entry'), 'de'),
98    (_('JUPEB'), 'jupeb'),
99    (_('Inter Uni Transfer'), 'transfer'),
100    )
101
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(
114    (_('Very good (highest 10%)'), 'vg'),
115    (_('Above average (next 15%)'), 'aa'),
116    (_('Average (middle 20%)'), 'a'),
117    (_('Below average (middle 40%)'), 'ba'),
118    )
119
120DESTINATION_COST = {
121    'local': ('Local (Nigeria)', 15000.0, 1),
122    'overseas': ('Overseas', 25000.0, 2),
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
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
161class ICustomUGApplicant(IApplicantBaseData):
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
169    email = TextLineChoice(
170        title = _(u'Email Address'),
171        required = True,
172        constraint=validate_email,
173        source = contextual_email_source,
174        )
175
176    subtype = schema.Choice(
177        title = _(u'Application Subtype'),
178        vocabulary = subtype_vocab,
179        required = False,
180        )
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        )
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        )
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        )
213    perm_address = schema.Text(
214        title = _(u'Residential Address'),
215        required = True,
216        )
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        )
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        )
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        )
336    jamb_fname = schema.TextLine(
337        title = _(u'Full Name'),
338        required = False,
339        readonly = False,
340        )
341    #jamb_subjects = schema.Text(
342    #    title = _(u'Subjects and Scores'),
343    #    required = False,
344    #    )
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,
365        # constraint=validate_jamb_reg_number,
366        description = _(u'Use all CAPS when entering the field.'),
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        )
409
410ICustomUGApplicant[
411    'subtype'].order =  ICustomUGApplicant['lga'].order
412ICustomUGApplicant[
413    'locked'].order =  ICustomUGApplicant['suspended'].order
414ICustomUGApplicant[
415    'result_uploaded'].order =  ICustomUGApplicant['suspended'].order
416
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
425    email = TextLineChoice(
426        title = _(u'Email Address'),
427        required = True,
428        constraint=validate_email,
429        source = contextual_email_source,
430        )
431
432    perm_address = schema.Text(
433        title = _(u'Residential Address'),
434        required = True,
435        )
436
437    sponsor = schema.Choice(
438        title = _(u'Sponsor'),
439        vocabulary = sponsors_vocab,
440        required = False,
441        )
442
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
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
462ICustomPGApplicant[
463    'referees'].order =  INigeriaPGApplicant['emp2_reason'].order
464ICustomPGApplicant[
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
472ICustomPGApplicant[
473    'nysc_number'].order =  ICustomPGApplicant['nysc_year'].order
474ICustomPGApplicant[
475    'perm_address'].order =  ICustomPGApplicant['lga'].order
476ICustomPGApplicant[
477    'email'].order =  ICustomPGApplicant['lga'].order
478
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
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    #    )
528
529    sex = schema.Choice(
530        title = _(u'Gender'),
531        source = GenderSource(),
532        required = True,
533        )
534
535    #nationality = schema.Choice(
536    #    vocabulary = nats_vocab,
537    #    title = _(u'Nationality'),
538    #    required = False,
539    #    )
540
541    email = schema.ASCIILine(
542        title = _(u'Email Address'),
543        required = True,
544        constraint=validate_email,
545        )
546
547    #phone = PhoneNumber(
548    #    title = _(u'Phone'),
549    #    description = u'',
550    #    required = False,
551    #    )
552
553    #perm_address = schema.Text(
554    #    title = _(u'Current Local Address'),
555    #    required = False,
556    #    readonly = False,
557    #    )
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
573    #entry_mode = schema.Choice(
574    #    title = _(u'Entry Mode'),
575    #    source = StudyModeSource(),
576    #    required = False,
577    #    readonly = False,
578    #    )
579
580    #entry_session = schema.Choice(
581    #    title = _(u'Entry Session'),
582    #    source = academic_sessions_vocab,
583    #    required = False,
584    #    readonly = False,
585    #    )
586
587    end_session = schema.Choice(
588        title = _(u'Academic Session of Graduation'),
589        source = academic_sessions_vocab,
590        required = False,
591        readonly = False,
592        )
593
594    course_studied = schema.Choice(
595        title = _(u'Course of Study'),
596        source = TranscriptCertificateSource(),
597        description = u'Faculty / Department / Course',
598        required = False,
599        readonly = False,
600        )
601
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    #    )
609
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    #    )
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):
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
647class ICustomUGApplicantEdit(ICustomUGApplicant):
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
659    phone = PhoneNumber(
660        title = _(u'Phone'),
661        description = u'',
662        required = True,
663        )
664    email = TextLineChoice(
665        title = _(u'Email Address'),
666        constraint=validate_email,
667        source = contextual_email_source,
668        required = True,
669        )
670    date_of_birth = FormattedDate(
671        title = _(u'Date of Birth'),
672        required = True,
673        show_year = True,
674        )
675
676    parents_name = schema.TextLine(
677        title = _(u'Full Name'),
678        required = True,
679        readonly = False,
680        )
681
682    parents_email = schema.ASCIILine(
683        title = _(u'Email Address'),
684        required = True,
685        constraint=validate_email,
686        )
687
688    parents_phone = PhoneNumber(
689        title = _(u'Phone'),
690        required = True,
691        )
692
693    fst_sit_fname = schema.TextLine(
694        title = _(u'Full Name'),
695        description = _(u'As it is written on your WAEC/NECO result.'),
696        required = False,
697        readonly = False,
698        )
699
700    scd_sit_fname = schema.TextLine(
701        title = _(u'Full Name'),
702        description = _(u'As it is written on your WAEC/NECO result.'),
703        required = False,
704        readonly = False,
705        )
706
707    jamb_fname = schema.TextLine(
708        title = _(u'Full Name'),
709        description = _(u'As it is written on your JAMB result slip.'),
710        required = True,
711        readonly = False,
712        )
713
714    jamb_score = schema.Int(
715        title = _(u'Total JAMB Score'),
716        required = False,
717        )
718
719    jamb_reg_number = schema.TextLine(
720        title = _(u'JAMB Registration Number'),
721        required = False,
722        # constraint=validate_jamb_reg_number_2, # temporarily in 2021
723        constraint=validate_jamb_reg_number_3,
724        description = _(u'Use all CAPS when entering the field.'),
725        )
726
727ICustomUGApplicantEdit[
728    'date_of_birth'].order = ICustomUGApplicant['date_of_birth'].order
729ICustomUGApplicantEdit[
730    'email'].order = ICustomUGApplicant['email'].order
731ICustomUGApplicantEdit[
732    'phone'].order =  ICustomUGApplicantEdit['email'].order
733ICustomUGApplicantEdit[
734    'fst_sit_fname'].order =  ICustomUGApplicant['fst_sit_fname'].order
735ICustomUGApplicantEdit[
736    'scd_sit_fname'].order =  ICustomUGApplicant['scd_sit_fname'].order
737ICustomUGApplicantEdit[
738    'jamb_fname'].order =  ICustomUGApplicant['jamb_fname'].order
739ICustomUGApplicantEdit[
740    'jamb_score'].order =  ICustomUGApplicant['jamb_score'].order
741ICustomUGApplicantEdit[
742    'jamb_reg_number'].order =  ICustomUGApplicant['jamb_reg_number'].order
743ICustomUGApplicantEdit[
744    'parents_name'].order =  ICustomUGApplicant['parents_name'].order
745ICustomUGApplicantEdit[
746    'parents_email'].order =  ICustomUGApplicant['parents_email'].order
747ICustomUGApplicantEdit[
748    'parents_phone'].order =  ICustomUGApplicant['parents_phone'].order
749
750class ICustomPGApplicantEdit(ICustomPGApplicant):
751    """A postgraduate applicant interface for editing.
752
753    Here we can repeat the fields from base data and set the
754    `required` and `readonly` attributes to True to further restrict
755    the data access. Or we can allow only certain certificates to be
756    selected by choosing the appropriate source.
757
758    We cannot omit fields here. This has to be done in the
759    respective form page.
760    """
761
762    phone = PhoneNumber(
763        title = _(u'Phone'),
764        description = u'',
765        required = True,
766        )
767    email = TextLineChoice(
768        title = _(u'Email Address'),
769        required = False,
770        constraint=validate_email,
771        source = contextual_email_source,
772        )
773    date_of_birth = FormattedDate(
774        title = _(u'Date of Birth'),
775        required = True,
776        show_year = True,
777        )
778
779ICustomPGApplicantEdit[
780    'date_of_birth'].order = ICustomPGApplicant['date_of_birth'].order
781ICustomPGApplicantEdit[
782    'email'].order = ICustomPGApplicant['email'].order
783ICustomPGApplicantEdit[
784    'phone'].order =  ICustomPGApplicantEdit['email'].order
785
786class ICustomApplicantRegisterUpdate(IApplicantRegisterUpdate):
787    """This is a representation of an applicant for first-time registration.
788    This interface is used when applicants use the registration page to
789    update their records.
790    """
791
792    email = TextLineChoice(
793        title = _(u'Email Address'),
794        required = False,
795        constraint=validate_email,
796        source = contextual_email_source,
797        )
798
799class ICustomApplicantOnlinePayment(INigeriaApplicantOnlinePayment):
800    """An applicant payment via payment gateways.
801
802    """
803
804class IPUTMEApplicantEdit(IPUTMEApplicantEdit):
805    """An undergraduate applicant interface for editing.
806
807    Here we can repeat the fields from base data and set the
808    `required` and `readonly` attributes to True to further restrict
809    the data access. Or we can allow only certain certificates to be
810    selected by choosing the appropriate source.
811
812    We cannot omit fields here. This has to be done in the
813    respective form page.
814    """
815
816class ICustomApplicantUpdateByRegNo(INigeriaApplicantUpdateByRegNo):
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
823class ICustomApplicantRefereeReport(IApplicantRefereeReport):
824    """A referee report.
825    """
826
827    duration = schema.Text(
828        title = _(u'How long and in what capacity have you known the candidate?'),
829        required = False,
830        )
831
832    itellectual = schema.Choice(
833        title = _(u'Intellectual Capacity'),
834        required = False,
835        readonly = False,
836        vocabulary = rating_vocab,
837        )
838
839    persistent = schema.Choice(
840        title = _(u'Capacity for Persistent and Independent Academic Study'),
841        required = False,
842        readonly = False,
843        vocabulary = rating_vocab,
844        )
845
846    imaginative = schema.Choice(
847        title = _(u'Ability for Imaginative Thought'),
848        required = False,
849        readonly = False,
850        vocabulary = rating_vocab,
851        )
852
853    productive = schema.Choice(
854        title = _(u'Promise of Productive Scholarship'),
855        required = False,
856        readonly = False,
857        vocabulary = rating_vocab,
858        )
859
860    previous = schema.Choice(
861        title = _(u'Quality of Previous Work'),
862        required = False,
863        readonly = False,
864        vocabulary = rating_vocab,
865        )
866
867    expression = schema.Choice(
868        title = _(u'Oral and Written Expression in English'),
869        required = False,
870        readonly = False,
871        vocabulary = rating_vocab,
872        )
873
874    personality = schema.Text(
875        title = _(u'Please comment on the candidate\'s personality '
876            'with particular reference to his/her moral character, emotional '
877            'and physical stabilty'),
878        required = False,
879        )
880
881    promise = schema.Choice(
882        title = _(u'Candidate\'s overall promise'),
883        required = False,
884        readonly = False,
885        vocabulary = overallpromise_vocab,
886        )
887
888    report = schema.Text(
889        title = _(u'Any other relevant information which would help '
890            'in determining the candidate\'s suitability?'),
891        required = False,
892        )
893
894    objection = schema.Text(
895        title = _(u'Have you any objection to the contents of this '
896            'evaluation being disclosed to any award-given body if '
897            'the need arises?'),
898        required = False,
899        )
Note: See TracBrowser for help on using the repository browser.