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