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

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

Customize referee report form.

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