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

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

Add field.

  • Property svn:keywords set to Id
File size: 33.4 KB
Line 
1## $Id: interfaces.py 15994 2020-02-07 10:53:54Z 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        )
934
935    #reg_number = TextLineChoice(
936    #    title = _(u'Kofa Registration Number'),
937    #    readonly = False,
938    #    required = True,
939    #    source = contextual_reg_num_source,
940    #    )
941
942    firstname = schema.TextLine(
943        title = _(u'First Name'),
944        required = True,
945        )
946
947    middlename = schema.TextLine(
948        title = _(u'Middle Name'),
949        required = False,
950        )
951
952    lastname = schema.TextLine(
953        title = _(u'Last Name (Surname)'),
954        required = True,
955        )
956
957    sex = schema.Choice(
958        title = _(u'Gender'),
959        source = GenderSource(),
960        required = True,
961        )
962
963    email = schema.ASCIILine(
964        title = _(u'Email Address'),
965        required = True,
966        constraint=validate_email,
967        )
968
969    phone = PhoneNumber(
970        title = _(u'Phone'),
971        description = u'',
972        required = False,
973        )
974
975    matric_number = schema.TextLine(
976        title = _(u'WES Reference Number (where applicable)'),
977        readonly = False,
978        required = False,
979        )
980
981    dispatch_address = schema.Text(
982        title = _(u'Dispatch Address'),
983        required = True,
984        )
985
986class IRecruitment(IKofaObject):
987    """A recruitment application.
988    """
989
990    suspended = schema.Bool(
991        title = _(u'Account suspended'),
992        default = False,
993        required = False,
994        )
995
996    locked = schema.Bool(
997        title = _(u'Form locked'),
998        default = False,
999        required = False,
1000        )
1001
1002    applicant_id = schema.TextLine(
1003        title = _(u'Application Id'),
1004        required = False,
1005        readonly = False,
1006        )
1007
1008    #reg_number = TextLineChoice(
1009    #    title = _(u'Kofa Registration Number'),
1010    #    readonly = False,
1011    #    required = True,
1012    #    source = contextual_reg_num_source,
1013    #    )
1014
1015    application_types = schema.Choice(
1016        title = _(u'Application Category'),
1017        vocabulary = application_types_vocab,
1018        required = True,
1019        )
1020
1021    position_comment = schema.Text(
1022        title = _(u'Desired Position'),
1023        required = True,
1024        description = u'Copy and paste the vacant position '
1025                       'text from the <a target="_blank" '
1026                       'href="https://aauekpoma.edu.ng/">university website</a>.',
1027        )
1028
1029    firstname = schema.TextLine(
1030        title = _(u'First Name'),
1031        required = True,
1032        )
1033
1034    middlename = schema.TextLine(
1035        title = _(u'Middle Name'),
1036        required = False,
1037        )
1038
1039    lastname = schema.TextLine(
1040        title = _(u'Last Name (Surname)'),
1041        required = True,
1042        )
1043
1044    sex = schema.Choice(
1045        title = _(u'Gender'),
1046        source = GenderSource(),
1047        required = True,
1048        )
1049
1050    email = schema.ASCIILine(
1051        title = _(u'Email Address'),
1052        required = True,
1053        constraint=validate_email,
1054        )
1055
1056    phone = PhoneNumber(
1057        title = _(u'Phone'),
1058        description = u'',
1059        required = False,
1060        )
1061
1062    address = schema.Text(
1063        title = _(u'Address'),
1064        required = True,
1065        )
1066
1067class ISendByEmailRequest(IKofaObject):
1068    """A applicant asking for sending an email.
1069    """
1070
1071    suspended = schema.Bool(
1072        title = _(u'Account suspended'),
1073        default = False,
1074        required = False,
1075        )
1076
1077    locked = schema.Bool(
1078        title = _(u'Form locked'),
1079        default = False,
1080        required = False,
1081        )
1082
1083    applicant_id = schema.TextLine(
1084        title = _(u'Applicant Id'),
1085        required = False,
1086        readonly = False,
1087        )
1088
1089    firstname = schema.TextLine(
1090        title = _(u'First Name'),
1091        required = True,
1092        )
1093
1094    middlename = schema.TextLine(
1095        title = _(u'Middle Name'),
1096        required = False,
1097        )
1098
1099    lastname = schema.TextLine(
1100        title = _(u'Last Name (Surname)'),
1101        required = True,
1102        )
1103
1104    sex = schema.Choice(
1105        title = _(u'Gender'),
1106        source = GenderSource(),
1107        required = True,
1108        )
1109
1110    email = schema.ASCIILine(
1111        title = _(u"Applicant's Email Address"),
1112        required = True,
1113        constraint=validate_email,
1114        )
1115
1116    phone = PhoneNumber(
1117        title = _(u'Phone'),
1118        description = u'',
1119        required = False,
1120        )
1121
1122    body_address = schema.Text(
1123        title = _(u'Address of Requesting Organization'),
1124        required = True,
1125        )
1126
1127    body_email = schema.ASCIILine(
1128        title = _(u"Email Address of Requesting Organization"),
1129        required = True,
1130        constraint=validate_email,
1131        )
1132
1133    request_type = schema.Choice(
1134        title = _(u'Request Type'),
1135        vocabulary = request_types_vocab,
1136        required = True,
1137        )
1138
1139    document_type = schema.Choice(
1140        title = _(u'Document Type'),
1141        vocabulary = document_types_vocab,
1142        required = True,
1143        )
1144
1145class ICustomApplicant(ICustomUGApplicant, ICustomPGApplicant,
1146                       ITranscriptApplicant, ICertificateRequest,
1147                       IVerificationRequest, ISendByEmailRequest,
1148                       IFedexRequest, IRecruitment):
1149    """An interface for all types of applicants.
1150
1151    Attention: The ICustomPGApplicant field seetings will be overwritten
1152    by ICustomPGApplicant field settings. If a field is defined
1153    in both interfaces zope.schema validates only against the
1154    constraints in ICustomUGApplicant. This does not affect the forms
1155    since they are build on either ICustomUGApplicant or ICustomPGApplicant.
1156    """
1157
1158    def writeLogMessage(view, comment):
1159        """Adds an INFO message to the log file
1160        """
1161
1162    def createStudent():
1163        """Create a student object from applicatnt data
1164        and copy applicant object.
1165        """
1166
1167class ICustomUGApplicantEdit(ICustomUGApplicant):
1168    """An undergraduate applicant interface for edit forms.
1169
1170    Here we can repeat the fields from base data and set the
1171    `required` and `readonly` attributes to True to further restrict
1172    the data access. Or we can allow only certain certificates to be
1173    selected by choosing the appropriate source.
1174
1175    We cannot omit fields here. This has to be done in the
1176    respective form page.
1177    """
1178
1179    #programme_type = schema.Choice(
1180    #    title = _(u'Programme Type'),
1181    #    vocabulary = programme_types_vocab,
1182    #    required = True,
1183    #    )
1184
1185    date_of_birth = FormattedDate(
1186        title = _(u'Date of Birth'),
1187        required = True,
1188        show_year = True,
1189        )
1190
1191    course1 = schema.Choice(
1192        title = _(u'1st Choice Course of Study'),
1193        source = AppCatCertificateSource(),
1194        required = True,
1195        )
1196
1197    course2 = schema.Choice(
1198        title = _(u'2nd Choice Course of Study'),
1199        source = AppCatCertificateSource(),
1200        required = True,
1201        )
1202
1203    course3 = schema.Choice(
1204        title = _(u'3rd Choice Course of Study'),
1205        source = AppCatCertificateSource(),
1206        required = True,
1207        )
1208
1209    fst_sit_fname = schema.TextLine(
1210        title = _(u'Full Name'),
1211        required = True,
1212        readonly = False,
1213        )
1214
1215    fst_sit_no = schema.TextLine(
1216        title = _(u'Exam Number'),
1217        required = True,
1218        readonly = False,
1219        )
1220
1221    fst_sit_sc_pin = schema.TextLine(
1222        title = _(u'Scratch Card Pin'),
1223        required = True,
1224        readonly = False,
1225        )
1226
1227    fst_sit_sc_serial_number = schema.TextLine(
1228        title = _(u'Scratch Card Serial Number'),
1229        required = True,
1230        readonly = False,
1231        )
1232
1233    fst_sit_date = FormattedDate(
1234        title = _(u'Exam Date'),
1235        required = True,
1236        readonly = False,
1237        show_year = True,
1238        )
1239
1240    fst_sit_type = schema.Choice(
1241        title = _(u'Exam Type'),
1242        required = True,
1243        readonly = False,
1244        vocabulary = exam_types,
1245        )
1246
1247    # course1 works only on manage pages. On edit pages course1 input is missing
1248    # and no Invalid exception is raised.
1249    # NoInputData: NoInputD...course1'
1250    # Therefore, we check and compare course1 on CustomApplicantEditFormPage.
1251    @invariant
1252    def course_choice(applicant):
1253        if applicant.course2 == applicant.course3:
1254            raise Invalid(_("3rd choice course must differ from 2nd choice course."))
1255
1256#ICustomUGApplicantEdit['programme_type'].order = ICustomUGApplicant[
1257#    'programme_type'].order
1258ICustomUGApplicantEdit['date_of_birth'].order = ICustomUGApplicant[
1259    'date_of_birth'].order
1260ICustomUGApplicantEdit['course1'].order = ICustomUGApplicant[
1261    'course1'].order
1262ICustomUGApplicantEdit['course2'].order = ICustomUGApplicant[
1263    'course2'].order
1264ICustomUGApplicantEdit['course3'].order = ICustomUGApplicant[
1265    'course3'].order
1266ICustomUGApplicantEdit['fst_sit_fname'].order = ICustomUGApplicant[
1267    'fst_sit_fname'].order
1268ICustomUGApplicantEdit['fst_sit_no'].order = ICustomUGApplicant[
1269    'fst_sit_no'].order
1270ICustomUGApplicantEdit['fst_sit_sc_pin'].order = ICustomUGApplicant[
1271    'fst_sit_sc_pin'].order
1272ICustomUGApplicantEdit['fst_sit_sc_serial_number'].order = ICustomUGApplicant[
1273    'fst_sit_sc_serial_number'].order
1274ICustomUGApplicantEdit['fst_sit_date'].order = ICustomUGApplicant[
1275    'fst_sit_date'].order
1276ICustomUGApplicantEdit['fst_sit_type'].order = ICustomUGApplicant[
1277    'fst_sit_type'].order
1278
1279class ICustomPGApplicantEdit(INigeriaPGApplicantEdit):
1280    """A postgraduate applicant interface for editing.
1281
1282    Here we can repeat the fields from base data and set the
1283    `required` and `readonly` attributes to True to further restrict
1284    the data access. Or we can allow only certain certificates to be
1285    selected by choosing the appropriate source.
1286
1287    We cannot omit fields here. This has to be done in the
1288    respective form page.
1289    """
1290
1291class ICustomApplicantOnlinePayment(INigeriaApplicantOnlinePayment):
1292    """An applicant payment via payment gateways.
1293
1294    """
1295
1296class IPUTMEApplicantEdit(IPUTMEApplicantEdit):
1297    """An undergraduate applicant interface for editing.
1298
1299    Here we can repeat the fields from base data and set the
1300    `required` and `readonly` attributes to True to further restrict
1301    the data access. Or we can allow only certain certificates to be
1302    selected by choosing the appropriate source.
1303
1304    We cannot omit fields here. This has to be done in the
1305    respective form page.
1306    """
1307
1308class ICustomApplicantUpdateByRegNo(ICustomApplicant):
1309    """Representation of an applicant.
1310
1311    Skip regular reg_number validation if reg_number is used for finding
1312    the applicant object.
1313    """
1314
1315    reg_number = schema.TextLine(
1316        title = u'Registration Number',
1317        required = False,
1318        )
1319
1320
1321
1322
Note: See TracBrowser for help on using the repository browser.