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