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