source: main/waeup.aaue/trunk/src/waeup/aaue/applicants/interfaces.py @ 16765

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

Implement new pg application form.

  • Property svn:keywords set to Id
File size: 41.7 KB
Line 
1## $Id: interfaces.py 16763 2022-01-31 09:14:15Z henrik $
2##
3## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann
4## This program is free software; you can redistribute it and/or modify
5## it under the terms of the GNU General Public License as published by
6## the Free Software Foundation; either version 2 of the License, or
7## (at your option) any later version.
8##
9## This program is distributed in the hope that it will be useful,
10## but WITHOUT ANY WARRANTY; without even the implied warranty of
11## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12## GNU General Public License for more details.
13##
14## You should have received a copy of the GNU General Public License
15## along with this program; if not, write to the Free Software
16## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17##
18"""Customized interfaces of the university application package.
19"""
20
21from zope import schema
22from zope.interface import Attribute, invariant, Invalid
23from waeup.kofa.applicants.interfaces import (
24    IApplicantBaseData,
25    AppCatCertificateSource, CertificateSource)
26from waeup.kofa.schoolgrades import ResultEntryField
27from waeup.kofa.interfaces import (
28    SimpleKofaVocabulary, academic_sessions_vocab, validate_email)
29from waeup.kofa.schema import FormattedDate, TextLineChoice, PhoneNumber
30from waeup.kofa.interfaces import IKofaObject
31from waeup.kofa.students.vocabularies import (
32    nats_vocab, GenderSource, StudyLevelSource)
33from waeup.kofa.applicants.interfaces import (
34    contextual_reg_num_source,
35    IApplicantBaseData)
36from waeup.kofa.refereeentries import RefereeEntryField
37from waeup.kofa.university.vocabularies import StudyModeSource
38from kofacustom.nigeria.applicants.interfaces import (
39    LGASource, high_qual, high_grade, exam_types,
40    INigeriaUGApplicant, INigeriaPGApplicant,
41    INigeriaApplicantOnlinePayment,
42    INigeriaUGApplicantEdit, INigeriaPGApplicantEdit,
43    INigeriaApplicantUpdateByRegNo,
44    IPUTMEApplicantEdit,
45    )
46from waeup.aaue.interfaces import MessageFactory as _
47from waeup.aaue.payments.interfaces import ICustomOnlinePayment
48
49programme_types_vocab = SimpleKofaVocabulary(
50    (_('Undergraduate Programme (100 level)'), 'regular'),
51    (_('Direct Entry (200 level)'), 'direct'),
52    (_('not applicable'), 'na'),
53    )
54
55certificate_types_vocab = SimpleKofaVocabulary(
56    (_('Full-time Degree'), 'ft'),
57    (_('Part-time Degree'), 'pt'),
58    (_('Diploma'), 'dp'),
59    (_('Masters Degree'), 'ma'),
60    (_('Doctorate Degree'), 'phd'),
61    )
62
63document_types_vocab = SimpleKofaVocabulary(
64    (_('Certificate'), 'certificate'),
65    (_('Result'), 'result'),
66    (_('Transcript'), 'transcript'),
67    (_('Studentship'), 'studship'),
68    )
69
70application_types_vocab = SimpleKofaVocabulary(
71    (_('Academic Staff Positions'), 'academic'),
72    (_('Senior Non-Teaching Staff'), 'senior'),
73    (_('Junior Staff (Non-Teaching)'), 'junior'),
74    )
75
76request_types_vocab = SimpleKofaVocabulary(
77    (_('Scanned Result'), 'result'),
78    (_('Scanned Certificate'), 'certificate'),
79    (_('Scanned Transcript'), 'transcript'),
80    (_('Attestation'), 'attest'),
81    (_('Proficiency in English Language'), 'english'),
82    )
83
84class ICustomUGApplicant(IApplicantBaseData):
85    """An undergraduate applicant.
86
87    This interface defines the least common multiple of all fields
88    in ug application forms. In customized forms, fields can be excluded by
89    adding them to the UG_OMIT* tuples.
90    """
91
92    #programme_type = schema.Choice(
93    #    title = _(u'Programme Type'),
94    #    vocabulary = programme_types_vocab,
95    #    required = False,
96    #    )
97
98    nationality = schema.Choice(
99        source = nats_vocab,
100        title = _(u'Nationality'),
101        required = True,
102        )
103
104    lga = schema.Choice(
105        source = LGASource(),
106        title = _(u'State/LGA (Nigerians only)'),
107        required = False,
108        )
109
110    perm_address = schema.Text(
111        title = _(u'Permanent Address'),
112        required = False,
113        )
114
115    home_town = schema.TextLine(
116        title = _(u'Home Town'),
117        required = False,
118        )
119
120    #jamb_reg_number = schema.TextLine(
121    #    title = _(u'JAMB Registration Number'),
122    #    required = False,
123    #    )
124
125    jamb_score = schema.Int(
126        title = _(u'Total JAMB Score'),
127        required = False,
128        )
129
130    jamb_subjects = schema.Text(
131        title = _(u'JAMB Subjects and Scores'),
132        required = False,
133        )
134
135    course1 = schema.Choice(
136        title = _(u'1st Choice Course of Study'),
137        source = AppCatCertificateSource(),
138        required = False,
139        )
140
141    course2 = schema.Choice(
142        title = _(u'2nd Choice Course of Study'),
143        source = AppCatCertificateSource(),
144        required = False,
145        )
146
147    course3 = schema.Choice(
148        title = _(u'3rd Choice Course of Study'),
149        source = AppCatCertificateSource(),
150        required = False,
151        )
152
153    fst_sit_fname = schema.TextLine(
154        title = _(u'Full Name'),
155        required = False,
156        readonly = False,
157        )
158
159    fst_sit_no = schema.TextLine(
160        title = _(u'Exam Number'),
161        required = False,
162        readonly = False,
163        )
164
165    fst_sit_sc_pin = schema.TextLine(
166        title = _(u'Scratch Card Pin'),
167        required = False,
168        readonly = False,
169        )
170
171    fst_sit_sc_serial_number = schema.TextLine(
172        title = _(u'Scratch Card Serial Number'),
173        required = False,
174        readonly = False,
175        )
176
177    fst_sit_date = FormattedDate(
178        title = _(u'Exam Date'),
179        required = False,
180        readonly = False,
181        show_year = True,
182        )
183
184    fst_sit_type = schema.Choice(
185        title = _(u'Exam Type'),
186        required = False,
187        readonly = False,
188        vocabulary = exam_types,
189        )
190
191    fst_sit_results = schema.List(
192        title = _(u'Exam Results'),
193        value_type = ResultEntryField(),
194        required = False,
195        readonly = False,
196        defaultFactory=list,
197        )
198
199    scd_sit_fname = schema.TextLine(
200        title = _(u'Full Name'),
201        required = False,
202        readonly = False,
203        )
204
205    scd_sit_no = schema.TextLine(
206        title = _(u'Exam Number'),
207        required = False,
208        readonly = False,
209        )
210
211    scd_sit_sc_pin = schema.TextLine(
212        title = _(u'Scratch Card Pin'),
213        required = False,
214        readonly = False,
215        )
216
217    scd_sit_sc_serial_number = schema.TextLine(
218        title = _(u'Scratch Card Serial Number'),
219        required = False,
220        readonly = False,
221        )
222
223    scd_sit_date = FormattedDate(
224        title = _(u'Exam Date'),
225        required = False,
226        readonly = False,
227        show_year = True,
228        )
229
230    scd_sit_type = schema.Choice(
231        title = _(u'Exam Type'),
232        required = False,
233        readonly = False,
234        vocabulary = exam_types,
235        )
236
237    scd_sit_results = schema.List(
238        title = _(u'Exam Results'),
239        value_type = ResultEntryField(),
240        required = False,
241        readonly = False,
242        defaultFactory=list,
243        )
244
245    alr_fname = schema.TextLine(
246        title = _(u'Full Name'),
247        required = False,
248        readonly = False,
249        )
250
251    alr_no = schema.TextLine(
252        title = _(u'Exam Number'),
253        required = False,
254        readonly = False,
255        )
256
257    alr_date = FormattedDate(
258        title = _(u'Exam Date'),
259        required = False,
260        readonly = False,
261        show_year = True,
262        )
263
264    alr_results = schema.List(
265        title = _(u'Exam Results'),
266        value_type = ResultEntryField(),
267        required = False,
268        readonly = False,
269        defaultFactory=list,
270        )
271
272    hq_type = schema.Choice(
273        title = _(u'Qualification Obtained'),
274        required = False,
275        readonly = False,
276        vocabulary = high_qual,
277        )
278
279    hq_fname = schema.TextLine(
280        title = _(u'Full Name'),
281        required = False,
282        readonly = False,
283        )
284
285    hq_matric_no = schema.TextLine(
286        title = _(u'Former Matric Number'),
287        required = False,
288        readonly = False,
289        )
290
291    hq_degree = schema.Choice(
292        title = _(u'Class of Degree'),
293        required = False,
294        readonly = False,
295        vocabulary = high_grade,
296        )
297
298    hq_school = schema.TextLine(
299        title = _(u'Institution Attended'),
300        required = False,
301        readonly = False,
302        )
303
304    hq_session = schema.TextLine(
305        title = _(u'Years Attended'),
306        required = False,
307        readonly = False,
308        )
309
310    hq_disc = schema.TextLine(
311        title = _(u'Discipline'),
312        required = False,
313        readonly = False,
314        )
315
316    hq_type2 = schema.Choice(
317        title = _(u'Qualification Obtained'),
318        required = False,
319        readonly = False,
320        vocabulary = high_qual,
321        )
322
323    hq_fname2 = schema.TextLine(
324        title = _(u'Full Name'),
325        required = False,
326        readonly = False,
327        )
328
329    hq_matric_no2 = schema.TextLine(
330        title = _(u'Former Matric Number'),
331        required = False,
332        readonly = False,
333        )
334
335    hq_degree2 = schema.Choice(
336        title = _(u'Class of Degree'),
337        required = False,
338        readonly = False,
339        vocabulary = high_grade,
340        )
341
342    hq_school2 = schema.TextLine(
343        title = _(u'Institution Attended'),
344        required = False,
345        readonly = False,
346        )
347
348    hq_session2 = schema.TextLine(
349        title = _(u'Years Attended'),
350        required = False,
351        readonly = False,
352        )
353
354    hq_disc2 = schema.TextLine(
355        title = _(u'Discipline'),
356        required = False,
357        readonly = False,
358        )
359
360    hq_type3 = schema.Choice(
361        title = _(u'Qualification Obtained'),
362        required = False,
363        readonly = False,
364        vocabulary = high_qual,
365        )
366
367    hq_fname3 = schema.TextLine(
368        title = _(u'Full Name'),
369        required = False,
370        readonly = False,
371        )
372
373    hq_matric_no3 = schema.TextLine(
374        title = _(u'Former Matric Number'),
375        required = False,
376        readonly = False,
377        )
378
379    hq_degree3 = schema.Choice(
380        title = _(u'Class of Degree'),
381        required = False,
382        readonly = False,
383        vocabulary = high_grade,
384        )
385
386    hq_school3 = schema.TextLine(
387        title = _(u'Institution Attended'),
388        required = False,
389        readonly = False,
390        )
391
392    hq_session3 = schema.TextLine(
393        title = _(u'Years Attended'),
394        required = False,
395        readonly = False,
396        )
397
398    hq_disc3 = schema.TextLine(
399        title = _(u'Discipline'),
400        required = False,
401        readonly = False,
402        )
403
404    nysc_year = schema.Int(
405        title = _(u'Nysc Year'),
406        required = False,
407        readonly = False,
408        )
409
410    nysc_location = schema.TextLine(
411        title = _(u'Nysc Location'),
412        required = False,
413        )
414
415    nysc_lga = schema.Choice(
416        source = LGASource(),
417        title = _(u'Nysc LGA'),
418        required = False,
419        )
420
421    employer = schema.TextLine(
422        title = _(u'Employer'),
423        required = False,
424        readonly = False,
425        )
426
427    emp_position = schema.TextLine(
428        title = _(u'Employer Position'),
429        required = False,
430        readonly = False,
431        )
432
433    emp_start = FormattedDate(
434        title = _(u'Start Date'),
435        required = False,
436        readonly = False,
437        show_year = True,
438        )
439
440    emp_end = FormattedDate(
441        title = _(u'End Date'),
442        required = False,
443        readonly = False,
444        show_year = True,
445        )
446
447    emp_reason = schema.TextLine(
448        title = _(u'Reason for Leaving'),
449        required = False,
450        readonly = False,
451        )
452
453    employer2 = schema.TextLine(
454        title = _(u'2nd Employer'),
455        required = False,
456        readonly = False,
457        )
458
459    emp2_position = schema.TextLine(
460        title = _(u'2nd Employer Position'),
461        required = False,
462        readonly = False,
463        )
464
465    emp2_start = FormattedDate(
466        title = _(u'Start Date'),
467        required = False,
468        readonly = False,
469        show_year = True,
470        )
471
472    emp2_end = FormattedDate(
473        title = _(u'End Date'),
474        required = False,
475        readonly = False,
476        show_year = True,
477        )
478
479    emp2_reason = schema.TextLine(
480        title = _(u'Reason for Leaving'),
481        required = False,
482        readonly = False,
483        )
484
485    former_matric = schema.TextLine(
486        title = _(u'If yes, matric number'),
487        required = False,
488        readonly = False,
489        )
490
491    notice = schema.Text(
492        title = _(u'Notice'),
493        required = False,
494        )
495
496
497    master_sheet_number = schema.TextLine(
498        title = _(u'Master Sheet Number'),
499        required = False,
500        readonly = False,
501        )
502
503    screening_venue = schema.TextLine(
504        title = _(u'Screening Venue'),
505        required = False,
506        )
507
508    screening_date = schema.TextLine(
509        title = _(u'Screening Date'),
510        required = False,
511        )
512
513    screening_score = schema.Int(
514        title = _(u'Screening Points'),
515        required = False,
516        )
517
518    student_id = schema.TextLine(
519        title = _(u'Student Id'),
520        required = False,
521        readonly = False,
522        )
523
524    course_admitted = schema.Choice(
525        title = _(u'Admitted Course of Study'),
526        source = CertificateSource(),
527        required = False,
528        )
529
530    locked = schema.Bool(
531        title = _(u'Form locked'),
532        default = False,
533        )
534
535    @invariant
536    def course_choice(applicant):
537        if applicant.course1 == applicant.course2:
538            raise Invalid(_("2nd choice course must differ from 1st choice course."))
539        if applicant.course1 == applicant.course3:
540            raise Invalid(_("3rd choice course must differ from 1st choice course."))
541        if applicant.course2 == applicant.course3:
542            raise Invalid(_("3rd choice course must differ from 2nd choice course."))
543
544#ICustomUGApplicant['programme_type'].order = IApplicantBaseData[
545#    'reg_number'].order
546
547
548class ICustomPGApplicant(IApplicantBaseData):
549    """A postgraduate applicant.
550
551    This interface defines the least common multiple of all fields
552    in pg application forms. In customized forms, fields can be excluded by
553    adding them to the PG_OMIT* tuples.
554    """
555
556    nationality = schema.Choice(
557        source = nats_vocab,
558        title = _(u'Nationality'),
559        required = True,
560        )
561    lga = schema.Choice(
562        source = LGASource(),
563        title = _(u'State/LGA (Nigerians only)'),
564        required = False,
565        )
566    #perm_address = schema.Text(
567    #    title = _(u'Permanent Address'),
568    #    required = False,
569    #    )
570    course1 = schema.Choice(
571        title = _(u'1st Choice Course of Study'),
572        source = AppCatCertificateSource(),
573        required = True,
574        )
575    course2 = schema.Choice(
576        title = _(u'2nd Choice Course of Study'),
577        source = AppCatCertificateSource(),
578        required = False,
579        )
580    hq_type = schema.Choice(
581        title = _(u'Qualification Obtained'),
582        required = False,
583        readonly = False,
584        vocabulary = high_qual,
585        )
586    hq_fname = schema.TextLine(
587        title = _(u'Full Name'),
588        required = False,
589        readonly = False,
590        )
591    hq_matric_no = schema.TextLine(
592        title = _(u'Former Matric Number'),
593        required = False,
594        readonly = False,
595        )
596    hq_degree = schema.Choice(
597        title = _(u'Class of Degree'),
598        required = False,
599        readonly = False,
600        vocabulary = high_grade,
601        )
602    hq_school = schema.TextLine(
603        title = _(u'Institution Attended'),
604        required = False,
605        readonly = False,
606        )
607    hq_session = schema.TextLine(
608        title = _(u'Years Attended'),
609        required = False,
610        readonly = False,
611        )
612    hq_disc = schema.TextLine(
613        title = _(u'Discipline'),
614        required = False,
615        readonly = False,
616        )
617    hq_type2 = schema.Choice(
618        title = _(u'Qualification Obtained'),
619        required = False,
620        readonly = False,
621        vocabulary = high_qual,
622        )
623
624    hq_fname2 = schema.TextLine(
625        title = _(u'Full Name'),
626        required = False,
627        readonly = False,
628        )
629
630    hq_matric_no2 = schema.TextLine(
631        title = _(u'Former Matric Number'),
632        required = False,
633        readonly = False,
634        )
635
636    hq_degree2 = schema.Choice(
637        title = _(u'Class of Degree'),
638        required = False,
639        readonly = False,
640        vocabulary = high_grade,
641        )
642
643    hq_school2 = schema.TextLine(
644        title = _(u'Institution Attended'),
645        required = False,
646        readonly = False,
647        )
648
649    hq_session2 = schema.TextLine(
650        title = _(u'Years Attended'),
651        required = False,
652        readonly = False,
653        )
654
655    hq_disc2 = schema.TextLine(
656        title = _(u'Discipline'),
657        required = False,
658        readonly = False,
659        )
660
661    hq_type3 = schema.Choice(
662        title = _(u'Qualification Obtained'),
663        required = False,
664        readonly = False,
665        vocabulary = high_qual,
666        )
667
668    hq_fname3 = schema.TextLine(
669        title = _(u'Full Name'),
670        required = False,
671        readonly = False,
672        )
673
674    hq_matric_no3 = schema.TextLine(
675        title = _(u'Former Matric Number'),
676        required = False,
677        readonly = False,
678        )
679
680    hq_degree3 = schema.Choice(
681        title = _(u'Class of Degree'),
682        required = False,
683        readonly = False,
684        vocabulary = high_grade,
685        )
686
687    hq_school3 = schema.TextLine(
688        title = _(u'Institution Attended'),
689        required = False,
690        readonly = False,
691        )
692
693    hq_session3 = schema.TextLine(
694        title = _(u'Years Attended'),
695        required = False,
696        readonly = False,
697        )
698
699    hq_disc3 = schema.TextLine(
700        title = _(u'Discipline'),
701        required = False,
702        readonly = False,
703        )
704
705    hq_type4 = schema.Choice(
706        title = _(u'Qualification Obtained'),
707        required = False,
708        readonly = False,
709        vocabulary = high_qual,
710        )
711
712    hq_fname4 = schema.TextLine(
713        title = _(u'Full Name'),
714        required = False,
715        readonly = False,
716        )
717
718    hq_matric_no4 = schema.TextLine(
719        title = _(u'Former Matric Number'),
720        required = False,
721        readonly = False,
722        )
723
724    hq_degree4 = schema.Choice(
725        title = _(u'Class of Degree'),
726        required = False,
727        readonly = False,
728        vocabulary = high_grade,
729        )
730
731    hq_school4 = schema.TextLine(
732        title = _(u'Institution Attended'),
733        required = False,
734        readonly = False,
735        )
736
737    hq_session4 = schema.TextLine(
738        title = _(u'Years Attended'),
739        required = False,
740        readonly = False,
741        )
742
743    hq_disc4 = schema.TextLine(
744        title = _(u'Discipline'),
745        required = False,
746        readonly = False,
747        )
748    presently_inst = schema.TextLine(
749        title = _(u'If yes, name of institution'),
750        required = False,
751        readonly = False,
752        )
753    nysc_year = schema.Int(
754        title = _(u'Nysc Year'),
755        required = False,
756        readonly = False,
757        )
758    nysc_lga = schema.Choice(
759        source = LGASource(),
760        title = _(u'Nysc Location'),
761        description = _(u'Leave blank for exception letters.'),
762        required = False,
763        )
764    employer = schema.TextLine(
765        title = _(u'Employer'),
766        required = False,
767        readonly = False,
768        )
769    emp_position = schema.TextLine(
770        title = _(u'Employer Position'),
771        required = False,
772        readonly = False,
773        )
774    emp_start = FormattedDate(
775        title = _(u'Start Date'),
776        required = False,
777        readonly = False,
778        show_year = True,
779        )
780    emp_end = FormattedDate(
781        title = _(u'End Date'),
782        required = False,
783        readonly = False,
784        show_year = True,
785        )
786    emp_reason = schema.TextLine(
787        title = _(u'Reason for Leaving'),
788        required = False,
789        readonly = False,
790        )
791    employer2 = schema.TextLine(
792        title = _(u'2nd Employer'),
793        required = False,
794        readonly = False,
795        )
796    emp2_position = schema.TextLine(
797        title = _(u'2nd Employer Position'),
798        required = False,
799        readonly = False,
800        )
801    emp2_start = FormattedDate(
802        title = _(u'Start Date'),
803        required = False,
804        readonly = False,
805        show_year = True,
806        )
807    emp2_end = FormattedDate(
808        title = _(u'End Date'),
809        required = False,
810        readonly = False,
811        show_year = True,
812        )
813    emp2_reason = schema.TextLine(
814        title = _(u'Reason for Leaving'),
815        required = False,
816        readonly = False,
817        )
818    former_matric = schema.TextLine(
819        title = _(u'If yes, matric number'),
820        required = False,
821        readonly = False,
822        )
823    notice = schema.Text(
824        title = _(u'Notice'),
825        required = False,
826        readonly = False,
827        )
828    screening_venue = schema.TextLine(
829        title = _(u'Screening Venue'),
830        required = False,
831        )
832    screening_date = schema.TextLine(
833        title = _(u'Screening Date'),
834        required = False,
835        )
836    screening_score = schema.Float(
837        title = _(u'Screening Score (%)'),
838        required = False,
839        )
840    student_id = schema.TextLine(
841        title = _(u'Student Id'),
842        required = False,
843        readonly = False,
844        )
845    course_admitted = schema.Choice(
846        title = _(u'Admitted Course of Study'),
847        source = CertificateSource(),
848        required = False,
849        readonly = False,
850        )
851    locked = schema.Bool(
852        title = _(u'Form locked'),
853        default = False,
854        required = False,
855        )
856
857    referees = schema.List(
858        title = _(u'Referees'),
859        value_type = RefereeEntryField(),
860        required = False,
861        defaultFactory=list,
862        )
863
864class ITranscriptApplicant(IKofaObject):
865    """A transcript applicant.
866    """
867
868    suspended = schema.Bool(
869        title = _(u'Account suspended'),
870        default = False,
871        required = False,
872        )
873
874    locked = schema.Bool(
875        title = _(u'Form locked'),
876        default = False,
877        required = False,
878        )
879
880    applicant_id = schema.TextLine(
881        title = _(u'Application Id'),
882        required = False,
883        readonly = False,
884        )
885
886    reg_number = TextLineChoice(
887        title = _(u'Kofa Registration Number'),
888        readonly = False,
889        required = True,
890        source = contextual_reg_num_source,
891        )
892
893    firstname = schema.TextLine(
894        title = _(u'First Name'),
895        required = True,
896        )
897
898    middlename = schema.TextLine(
899        title = _(u'Middle Name'),
900        required = False,
901        )
902
903    lastname = schema.TextLine(
904        title = _(u'Last Name (Surname)'),
905        required = True,
906        )
907
908    matric_number = schema.TextLine(
909        title = _(u'Matriculation Number'),
910        readonly = False,
911        required = True,
912        )
913
914    date_of_birth = FormattedDate(
915        title = _(u'Date of Birth'),
916        required = False,
917        #date_format = u'%d/%m/%Y', # Use grok-instance-wide default
918        show_year = True,
919        )
920
921    sex = schema.Choice(
922        title = _(u'Gender'),
923        source = GenderSource(),
924        required = True,
925        )
926
927    place_of_birth = schema.TextLine(
928        title = _(u'Place of Birth'),
929        readonly = False,
930        required = False,
931        )
932
933    nationality = schema.Choice(
934        vocabulary = nats_vocab,
935        title = _(u'Nationality'),
936        required = False,
937        )
938
939    email = schema.ASCIILine(
940        title = _(u'Email Address'),
941        required = True,
942        constraint=validate_email,
943        )
944
945    phone = PhoneNumber(
946        title = _(u'Phone'),
947        description = u'',
948        required = False,
949        )
950
951    perm_address = schema.Text(
952        title = _(u'Current Local Address'),
953        required = False,
954        readonly = False,
955        )
956
957    dispatch_address = schema.Text(
958        title = _(u'Dispatch Addresses'),
959        description = u'Addresses to which transcript should be posted.',
960        required = False,
961        readonly = False,
962        )
963
964    entry_mode = schema.Choice(
965        title = _(u'Entry Mode'),
966        source = StudyModeSource(),
967        required = False,
968        readonly = False,
969        )
970
971    entry_session = schema.Choice(
972        title = _(u'Entry Session'),
973        source = academic_sessions_vocab,
974        required = False,
975        readonly = False,
976        )
977
978    end_session = schema.Choice(
979        title = _(u'End Session'),
980        source = academic_sessions_vocab,
981        required = False,
982        readonly = False,
983        )
984
985    course_studied = schema.Choice(
986        title = _(u'Course of Study / Degree'),
987        source = CertificateSource(),
988        required = False,
989        readonly = False,
990        )
991
992    purpose = schema.TextLine(
993        title = _(u'Purpose of this Application'),
994        readonly = False,
995        required = False,
996        )
997
998    course_changed = schema.Choice(
999        title = _(u'Change of Study Course'),
1000        description = u'If yes, select previous course of study.',
1001        source = CertificateSource(),
1002        readonly = False,
1003        required = False,
1004        )
1005
1006    change_level = schema.Choice(
1007        title = _(u'Change Level'),
1008        description = u'If yes, select level at which you changed course of study.',
1009        source = StudyLevelSource(),
1010        required = False,
1011        readonly = False,
1012        )
1013
1014    no_copies = schema.Choice(
1015        title = _(u'Number of Copies'),
1016        description = u'Must correspond with the number of dispatch addresses above.',
1017        values=[1, 2, 3, 4],
1018        required = False,
1019        readonly = False,
1020        default = 1,
1021        )
1022
1023class ICertificateRequest(IKofaObject):
1024    """A transcript applicant.
1025    """
1026
1027    suspended = schema.Bool(
1028        title = _(u'Account suspended'),
1029        default = False,
1030        required = False,
1031        )
1032
1033    locked = schema.Bool(
1034        title = _(u'Form locked'),
1035        default = False,
1036        required = False,
1037        )
1038
1039    applicant_id = schema.TextLine(
1040        title = _(u'Application Id'),
1041        required = False,
1042        readonly = False,
1043        )
1044
1045    reg_number = TextLineChoice(
1046        title = _(u'Kofa Registration Number'),
1047        readonly = False,
1048        required = True,
1049        source = contextual_reg_num_source,
1050        )
1051
1052    firstname = schema.TextLine(
1053        title = _(u'First Name'),
1054        required = True,
1055        )
1056
1057    middlename = schema.TextLine(
1058        title = _(u'Middle Name'),
1059        required = False,
1060        )
1061
1062    lastname = schema.TextLine(
1063        title = _(u'Last Name (Surname)'),
1064        required = True,
1065        )
1066
1067    matric_number = schema.TextLine(
1068        title = _(u'Matriculation Number'),
1069        readonly = False,
1070        required = True,
1071        )
1072
1073    date_of_birth = FormattedDate(
1074        title = _(u'Date of Birth'),
1075        required = False,
1076        #date_format = u'%d/%m/%Y', # Use grok-instance-wide default
1077        show_year = True,
1078        )
1079
1080    sex = schema.Choice(
1081        title = _(u'Gender'),
1082        source = GenderSource(),
1083        required = True,
1084        )
1085
1086    place_of_birth = schema.TextLine(
1087        title = _(u'Place of Birth'),
1088        readonly = False,
1089        required = False,
1090        )
1091
1092    nationality = schema.Choice(
1093        vocabulary = nats_vocab,
1094        title = _(u'Nationality'),
1095        required = False,
1096        )
1097
1098    email = schema.ASCIILine(
1099        title = _(u'Email Address'),
1100        required = True,
1101        constraint=validate_email,
1102        )
1103
1104    phone = PhoneNumber(
1105        title = _(u'Phone'),
1106        description = u'',
1107        required = False,
1108        )
1109
1110    entry_session = schema.Choice(
1111        title = _(u'Entry Session'),
1112        source = academic_sessions_vocab,
1113        required = False,
1114        readonly = False,
1115        )
1116
1117    end_session = schema.Choice(
1118        title = _(u'End Session'),
1119        source = academic_sessions_vocab,
1120        required = False,
1121        readonly = False,
1122        )
1123
1124    course_studied = schema.Choice(
1125        title = _(u'Course of Study / Degree'),
1126        source = CertificateSource(),
1127        required = True,
1128        readonly = False,
1129        )
1130
1131    certificate_type = schema.Choice(
1132        title = _(u'Certificate Type'),
1133        vocabulary = certificate_types_vocab,
1134        required = False,
1135        )
1136
1137
1138class IVerificationRequest(IKofaObject):
1139    """A applicant asking for verification.
1140    """
1141
1142    suspended = schema.Bool(
1143        title = _(u'Account suspended'),
1144        default = False,
1145        required = False,
1146        )
1147
1148    locked = schema.Bool(
1149        title = _(u'Form locked'),
1150        default = False,
1151        required = False,
1152        )
1153
1154    applicant_id = schema.TextLine(
1155        title = _(u'Application Id'),
1156        required = False,
1157        readonly = False,
1158        )
1159
1160    #reg_number = TextLineChoice(
1161    #    title = _(u'Kofa Registration Number'),
1162    #    readonly = False,
1163    #    required = True,
1164    #    source = contextual_reg_num_source,
1165    #    )
1166
1167    firstname = schema.TextLine(
1168        title = _(u'First Name'),
1169        required = True,
1170        )
1171
1172    middlename = schema.TextLine(
1173        title = _(u'Middle Name'),
1174        required = False,
1175        )
1176
1177    lastname = schema.TextLine(
1178        title = _(u'Last Name (Surname)'),
1179        required = True,
1180        )
1181
1182    sex = schema.Choice(
1183        title = _(u'Gender'),
1184        source = GenderSource(),
1185        required = True,
1186        )
1187
1188    email = schema.ASCIILine(
1189        title = _(u'Email Address'),
1190        required = True,
1191        constraint=validate_email,
1192        )
1193
1194    phone = PhoneNumber(
1195        title = _(u'Phone'),
1196        description = u'',
1197        required = False,
1198        )
1199
1200    matric_number = schema.TextLine(
1201        title = _(u'Verification Body Reference Number'),
1202        readonly = False,
1203        required = True,
1204        )
1205
1206    body_address = schema.Text(
1207        title = _(u'Verification Body Address'),
1208        required = True,
1209        )
1210
1211    document_type = schema.Choice(
1212        title = _(u'Document Type'),
1213        vocabulary = document_types_vocab,
1214        required = True,
1215        )
1216
1217class IFedexRequest(IKofaObject):
1218    """A applicant requests payment for courier.
1219    """
1220
1221    suspended = schema.Bool(
1222        title = _(u'Account suspended'),
1223        default = False,
1224        required = False,
1225        )
1226
1227    locked = schema.Bool(
1228        title = _(u'Form locked'),
1229        default = False,
1230        required = False,
1231        )
1232
1233    applicant_id = schema.TextLine(
1234        title = _(u'Application Id'),
1235        required = False,
1236        readonly = False,
1237        )
1238
1239    trans_id = schema.TextLine(
1240        title = _(u'Transcript Application Id'),
1241        required = True,
1242        readonly = False,
1243        #description = u'This serve as a unique identifier which '
1244        #               'allows the the officer to verify the transcript '
1245        #               'in order to avoid errors before dispatch.',
1246        )
1247
1248    #reg_number = TextLineChoice(
1249    #    title = _(u'Kofa Registration Number'),
1250    #    readonly = False,
1251    #    required = True,
1252    #    source = contextual_reg_num_source,
1253    #    )
1254
1255    firstname = schema.TextLine(
1256        title = _(u'First Name'),
1257        required = True,
1258        )
1259
1260    middlename = schema.TextLine(
1261        title = _(u'Middle Name'),
1262        required = False,
1263        )
1264
1265    lastname = schema.TextLine(
1266        title = _(u'Last Name (Surname)'),
1267        required = True,
1268        )
1269
1270    sex = schema.Choice(
1271        title = _(u'Gender'),
1272        source = GenderSource(),
1273        required = True,
1274        )
1275
1276    email = schema.ASCIILine(
1277        title = _(u'Email Address'),
1278        required = True,
1279        constraint=validate_email,
1280        )
1281
1282    phone = PhoneNumber(
1283        title = _(u'Phone'),
1284        description = u'',
1285        required = False,
1286        )
1287
1288    matric_number = schema.TextLine(
1289        title = _(u'WES Reference Number (where applicable)'),
1290        readonly = False,
1291        required = False,
1292        )
1293
1294    dispatch_address = schema.Text(
1295        title = _(u'Dispatch Address'),
1296        required = True,
1297        )
1298
1299class IRecruitment(IKofaObject):
1300    """A recruitment application.
1301    """
1302
1303    suspended = schema.Bool(
1304        title = _(u'Account suspended'),
1305        default = False,
1306        required = False,
1307        )
1308
1309    locked = schema.Bool(
1310        title = _(u'Form locked'),
1311        default = False,
1312        required = False,
1313        )
1314
1315    applicant_id = schema.TextLine(
1316        title = _(u'Application Id'),
1317        required = False,
1318        readonly = False,
1319        )
1320
1321    #reg_number = TextLineChoice(
1322    #    title = _(u'Kofa Registration Number'),
1323    #    readonly = False,
1324    #    required = True,
1325    #    source = contextual_reg_num_source,
1326    #    )
1327
1328    application_types = schema.Choice(
1329        title = _(u'Application Category'),
1330        vocabulary = application_types_vocab,
1331        required = True,
1332        )
1333
1334    position_comment = schema.Text(
1335        title = _(u'Desired Position'),
1336        required = True,
1337        description = u'Copy and paste the vacant position '
1338                       'text from the <a target="_blank" '
1339                       'href="https://aauekpoma.edu.ng/">university website</a>.',
1340        )
1341
1342    firstname = schema.TextLine(
1343        title = _(u'First Name'),
1344        required = True,
1345        )
1346
1347    middlename = schema.TextLine(
1348        title = _(u'Middle Name'),
1349        required = False,
1350        )
1351
1352    lastname = schema.TextLine(
1353        title = _(u'Last Name (Surname)'),
1354        required = True,
1355        )
1356
1357    sex = schema.Choice(
1358        title = _(u'Gender'),
1359        source = GenderSource(),
1360        required = True,
1361        )
1362
1363    email = schema.ASCIILine(
1364        title = _(u'Email Address'),
1365        required = True,
1366        constraint=validate_email,
1367        )
1368
1369    phone = PhoneNumber(
1370        title = _(u'Phone'),
1371        description = u'',
1372        required = False,
1373        )
1374
1375    address = schema.Text(
1376        title = _(u'Address'),
1377        required = True,
1378        )
1379
1380class ISendByEmailRequest(IKofaObject):
1381    """A applicant asking for sending an email.
1382    """
1383
1384    suspended = schema.Bool(
1385        title = _(u'Account suspended'),
1386        default = False,
1387        required = False,
1388        )
1389
1390    locked = schema.Bool(
1391        title = _(u'Form locked'),
1392        default = False,
1393        required = False,
1394        )
1395
1396    applicant_id = schema.TextLine(
1397        title = _(u'Applicant Id'),
1398        required = False,
1399        readonly = False,
1400        )
1401
1402    firstname = schema.TextLine(
1403        title = _(u'First Name'),
1404        required = True,
1405        )
1406
1407    middlename = schema.TextLine(
1408        title = _(u'Middle Name'),
1409        required = False,
1410        )
1411
1412    lastname = schema.TextLine(
1413        title = _(u'Last Name (Surname)'),
1414        required = True,
1415        )
1416
1417    sex = schema.Choice(
1418        title = _(u'Gender'),
1419        source = GenderSource(),
1420        required = True,
1421        )
1422
1423    email = schema.ASCIILine(
1424        title = _(u"Applicant's Email Address"),
1425        required = True,
1426        constraint=validate_email,
1427        )
1428
1429    phone = PhoneNumber(
1430        title = _(u'Phone'),
1431        description = u'',
1432        required = False,
1433        )
1434
1435    body_address = schema.Text(
1436        title = _(u'Address of Requesting Organization'),
1437        required = True,
1438        )
1439
1440    body_email = schema.ASCIILine(
1441        title = _(u"Email Address of Requesting Organization"),
1442        required = True,
1443        constraint=validate_email,
1444        )
1445
1446    request_type = schema.Choice(
1447        title = _(u'Request Type'),
1448        vocabulary = request_types_vocab,
1449        required = True,
1450        )
1451
1452    document_type = schema.Choice(
1453        title = _(u'Document Type'),
1454        vocabulary = document_types_vocab,
1455        required = True,
1456        )
1457
1458class ICustomApplicant(ICustomUGApplicant, ICustomPGApplicant,
1459                       ITranscriptApplicant, ICertificateRequest,
1460                       IVerificationRequest, ISendByEmailRequest,
1461                       IFedexRequest, IRecruitment):
1462    """An interface for all types of applicants.
1463
1464    Attention: The ICustomPGApplicant field seetings will be overwritten
1465    by ICustomPGApplicant field settings. If a field is defined
1466    in both interfaces zope.schema validates only against the
1467    constraints in ICustomUGApplicant. This does not affect the forms
1468    since they are build on either ICustomUGApplicant or ICustomPGApplicant.
1469    """
1470
1471    def writeLogMessage(view, comment):
1472        """Adds an INFO message to the log file
1473        """
1474
1475    def createStudent():
1476        """Create a student object from applicatnt data
1477        and copy applicant object.
1478        """
1479
1480class ICustomUGApplicantEdit(ICustomUGApplicant):
1481    """An undergraduate applicant interface for edit forms.
1482
1483    Here we can repeat the fields from base data and set the
1484    `required` and `readonly` attributes to True to further restrict
1485    the data access. Or we can allow only certain certificates to be
1486    selected by choosing the appropriate source.
1487
1488    We cannot omit fields here. This has to be done in the
1489    respective form page.
1490    """
1491
1492    #programme_type = schema.Choice(
1493    #    title = _(u'Programme Type'),
1494    #    vocabulary = programme_types_vocab,
1495    #    required = True,
1496    #    )
1497
1498    date_of_birth = FormattedDate(
1499        title = _(u'Date of Birth'),
1500        required = True,
1501        show_year = True,
1502        )
1503
1504    course1 = schema.Choice(
1505        title = _(u'1st Choice Course of Study'),
1506        source = AppCatCertificateSource(),
1507        required = True,
1508        )
1509
1510    course2 = schema.Choice(
1511        title = _(u'2nd Choice Course of Study'),
1512        source = AppCatCertificateSource(),
1513        required = True,
1514        )
1515
1516    course3 = schema.Choice(
1517        title = _(u'3rd Choice Course of Study'),
1518        source = AppCatCertificateSource(),
1519        required = True,
1520        )
1521
1522    fst_sit_fname = schema.TextLine(
1523        title = _(u'Full Name'),
1524        required = True,
1525        readonly = False,
1526        )
1527
1528    fst_sit_no = schema.TextLine(
1529        title = _(u'Exam Number'),
1530        required = True,
1531        readonly = False,
1532        )
1533
1534    fst_sit_sc_pin = schema.TextLine(
1535        title = _(u'Scratch Card Pin'),
1536        required = True,
1537        readonly = False,
1538        )
1539
1540    fst_sit_sc_serial_number = schema.TextLine(
1541        title = _(u'Scratch Card Serial Number'),
1542        required = True,
1543        readonly = False,
1544        )
1545
1546    fst_sit_date = FormattedDate(
1547        title = _(u'Exam Date'),
1548        required = True,
1549        readonly = False,
1550        show_year = True,
1551        )
1552
1553    fst_sit_type = schema.Choice(
1554        title = _(u'Exam Type'),
1555        required = True,
1556        readonly = False,
1557        vocabulary = exam_types,
1558        )
1559
1560    # course1 works only on manage pages. On edit pages course1 input is missing
1561    # and no Invalid exception is raised.
1562    # NoInputData: NoInputD...course1'
1563    # Therefore, we check and compare course1 on CustomApplicantEditFormPage.
1564    @invariant
1565    def course_choice(applicant):
1566        if applicant.course2 == applicant.course3:
1567            raise Invalid(_("3rd choice course must differ from 2nd choice course."))
1568
1569#ICustomUGApplicantEdit['programme_type'].order = ICustomUGApplicant[
1570#    'programme_type'].order
1571ICustomUGApplicantEdit['date_of_birth'].order = ICustomUGApplicant[
1572    'date_of_birth'].order
1573ICustomUGApplicantEdit['course1'].order = ICustomUGApplicant[
1574    'course1'].order
1575ICustomUGApplicantEdit['course2'].order = ICustomUGApplicant[
1576    'course2'].order
1577ICustomUGApplicantEdit['course3'].order = ICustomUGApplicant[
1578    'course3'].order
1579ICustomUGApplicantEdit['fst_sit_fname'].order = ICustomUGApplicant[
1580    'fst_sit_fname'].order
1581ICustomUGApplicantEdit['fst_sit_no'].order = ICustomUGApplicant[
1582    'fst_sit_no'].order
1583ICustomUGApplicantEdit['fst_sit_sc_pin'].order = ICustomUGApplicant[
1584    'fst_sit_sc_pin'].order
1585ICustomUGApplicantEdit['fst_sit_sc_serial_number'].order = ICustomUGApplicant[
1586    'fst_sit_sc_serial_number'].order
1587ICustomUGApplicantEdit['fst_sit_date'].order = ICustomUGApplicant[
1588    'fst_sit_date'].order
1589ICustomUGApplicantEdit['fst_sit_type'].order = ICustomUGApplicant[
1590    'fst_sit_type'].order
1591
1592class ICustomPGApplicantEdit(ICustomPGApplicant):
1593    """A postgraduate applicant interface for editing.
1594
1595    Here we can repeat the fields from base data and set the
1596    `required` and `readonly` attributes to True to further restrict
1597    the data access. Or we can allow only certain certificates to be
1598    selected by choosing the appropriate source.
1599
1600    We cannot omit fields here. This has to be done in the
1601    respective form page.
1602    """
1603
1604    email = schema.ASCIILine(
1605        title = _(u'Email Address'),
1606        required = True,
1607        constraint=validate_email,
1608        )
1609    date_of_birth = FormattedDate(
1610        title = _(u'Date of Birth'),
1611        required = True,
1612        show_year = True,
1613        )
1614
1615ICustomPGApplicantEdit[
1616    'date_of_birth'].order =  ICustomPGApplicant['date_of_birth'].order
1617ICustomPGApplicantEdit[
1618    'email'].order =  ICustomPGApplicant['email'].order
1619
1620class ICustomApplicantOnlinePayment(INigeriaApplicantOnlinePayment):
1621    """An applicant payment via payment gateways.
1622
1623    """
1624
1625class IPUTMEApplicantEdit(IPUTMEApplicantEdit):
1626    """An undergraduate applicant interface for editing.
1627
1628    Here we can repeat the fields from base data and set the
1629    `required` and `readonly` attributes to True to further restrict
1630    the data access. Or we can allow only certain certificates to be
1631    selected by choosing the appropriate source.
1632
1633    We cannot omit fields here. This has to be done in the
1634    respective form page.
1635    """
1636
1637class ICustomApplicantUpdateByRegNo(ICustomApplicant):
1638    """Representation of an applicant.
1639
1640    Skip regular reg_number validation if reg_number is used for finding
1641    the applicant object.
1642    """
1643
1644    reg_number = schema.TextLine(
1645        title = u'Registration Number',
1646        required = False,
1647        )
1648
1649
1650
1651
Note: See TracBrowser for help on using the repository browser.