1 | ## $Id: interfaces.py 15530 2019-07-31 10:49:59Z 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 | |
---|
870 | class ICustomApplicant(ICustomUGApplicant, ICustomPGApplicant, |
---|
871 | ITranscriptApplicant, ICertificateRequest, |
---|
872 | IVerificationRequest): |
---|
873 | """An interface for all types of applicants. |
---|
874 | |
---|
875 | Attention: The ICustomPGApplicant field seetings will be overwritten |
---|
876 | by ICustomPGApplicant field settings. If a field is defined |
---|
877 | in both interfaces zope.schema validates only against the |
---|
878 | constraints in ICustomUGApplicant. This does not affect the forms |
---|
879 | since they are build on either ICustomUGApplicant or ICustomPGApplicant. |
---|
880 | """ |
---|
881 | |
---|
882 | def writeLogMessage(view, comment): |
---|
883 | """Adds an INFO message to the log file |
---|
884 | """ |
---|
885 | |
---|
886 | def createStudent(): |
---|
887 | """Create a student object from applicatnt data |
---|
888 | and copy applicant object. |
---|
889 | """ |
---|
890 | |
---|
891 | class ICustomUGApplicantEdit(ICustomUGApplicant): |
---|
892 | """An undergraduate applicant interface for edit forms. |
---|
893 | |
---|
894 | Here we can repeat the fields from base data and set the |
---|
895 | `required` and `readonly` attributes to True to further restrict |
---|
896 | the data access. Or we can allow only certain certificates to be |
---|
897 | selected by choosing the appropriate source. |
---|
898 | |
---|
899 | We cannot omit fields here. This has to be done in the |
---|
900 | respective form page. |
---|
901 | """ |
---|
902 | |
---|
903 | #programme_type = schema.Choice( |
---|
904 | # title = _(u'Programme Type'), |
---|
905 | # vocabulary = programme_types_vocab, |
---|
906 | # required = True, |
---|
907 | # ) |
---|
908 | |
---|
909 | date_of_birth = FormattedDate( |
---|
910 | title = _(u'Date of Birth'), |
---|
911 | required = True, |
---|
912 | show_year = True, |
---|
913 | ) |
---|
914 | |
---|
915 | course1 = schema.Choice( |
---|
916 | title = _(u'1st Choice Course of Study'), |
---|
917 | source = AppCatCertificateSource(), |
---|
918 | required = True, |
---|
919 | ) |
---|
920 | |
---|
921 | course2 = schema.Choice( |
---|
922 | title = _(u'2nd Choice Course of Study'), |
---|
923 | source = AppCatCertificateSource(), |
---|
924 | required = True, |
---|
925 | ) |
---|
926 | |
---|
927 | course3 = schema.Choice( |
---|
928 | title = _(u'3rd Choice Course of Study'), |
---|
929 | source = AppCatCertificateSource(), |
---|
930 | required = True, |
---|
931 | ) |
---|
932 | |
---|
933 | fst_sit_fname = schema.TextLine( |
---|
934 | title = _(u'Full Name'), |
---|
935 | required = True, |
---|
936 | readonly = False, |
---|
937 | ) |
---|
938 | |
---|
939 | fst_sit_no = schema.TextLine( |
---|
940 | title = _(u'Exam Number'), |
---|
941 | required = True, |
---|
942 | readonly = False, |
---|
943 | ) |
---|
944 | |
---|
945 | fst_sit_sc_pin = schema.TextLine( |
---|
946 | title = _(u'Scratch Card Pin'), |
---|
947 | required = True, |
---|
948 | readonly = False, |
---|
949 | ) |
---|
950 | |
---|
951 | fst_sit_sc_serial_number = schema.TextLine( |
---|
952 | title = _(u'Scratch Card Serial Number'), |
---|
953 | required = True, |
---|
954 | readonly = False, |
---|
955 | ) |
---|
956 | |
---|
957 | fst_sit_date = FormattedDate( |
---|
958 | title = _(u'Exam Date'), |
---|
959 | required = True, |
---|
960 | readonly = False, |
---|
961 | show_year = True, |
---|
962 | ) |
---|
963 | |
---|
964 | fst_sit_type = schema.Choice( |
---|
965 | title = _(u'Exam Type'), |
---|
966 | required = True, |
---|
967 | readonly = False, |
---|
968 | vocabulary = exam_types, |
---|
969 | ) |
---|
970 | |
---|
971 | # course1 works only on manage pages. On edit pages course1 input is missing |
---|
972 | # and no Invalid exception is raised. |
---|
973 | # NoInputData: NoInputD...course1' |
---|
974 | # Therefore, we check and compare course1 on CustomApplicantEditFormPage. |
---|
975 | @invariant |
---|
976 | def course_choice(applicant): |
---|
977 | if applicant.course2 == applicant.course3: |
---|
978 | raise Invalid(_("3rd choice course must differ from 2nd choice course.")) |
---|
979 | |
---|
980 | #ICustomUGApplicantEdit['programme_type'].order = ICustomUGApplicant[ |
---|
981 | # 'programme_type'].order |
---|
982 | ICustomUGApplicantEdit['date_of_birth'].order = ICustomUGApplicant[ |
---|
983 | 'date_of_birth'].order |
---|
984 | ICustomUGApplicantEdit['course1'].order = ICustomUGApplicant[ |
---|
985 | 'course1'].order |
---|
986 | ICustomUGApplicantEdit['course2'].order = ICustomUGApplicant[ |
---|
987 | 'course2'].order |
---|
988 | ICustomUGApplicantEdit['course3'].order = ICustomUGApplicant[ |
---|
989 | 'course3'].order |
---|
990 | ICustomUGApplicantEdit['fst_sit_fname'].order = ICustomUGApplicant[ |
---|
991 | 'fst_sit_fname'].order |
---|
992 | ICustomUGApplicantEdit['fst_sit_no'].order = ICustomUGApplicant[ |
---|
993 | 'fst_sit_no'].order |
---|
994 | ICustomUGApplicantEdit['fst_sit_sc_pin'].order = ICustomUGApplicant[ |
---|
995 | 'fst_sit_sc_pin'].order |
---|
996 | ICustomUGApplicantEdit['fst_sit_sc_serial_number'].order = ICustomUGApplicant[ |
---|
997 | 'fst_sit_sc_serial_number'].order |
---|
998 | ICustomUGApplicantEdit['fst_sit_date'].order = ICustomUGApplicant[ |
---|
999 | 'fst_sit_date'].order |
---|
1000 | ICustomUGApplicantEdit['fst_sit_type'].order = ICustomUGApplicant[ |
---|
1001 | 'fst_sit_type'].order |
---|
1002 | |
---|
1003 | class ICustomPGApplicantEdit(INigeriaPGApplicantEdit): |
---|
1004 | """A postgraduate applicant interface for editing. |
---|
1005 | |
---|
1006 | Here we can repeat the fields from base data and set the |
---|
1007 | `required` and `readonly` attributes to True to further restrict |
---|
1008 | the data access. Or we can allow only certain certificates to be |
---|
1009 | selected by choosing the appropriate source. |
---|
1010 | |
---|
1011 | We cannot omit fields here. This has to be done in the |
---|
1012 | respective form page. |
---|
1013 | """ |
---|
1014 | |
---|
1015 | class ICustomApplicantOnlinePayment(INigeriaApplicantOnlinePayment): |
---|
1016 | """An applicant payment via payment gateways. |
---|
1017 | |
---|
1018 | """ |
---|
1019 | |
---|
1020 | class IPUTMEApplicantEdit(IPUTMEApplicantEdit): |
---|
1021 | """An undergraduate applicant interface for editing. |
---|
1022 | |
---|
1023 | Here we can repeat the fields from base data and set the |
---|
1024 | `required` and `readonly` attributes to True to further restrict |
---|
1025 | the data access. Or we can allow only certain certificates to be |
---|
1026 | selected by choosing the appropriate source. |
---|
1027 | |
---|
1028 | We cannot omit fields here. This has to be done in the |
---|
1029 | respective form page. |
---|
1030 | """ |
---|
1031 | |
---|
1032 | class ICustomApplicantUpdateByRegNo(ICustomApplicant): |
---|
1033 | """Representation of an applicant. |
---|
1034 | |
---|
1035 | Skip regular reg_number validation if reg_number is used for finding |
---|
1036 | the applicant object. |
---|
1037 | """ |
---|
1038 | |
---|
1039 | reg_number = schema.TextLine( |
---|
1040 | title = u'Registration Number', |
---|
1041 | required = False, |
---|
1042 | ) |
---|
1043 | |
---|
1044 | |
---|
1045 | |
---|
1046 | |
---|