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

Last change on this file since 16673 was 16005, checked in by Henrik Bettermann, 5 years ago

Remove description.

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