1 | ## $Id: interfaces.py 15045 2018-06-11 07:29:33Z 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.component import getUtility |
---|
23 | from zope.schema import getFields |
---|
24 | from waeup.kofa.applicants.interfaces import ( |
---|
25 | contextual_reg_num_source, |
---|
26 | IApplicantBaseData, |
---|
27 | AppCatCertificateSource, CertificateSource) |
---|
28 | from waeup.kofa.schoolgrades import ResultEntryField |
---|
29 | from waeup.kofa.interfaces import ( |
---|
30 | SimpleKofaVocabulary, |
---|
31 | academic_sessions_vocab, |
---|
32 | validate_email, |
---|
33 | SubjectSource, |
---|
34 | IKofaUtils, |
---|
35 | IKofaObject) |
---|
36 | from waeup.kofa.schema import FormattedDate, TextLineChoice |
---|
37 | from waeup.kofa.students.vocabularies import nats_vocab, GenderSource |
---|
38 | from kofacustom.nigeria.interfaces import ( |
---|
39 | LGASource, high_qual, high_grade, exam_types, validate_jamb_reg_number) |
---|
40 | from kofacustom.nigeria.interfaces import MessageFactory as _ |
---|
41 | from kofacustom.nigeria.payments.interfaces import INigeriaOnlinePayment |
---|
42 | |
---|
43 | programme_types_vocab = SimpleKofaVocabulary( |
---|
44 | (_('Post UTME'), 'putme'), |
---|
45 | (_('Post DE'), 'pude'), |
---|
46 | (_('Admission Screening Exercise'), 'ase'), |
---|
47 | (_('not applicable'), 'na'), |
---|
48 | ) |
---|
49 | |
---|
50 | jambsubjects = SimpleKofaVocabulary( |
---|
51 | (_('Use of English'),'english_language'), |
---|
52 | (_('Agricultural Science'),'agricultural_science'), |
---|
53 | (_('Arabic'),'arabic'), |
---|
54 | (_('Biology'),'biology'), |
---|
55 | (_('Book Keeping'),'book_keeping'), |
---|
56 | (_('Chemistry'),'chemistry'), |
---|
57 | (_('Christian Religious Studies'),'christian_religious_studies'), |
---|
58 | (_('Commerce'),'commerce'), |
---|
59 | (_('Economics'),'economics'), |
---|
60 | (_('Financial Accounting'),'financial_accounting'), |
---|
61 | (_('Fine Art'),'fine_art'), |
---|
62 | (_('Food and Nutrition'),'food_and_nutrition'), |
---|
63 | (_('French'),'french'), |
---|
64 | (_('Geography'),'geography'), |
---|
65 | (_('German'),'german'), |
---|
66 | (_('Government'),'government'), |
---|
67 | (_('Hausa'),'hausa'), |
---|
68 | (_('Home Economics'),'home_economics'), |
---|
69 | (_('History'),'history'), |
---|
70 | (_('Igbo'),'igbo'), |
---|
71 | (_('Literature in English'),'literature_in_english'), |
---|
72 | (_('Literature in Nigerian Languages'),'literature_in_nigerian_languages'), |
---|
73 | (_('Mathematics'),'mathematics'), |
---|
74 | (_('Music'),'music'), |
---|
75 | (_('Physics'),'physics'), |
---|
76 | (_('Yoruba'),'yoruba'), |
---|
77 | ) |
---|
78 | |
---|
79 | # Define a validation method for jamb subjects |
---|
80 | class NotExactNumberOfItems(schema.ValidationError): |
---|
81 | __doc__ = u"Not exactly 4 items selected." |
---|
82 | |
---|
83 | def four_items(value): |
---|
84 | if len(value) and len(value) != 4: |
---|
85 | raise NotExactNumberOfItems(value) |
---|
86 | return True |
---|
87 | |
---|
88 | class JAMBSubjectSource(SubjectSource): |
---|
89 | """A source for school subjects used in exam documentation. |
---|
90 | """ |
---|
91 | |
---|
92 | def getTitle(self, value): |
---|
93 | subjects_dict = getUtility(IKofaUtils).EXAM_SUBJECTS_DICT |
---|
94 | return "%s" % subjects_dict[value] |
---|
95 | |
---|
96 | # Fields to be omitted in all display forms. course_admitted is |
---|
97 | # rendered separately. |
---|
98 | |
---|
99 | OMIT_DISPLAY_FIELDS = ('locked', 'course_admitted', |
---|
100 | 'result_uploaded', 'suspended', 'special_application', |
---|
101 | 'bank_account_number', |
---|
102 | 'bank_account_name', |
---|
103 | 'bank_name') |
---|
104 | |
---|
105 | # UG students are all undergraduate students. |
---|
106 | UG_OMIT_DISPLAY_FIELDS = OMIT_DISPLAY_FIELDS + ( |
---|
107 | 'jamb_subjects_list', 'programme_type') |
---|
108 | UG_OMIT_PDF_FIELDS = UG_OMIT_DISPLAY_FIELDS + ('phone',) |
---|
109 | UG_OMIT_MANAGE_FIELDS = ( |
---|
110 | 'special_application', |
---|
111 | 'jamb_subjects_list', |
---|
112 | 'programme_type') |
---|
113 | UG_OMIT_EDIT_FIELDS = UG_OMIT_MANAGE_FIELDS + OMIT_DISPLAY_FIELDS + ( |
---|
114 | 'student_id', |
---|
115 | 'notice', |
---|
116 | 'screening_score', |
---|
117 | 'screening_venue', |
---|
118 | 'screening_date', |
---|
119 | 'jamb_age', |
---|
120 | 'jamb_subjects', |
---|
121 | 'jamb_score', |
---|
122 | 'jamb_reg_number', |
---|
123 | 'aggregate') |
---|
124 | |
---|
125 | # CBT is a subgroup of UG with the same interface. |
---|
126 | CBT_OMIT_FIELDS = ( |
---|
127 | 'hq_type', 'hq_matric_no', |
---|
128 | 'hq_degree', 'hq_school', |
---|
129 | 'hq_session', 'hq_disc', |
---|
130 | 'aggregate', 'jamb_subjects', |
---|
131 | 'programme_type') |
---|
132 | CBT_OMIT_DISPLAY_FIELDS = OMIT_DISPLAY_FIELDS + CBT_OMIT_FIELDS |
---|
133 | CBT_OMIT_MANAGE_FIELDS = CBT_OMIT_FIELDS + ('special_application',) |
---|
134 | CBT_OMIT_EDIT_FIELDS = OMIT_DISPLAY_FIELDS + CBT_OMIT_FIELDS + ( |
---|
135 | 'special_application', |
---|
136 | 'student_id', |
---|
137 | 'notice', |
---|
138 | 'screening_score', |
---|
139 | 'screening_venue', |
---|
140 | 'screening_date', |
---|
141 | #'jamb_age', |
---|
142 | #'jamb_subjects', |
---|
143 | #'jamb_score', |
---|
144 | #'jamb_reg_number', |
---|
145 | ) |
---|
146 | CBT_OMIT_PDF_FIELDS = CBT_OMIT_DISPLAY_FIELDS + ('phone',) |
---|
147 | |
---|
148 | # AFFIL is a subgroup of UG with the same interface. |
---|
149 | AFFIL_OMIT_FIELDS = ( |
---|
150 | 'hq_type', 'hq_matric_no', |
---|
151 | 'hq_degree', 'hq_school', |
---|
152 | 'hq_session', 'hq_disc', |
---|
153 | 'jamb_subjects') |
---|
154 | AFFIL_OMIT_DISPLAY_FIELDS = OMIT_DISPLAY_FIELDS + AFFIL_OMIT_FIELDS |
---|
155 | AFFIL_OMIT_MANAGE_FIELDS = AFFIL_OMIT_FIELDS + ('special_application',) |
---|
156 | AFFIL_OMIT_EDIT_FIELDS = OMIT_DISPLAY_FIELDS + AFFIL_OMIT_FIELDS + ( |
---|
157 | 'special_application', |
---|
158 | 'student_id', |
---|
159 | 'notice', |
---|
160 | 'screening_score', |
---|
161 | 'screening_venue', |
---|
162 | 'screening_date', |
---|
163 | 'aggregate', |
---|
164 | ) |
---|
165 | AFFIL_OMIT_PDF_FIELDS = AFFIL_OMIT_DISPLAY_FIELDS + ('phone',) |
---|
166 | |
---|
167 | # PUTME is a subgroup of UG with the same interface. |
---|
168 | PUTME_OMIT_FIELDS = ( |
---|
169 | 'hq_type', 'hq_matric_no', |
---|
170 | 'hq_degree', 'hq_school', |
---|
171 | 'hq_session', 'hq_disc', |
---|
172 | 'jamb_subjects_list', 'programme_type') |
---|
173 | |
---|
174 | PUTME_OMIT_DISPLAY_FIELDS = OMIT_DISPLAY_FIELDS + PUTME_OMIT_FIELDS |
---|
175 | |
---|
176 | # temporary solution to display bank account fields only |
---|
177 | # for PUTME (ase) application |
---|
178 | #PUTME_OMIT_DISPLAY_FIELDS = ( |
---|
179 | # 'locked', 'course_admitted', 'result_uploaded', |
---|
180 | # 'suspended', 'special_application') + PUTME_OMIT_FIELDS |
---|
181 | |
---|
182 | PUTME_OMIT_MANAGE_FIELDS = UG_OMIT_MANAGE_FIELDS + PUTME_OMIT_FIELDS |
---|
183 | |
---|
184 | PUTME_OMIT_EDIT_FIELDS = UG_OMIT_EDIT_FIELDS + PUTME_OMIT_FIELDS + ( |
---|
185 | 'firstname', 'middlename', 'lastname', 'sex', |
---|
186 | 'course1', 'lga') |
---|
187 | |
---|
188 | # temporary solution to display bank account fields only |
---|
189 | # for PUTME (ase) application |
---|
190 | #PUTME_OMIT_EDIT_FIELDS = UG_OMIT_MANAGE_FIELDS + ( |
---|
191 | # 'locked', 'course_admitted', 'result_uploaded', |
---|
192 | # 'suspended', 'special_application', |
---|
193 | # 'student_id', |
---|
194 | # 'notice', |
---|
195 | # 'screening_score', |
---|
196 | # 'screening_venue', |
---|
197 | # 'screening_date', |
---|
198 | # 'jamb_age', |
---|
199 | # 'jamb_subjects', |
---|
200 | # 'jamb_score', |
---|
201 | # 'jamb_reg_number', |
---|
202 | # 'aggregate', |
---|
203 | # 'firstname', 'middlename', 'lastname', 'sex', |
---|
204 | # 'course1', 'lga') + PUTME_OMIT_FIELDS |
---|
205 | |
---|
206 | PUTME_OMIT_PDF_FIELDS = PUTME_OMIT_DISPLAY_FIELDS + ('phone',) |
---|
207 | PUTME_OMIT_RESULT_SLIP_FIELDS = PUTME_OMIT_DISPLAY_FIELDS + ( |
---|
208 | 'phone', |
---|
209 | 'date_of_birth', 'sex', |
---|
210 | 'nationality', 'lga', #'perm_address', |
---|
211 | 'course2', 'screening_venue', |
---|
212 | 'screening_date') |
---|
213 | |
---|
214 | # PUDE is a subgroup of UG with the same interface. |
---|
215 | PUDE_OMIT_FIELDS = ( |
---|
216 | 'jamb_subjects', |
---|
217 | 'jamb_score', |
---|
218 | 'jamb_age', |
---|
219 | 'aggregate', |
---|
220 | 'jamb_subjects_list', |
---|
221 | 'programme_type') |
---|
222 | PUDE_OMIT_DISPLAY_FIELDS = OMIT_DISPLAY_FIELDS + PUDE_OMIT_FIELDS |
---|
223 | PUDE_OMIT_MANAGE_FIELDS = UG_OMIT_MANAGE_FIELDS + PUDE_OMIT_FIELDS |
---|
224 | PUDE_OMIT_EDIT_FIELDS = set(UG_OMIT_EDIT_FIELDS + PUDE_OMIT_FIELDS + ( |
---|
225 | 'firstname', 'middlename', 'lastname', 'sex', |
---|
226 | 'course1', 'lga')) |
---|
227 | PUDE_OMIT_PDF_FIELDS = PUDE_OMIT_DISPLAY_FIELDS + ('phone',) |
---|
228 | PUDE_OMIT_RESULT_SLIP_FIELDS = PUDE_OMIT_DISPLAY_FIELDS + ( |
---|
229 | 'phone', |
---|
230 | 'date_of_birth', 'sex', |
---|
231 | 'nationality', 'lga', #'perm_address', |
---|
232 | 'course2', 'screening_venue', |
---|
233 | 'screening_date') |
---|
234 | |
---|
235 | # PG has its own interface |
---|
236 | PG_OMIT_DISPLAY_FIELDS = OMIT_DISPLAY_FIELDS |
---|
237 | PG_OMIT_PDF_FIELDS = PG_OMIT_DISPLAY_FIELDS + ('phone',) |
---|
238 | PG_OMIT_MANAGE_FIELDS = ('special_application',) |
---|
239 | PG_OMIT_EDIT_FIELDS = PG_OMIT_MANAGE_FIELDS + PG_OMIT_DISPLAY_FIELDS + ( |
---|
240 | 'student_id', 'notice', |
---|
241 | 'screening_score', 'screening_venue', |
---|
242 | 'screening_date',) |
---|
243 | |
---|
244 | class IBankAccount(IKofaObject): |
---|
245 | |
---|
246 | bank_name = schema.TextLine( |
---|
247 | title = _(u'Bank Name'), |
---|
248 | required = False, |
---|
249 | readonly = False, |
---|
250 | ) |
---|
251 | |
---|
252 | bank_account_name = schema.TextLine( |
---|
253 | title = _(u'Bank Account Name'), |
---|
254 | required = False, |
---|
255 | readonly = False, |
---|
256 | ) |
---|
257 | |
---|
258 | bank_account_number = schema.TextLine( |
---|
259 | title = _(u'Bank Account Number'), |
---|
260 | required = False, |
---|
261 | readonly = False, |
---|
262 | ) |
---|
263 | |
---|
264 | class INigeriaUGApplicant(IApplicantBaseData, IBankAccount): |
---|
265 | """An undergraduate applicant. |
---|
266 | |
---|
267 | This interface defines the least common multiple of all fields |
---|
268 | in ug application forms. In customized forms, fields can be excluded by |
---|
269 | adding them to the UG_OMIT* tuples. |
---|
270 | """ |
---|
271 | |
---|
272 | nationality = schema.Choice( |
---|
273 | source = nats_vocab, |
---|
274 | title = _(u'Nationality'), |
---|
275 | required = False, |
---|
276 | ) |
---|
277 | lga = schema.Choice( |
---|
278 | source = LGASource(), |
---|
279 | title = _(u'State/LGA (Nigerians only)'), |
---|
280 | required = False, |
---|
281 | ) |
---|
282 | #perm_address = schema.Text( |
---|
283 | # title = _(u'Permanent Address'), |
---|
284 | # required = False, |
---|
285 | # ) |
---|
286 | course1 = schema.Choice( |
---|
287 | title = _(u'1st Choice Course of Study'), |
---|
288 | source = AppCatCertificateSource(), |
---|
289 | required = True, |
---|
290 | ) |
---|
291 | course2 = schema.Choice( |
---|
292 | title = _(u'2nd Choice Course of Study'), |
---|
293 | source = AppCatCertificateSource(), |
---|
294 | required = False, |
---|
295 | ) |
---|
296 | |
---|
297 | programme_type = schema.Choice( |
---|
298 | title = _(u'Programme Type'), |
---|
299 | vocabulary = programme_types_vocab, |
---|
300 | required = False, |
---|
301 | ) |
---|
302 | |
---|
303 | hq_type = schema.Choice( |
---|
304 | title = _(u'Qualification Obtained'), |
---|
305 | required = False, |
---|
306 | readonly = False, |
---|
307 | vocabulary = high_qual, |
---|
308 | ) |
---|
309 | hq_matric_no = schema.TextLine( |
---|
310 | title = _(u'Former Matric Number'), |
---|
311 | required = False, |
---|
312 | readonly = False, |
---|
313 | ) |
---|
314 | hq_degree = schema.Choice( |
---|
315 | title = _(u'Class of Degree'), |
---|
316 | required = False, |
---|
317 | readonly = False, |
---|
318 | vocabulary = high_grade, |
---|
319 | ) |
---|
320 | hq_school = schema.TextLine( |
---|
321 | title = _(u'Institution Attended'), |
---|
322 | required = False, |
---|
323 | readonly = False, |
---|
324 | ) |
---|
325 | hq_session = schema.TextLine( |
---|
326 | title = _(u'Years Attended'), |
---|
327 | required = False, |
---|
328 | readonly = False, |
---|
329 | ) |
---|
330 | hq_disc = schema.TextLine( |
---|
331 | title = _(u'Discipline'), |
---|
332 | required = False, |
---|
333 | readonly = False, |
---|
334 | ) |
---|
335 | jamb_subjects = schema.Text( |
---|
336 | title = _(u'Subjects and Scores'), |
---|
337 | required = False, |
---|
338 | ) |
---|
339 | jamb_subjects_list = schema.List( |
---|
340 | title = _(u'JAMB Subjects'), |
---|
341 | required = False, |
---|
342 | defaultFactory=list, |
---|
343 | value_type = schema.Choice( |
---|
344 | vocabulary = jambsubjects |
---|
345 | #source = JAMBSubjectSource(), |
---|
346 | ), |
---|
347 | ) |
---|
348 | jamb_score = schema.Int( |
---|
349 | title = _(u'Total JAMB Score'), |
---|
350 | required = False, |
---|
351 | ) |
---|
352 | #jamb_age = schema.Int( |
---|
353 | # title = _(u'Age (provided by JAMB)'), |
---|
354 | # required = False, |
---|
355 | # ) |
---|
356 | jamb_reg_number = schema.TextLine( |
---|
357 | title = _(u'JAMB Registration Number'), |
---|
358 | required = False, |
---|
359 | constraint=validate_jamb_reg_number, |
---|
360 | ) |
---|
361 | notice = schema.Text( |
---|
362 | title = _(u'Notice'), |
---|
363 | required = False, |
---|
364 | ) |
---|
365 | screening_venue = schema.TextLine( |
---|
366 | title = _(u'Screening Venue'), |
---|
367 | required = False, |
---|
368 | ) |
---|
369 | screening_date = schema.TextLine( |
---|
370 | title = _(u'Screening Date'), |
---|
371 | required = False, |
---|
372 | ) |
---|
373 | screening_score = schema.Int( |
---|
374 | title = _(u'Screening Score (%)'), |
---|
375 | required = False, |
---|
376 | ) |
---|
377 | aggregate = schema.Int( |
---|
378 | title = _(u'Aggregate Score (%)'), |
---|
379 | description = _(u'(average of relative JAMB and PUTME scores)'), |
---|
380 | required = False, |
---|
381 | ) |
---|
382 | result_uploaded = schema.Bool( |
---|
383 | title = _(u'Result uploaded'), |
---|
384 | default = False, |
---|
385 | required = False, |
---|
386 | ) |
---|
387 | student_id = schema.TextLine( |
---|
388 | title = _(u'Student Id'), |
---|
389 | required = False, |
---|
390 | readonly = False, |
---|
391 | ) |
---|
392 | course_admitted = schema.Choice( |
---|
393 | title = _(u'Admitted Course of Study'), |
---|
394 | source = CertificateSource(), |
---|
395 | required = False, |
---|
396 | ) |
---|
397 | locked = schema.Bool( |
---|
398 | title = _(u'Form locked'), |
---|
399 | default = False, |
---|
400 | required = False, |
---|
401 | ) |
---|
402 | |
---|
403 | INigeriaUGApplicant[ |
---|
404 | 'locked'].order = IApplicantBaseData['suspended'].order |
---|
405 | INigeriaUGApplicant[ |
---|
406 | 'result_uploaded'].order = INigeriaUGApplicant['suspended'].order |
---|
407 | |
---|
408 | class INigeriaPGApplicant(IApplicantBaseData): |
---|
409 | """A postgraduate applicant. |
---|
410 | |
---|
411 | This interface defines the least common multiple of all fields |
---|
412 | in pg application forms. In customized forms, fields can be excluded by |
---|
413 | adding them to the PG_OMIT* tuples. |
---|
414 | """ |
---|
415 | |
---|
416 | nationality = schema.Choice( |
---|
417 | source = nats_vocab, |
---|
418 | title = _(u'Nationality'), |
---|
419 | required = True, |
---|
420 | ) |
---|
421 | lga = schema.Choice( |
---|
422 | source = LGASource(), |
---|
423 | title = _(u'State/LGA (Nigerians only)'), |
---|
424 | required = False, |
---|
425 | ) |
---|
426 | #perm_address = schema.Text( |
---|
427 | # title = _(u'Permanent Address'), |
---|
428 | # required = False, |
---|
429 | # ) |
---|
430 | course1 = schema.Choice( |
---|
431 | title = _(u'1st Choice Course of Study'), |
---|
432 | source = AppCatCertificateSource(), |
---|
433 | required = True, |
---|
434 | ) |
---|
435 | course2 = schema.Choice( |
---|
436 | title = _(u'2nd Choice Course of Study'), |
---|
437 | source = AppCatCertificateSource(), |
---|
438 | required = False, |
---|
439 | ) |
---|
440 | hq_type = schema.Choice( |
---|
441 | title = _(u'Qualification Obtained'), |
---|
442 | required = False, |
---|
443 | readonly = False, |
---|
444 | vocabulary = high_qual, |
---|
445 | ) |
---|
446 | hq_fname = schema.TextLine( |
---|
447 | title = _(u'Full Name'), |
---|
448 | required = False, |
---|
449 | readonly = False, |
---|
450 | ) |
---|
451 | hq_matric_no = schema.TextLine( |
---|
452 | title = _(u'Former Matric Number'), |
---|
453 | required = False, |
---|
454 | readonly = False, |
---|
455 | ) |
---|
456 | hq_degree = schema.Choice( |
---|
457 | title = _(u'Class of Degree'), |
---|
458 | required = False, |
---|
459 | readonly = False, |
---|
460 | vocabulary = high_grade, |
---|
461 | ) |
---|
462 | hq_school = schema.TextLine( |
---|
463 | title = _(u'Institution Attended'), |
---|
464 | required = False, |
---|
465 | readonly = False, |
---|
466 | ) |
---|
467 | hq_session = schema.TextLine( |
---|
468 | title = _(u'Years Attended'), |
---|
469 | required = False, |
---|
470 | readonly = False, |
---|
471 | ) |
---|
472 | hq_disc = schema.TextLine( |
---|
473 | title = _(u'Discipline'), |
---|
474 | required = False, |
---|
475 | readonly = False, |
---|
476 | ) |
---|
477 | fst_sit_fname = schema.TextLine( |
---|
478 | title = _(u'Full Name'), |
---|
479 | required = False, |
---|
480 | readonly = False, |
---|
481 | ) |
---|
482 | fst_sit_no = schema.TextLine( |
---|
483 | title = _(u'Exam Number'), |
---|
484 | required = False, |
---|
485 | readonly = False, |
---|
486 | ) |
---|
487 | fst_sit_date = FormattedDate( |
---|
488 | title = _(u'Exam Date'), |
---|
489 | required = False, |
---|
490 | readonly = False, |
---|
491 | show_year = True, |
---|
492 | ) |
---|
493 | fst_sit_type = schema.Choice( |
---|
494 | title = _(u'Exam Type'), |
---|
495 | required = False, |
---|
496 | readonly = False, |
---|
497 | vocabulary = exam_types, |
---|
498 | ) |
---|
499 | fst_sit_results = schema.List( |
---|
500 | title = _(u'Exam Results'), |
---|
501 | value_type = ResultEntryField(), |
---|
502 | required = False, |
---|
503 | readonly = False, |
---|
504 | defaultFactory=list, |
---|
505 | ) |
---|
506 | scd_sit_fname = schema.TextLine( |
---|
507 | title = _(u'Full Name'), |
---|
508 | required = False, |
---|
509 | readonly = False, |
---|
510 | ) |
---|
511 | scd_sit_no = schema.TextLine( |
---|
512 | title = _(u'Exam Number'), |
---|
513 | required = False, |
---|
514 | readonly = False, |
---|
515 | ) |
---|
516 | scd_sit_date = FormattedDate( |
---|
517 | title = _(u'Exam Date'), |
---|
518 | required = False, |
---|
519 | readonly = False, |
---|
520 | show_year = True, |
---|
521 | ) |
---|
522 | scd_sit_type = schema.Choice( |
---|
523 | title = _(u'Exam Type'), |
---|
524 | required = False, |
---|
525 | readonly = False, |
---|
526 | vocabulary = exam_types, |
---|
527 | ) |
---|
528 | scd_sit_results = schema.List( |
---|
529 | title = _(u'Exam Results'), |
---|
530 | value_type = ResultEntryField(), |
---|
531 | required = False, |
---|
532 | readonly = False, |
---|
533 | defaultFactory=list, |
---|
534 | ) |
---|
535 | # Replaced by first and second sitting |
---|
536 | #pp_school = schema.Choice( |
---|
537 | # title = _(u'Qualification Obtained'), |
---|
538 | # required = False, |
---|
539 | # readonly = False, |
---|
540 | # vocabulary = exam_types, |
---|
541 | # ) |
---|
542 | presently_inst = schema.TextLine( |
---|
543 | title = _(u'If yes, name of institution'), |
---|
544 | required = False, |
---|
545 | readonly = False, |
---|
546 | ) |
---|
547 | nysc_year = schema.Int( |
---|
548 | title = _(u'Nysc Year'), |
---|
549 | required = False, |
---|
550 | readonly = False, |
---|
551 | ) |
---|
552 | nysc_lga = schema.Choice( |
---|
553 | source = LGASource(), |
---|
554 | title = _(u'Nysc Location'), |
---|
555 | required = False, |
---|
556 | ) |
---|
557 | employer = schema.TextLine( |
---|
558 | title = _(u'Employer'), |
---|
559 | required = False, |
---|
560 | readonly = False, |
---|
561 | ) |
---|
562 | emp_position = schema.TextLine( |
---|
563 | title = _(u'Employer Position'), |
---|
564 | required = False, |
---|
565 | readonly = False, |
---|
566 | ) |
---|
567 | emp_start = FormattedDate( |
---|
568 | title = _(u'Start Date'), |
---|
569 | required = False, |
---|
570 | readonly = False, |
---|
571 | show_year = True, |
---|
572 | ) |
---|
573 | emp_end = FormattedDate( |
---|
574 | title = _(u'End Date'), |
---|
575 | required = False, |
---|
576 | readonly = False, |
---|
577 | show_year = True, |
---|
578 | ) |
---|
579 | emp_reason = schema.TextLine( |
---|
580 | title = _(u'Reason for Leaving'), |
---|
581 | required = False, |
---|
582 | readonly = False, |
---|
583 | ) |
---|
584 | employer2 = schema.TextLine( |
---|
585 | title = _(u'2nd Employer'), |
---|
586 | required = False, |
---|
587 | readonly = False, |
---|
588 | ) |
---|
589 | emp2_position = schema.TextLine( |
---|
590 | title = _(u'2nd Employer Position'), |
---|
591 | required = False, |
---|
592 | readonly = False, |
---|
593 | ) |
---|
594 | emp2_start = FormattedDate( |
---|
595 | title = _(u'Start Date'), |
---|
596 | required = False, |
---|
597 | readonly = False, |
---|
598 | show_year = True, |
---|
599 | ) |
---|
600 | emp2_end = FormattedDate( |
---|
601 | title = _(u'End Date'), |
---|
602 | required = False, |
---|
603 | readonly = False, |
---|
604 | show_year = True, |
---|
605 | ) |
---|
606 | emp2_reason = schema.TextLine( |
---|
607 | title = _(u'Reason for Leaving'), |
---|
608 | required = False, |
---|
609 | readonly = False, |
---|
610 | ) |
---|
611 | notice = schema.Text( |
---|
612 | title = _(u'Notice'), |
---|
613 | required = False, |
---|
614 | readonly = False, |
---|
615 | ) |
---|
616 | screening_venue = schema.TextLine( |
---|
617 | title = _(u'Screening Venue'), |
---|
618 | required = False, |
---|
619 | ) |
---|
620 | screening_date = schema.TextLine( |
---|
621 | title = _(u'Screening Date'), |
---|
622 | required = False, |
---|
623 | ) |
---|
624 | screening_score = schema.Int( |
---|
625 | title = _(u'Screening Score (%)'), |
---|
626 | required = False, |
---|
627 | ) |
---|
628 | student_id = schema.TextLine( |
---|
629 | title = _(u'Student Id'), |
---|
630 | required = False, |
---|
631 | readonly = False, |
---|
632 | ) |
---|
633 | course_admitted = schema.Choice( |
---|
634 | title = _(u'Admitted Course of Study'), |
---|
635 | source = CertificateSource(), |
---|
636 | required = False, |
---|
637 | readonly = False, |
---|
638 | ) |
---|
639 | locked = schema.Bool( |
---|
640 | title = _(u'Form locked'), |
---|
641 | default = False, |
---|
642 | required = False, |
---|
643 | ) |
---|
644 | |
---|
645 | INigeriaPGApplicant[ |
---|
646 | 'locked'].order = IApplicantBaseData['suspended'].order |
---|
647 | |
---|
648 | # PRE is used by Uniben |
---|
649 | # med: "it is as named... PRE - DEGREE... much like a 1 year diploma programme" |
---|
650 | PRE_OMIT_FIELDS = tuple([ |
---|
651 | i for i in getFields(INigeriaPGApplicant).keys() |
---|
652 | if i[:3] in ('hq_', 'emp', 'nys')]) + ('referees',) |
---|
653 | PRE_OMIT_DISPLAY_FIELDS = OMIT_DISPLAY_FIELDS + PRE_OMIT_FIELDS |
---|
654 | PRE_OMIT_MANAGE_FIELDS = PG_OMIT_MANAGE_FIELDS + PRE_OMIT_FIELDS |
---|
655 | PRE_OMIT_EDIT_FIELDS = set(PG_OMIT_EDIT_FIELDS + PRE_OMIT_FIELDS) |
---|
656 | PRE_OMIT_PDF_FIELDS = PRE_OMIT_DISPLAY_FIELDS |
---|
657 | PRE_OMIT_RESULT_SLIP_FIELDS = PRE_OMIT_DISPLAY_FIELDS |
---|
658 | |
---|
659 | class INigeriaApplicant(INigeriaUGApplicant, INigeriaPGApplicant): |
---|
660 | """An interface for both types of applicants. |
---|
661 | |
---|
662 | Attention: The INigeriaPGApplicant field seetings will be overwritten |
---|
663 | by INigeriaPGApplicant field settings. If a field is defined |
---|
664 | in both interfaces zope.schema validates only against the |
---|
665 | constraints in INigeriaUGApplicant. This does not affect the forms |
---|
666 | since they are build on either INigeriaUGApplicant or INigeriaPGApplicant. |
---|
667 | """ |
---|
668 | |
---|
669 | def writeLogMessage(view, comment): |
---|
670 | """Adds an INFO message to the log file |
---|
671 | """ |
---|
672 | |
---|
673 | def createStudent(): |
---|
674 | """Create a student object from applicant data |
---|
675 | and copy applicant object. |
---|
676 | """ |
---|
677 | |
---|
678 | class INigeriaUGApplicantEdit(INigeriaUGApplicant): |
---|
679 | """An undergraduate applicant interface for edit forms. |
---|
680 | |
---|
681 | Here we can repeat the fields from base data and set the |
---|
682 | `required` and `readonly` attributes to True to further restrict |
---|
683 | the data access. Or we can allow only certain certificates to be |
---|
684 | selected by choosing the appropriate source. |
---|
685 | |
---|
686 | We cannot omit fields here. This has to be done in the |
---|
687 | respective form page. |
---|
688 | """ |
---|
689 | |
---|
690 | email = schema.ASCIILine( |
---|
691 | title = _(u'Email Address'), |
---|
692 | required = True, |
---|
693 | constraint=validate_email, |
---|
694 | ) |
---|
695 | date_of_birth = FormattedDate( |
---|
696 | title = _(u'Date of Birth'), |
---|
697 | required = True, |
---|
698 | show_year = True, |
---|
699 | ) |
---|
700 | jamb_subjects_list = schema.List( |
---|
701 | title = _(u'JAMB Subjects'), |
---|
702 | description = _(u'Select four subjects.'), |
---|
703 | required = True, |
---|
704 | constraint = four_items, |
---|
705 | value_type = schema.Choice( |
---|
706 | vocabulary = jambsubjects |
---|
707 | #source = JAMBSubjectSource(), |
---|
708 | ), |
---|
709 | ) |
---|
710 | |
---|
711 | INigeriaUGApplicantEdit[ |
---|
712 | 'date_of_birth'].order = INigeriaUGApplicant['date_of_birth'].order |
---|
713 | INigeriaUGApplicantEdit[ |
---|
714 | 'email'].order = INigeriaUGApplicant['email'].order |
---|
715 | INigeriaUGApplicantEdit[ |
---|
716 | 'jamb_subjects_list'].order = INigeriaUGApplicant['jamb_subjects_list'].order |
---|
717 | |
---|
718 | class INigeriaPGApplicantEdit(INigeriaPGApplicant): |
---|
719 | """A postgraduate applicant interface for editing. |
---|
720 | |
---|
721 | Here we can repeat the fields from base data and set the |
---|
722 | `required` and `readonly` attributes to True to further restrict |
---|
723 | the data access. Or we can allow only certain certificates to be |
---|
724 | selected by choosing the appropriate source. |
---|
725 | |
---|
726 | We cannot omit fields here. This has to be done in the |
---|
727 | respective form page. |
---|
728 | """ |
---|
729 | |
---|
730 | email = schema.ASCIILine( |
---|
731 | title = _(u'Email Address'), |
---|
732 | required = True, |
---|
733 | constraint=validate_email, |
---|
734 | ) |
---|
735 | date_of_birth = FormattedDate( |
---|
736 | title = _(u'Date of Birth'), |
---|
737 | required = True, |
---|
738 | show_year = True, |
---|
739 | ) |
---|
740 | |
---|
741 | INigeriaPGApplicantEdit[ |
---|
742 | 'date_of_birth'].order = INigeriaPGApplicant['date_of_birth'].order |
---|
743 | INigeriaPGApplicantEdit[ |
---|
744 | 'email'].order = INigeriaPGApplicant['email'].order |
---|
745 | |
---|
746 | class INigeriaApplicantOnlinePayment(INigeriaOnlinePayment): |
---|
747 | """An applicant payment via payment gateways. |
---|
748 | """ |
---|
749 | |
---|
750 | class IPUTMEApplicantEdit(INigeriaUGApplicant): |
---|
751 | """An undergraduate applicant interface for editing. |
---|
752 | |
---|
753 | Here we can repeat the fields from base data and set the |
---|
754 | `required` and `readonly` attributes to True to further restrict |
---|
755 | the data access. Or we can allow only certain certificates to be |
---|
756 | selected by choosing the appropriate source. |
---|
757 | |
---|
758 | We cannot omit fields here. This has to be done in the |
---|
759 | respective form page. |
---|
760 | """ |
---|
761 | email = schema.ASCIILine( |
---|
762 | title = _(u'Email Address'), |
---|
763 | required = True, |
---|
764 | constraint=validate_email, |
---|
765 | ) |
---|
766 | date_of_birth = FormattedDate( |
---|
767 | title = _(u'Date of Birth'), |
---|
768 | required = True, |
---|
769 | show_year = True, |
---|
770 | ) |
---|
771 | nationality = schema.Choice( |
---|
772 | source = nats_vocab, |
---|
773 | title = _(u'Nationality'), |
---|
774 | required = True, |
---|
775 | ) |
---|
776 | |
---|
777 | IPUTMEApplicantEdit[ |
---|
778 | 'date_of_birth'].order = INigeriaUGApplicant['date_of_birth'].order |
---|
779 | IPUTMEApplicantEdit[ |
---|
780 | 'email'].order = INigeriaUGApplicant['email'].order |
---|
781 | IPUTMEApplicantEdit[ |
---|
782 | 'nationality'].order = INigeriaUGApplicant['nationality'].order |
---|
783 | |
---|
784 | class INigeriaApplicantUpdateByRegNo(INigeriaApplicant): |
---|
785 | """Representation of an applicant. |
---|
786 | |
---|
787 | Skip regular reg_number validation if reg_number is used for finding |
---|
788 | the applicant object. |
---|
789 | """ |
---|
790 | reg_number = schema.TextLine( |
---|
791 | title = u'Registration Number', |
---|
792 | required = False, |
---|
793 | ) |
---|