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