1 | # -*- coding: utf-8 -*- |
---|
2 | ## $Id: interfaces.py 16804 2022-02-14 07:13:51Z henrik $ |
---|
3 | ## |
---|
4 | ## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann |
---|
5 | ## This program is free software; you can redistribute it and/or modify |
---|
6 | ## it under the terms of the GNU General Public License as published by |
---|
7 | ## the Free Software Foundation; either version 2 of the License, or |
---|
8 | ## (at your option) any later version. |
---|
9 | ## |
---|
10 | ## This program is distributed in the hope that it will be useful, |
---|
11 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
12 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
13 | ## GNU General Public License for more details. |
---|
14 | ## |
---|
15 | ## You should have received a copy of the GNU General Public License |
---|
16 | ## along with this program; if not, write to the Free Software |
---|
17 | ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
18 | ## |
---|
19 | """Customized interfaces of the university application package. |
---|
20 | """ |
---|
21 | |
---|
22 | #from grok import getSite |
---|
23 | from zope import schema |
---|
24 | from zope.interface import invariant, Invalid |
---|
25 | from zope.component import getUtility |
---|
26 | from zope.catalog.interfaces import ICatalog |
---|
27 | from zc.sourcefactory.basic import BasicSourceFactory |
---|
28 | from waeup.kofa.applicants.interfaces import ( |
---|
29 | IApplicantBaseData, |
---|
30 | AppCatCertificateSource, CertificateSource) |
---|
31 | from waeup.kofa.university.vocabularies import StudyModeSource |
---|
32 | from waeup.kofa.students.vocabularies import ( |
---|
33 | nats_vocab, GenderSource, StudyLevelSource) |
---|
34 | from waeup.kofa.schoolgrades import ResultEntryField |
---|
35 | from waeup.kofa.interfaces import ( |
---|
36 | SimpleKofaVocabulary, academic_sessions_vocab, validate_email, |
---|
37 | IKofaObject, ContextualDictSourceFactoryBase) |
---|
38 | from waeup.kofa.schema import FormattedDate, TextLineChoice, PhoneNumber |
---|
39 | from waeup.kofa.students.vocabularies import ( |
---|
40 | nats_vocab, GenderSource) |
---|
41 | from waeup.kofa.refereeentries import RefereeEntryField |
---|
42 | from waeup.kofa.applicants.interfaces import contextual_reg_num_source |
---|
43 | from kofacustom.nigeria.interfaces import DisabilitiesSource |
---|
44 | from kofacustom.nigeria.applicants.interfaces import ( |
---|
45 | LGASource, high_qual, high_grade, exam_types, |
---|
46 | programme_types_vocab, jambsubjects, |
---|
47 | INigeriaUGApplicant, INigeriaPGApplicant, |
---|
48 | INigeriaApplicantOnlinePayment, |
---|
49 | INigeriaUGApplicantEdit, INigeriaPGApplicantEdit, |
---|
50 | INigeriaApplicantUpdateByRegNo, |
---|
51 | IPUTMEApplicantEdit, |
---|
52 | IBankAccount, |
---|
53 | ) |
---|
54 | from waeup.uniben.interfaces import MessageFactory as _ |
---|
55 | from waeup.uniben.payments.interfaces import ICustomOnlinePayment |
---|
56 | |
---|
57 | class TranscriptCertificateSource(CertificateSource): |
---|
58 | """Include Department and Faculty in Title. |
---|
59 | """ |
---|
60 | def getValues(self, context): |
---|
61 | catalog = getUtility(ICatalog, name='certificates_catalog') |
---|
62 | resultset = catalog.searchResults(code=(None, None)) |
---|
63 | resultlist = sorted(resultset, key=lambda |
---|
64 | value: value.__parent__.__parent__.__parent__.code + |
---|
65 | value.__parent__.__parent__.code + |
---|
66 | value.code) |
---|
67 | return resultlist |
---|
68 | |
---|
69 | def getTitle(self, context, value): |
---|
70 | """ |
---|
71 | """ |
---|
72 | try: title = "%s / %s / %s (%s)" % ( |
---|
73 | value.__parent__.__parent__.__parent__.title, |
---|
74 | value.__parent__.__parent__.title, |
---|
75 | value.title, value.code) |
---|
76 | except AttributeError: |
---|
77 | title = "NA / %s (%s)" % (value.title, value.code) |
---|
78 | return title |
---|
79 | |
---|
80 | REGISTRATION_CATS = { |
---|
81 | 'corporate': ('Corporate Registration', 250000, 1), |
---|
82 | 'group': ('Group Registration', 200000, 2), |
---|
83 | 'individual': ('Individual Registration', 45000, 3), |
---|
84 | 'student': ('Student Registration', 5000, 4), |
---|
85 | 'fullpage': ('Full Page Advert', 250000, 5), |
---|
86 | 'halfpage': ('Half Page Advert', 150000, 6), |
---|
87 | 'quarterpage': ('Quarter Page Advert', 100000, 7), |
---|
88 | } |
---|
89 | |
---|
90 | class RegTypesSource(BasicSourceFactory): |
---|
91 | """A source that delivers all kinds of registrations. |
---|
92 | """ |
---|
93 | def getValues(self): |
---|
94 | sorted_items = sorted(REGISTRATION_CATS.items(), |
---|
95 | key=lambda element: element[1][2]) |
---|
96 | return [item[0] for item in sorted_items] |
---|
97 | |
---|
98 | def getTitle(self, value): |
---|
99 | return u"%s @ ₦ %s" % ( |
---|
100 | REGISTRATION_CATS[value][0], |
---|
101 | REGISTRATION_CATS[value][1]) |
---|
102 | |
---|
103 | DESTINATION_COST = { |
---|
104 | #'none': ('To the moon', 1000000000.0, 1), |
---|
105 | 'nigeria': ('Within Nigeria', 20000.0, 1), |
---|
106 | 'africa': ('Within Africa ', 30000.0, 2), |
---|
107 | 'inter': ('International', 35000.0, 3), |
---|
108 | 'cert_nigeria': ('Certified Copy - Within Nigeria', 13000.0, 4), |
---|
109 | 'cert_africa': ('Certified Copy - Within Africa', 23000.0, 5), |
---|
110 | 'cert_inter': ('Certified Copy - International', 28000.0, 6), |
---|
111 | } |
---|
112 | |
---|
113 | class DestinationCostSource(BasicSourceFactory): |
---|
114 | """A source that delivers continents and shipment costs. |
---|
115 | """ |
---|
116 | def getValues(self): |
---|
117 | sorted_items = sorted(DESTINATION_COST.items(), |
---|
118 | key=lambda element: element[1][2]) |
---|
119 | return [item[0] for item in sorted_items] |
---|
120 | |
---|
121 | def getToken(self, value): |
---|
122 | return value |
---|
123 | |
---|
124 | def getTitle(self, value): |
---|
125 | return u"%s (₦ %s)" % ( |
---|
126 | DESTINATION_COST[value][0], |
---|
127 | DESTINATION_COST[value][1]) |
---|
128 | |
---|
129 | class OrderSource(BasicSourceFactory): |
---|
130 | """ |
---|
131 | """ |
---|
132 | def getValues(self): |
---|
133 | return ['o', 'c'] |
---|
134 | |
---|
135 | def getToken(self, value): |
---|
136 | return value |
---|
137 | |
---|
138 | def getTitle(self, value): |
---|
139 | if value == 'o': |
---|
140 | return _('Original') |
---|
141 | if value == 'c': |
---|
142 | return _('Certified True Copy') |
---|
143 | |
---|
144 | class ProficiencySource(BasicSourceFactory): |
---|
145 | """ |
---|
146 | """ |
---|
147 | def getValues(self): |
---|
148 | return ['n', 'c', 'p'] |
---|
149 | |
---|
150 | def getToken(self, value): |
---|
151 | return value |
---|
152 | |
---|
153 | def getTitle(self, value): |
---|
154 | if value == 'n': |
---|
155 | return _('none') |
---|
156 | if value == 'c': |
---|
157 | return _('conversational') |
---|
158 | if value == 'c': |
---|
159 | return _('professional') |
---|
160 | |
---|
161 | class IUnibenRegistration(IKofaObject): |
---|
162 | """A Uniben registrant. |
---|
163 | """ |
---|
164 | |
---|
165 | suspended = schema.Bool( |
---|
166 | title = _(u'Account suspended'), |
---|
167 | default = False, |
---|
168 | required = False, |
---|
169 | ) |
---|
170 | |
---|
171 | locked = schema.Bool( |
---|
172 | title = _(u'Form locked'), |
---|
173 | default = False, |
---|
174 | required = False, |
---|
175 | ) |
---|
176 | |
---|
177 | applicant_id = schema.TextLine( |
---|
178 | title = _(u'Registrant Id'), |
---|
179 | required = False, |
---|
180 | readonly = False, |
---|
181 | ) |
---|
182 | |
---|
183 | firstname = schema.TextLine( |
---|
184 | title = _(u'First Name'), |
---|
185 | required = True, |
---|
186 | ) |
---|
187 | |
---|
188 | middlename = schema.TextLine( |
---|
189 | title = _(u'Middle Name'), |
---|
190 | required = False, |
---|
191 | ) |
---|
192 | |
---|
193 | lastname = schema.TextLine( |
---|
194 | title = _(u'Last Name (Surname)'), |
---|
195 | required = True, |
---|
196 | ) |
---|
197 | |
---|
198 | sex = schema.Choice( |
---|
199 | title = _(u'Sex'), |
---|
200 | source = GenderSource(), |
---|
201 | required = True, |
---|
202 | ) |
---|
203 | |
---|
204 | nationality = schema.Choice( |
---|
205 | vocabulary = nats_vocab, |
---|
206 | title = _(u'Nationality'), |
---|
207 | required = False, |
---|
208 | ) |
---|
209 | |
---|
210 | email = schema.ASCIILine( |
---|
211 | title = _(u'Email Address'), |
---|
212 | required = True, |
---|
213 | constraint=validate_email, |
---|
214 | ) |
---|
215 | |
---|
216 | phone = PhoneNumber( |
---|
217 | title = _(u'Phone'), |
---|
218 | description = u'', |
---|
219 | required = False, |
---|
220 | ) |
---|
221 | |
---|
222 | #perm_address = schema.Text( |
---|
223 | # title = _(u'Current Local Address'), |
---|
224 | # required = False, |
---|
225 | # readonly = False, |
---|
226 | # ) |
---|
227 | |
---|
228 | institution = schema.TextLine( |
---|
229 | title = _(u'Institution/Organisation'), |
---|
230 | required = False, |
---|
231 | readonly = False, |
---|
232 | ) |
---|
233 | |
---|
234 | city = schema.TextLine( |
---|
235 | title = _(u'City'), |
---|
236 | required = False, |
---|
237 | readonly = False, |
---|
238 | ) |
---|
239 | |
---|
240 | lga = schema.Choice( |
---|
241 | source = LGASource(), |
---|
242 | title = _(u'State/LGA'), |
---|
243 | required = False, |
---|
244 | ) |
---|
245 | |
---|
246 | matric_number = schema.TextLine( |
---|
247 | title = _(u'Uniben Matriculation Number'), |
---|
248 | required = False, |
---|
249 | readonly = False, |
---|
250 | ) |
---|
251 | |
---|
252 | registration_cats = schema.List( |
---|
253 | title = _(u'Registration Categories'), |
---|
254 | value_type = schema.Choice(source=RegTypesSource()), |
---|
255 | required = True, |
---|
256 | defaultFactory=list, |
---|
257 | ) |
---|
258 | |
---|
259 | # @invariant |
---|
260 | # def matric_number_exists(applicant): |
---|
261 | # if applicant.matric_number: |
---|
262 | # catalog = getUtility(ICatalog, name='students_catalog') |
---|
263 | # accommodation_session = getSite()['hostels'].accommodation_session |
---|
264 | # student = catalog.searchResults(matric_number=( |
---|
265 | # applicant.matric_number, applicant.matric_number)) |
---|
266 | # if len(student) != 1: |
---|
267 | # raise Invalid(_("Matriculation number not found.")) |
---|
268 | |
---|
269 | class ITranscriptApplicant(IKofaObject): |
---|
270 | """A transcript applicant. |
---|
271 | """ |
---|
272 | |
---|
273 | suspended = schema.Bool( |
---|
274 | title = _(u'Account suspended'), |
---|
275 | default = False, |
---|
276 | required = False, |
---|
277 | ) |
---|
278 | |
---|
279 | locked = schema.Bool( |
---|
280 | title = _(u'Form locked'), |
---|
281 | default = False, |
---|
282 | required = False, |
---|
283 | ) |
---|
284 | |
---|
285 | applicant_id = schema.TextLine( |
---|
286 | title = _(u'Transcript Application Id'), |
---|
287 | required = False, |
---|
288 | readonly = False, |
---|
289 | ) |
---|
290 | |
---|
291 | student_id = schema.TextLine( |
---|
292 | title = _(u'Kofa Student Id'), |
---|
293 | required = False, |
---|
294 | readonly = False, |
---|
295 | ) |
---|
296 | |
---|
297 | matric_number = schema.TextLine( |
---|
298 | title = _(u'Matriculation Number'), |
---|
299 | readonly = False, |
---|
300 | required = True, |
---|
301 | ) |
---|
302 | |
---|
303 | firstname = schema.TextLine( |
---|
304 | title = _(u'First Name in School'), |
---|
305 | required = True, |
---|
306 | ) |
---|
307 | |
---|
308 | middlename = schema.TextLine( |
---|
309 | title = _(u'Middle Name in School'), |
---|
310 | required = False, |
---|
311 | ) |
---|
312 | |
---|
313 | lastname = schema.TextLine( |
---|
314 | title = _(u'Surname in School'), |
---|
315 | required = True, |
---|
316 | ) |
---|
317 | |
---|
318 | date_of_birth = FormattedDate( |
---|
319 | title = _(u'Date of Birth'), |
---|
320 | required = False, |
---|
321 | #date_format = u'%d/%m/%Y', # Use grok-instance-wide default |
---|
322 | show_year = True, |
---|
323 | ) |
---|
324 | |
---|
325 | sex = schema.Choice( |
---|
326 | title = _(u'Gender'), |
---|
327 | source = GenderSource(), |
---|
328 | required = True, |
---|
329 | ) |
---|
330 | |
---|
331 | #nationality = schema.Choice( |
---|
332 | # vocabulary = nats_vocab, |
---|
333 | # title = _(u'Nationality'), |
---|
334 | # required = False, |
---|
335 | # ) |
---|
336 | |
---|
337 | email = schema.ASCIILine( |
---|
338 | title = _(u'Email Address'), |
---|
339 | required = True, |
---|
340 | constraint=validate_email, |
---|
341 | ) |
---|
342 | |
---|
343 | phone = PhoneNumber( |
---|
344 | title = _(u'Phone'), |
---|
345 | description = u'', |
---|
346 | required = False, |
---|
347 | ) |
---|
348 | |
---|
349 | #perm_address = schema.Text( |
---|
350 | # title = _(u'Current Local Address'), |
---|
351 | # required = False, |
---|
352 | # readonly = False, |
---|
353 | # ) |
---|
354 | |
---|
355 | collected = schema.Bool( |
---|
356 | title = _(u'Have you collected transcript before?'), |
---|
357 | default = False, |
---|
358 | required = False, |
---|
359 | ) |
---|
360 | |
---|
361 | entry_session = schema.Choice( |
---|
362 | title = _(u'Academic Session of Entry'), |
---|
363 | source = academic_sessions_vocab, |
---|
364 | required = False, |
---|
365 | readonly = False, |
---|
366 | ) |
---|
367 | |
---|
368 | end_session = schema.Choice( |
---|
369 | title = _(u'Academic Session of Graduation'), |
---|
370 | source = academic_sessions_vocab, |
---|
371 | required = False, |
---|
372 | readonly = False, |
---|
373 | ) |
---|
374 | |
---|
375 | entry_mode = schema.Choice( |
---|
376 | title = _(u'Mode of Entry'), |
---|
377 | source = StudyModeSource(), |
---|
378 | required = False, |
---|
379 | readonly = False, |
---|
380 | ) |
---|
381 | |
---|
382 | course_studied = schema.Choice( |
---|
383 | title = _(u'Course of Study'), |
---|
384 | source = TranscriptCertificateSource(), |
---|
385 | description = u'Faculty / Department / Course', |
---|
386 | required = True, |
---|
387 | readonly = False, |
---|
388 | ) |
---|
389 | |
---|
390 | course_changed = schema.Choice( |
---|
391 | title = _(u'Change of Study Course / Transfer'), |
---|
392 | description = u'If yes, select previous course of study.', |
---|
393 | source = TranscriptCertificateSource(), |
---|
394 | readonly = False, |
---|
395 | required = False, |
---|
396 | ) |
---|
397 | |
---|
398 | spillover_level = schema.Choice( |
---|
399 | title = _(u'Spill-over'), |
---|
400 | description = u'Any spill-over? If yes, select session of spill-over.', |
---|
401 | source = academic_sessions_vocab, |
---|
402 | required = False, |
---|
403 | readonly = False, |
---|
404 | ) |
---|
405 | |
---|
406 | purpose = schema.TextLine( |
---|
407 | title = _(u'Transcript Purpose'), |
---|
408 | required = False, |
---|
409 | ) |
---|
410 | |
---|
411 | order = schema.Choice( |
---|
412 | source = OrderSource(), |
---|
413 | title = _(u'Type of Order'), |
---|
414 | required = True, |
---|
415 | ) |
---|
416 | |
---|
417 | dispatch_address = schema.Text( |
---|
418 | title = _(u'Recipient Body'), |
---|
419 | description = u'Addresses (including email address and phone number) ' |
---|
420 | 'to which transcripts should be posted. ' |
---|
421 | 'All addresses must involve same courier charges.', |
---|
422 | required = True, |
---|
423 | readonly = False, |
---|
424 | ) |
---|
425 | |
---|
426 | charge = schema.Choice( |
---|
427 | title = _(u'Transcript Charge'), |
---|
428 | source = DestinationCostSource(), |
---|
429 | required = False, |
---|
430 | readonly = False, |
---|
431 | ) |
---|
432 | |
---|
433 | no_copies = schema.Choice( |
---|
434 | title = _(u'Number of Copies'), |
---|
435 | description = u'Must correspond with the number of dispatch addresses above.', |
---|
436 | values=[1, 2, 3, 4], |
---|
437 | required = False, |
---|
438 | readonly = False, |
---|
439 | default = 1, |
---|
440 | ) |
---|
441 | |
---|
442 | courier_tno = schema.TextLine( |
---|
443 | title = _(u'Courier Tracking Number'), |
---|
444 | required = False, |
---|
445 | ) |
---|
446 | |
---|
447 | proc_date = FormattedDate( |
---|
448 | title = _(u'Processing Date'), |
---|
449 | required = False, |
---|
450 | #date_format = u'%d/%m/%Y', # Use grok-instance-wide default |
---|
451 | show_year = True, |
---|
452 | ) |
---|
453 | |
---|
454 | @invariant |
---|
455 | def type_of_order(applicant): |
---|
456 | if not applicant.collected and applicant.order != 'o': |
---|
457 | raise Invalid(_("If you haven't collected transcript before, type of order must be 'original'.")) |
---|
458 | if applicant.order == 'o' and applicant.charge.startswith('cert_'): |
---|
459 | raise Invalid(_("You've selected the wrong transcript charge.")) |
---|
460 | if applicant.order == 'c' and not applicant.charge.startswith('cert_'): |
---|
461 | raise Invalid(_("You've selected the wrong transcript charge.")) |
---|
462 | |
---|
463 | class IFrenchApplicant(IKofaObject): |
---|
464 | """A transcript applicant. |
---|
465 | """ |
---|
466 | |
---|
467 | suspended = schema.Bool( |
---|
468 | title = _(u'Account suspended'), |
---|
469 | default = False, |
---|
470 | required = False, |
---|
471 | ) |
---|
472 | |
---|
473 | locked = schema.Bool( |
---|
474 | title = _(u'Form locked'), |
---|
475 | default = False, |
---|
476 | required = False, |
---|
477 | ) |
---|
478 | |
---|
479 | applicant_id = schema.TextLine( |
---|
480 | title = _(u'Applicant Id'), |
---|
481 | required = False, |
---|
482 | readonly = False, |
---|
483 | ) |
---|
484 | |
---|
485 | firstname = schema.TextLine( |
---|
486 | title = _(u'First Name'), |
---|
487 | required = True, |
---|
488 | ) |
---|
489 | |
---|
490 | middlename = schema.TextLine( |
---|
491 | title = _(u'Middle Name'), |
---|
492 | required = False, |
---|
493 | ) |
---|
494 | |
---|
495 | lastname = schema.TextLine( |
---|
496 | title = _(u'Surname'), |
---|
497 | required = True, |
---|
498 | ) |
---|
499 | |
---|
500 | date_of_birth = FormattedDate( |
---|
501 | title = _(u'Date of Birth'), |
---|
502 | required = False, |
---|
503 | #date_format = u'%d/%m/%Y', # Use grok-instance-wide default |
---|
504 | show_year = True, |
---|
505 | ) |
---|
506 | |
---|
507 | sex = schema.Choice( |
---|
508 | title = _(u'Gender'), |
---|
509 | source = GenderSource(), |
---|
510 | required = True, |
---|
511 | ) |
---|
512 | |
---|
513 | nationality = schema.Choice( |
---|
514 | vocabulary = nats_vocab, |
---|
515 | title = _(u'Nationality'), |
---|
516 | required = False, |
---|
517 | ) |
---|
518 | |
---|
519 | email = schema.ASCIILine( |
---|
520 | title = _(u'Email Address'), |
---|
521 | required = True, |
---|
522 | constraint=validate_email, |
---|
523 | ) |
---|
524 | |
---|
525 | phone = PhoneNumber( |
---|
526 | title = _(u'Phone'), |
---|
527 | description = u'', |
---|
528 | required = False, |
---|
529 | ) |
---|
530 | |
---|
531 | work = schema.TextLine( |
---|
532 | title = _(u'Place of Work'), |
---|
533 | required = False, |
---|
534 | ) |
---|
535 | |
---|
536 | hq_obtained = schema.Choice( |
---|
537 | title = _(u'Highest Qualification Obtained'), |
---|
538 | required = False, |
---|
539 | readonly = False, |
---|
540 | vocabulary = high_qual, |
---|
541 | ) |
---|
542 | |
---|
543 | hq_date = FormattedDate( |
---|
544 | title = _(u'Highest Qualification Date'), |
---|
545 | required = False, |
---|
546 | readonly = False, |
---|
547 | show_year = True, |
---|
548 | ) |
---|
549 | proficiency = schema.Choice( |
---|
550 | source = ProficiencySource(), |
---|
551 | title = _(u'Level of Proficiency'), |
---|
552 | required = False, |
---|
553 | ) |
---|
554 | |
---|
555 | guarantor = schema.TextLine( |
---|
556 | title = _(u'Name of Guarantor'), |
---|
557 | required = False, |
---|
558 | ) |
---|
559 | |
---|
560 | class ICustomUGApplicant(IApplicantBaseData, IBankAccount): |
---|
561 | """An undergraduate applicant. |
---|
562 | |
---|
563 | This interface defines the least common multiple of all fields |
---|
564 | in ug application forms. In customized forms, fields can be excluded by |
---|
565 | adding them to the UG_OMIT* tuples. |
---|
566 | """ |
---|
567 | |
---|
568 | disabilities = schema.Choice( |
---|
569 | title = _(u'Disabilities'), |
---|
570 | source = DisabilitiesSource(), |
---|
571 | required = False, |
---|
572 | ) |
---|
573 | nationality = schema.Choice( |
---|
574 | source = nats_vocab, |
---|
575 | title = _(u'Nationality'), |
---|
576 | required = False, |
---|
577 | ) |
---|
578 | lga = schema.Choice( |
---|
579 | source = LGASource(), |
---|
580 | title = _(u'State/LGA (Nigerians only)'), |
---|
581 | required = False, |
---|
582 | ) |
---|
583 | #perm_address = schema.Text( |
---|
584 | # title = _(u'Permanent Address'), |
---|
585 | # required = False, |
---|
586 | # ) |
---|
587 | course1 = schema.Choice( |
---|
588 | title = _(u'1st Choice Course of Study'), |
---|
589 | source = AppCatCertificateSource(), |
---|
590 | required = True, |
---|
591 | ) |
---|
592 | course2 = schema.Choice( |
---|
593 | title = _(u'2nd Choice Course of Study'), |
---|
594 | source = AppCatCertificateSource(), |
---|
595 | required = False, |
---|
596 | ) |
---|
597 | |
---|
598 | programme_type = schema.Choice( |
---|
599 | title = _(u'Programme Type'), |
---|
600 | vocabulary = programme_types_vocab, |
---|
601 | required = False, |
---|
602 | ) |
---|
603 | |
---|
604 | hq_type = schema.Choice( |
---|
605 | title = _(u'Qualification Obtained'), |
---|
606 | required = False, |
---|
607 | readonly = False, |
---|
608 | vocabulary = high_qual, |
---|
609 | ) |
---|
610 | hq_matric_no = schema.TextLine( |
---|
611 | title = _(u'Former Matric Number'), |
---|
612 | required = False, |
---|
613 | readonly = False, |
---|
614 | ) |
---|
615 | hq_degree = schema.Choice( |
---|
616 | title = _(u'Class of Degree'), |
---|
617 | required = False, |
---|
618 | readonly = False, |
---|
619 | vocabulary = high_grade, |
---|
620 | ) |
---|
621 | hq_school = schema.TextLine( |
---|
622 | title = _(u'Institution Attended'), |
---|
623 | required = False, |
---|
624 | readonly = False, |
---|
625 | ) |
---|
626 | hq_session = schema.TextLine( |
---|
627 | title = _(u'Years Attended'), |
---|
628 | required = False, |
---|
629 | readonly = False, |
---|
630 | ) |
---|
631 | hq_disc = schema.TextLine( |
---|
632 | title = _(u'Discipline'), |
---|
633 | required = False, |
---|
634 | readonly = False, |
---|
635 | ) |
---|
636 | fst_sit_fname = schema.TextLine( |
---|
637 | title = _(u'Full Name'), |
---|
638 | required = False, |
---|
639 | readonly = False, |
---|
640 | ) |
---|
641 | fst_sit_no = schema.TextLine( |
---|
642 | title = _(u'Exam Number'), |
---|
643 | required = False, |
---|
644 | readonly = False, |
---|
645 | ) |
---|
646 | fst_sit_date = FormattedDate( |
---|
647 | title = _(u'Exam Date'), |
---|
648 | required = False, |
---|
649 | readonly = False, |
---|
650 | show_year = True, |
---|
651 | ) |
---|
652 | fst_sit_type = schema.Choice( |
---|
653 | title = _(u'Exam Type'), |
---|
654 | required = False, |
---|
655 | readonly = False, |
---|
656 | vocabulary = exam_types, |
---|
657 | ) |
---|
658 | fst_sit_results = schema.List( |
---|
659 | title = _(u'Exam Results'), |
---|
660 | value_type = ResultEntryField(), |
---|
661 | required = False, |
---|
662 | readonly = False, |
---|
663 | defaultFactory=list, |
---|
664 | ) |
---|
665 | scd_sit_fname = schema.TextLine( |
---|
666 | title = _(u'Full Name'), |
---|
667 | required = False, |
---|
668 | readonly = False, |
---|
669 | ) |
---|
670 | scd_sit_no = schema.TextLine( |
---|
671 | title = _(u'Exam Number'), |
---|
672 | required = False, |
---|
673 | readonly = False, |
---|
674 | ) |
---|
675 | scd_sit_date = FormattedDate( |
---|
676 | title = _(u'Exam Date'), |
---|
677 | required = False, |
---|
678 | readonly = False, |
---|
679 | show_year = True, |
---|
680 | ) |
---|
681 | scd_sit_type = schema.Choice( |
---|
682 | title = _(u'Exam Type'), |
---|
683 | required = False, |
---|
684 | readonly = False, |
---|
685 | vocabulary = exam_types, |
---|
686 | ) |
---|
687 | scd_sit_results = schema.List( |
---|
688 | title = _(u'Exam Results'), |
---|
689 | value_type = ResultEntryField(), |
---|
690 | required = False, |
---|
691 | readonly = False, |
---|
692 | defaultFactory=list, |
---|
693 | ) |
---|
694 | jamb_subjects = schema.Text( |
---|
695 | title = _(u'Subjects and Scores'), |
---|
696 | required = False, |
---|
697 | ) |
---|
698 | jamb_subjects_list = schema.List( |
---|
699 | title = _(u'JAMB Subjects'), |
---|
700 | required = False, |
---|
701 | defaultFactory=list, |
---|
702 | value_type = schema.Choice( |
---|
703 | vocabulary = jambsubjects |
---|
704 | #source = JAMBSubjectSource(), |
---|
705 | ), |
---|
706 | ) |
---|
707 | jamb_score = schema.Float( |
---|
708 | title = _(u'Total JAMB Score'), |
---|
709 | required = False, |
---|
710 | ) |
---|
711 | #jamb_age = schema.Int( |
---|
712 | # title = _(u'Age (provided by JAMB)'), |
---|
713 | # required = False, |
---|
714 | # ) |
---|
715 | jamb_reg_number = schema.TextLine( |
---|
716 | title = _(u'JAMB Registration Number'), |
---|
717 | required = False, |
---|
718 | ) |
---|
719 | notice = schema.Text( |
---|
720 | title = _(u'Notice'), |
---|
721 | required = False, |
---|
722 | ) |
---|
723 | screening_venue = schema.TextLine( |
---|
724 | title = _(u'Screening Venue'), |
---|
725 | required = False, |
---|
726 | ) |
---|
727 | screening_date = schema.TextLine( |
---|
728 | title = _(u'Screening Date'), |
---|
729 | required = False, |
---|
730 | ) |
---|
731 | screening_score = schema.Float( |
---|
732 | title = _(u'Screening Score (%)'), |
---|
733 | required = False, |
---|
734 | ) |
---|
735 | aggregate = schema.Float( |
---|
736 | title = _(u'Aggregate Score (%)'), |
---|
737 | description = _(u'(average of relative JAMB and PUTME scores)'), |
---|
738 | required = False, |
---|
739 | ) |
---|
740 | result_uploaded = schema.Bool( |
---|
741 | title = _(u'Result uploaded'), |
---|
742 | default = False, |
---|
743 | required = False, |
---|
744 | ) |
---|
745 | student_id = schema.TextLine( |
---|
746 | title = _(u'Student Id'), |
---|
747 | required = False, |
---|
748 | readonly = False, |
---|
749 | ) |
---|
750 | course_admitted = schema.Choice( |
---|
751 | title = _(u'Admitted Course of Study'), |
---|
752 | source = CertificateSource(), |
---|
753 | required = False, |
---|
754 | ) |
---|
755 | locked = schema.Bool( |
---|
756 | title = _(u'Form locked'), |
---|
757 | default = False, |
---|
758 | required = False, |
---|
759 | ) |
---|
760 | |
---|
761 | ICustomUGApplicant[ |
---|
762 | 'locked'].order = IApplicantBaseData['suspended'].order |
---|
763 | ICustomUGApplicant[ |
---|
764 | 'result_uploaded'].order = ICustomUGApplicant['suspended'].order |
---|
765 | |
---|
766 | class ICustomPGApplicant(INigeriaPGApplicant): |
---|
767 | """A postgraduate applicant. |
---|
768 | |
---|
769 | This interface defines the least common multiple of all fields |
---|
770 | in pg application forms. In customized forms, fields can be excluded by |
---|
771 | adding them to the PG_OMIT* tuples. |
---|
772 | """ |
---|
773 | |
---|
774 | referees = schema.List( |
---|
775 | title = _(u'Referees'), |
---|
776 | value_type = RefereeEntryField(), |
---|
777 | required = False, |
---|
778 | defaultFactory=list, |
---|
779 | ) |
---|
780 | |
---|
781 | ICustomPGApplicant[ |
---|
782 | 'referees'].order = INigeriaPGApplicant['emp2_reason'].order |
---|
783 | |
---|
784 | class ICustomApplicant(ICustomUGApplicant, ICustomPGApplicant, |
---|
785 | IUnibenRegistration, ITranscriptApplicant, IFrenchApplicant): |
---|
786 | """An interface for both types of applicants. |
---|
787 | |
---|
788 | Attention: The ICustomPGApplicant field seetings will be overwritten |
---|
789 | by ICustomPGApplicant field settings. If a field is defined |
---|
790 | in both interfaces zope.schema validates only against the |
---|
791 | constraints in ICustomUGApplicant. This does not affect the forms |
---|
792 | since they are build on either ICustomUGApplicant or ICustomPGApplicant. |
---|
793 | """ |
---|
794 | |
---|
795 | def writeLogMessage(view, comment): |
---|
796 | """Adds an INFO message to the log file |
---|
797 | """ |
---|
798 | |
---|
799 | def createStudent(): |
---|
800 | """Create a student object from applicant data |
---|
801 | and copy applicant object. |
---|
802 | """ |
---|
803 | |
---|
804 | class ICustomUGApplicantEdit(ICustomUGApplicant): |
---|
805 | """An undergraduate applicant interface for edit forms. |
---|
806 | |
---|
807 | Here we can repeat the fields from base data and set the |
---|
808 | `required` and `readonly` attributes to True to further restrict |
---|
809 | the data access. Or we can allow only certain certificates to be |
---|
810 | selected by choosing the appropriate source. |
---|
811 | |
---|
812 | We cannot omit fields here. This has to be done in the |
---|
813 | respective form page. |
---|
814 | """ |
---|
815 | |
---|
816 | email = schema.ASCIILine( |
---|
817 | title = _(u'Email Address'), |
---|
818 | required = True, |
---|
819 | constraint=validate_email, |
---|
820 | ) |
---|
821 | date_of_birth = FormattedDate( |
---|
822 | title = _(u'Date of Birth'), |
---|
823 | required = True, |
---|
824 | show_year = True, |
---|
825 | ) |
---|
826 | |
---|
827 | ICustomUGApplicantEdit[ |
---|
828 | 'date_of_birth'].order = ICustomUGApplicant['date_of_birth'].order |
---|
829 | ICustomUGApplicantEdit[ |
---|
830 | 'email'].order = ICustomUGApplicant['email'].order |
---|
831 | |
---|
832 | class ICustomPGApplicantEdit(INigeriaPGApplicantEdit): |
---|
833 | """A postgraduate applicant interface for editing. |
---|
834 | |
---|
835 | Here we can repeat the fields from base data and set the |
---|
836 | `required` and `readonly` attributes to True to further restrict |
---|
837 | the data access. Or we can allow only certain certificates to be |
---|
838 | selected by choosing the appropriate source. |
---|
839 | |
---|
840 | We cannot omit fields here. This has to be done in the |
---|
841 | respective form page. |
---|
842 | """ |
---|
843 | |
---|
844 | referees = schema.List( |
---|
845 | title = _(u'Referees'), |
---|
846 | value_type = RefereeEntryField(), |
---|
847 | required = False, |
---|
848 | defaultFactory=list, |
---|
849 | ) |
---|
850 | |
---|
851 | ICustomPGApplicantEdit[ |
---|
852 | 'referees'].order = INigeriaPGApplicantEdit['emp2_reason'].order |
---|
853 | |
---|
854 | class ICustomApplicantOnlinePayment(INigeriaApplicantOnlinePayment): |
---|
855 | """An applicant payment via payment gateways. |
---|
856 | |
---|
857 | """ |
---|
858 | |
---|
859 | class IPUTMEApplicantEdit(ICustomUGApplicant): |
---|
860 | """An undergraduate applicant interface for editing. |
---|
861 | |
---|
862 | Here we can repeat the fields from base data and set the |
---|
863 | `required` and `readonly` attributes to True to further restrict |
---|
864 | the data access. Or we can allow only certain certificates to be |
---|
865 | selected by choosing the appropriate source. |
---|
866 | |
---|
867 | We cannot omit fields here. This has to be done in the |
---|
868 | respective form page. |
---|
869 | """ |
---|
870 | |
---|
871 | email = schema.ASCIILine( |
---|
872 | title = _(u'Email Address'), |
---|
873 | required = True, |
---|
874 | constraint=validate_email, |
---|
875 | ) |
---|
876 | date_of_birth = FormattedDate( |
---|
877 | title = _(u'Date of Birth'), |
---|
878 | required = True, |
---|
879 | show_year = True, |
---|
880 | ) |
---|
881 | nationality = schema.Choice( |
---|
882 | source = nats_vocab, |
---|
883 | title = _(u'Nationality'), |
---|
884 | required = True, |
---|
885 | ) |
---|
886 | |
---|
887 | IPUTMEApplicantEdit[ |
---|
888 | 'date_of_birth'].order = ICustomUGApplicant['date_of_birth'].order |
---|
889 | IPUTMEApplicantEdit[ |
---|
890 | 'email'].order = ICustomUGApplicant['email'].order |
---|
891 | IPUTMEApplicantEdit[ |
---|
892 | 'nationality'].order = ICustomUGApplicant['nationality'].order |
---|
893 | |
---|
894 | class ICustomApplicantUpdateByRegNo(INigeriaApplicantUpdateByRegNo): |
---|
895 | """Representation of an applicant. |
---|
896 | |
---|
897 | Skip regular reg_number validation if reg_number is used for finding |
---|
898 | the applicant object. |
---|
899 | """ |
---|