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