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