1 | # -*- coding: utf-8 -*- |
---|
2 | ## $Id: interfaces.py 16151 2020-07-08 08:28:52Z 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 | |
---|
58 | REGISTRATION_CATS = { |
---|
59 | 'corporate': ('Corporate Registration', 250000, 1), |
---|
60 | 'group': ('Group Registration', 200000, 2), |
---|
61 | 'individual': ('Individual Registration', 45000, 3), |
---|
62 | 'student': ('Student Registration', 5000, 4), |
---|
63 | 'fullpage': ('Full Page Advert', 250000, 5), |
---|
64 | 'halfpage': ('Half Page Advert', 150000, 6), |
---|
65 | 'quarterpage': ('Quarter Page Advert', 100000, 7), |
---|
66 | } |
---|
67 | |
---|
68 | class RegTypesSource(BasicSourceFactory): |
---|
69 | """A source that delivers all kinds of registrations. |
---|
70 | """ |
---|
71 | def getValues(self): |
---|
72 | sorted_items = sorted(REGISTRATION_CATS.items(), |
---|
73 | key=lambda element: element[1][2]) |
---|
74 | return [item[0] for item in sorted_items] |
---|
75 | |
---|
76 | def getTitle(self, value): |
---|
77 | return u"%s @ ₦ %s" % ( |
---|
78 | REGISTRATION_CATS[value][0], |
---|
79 | REGISTRATION_CATS[value][1]) |
---|
80 | |
---|
81 | DESTINATION_COST = { |
---|
82 | #'none': ('To the moon', 1000000000.0, 1), |
---|
83 | 'nigeria': ('Within Nigeria', 20000.0, 1), |
---|
84 | 'africa': ('Within Africa ', 30000.0, 2), |
---|
85 | 'inter': ('International', 35000.0, 3), |
---|
86 | } |
---|
87 | |
---|
88 | class DestinationCostSource(BasicSourceFactory): |
---|
89 | """A source that delivers continents and shipment costs. |
---|
90 | """ |
---|
91 | def getValues(self): |
---|
92 | sorted_items = sorted(DESTINATION_COST.items(), |
---|
93 | key=lambda element: element[1][2]) |
---|
94 | return [item[0] for item in sorted_items] |
---|
95 | |
---|
96 | def getToken(self, value): |
---|
97 | return value |
---|
98 | |
---|
99 | def getTitle(self, value): |
---|
100 | return u"%s (₦ %s)" % ( |
---|
101 | DESTINATION_COST[value][0], |
---|
102 | DESTINATION_COST[value][1]) |
---|
103 | |
---|
104 | class OrderSource(BasicSourceFactory): |
---|
105 | """ |
---|
106 | """ |
---|
107 | def getValues(self): |
---|
108 | return ['o', 'c'] |
---|
109 | |
---|
110 | def getToken(self, value): |
---|
111 | return value |
---|
112 | |
---|
113 | def getTitle(self, value): |
---|
114 | if value == 'o': |
---|
115 | return _('Original') |
---|
116 | if value == 'c': |
---|
117 | return _('Certified True Copy') |
---|
118 | |
---|
119 | class IUnibenRegistration(IKofaObject): |
---|
120 | """A Uniben registrant. |
---|
121 | """ |
---|
122 | |
---|
123 | suspended = schema.Bool( |
---|
124 | title = _(u'Account suspended'), |
---|
125 | default = False, |
---|
126 | required = False, |
---|
127 | ) |
---|
128 | |
---|
129 | locked = schema.Bool( |
---|
130 | title = _(u'Form locked'), |
---|
131 | default = False, |
---|
132 | required = False, |
---|
133 | ) |
---|
134 | |
---|
135 | applicant_id = schema.TextLine( |
---|
136 | title = _(u'Registrant Id'), |
---|
137 | required = False, |
---|
138 | readonly = False, |
---|
139 | ) |
---|
140 | |
---|
141 | firstname = schema.TextLine( |
---|
142 | title = _(u'First Name'), |
---|
143 | required = True, |
---|
144 | ) |
---|
145 | |
---|
146 | middlename = schema.TextLine( |
---|
147 | title = _(u'Middle Name'), |
---|
148 | required = False, |
---|
149 | ) |
---|
150 | |
---|
151 | lastname = schema.TextLine( |
---|
152 | title = _(u'Last Name (Surname)'), |
---|
153 | required = True, |
---|
154 | ) |
---|
155 | |
---|
156 | sex = schema.Choice( |
---|
157 | title = _(u'Sex'), |
---|
158 | source = GenderSource(), |
---|
159 | required = True, |
---|
160 | ) |
---|
161 | |
---|
162 | nationality = schema.Choice( |
---|
163 | vocabulary = nats_vocab, |
---|
164 | title = _(u'Nationality'), |
---|
165 | required = False, |
---|
166 | ) |
---|
167 | |
---|
168 | email = schema.ASCIILine( |
---|
169 | title = _(u'Email Address'), |
---|
170 | required = True, |
---|
171 | constraint=validate_email, |
---|
172 | ) |
---|
173 | |
---|
174 | phone = PhoneNumber( |
---|
175 | title = _(u'Phone'), |
---|
176 | description = u'', |
---|
177 | required = False, |
---|
178 | ) |
---|
179 | |
---|
180 | #perm_address = schema.Text( |
---|
181 | # title = _(u'Current Local Address'), |
---|
182 | # required = False, |
---|
183 | # readonly = False, |
---|
184 | # ) |
---|
185 | |
---|
186 | institution = schema.TextLine( |
---|
187 | title = _(u'Institution/Organisation'), |
---|
188 | required = False, |
---|
189 | readonly = False, |
---|
190 | ) |
---|
191 | |
---|
192 | city = schema.TextLine( |
---|
193 | title = _(u'City'), |
---|
194 | required = False, |
---|
195 | readonly = False, |
---|
196 | ) |
---|
197 | |
---|
198 | lga = schema.Choice( |
---|
199 | source = LGASource(), |
---|
200 | title = _(u'State/LGA'), |
---|
201 | required = False, |
---|
202 | ) |
---|
203 | |
---|
204 | matric_number = schema.TextLine( |
---|
205 | title = _(u'Uniben Matriculation Number'), |
---|
206 | required = False, |
---|
207 | readonly = False, |
---|
208 | ) |
---|
209 | |
---|
210 | registration_cats = schema.List( |
---|
211 | title = _(u'Registration Categories'), |
---|
212 | value_type = schema.Choice(source=RegTypesSource()), |
---|
213 | required = True, |
---|
214 | defaultFactory=list, |
---|
215 | ) |
---|
216 | |
---|
217 | # @invariant |
---|
218 | # def matric_number_exists(applicant): |
---|
219 | # if applicant.matric_number: |
---|
220 | # catalog = getUtility(ICatalog, name='students_catalog') |
---|
221 | # accommodation_session = getSite()['hostels'].accommodation_session |
---|
222 | # student = catalog.searchResults(matric_number=( |
---|
223 | # applicant.matric_number, applicant.matric_number)) |
---|
224 | # if len(student) != 1: |
---|
225 | # raise Invalid(_("Matriculation number not found.")) |
---|
226 | |
---|
227 | class ITranscriptApplicant(IKofaObject): |
---|
228 | """A transcript applicant. |
---|
229 | """ |
---|
230 | |
---|
231 | suspended = schema.Bool( |
---|
232 | title = _(u'Account suspended'), |
---|
233 | default = False, |
---|
234 | required = False, |
---|
235 | ) |
---|
236 | |
---|
237 | locked = schema.Bool( |
---|
238 | title = _(u'Form locked'), |
---|
239 | default = False, |
---|
240 | required = False, |
---|
241 | ) |
---|
242 | |
---|
243 | applicant_id = schema.TextLine( |
---|
244 | title = _(u'Transcript Application Id'), |
---|
245 | required = False, |
---|
246 | readonly = False, |
---|
247 | ) |
---|
248 | |
---|
249 | student_id = schema.TextLine( |
---|
250 | title = _(u'Kofa Student Id'), |
---|
251 | required = False, |
---|
252 | readonly = False, |
---|
253 | ) |
---|
254 | |
---|
255 | #reg_number = schema.TextLine( |
---|
256 | # title = _(u'Registration Number'), |
---|
257 | # readonly = False, |
---|
258 | # required = False, |
---|
259 | # ) |
---|
260 | |
---|
261 | matric_number = schema.TextLine( |
---|
262 | title = _(u'Matriculation Number'), |
---|
263 | readonly = False, |
---|
264 | required = True, |
---|
265 | ) |
---|
266 | |
---|
267 | firstname = schema.TextLine( |
---|
268 | title = _(u'First Name in School'), |
---|
269 | required = True, |
---|
270 | ) |
---|
271 | |
---|
272 | middlename = schema.TextLine( |
---|
273 | title = _(u'Middle Name in School'), |
---|
274 | required = False, |
---|
275 | ) |
---|
276 | |
---|
277 | lastname = schema.TextLine( |
---|
278 | title = _(u'Surname in School'), |
---|
279 | required = True, |
---|
280 | ) |
---|
281 | |
---|
282 | date_of_birth = FormattedDate( |
---|
283 | title = _(u'Date of Birth'), |
---|
284 | required = False, |
---|
285 | #date_format = u'%d/%m/%Y', # Use grok-instance-wide default |
---|
286 | show_year = True, |
---|
287 | ) |
---|
288 | |
---|
289 | sex = schema.Choice( |
---|
290 | title = _(u'Gender'), |
---|
291 | source = GenderSource(), |
---|
292 | required = True, |
---|
293 | ) |
---|
294 | |
---|
295 | #nationality = schema.Choice( |
---|
296 | # vocabulary = nats_vocab, |
---|
297 | # title = _(u'Nationality'), |
---|
298 | # required = False, |
---|
299 | # ) |
---|
300 | |
---|
301 | email = schema.ASCIILine( |
---|
302 | title = _(u'Email Address'), |
---|
303 | required = True, |
---|
304 | constraint=validate_email, |
---|
305 | ) |
---|
306 | |
---|
307 | phone = PhoneNumber( |
---|
308 | title = _(u'Phone'), |
---|
309 | description = u'', |
---|
310 | required = False, |
---|
311 | ) |
---|
312 | |
---|
313 | #perm_address = schema.Text( |
---|
314 | # title = _(u'Current Local Address'), |
---|
315 | # required = False, |
---|
316 | # readonly = False, |
---|
317 | # ) |
---|
318 | |
---|
319 | entry_session = schema.Choice( |
---|
320 | title = _(u'Academic Session of Entry'), |
---|
321 | source = academic_sessions_vocab, |
---|
322 | required = False, |
---|
323 | readonly = False, |
---|
324 | ) |
---|
325 | |
---|
326 | end_session = schema.Choice( |
---|
327 | title = _(u'Academic Session of Graduation'), |
---|
328 | source = academic_sessions_vocab, |
---|
329 | required = False, |
---|
330 | readonly = False, |
---|
331 | ) |
---|
332 | |
---|
333 | entry_mode = schema.Choice( |
---|
334 | title = _(u'Mode of Entry'), |
---|
335 | source = StudyModeSource(), |
---|
336 | required = False, |
---|
337 | readonly = False, |
---|
338 | ) |
---|
339 | |
---|
340 | course_studied = schema.Choice( |
---|
341 | title = _(u'Course of Study'), |
---|
342 | source = CertificateSource(), |
---|
343 | required = False, |
---|
344 | readonly = False, |
---|
345 | ) |
---|
346 | |
---|
347 | course_changed = schema.Choice( |
---|
348 | title = _(u'Change of Study Course / Transfer'), |
---|
349 | description = u'If yes, select previous course of study.', |
---|
350 | source = CertificateSource(), |
---|
351 | readonly = False, |
---|
352 | required = False, |
---|
353 | ) |
---|
354 | |
---|
355 | #change_level = schema.Choice( |
---|
356 | # title = _(u'Change Level'), |
---|
357 | # description = u'If yes, select level at which you changed course of study.', |
---|
358 | # source = StudyLevelSource(), |
---|
359 | # required = False, |
---|
360 | # readonly = False, |
---|
361 | # ) |
---|
362 | |
---|
363 | purpose = schema.TextLine( |
---|
364 | title = _(u'Transcript Purpose'), |
---|
365 | required = False, |
---|
366 | ) |
---|
367 | |
---|
368 | order = schema.Choice( |
---|
369 | source = OrderSource(), |
---|
370 | title = _(u'Type of Order'), |
---|
371 | required = False, |
---|
372 | ) |
---|
373 | |
---|
374 | dispatch_address = schema.Text( |
---|
375 | title = _(u'Recipient Body'), |
---|
376 | description = u'Addresses (including email address and phone number) ' |
---|
377 | 'to which transcripts should be posted. ' |
---|
378 | 'All addresses must involve same courier charges.', |
---|
379 | required = False, |
---|
380 | readonly = False, |
---|
381 | ) |
---|
382 | |
---|
383 | charge = schema.Choice( |
---|
384 | title = _(u'Courier Charge'), |
---|
385 | source = DestinationCostSource(), |
---|
386 | required = True, |
---|
387 | ) |
---|
388 | |
---|
389 | no_copies = schema.Choice( |
---|
390 | title = _(u'Number of Copies'), |
---|
391 | description = u'Must correspond with the number of dispatch addresses above.', |
---|
392 | values=[1, 2, 3, 4], |
---|
393 | required = False, |
---|
394 | readonly = False, |
---|
395 | default = 1, |
---|
396 | ) |
---|
397 | |
---|
398 | class ICustomUGApplicant(IApplicantBaseData, IBankAccount): |
---|
399 | """An undergraduate applicant. |
---|
400 | |
---|
401 | This interface defines the least common multiple of all fields |
---|
402 | in ug application forms. In customized forms, fields can be excluded by |
---|
403 | adding them to the UG_OMIT* tuples. |
---|
404 | """ |
---|
405 | |
---|
406 | disabilities = schema.Choice( |
---|
407 | title = _(u'Disabilities'), |
---|
408 | source = DisabilitiesSource(), |
---|
409 | required = False, |
---|
410 | ) |
---|
411 | nationality = schema.Choice( |
---|
412 | source = nats_vocab, |
---|
413 | title = _(u'Nationality'), |
---|
414 | required = False, |
---|
415 | ) |
---|
416 | lga = schema.Choice( |
---|
417 | source = LGASource(), |
---|
418 | title = _(u'State/LGA (Nigerians only)'), |
---|
419 | required = False, |
---|
420 | ) |
---|
421 | #perm_address = schema.Text( |
---|
422 | # title = _(u'Permanent Address'), |
---|
423 | # required = False, |
---|
424 | # ) |
---|
425 | course1 = schema.Choice( |
---|
426 | title = _(u'1st Choice Course of Study'), |
---|
427 | source = AppCatCertificateSource(), |
---|
428 | required = True, |
---|
429 | ) |
---|
430 | course2 = schema.Choice( |
---|
431 | title = _(u'2nd Choice Course of Study'), |
---|
432 | source = AppCatCertificateSource(), |
---|
433 | required = False, |
---|
434 | ) |
---|
435 | |
---|
436 | programme_type = schema.Choice( |
---|
437 | title = _(u'Programme Type'), |
---|
438 | vocabulary = programme_types_vocab, |
---|
439 | required = False, |
---|
440 | ) |
---|
441 | |
---|
442 | hq_type = schema.Choice( |
---|
443 | title = _(u'Qualification Obtained'), |
---|
444 | required = False, |
---|
445 | readonly = False, |
---|
446 | vocabulary = high_qual, |
---|
447 | ) |
---|
448 | hq_matric_no = schema.TextLine( |
---|
449 | title = _(u'Former Matric Number'), |
---|
450 | required = False, |
---|
451 | readonly = False, |
---|
452 | ) |
---|
453 | hq_degree = schema.Choice( |
---|
454 | title = _(u'Class of Degree'), |
---|
455 | required = False, |
---|
456 | readonly = False, |
---|
457 | vocabulary = high_grade, |
---|
458 | ) |
---|
459 | hq_school = schema.TextLine( |
---|
460 | title = _(u'Institution Attended'), |
---|
461 | required = False, |
---|
462 | readonly = False, |
---|
463 | ) |
---|
464 | hq_session = schema.TextLine( |
---|
465 | title = _(u'Years Attended'), |
---|
466 | required = False, |
---|
467 | readonly = False, |
---|
468 | ) |
---|
469 | hq_disc = schema.TextLine( |
---|
470 | title = _(u'Discipline'), |
---|
471 | required = False, |
---|
472 | readonly = False, |
---|
473 | ) |
---|
474 | fst_sit_fname = schema.TextLine( |
---|
475 | title = _(u'Full Name'), |
---|
476 | required = False, |
---|
477 | readonly = False, |
---|
478 | ) |
---|
479 | fst_sit_no = schema.TextLine( |
---|
480 | title = _(u'Exam Number'), |
---|
481 | required = False, |
---|
482 | readonly = False, |
---|
483 | ) |
---|
484 | fst_sit_date = FormattedDate( |
---|
485 | title = _(u'Exam Date'), |
---|
486 | required = False, |
---|
487 | readonly = False, |
---|
488 | show_year = True, |
---|
489 | ) |
---|
490 | fst_sit_type = schema.Choice( |
---|
491 | title = _(u'Exam Type'), |
---|
492 | required = False, |
---|
493 | readonly = False, |
---|
494 | vocabulary = exam_types, |
---|
495 | ) |
---|
496 | fst_sit_results = schema.List( |
---|
497 | title = _(u'Exam Results'), |
---|
498 | value_type = ResultEntryField(), |
---|
499 | required = False, |
---|
500 | readonly = False, |
---|
501 | defaultFactory=list, |
---|
502 | ) |
---|
503 | scd_sit_fname = schema.TextLine( |
---|
504 | title = _(u'Full Name'), |
---|
505 | required = False, |
---|
506 | readonly = False, |
---|
507 | ) |
---|
508 | scd_sit_no = schema.TextLine( |
---|
509 | title = _(u'Exam Number'), |
---|
510 | required = False, |
---|
511 | readonly = False, |
---|
512 | ) |
---|
513 | scd_sit_date = FormattedDate( |
---|
514 | title = _(u'Exam Date'), |
---|
515 | required = False, |
---|
516 | readonly = False, |
---|
517 | show_year = True, |
---|
518 | ) |
---|
519 | scd_sit_type = schema.Choice( |
---|
520 | title = _(u'Exam Type'), |
---|
521 | required = False, |
---|
522 | readonly = False, |
---|
523 | vocabulary = exam_types, |
---|
524 | ) |
---|
525 | scd_sit_results = schema.List( |
---|
526 | title = _(u'Exam Results'), |
---|
527 | value_type = ResultEntryField(), |
---|
528 | required = False, |
---|
529 | readonly = False, |
---|
530 | defaultFactory=list, |
---|
531 | ) |
---|
532 | jamb_subjects = schema.Text( |
---|
533 | title = _(u'Subjects and Scores'), |
---|
534 | required = False, |
---|
535 | ) |
---|
536 | jamb_subjects_list = schema.List( |
---|
537 | title = _(u'JAMB Subjects'), |
---|
538 | required = False, |
---|
539 | defaultFactory=list, |
---|
540 | value_type = schema.Choice( |
---|
541 | vocabulary = jambsubjects |
---|
542 | #source = JAMBSubjectSource(), |
---|
543 | ), |
---|
544 | ) |
---|
545 | jamb_score = schema.Int( |
---|
546 | title = _(u'Total JAMB Score'), |
---|
547 | required = False, |
---|
548 | ) |
---|
549 | #jamb_age = schema.Int( |
---|
550 | # title = _(u'Age (provided by JAMB)'), |
---|
551 | # required = False, |
---|
552 | # ) |
---|
553 | jamb_reg_number = schema.TextLine( |
---|
554 | title = _(u'JAMB Registration Number'), |
---|
555 | required = False, |
---|
556 | ) |
---|
557 | notice = schema.Text( |
---|
558 | title = _(u'Notice'), |
---|
559 | required = False, |
---|
560 | ) |
---|
561 | screening_venue = schema.TextLine( |
---|
562 | title = _(u'Screening Venue'), |
---|
563 | required = False, |
---|
564 | ) |
---|
565 | screening_date = schema.TextLine( |
---|
566 | title = _(u'Screening Date'), |
---|
567 | required = False, |
---|
568 | ) |
---|
569 | screening_score = schema.Int( |
---|
570 | title = _(u'Screening Score (%)'), |
---|
571 | required = False, |
---|
572 | ) |
---|
573 | aggregate = schema.Int( |
---|
574 | title = _(u'Aggregate Score (%)'), |
---|
575 | description = _(u'(average of relative JAMB and PUTME scores)'), |
---|
576 | required = False, |
---|
577 | ) |
---|
578 | result_uploaded = schema.Bool( |
---|
579 | title = _(u'Result uploaded'), |
---|
580 | default = False, |
---|
581 | required = False, |
---|
582 | ) |
---|
583 | student_id = schema.TextLine( |
---|
584 | title = _(u'Student Id'), |
---|
585 | required = False, |
---|
586 | readonly = False, |
---|
587 | ) |
---|
588 | course_admitted = schema.Choice( |
---|
589 | title = _(u'Admitted Course of Study'), |
---|
590 | source = CertificateSource(), |
---|
591 | required = False, |
---|
592 | ) |
---|
593 | locked = schema.Bool( |
---|
594 | title = _(u'Form locked'), |
---|
595 | default = False, |
---|
596 | required = False, |
---|
597 | ) |
---|
598 | |
---|
599 | ICustomUGApplicant[ |
---|
600 | 'locked'].order = IApplicantBaseData['suspended'].order |
---|
601 | ICustomUGApplicant[ |
---|
602 | 'result_uploaded'].order = ICustomUGApplicant['suspended'].order |
---|
603 | |
---|
604 | class ICustomPGApplicant(INigeriaPGApplicant): |
---|
605 | """A postgraduate applicant. |
---|
606 | |
---|
607 | This interface defines the least common multiple of all fields |
---|
608 | in pg application forms. In customized forms, fields can be excluded by |
---|
609 | adding them to the PG_OMIT* tuples. |
---|
610 | """ |
---|
611 | |
---|
612 | referees = schema.List( |
---|
613 | title = _(u'Referees'), |
---|
614 | value_type = RefereeEntryField(), |
---|
615 | required = False, |
---|
616 | defaultFactory=list, |
---|
617 | ) |
---|
618 | |
---|
619 | ICustomPGApplicant[ |
---|
620 | 'referees'].order = INigeriaPGApplicant['emp2_reason'].order |
---|
621 | |
---|
622 | class ICustomApplicant(ICustomUGApplicant, ICustomPGApplicant, |
---|
623 | IUnibenRegistration, ITranscriptApplicant): |
---|
624 | """An interface for both types of applicants. |
---|
625 | |
---|
626 | Attention: The ICustomPGApplicant field seetings will be overwritten |
---|
627 | by ICustomPGApplicant field settings. If a field is defined |
---|
628 | in both interfaces zope.schema validates only against the |
---|
629 | constraints in ICustomUGApplicant. This does not affect the forms |
---|
630 | since they are build on either ICustomUGApplicant or ICustomPGApplicant. |
---|
631 | """ |
---|
632 | |
---|
633 | def writeLogMessage(view, comment): |
---|
634 | """Adds an INFO message to the log file |
---|
635 | """ |
---|
636 | |
---|
637 | def createStudent(): |
---|
638 | """Create a student object from applicant data |
---|
639 | and copy applicant object. |
---|
640 | """ |
---|
641 | |
---|
642 | class ICustomUGApplicantEdit(ICustomUGApplicant): |
---|
643 | """An undergraduate applicant interface for edit forms. |
---|
644 | |
---|
645 | Here we can repeat the fields from base data and set the |
---|
646 | `required` and `readonly` attributes to True to further restrict |
---|
647 | the data access. Or we can allow only certain certificates to be |
---|
648 | selected by choosing the appropriate source. |
---|
649 | |
---|
650 | We cannot omit fields here. This has to be done in the |
---|
651 | respective form page. |
---|
652 | """ |
---|
653 | |
---|
654 | email = schema.ASCIILine( |
---|
655 | title = _(u'Email Address'), |
---|
656 | required = True, |
---|
657 | constraint=validate_email, |
---|
658 | ) |
---|
659 | date_of_birth = FormattedDate( |
---|
660 | title = _(u'Date of Birth'), |
---|
661 | required = True, |
---|
662 | show_year = True, |
---|
663 | ) |
---|
664 | |
---|
665 | ICustomUGApplicantEdit[ |
---|
666 | 'date_of_birth'].order = ICustomUGApplicant['date_of_birth'].order |
---|
667 | ICustomUGApplicantEdit[ |
---|
668 | 'email'].order = ICustomUGApplicant['email'].order |
---|
669 | |
---|
670 | class ICustomPGApplicantEdit(INigeriaPGApplicantEdit): |
---|
671 | """A postgraduate applicant interface for editing. |
---|
672 | |
---|
673 | Here we can repeat the fields from base data and set the |
---|
674 | `required` and `readonly` attributes to True to further restrict |
---|
675 | the data access. Or we can allow only certain certificates to be |
---|
676 | selected by choosing the appropriate source. |
---|
677 | |
---|
678 | We cannot omit fields here. This has to be done in the |
---|
679 | respective form page. |
---|
680 | """ |
---|
681 | |
---|
682 | referees = schema.List( |
---|
683 | title = _(u'Referees'), |
---|
684 | value_type = RefereeEntryField(), |
---|
685 | required = False, |
---|
686 | defaultFactory=list, |
---|
687 | ) |
---|
688 | |
---|
689 | ICustomPGApplicantEdit[ |
---|
690 | 'referees'].order = INigeriaPGApplicantEdit['emp2_reason'].order |
---|
691 | |
---|
692 | class ICustomApplicantOnlinePayment(INigeriaApplicantOnlinePayment): |
---|
693 | """An applicant payment via payment gateways. |
---|
694 | |
---|
695 | """ |
---|
696 | |
---|
697 | class IPUTMEApplicantEdit(ICustomUGApplicant): |
---|
698 | """An undergraduate applicant interface for editing. |
---|
699 | |
---|
700 | Here we can repeat the fields from base data and set the |
---|
701 | `required` and `readonly` attributes to True to further restrict |
---|
702 | the data access. Or we can allow only certain certificates to be |
---|
703 | selected by choosing the appropriate source. |
---|
704 | |
---|
705 | We cannot omit fields here. This has to be done in the |
---|
706 | respective form page. |
---|
707 | """ |
---|
708 | |
---|
709 | email = schema.ASCIILine( |
---|
710 | title = _(u'Email Address'), |
---|
711 | required = True, |
---|
712 | constraint=validate_email, |
---|
713 | ) |
---|
714 | date_of_birth = FormattedDate( |
---|
715 | title = _(u'Date of Birth'), |
---|
716 | required = True, |
---|
717 | show_year = True, |
---|
718 | ) |
---|
719 | nationality = schema.Choice( |
---|
720 | source = nats_vocab, |
---|
721 | title = _(u'Nationality'), |
---|
722 | required = True, |
---|
723 | ) |
---|
724 | |
---|
725 | IPUTMEApplicantEdit[ |
---|
726 | 'date_of_birth'].order = ICustomUGApplicant['date_of_birth'].order |
---|
727 | IPUTMEApplicantEdit[ |
---|
728 | 'email'].order = ICustomUGApplicant['email'].order |
---|
729 | IPUTMEApplicantEdit[ |
---|
730 | 'nationality'].order = ICustomUGApplicant['nationality'].order |
---|
731 | |
---|
732 | class ICustomApplicantUpdateByRegNo(INigeriaApplicantUpdateByRegNo): |
---|
733 | """Representation of an applicant. |
---|
734 | |
---|
735 | Skip regular reg_number validation if reg_number is used for finding |
---|
736 | the applicant object. |
---|
737 | """ |
---|