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

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

Add item.

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