1 | # -*- coding: utf-8 -*- |
---|
2 | ## $Id: interfaces.py 16569 2021-08-16 05:46:06Z 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 | import re |
---|
23 | from zope import schema |
---|
24 | from zope.component import getUtility |
---|
25 | from zope.catalog.interfaces import ICatalog |
---|
26 | from zc.sourcefactory.basic import BasicSourceFactory |
---|
27 | from waeup.kofa.applicants.interfaces import ( |
---|
28 | IApplicantBaseData, |
---|
29 | AppCatCertificateSource, CertificateSource) |
---|
30 | from waeup.kofa.schoolgrades import ResultEntryField |
---|
31 | from waeup.kofa.university.vocabularies import StudyModeSource |
---|
32 | from waeup.kofa.interfaces import ( |
---|
33 | SimpleKofaVocabulary, academic_sessions_vocab, validate_email, |
---|
34 | IKofaObject) |
---|
35 | from waeup.kofa.schema import FormattedDate, TextLineChoice, PhoneNumber |
---|
36 | from waeup.kofa.students.vocabularies import ( |
---|
37 | nats_vocab, GenderSource, StudyLevelSource) |
---|
38 | from waeup.kofa.applicants.interfaces import ( |
---|
39 | contextual_reg_num_source, IApplicantBaseData, IApplicantRefereeReport, |
---|
40 | contextual_email_source, IApplicantRegisterUpdate) |
---|
41 | from waeup.kofa.refereeentries import RefereeEntryField |
---|
42 | from kofacustom.nigeria.applicants.interfaces import ( |
---|
43 | LGASource, high_qual, high_grade, exam_types, DisabilitiesSource, |
---|
44 | programme_types_vocab, jambsubjects, validate_jamb_reg_number, |
---|
45 | INigeriaUGApplicant, INigeriaPGApplicant, |
---|
46 | INigeriaApplicantOnlinePayment, |
---|
47 | INigeriaUGApplicantEdit, INigeriaPGApplicantEdit, |
---|
48 | INigeriaApplicantUpdateByRegNo, |
---|
49 | IPUTMEApplicantEdit, |
---|
50 | ) |
---|
51 | from kofacustom.iuokada.interfaces import MessageFactory as _ |
---|
52 | from kofacustom.iuokada.payments.interfaces import ICustomOnlinePayment |
---|
53 | |
---|
54 | # Define a validation method for JAMB reg numbers |
---|
55 | class NotJAMBRegNumber2(schema.ValidationError): |
---|
56 | __doc__ = u"Your JAMB detail is not valid for this admission session, contact admission office for details." |
---|
57 | |
---|
58 | #: Regular expression to check jamb_reg_number formats. |
---|
59 | check_jamb_reg_number_2 = re.compile(r"^1\d{7}[A-Z]{2}$").match |
---|
60 | |
---|
61 | def validate_jamb_reg_number_2(value): |
---|
62 | if not check_jamb_reg_number_2(value): |
---|
63 | raise NotJAMBRegNumber2(value) |
---|
64 | return True |
---|
65 | |
---|
66 | |
---|
67 | sponsors_vocab = SimpleKofaVocabulary( |
---|
68 | (_('Bauchi Government'), 'bauchi'), |
---|
69 | (_('Company'), 'company'), |
---|
70 | (_('Federal Government of Nigeria'), 'federalgov'), |
---|
71 | #(_('Dangote Group'), 'dangote'), |
---|
72 | (_('Kano Government'), 'kano'), |
---|
73 | (_('Parent/Guardian'), 'parent'), |
---|
74 | (_('Rosula Organization'), 'rosula'), |
---|
75 | (_('Self'), 'self'), |
---|
76 | #(_('Social Impact Project'), 'social'), |
---|
77 | ) |
---|
78 | |
---|
79 | heard_about_types_vocab = SimpleKofaVocabulary( |
---|
80 | (_('Facebook/Twitter/Other Social Media'), 'socmedia'), |
---|
81 | (_('From a Friend'), 'friend'), |
---|
82 | (_('Newspaper Advertisement'), 'newspaper'), |
---|
83 | (_('Radio Advertisement'), 'radio'), |
---|
84 | (_('Television Advertisement'), 'television'), |
---|
85 | (_('SMS'), 'sms'), |
---|
86 | ) |
---|
87 | |
---|
88 | subtype_vocab = SimpleKofaVocabulary( |
---|
89 | (_('None'), 'none'), |
---|
90 | (_('UTME'), 'utme'), |
---|
91 | (_('Direct Entry'), 'de'), |
---|
92 | (_('Inter Uni Transfer'), 'transfer'), |
---|
93 | ) |
---|
94 | |
---|
95 | rating_vocab = SimpleKofaVocabulary( |
---|
96 | (_('Excellent'), 'e'), |
---|
97 | (_('Very good'), 'vg'), |
---|
98 | (_('Good'), 'g'), |
---|
99 | (_('Slightly above average'), 'saa'), |
---|
100 | (_('Average'), 'a'), |
---|
101 | (_('Below average'), 'ba'), |
---|
102 | (_('Unable to assess'), 'unable'), |
---|
103 | ) |
---|
104 | |
---|
105 | |
---|
106 | overallpromise_vocab = SimpleKofaVocabulary( |
---|
107 | (_('Very good (highest 10%)'), 'vg'), |
---|
108 | (_('Above average (next 15%)'), 'aa'), |
---|
109 | (_('Average (middle 20%)'), 'a'), |
---|
110 | (_('Below average (middle 40%)'), 'ba'), |
---|
111 | ) |
---|
112 | |
---|
113 | DESTINATION_COST = { |
---|
114 | 'local': ('Local (Nigeria)', 15000.0, 1), |
---|
115 | 'overseas': ('Overseas', 25000.0, 2), |
---|
116 | } |
---|
117 | |
---|
118 | class DestinationCostSource(BasicSourceFactory): |
---|
119 | """A source that delivers continents and shipment costs. |
---|
120 | """ |
---|
121 | def getValues(self): |
---|
122 | sorted_items = sorted(DESTINATION_COST.items(), |
---|
123 | key=lambda element: element[1][2]) |
---|
124 | return [item[0] for item in sorted_items] |
---|
125 | |
---|
126 | def getTitle(self, value): |
---|
127 | return u"%s (₦ %s)" % ( |
---|
128 | DESTINATION_COST[value][0], |
---|
129 | DESTINATION_COST[value][1]) |
---|
130 | |
---|
131 | class TranscriptCertificateSource(CertificateSource): |
---|
132 | """Include Department and Faculty in Title. |
---|
133 | """ |
---|
134 | def getValues(self, context): |
---|
135 | catalog = getUtility(ICatalog, name='certificates_catalog') |
---|
136 | resultset = catalog.searchResults(code=(None, None)) |
---|
137 | resultlist = sorted(resultset, key=lambda |
---|
138 | value: value.__parent__.__parent__.__parent__.code + |
---|
139 | value.__parent__.__parent__.code + |
---|
140 | value.code) |
---|
141 | return resultlist |
---|
142 | |
---|
143 | def getTitle(self, context, value): |
---|
144 | """ |
---|
145 | """ |
---|
146 | try: title = "%s / %s / %s (%s)" % ( |
---|
147 | value.__parent__.__parent__.__parent__.title, |
---|
148 | value.__parent__.__parent__.title, |
---|
149 | value.title, value.code) |
---|
150 | except AttributeError: |
---|
151 | title = "NA / %s (%s)" % (value.title, value.code) |
---|
152 | return title |
---|
153 | |
---|
154 | class ICustomUGApplicant(IApplicantBaseData): |
---|
155 | """An undergraduate applicant. |
---|
156 | |
---|
157 | This interface defines the least common multiple of all fields |
---|
158 | in ug application forms. In customized forms, fields can be excluded by |
---|
159 | adding them to the UG_OMIT* tuples. |
---|
160 | """ |
---|
161 | |
---|
162 | email = TextLineChoice( |
---|
163 | title = _(u'Email Address'), |
---|
164 | required = True, |
---|
165 | constraint=validate_email, |
---|
166 | source = contextual_email_source, |
---|
167 | ) |
---|
168 | |
---|
169 | subtype = schema.Choice( |
---|
170 | title = _(u'Application Subtype'), |
---|
171 | vocabulary = subtype_vocab, |
---|
172 | required = False, |
---|
173 | ) |
---|
174 | disabilities = schema.Choice( |
---|
175 | title = _(u'Disability'), |
---|
176 | source = DisabilitiesSource(), |
---|
177 | required = False, |
---|
178 | ) |
---|
179 | nationality = schema.Choice( |
---|
180 | source = nats_vocab, |
---|
181 | title = _(u'Nationality'), |
---|
182 | required = False, |
---|
183 | ) |
---|
184 | lga = schema.Choice( |
---|
185 | source = LGASource(), |
---|
186 | title = _(u'State/LGA (Nigerians only)'), |
---|
187 | required = False, |
---|
188 | ) |
---|
189 | sponsor = schema.Choice( |
---|
190 | title = _(u'Sponsor'), |
---|
191 | vocabulary = sponsors_vocab, |
---|
192 | required = False, |
---|
193 | ) |
---|
194 | heard_about = schema.Choice( |
---|
195 | title = _(u'How did you hear about IUO?'), |
---|
196 | vocabulary = heard_about_types_vocab, |
---|
197 | required = False, |
---|
198 | ) |
---|
199 | perm_address = schema.Text( |
---|
200 | title = _(u'Residential Address'), |
---|
201 | required = True, |
---|
202 | ) |
---|
203 | parents_name = schema.TextLine( |
---|
204 | title = _(u'Full Name'), |
---|
205 | required = False, |
---|
206 | readonly = False, |
---|
207 | ) |
---|
208 | parents_email = schema.ASCIILine( |
---|
209 | title = _(u'Email Address'), |
---|
210 | required = False, |
---|
211 | constraint=validate_email, |
---|
212 | ) |
---|
213 | parents_phone = PhoneNumber( |
---|
214 | title = _(u'Phone'), |
---|
215 | required = False, |
---|
216 | ) |
---|
217 | course1 = schema.Choice( |
---|
218 | title = _(u'1st Choice Course of Study'), |
---|
219 | source = AppCatCertificateSource(), |
---|
220 | required = True, |
---|
221 | ) |
---|
222 | course2 = schema.Choice( |
---|
223 | title = _(u'2nd Choice Course of Study'), |
---|
224 | source = AppCatCertificateSource(), |
---|
225 | required = False, |
---|
226 | ) |
---|
227 | programme_type = schema.Choice( |
---|
228 | title = _(u'Programme Type'), |
---|
229 | vocabulary = programme_types_vocab, |
---|
230 | required = False, |
---|
231 | ) |
---|
232 | fst_sit_fname = schema.TextLine( |
---|
233 | title = _(u'Full Name'), |
---|
234 | required = False, |
---|
235 | readonly = False, |
---|
236 | ) |
---|
237 | fst_sit_no = schema.TextLine( |
---|
238 | title = _(u'Exam Number'), |
---|
239 | required = False, |
---|
240 | readonly = False, |
---|
241 | ) |
---|
242 | fst_sit_date = FormattedDate( |
---|
243 | title = _(u'Exam Date'), |
---|
244 | required = False, |
---|
245 | readonly = False, |
---|
246 | show_year = True, |
---|
247 | ) |
---|
248 | fst_sit_type = schema.Choice( |
---|
249 | title = _(u'Exam Type'), |
---|
250 | required = False, |
---|
251 | readonly = False, |
---|
252 | vocabulary = exam_types, |
---|
253 | ) |
---|
254 | fst_sit_results = schema.List( |
---|
255 | title = _(u'Exam Results'), |
---|
256 | value_type = ResultEntryField(), |
---|
257 | required = False, |
---|
258 | readonly = False, |
---|
259 | defaultFactory=list, |
---|
260 | ) |
---|
261 | scd_sit_fname = schema.TextLine( |
---|
262 | title = _(u'Full Name'), |
---|
263 | required = False, |
---|
264 | readonly = False, |
---|
265 | ) |
---|
266 | scd_sit_no = schema.TextLine( |
---|
267 | title = _(u'Exam Number'), |
---|
268 | required = False, |
---|
269 | readonly = False, |
---|
270 | ) |
---|
271 | scd_sit_date = FormattedDate( |
---|
272 | title = _(u'Exam Date'), |
---|
273 | required = False, |
---|
274 | readonly = False, |
---|
275 | show_year = True, |
---|
276 | ) |
---|
277 | scd_sit_type = schema.Choice( |
---|
278 | title = _(u'Exam Type'), |
---|
279 | required = False, |
---|
280 | readonly = False, |
---|
281 | vocabulary = exam_types, |
---|
282 | ) |
---|
283 | scd_sit_results = schema.List( |
---|
284 | title = _(u'Exam Results'), |
---|
285 | value_type = ResultEntryField(), |
---|
286 | required = False, |
---|
287 | readonly = False, |
---|
288 | defaultFactory=list, |
---|
289 | ) |
---|
290 | hq_type = schema.Choice( |
---|
291 | title = _(u'Qualification Obtained'), |
---|
292 | required = False, |
---|
293 | readonly = False, |
---|
294 | vocabulary = high_qual, |
---|
295 | ) |
---|
296 | hq_matric_no = schema.TextLine( |
---|
297 | title = _(u'Former Matric Number'), |
---|
298 | required = False, |
---|
299 | readonly = False, |
---|
300 | ) |
---|
301 | hq_degree = schema.Choice( |
---|
302 | title = _(u'Class of Degree'), |
---|
303 | required = False, |
---|
304 | readonly = False, |
---|
305 | vocabulary = high_grade, |
---|
306 | ) |
---|
307 | hq_school = schema.TextLine( |
---|
308 | title = _(u'Institution Attended'), |
---|
309 | required = False, |
---|
310 | readonly = False, |
---|
311 | ) |
---|
312 | hq_session = schema.TextLine( |
---|
313 | title = _(u'Years Attended'), |
---|
314 | required = False, |
---|
315 | readonly = False, |
---|
316 | ) |
---|
317 | hq_disc = schema.TextLine( |
---|
318 | title = _(u'Discipline'), |
---|
319 | required = False, |
---|
320 | readonly = False, |
---|
321 | ) |
---|
322 | jamb_fname = schema.TextLine( |
---|
323 | title = _(u'Full Name'), |
---|
324 | required = False, |
---|
325 | readonly = False, |
---|
326 | ) |
---|
327 | #jamb_subjects = schema.Text( |
---|
328 | # title = _(u'Subjects and Scores'), |
---|
329 | # required = False, |
---|
330 | # ) |
---|
331 | jamb_subjects_list = schema.List( |
---|
332 | title = _(u'JAMB Subjects'), |
---|
333 | required = False, |
---|
334 | defaultFactory=list, |
---|
335 | value_type = schema.Choice( |
---|
336 | vocabulary = jambsubjects |
---|
337 | #source = JAMBSubjectSource(), |
---|
338 | ), |
---|
339 | ) |
---|
340 | jamb_score = schema.Int( |
---|
341 | title = _(u'Total JAMB Score'), |
---|
342 | required = False, |
---|
343 | ) |
---|
344 | #jamb_age = schema.Int( |
---|
345 | # title = _(u'Age (provided by JAMB)'), |
---|
346 | # required = False, |
---|
347 | # ) |
---|
348 | jamb_reg_number = schema.TextLine( |
---|
349 | title = _(u'JAMB Registration Number'), |
---|
350 | required = False, |
---|
351 | constraint=validate_jamb_reg_number, |
---|
352 | description = _(u'Use all CAPS when entering the field.'), |
---|
353 | ) |
---|
354 | notice = schema.Text( |
---|
355 | title = _(u'Notice'), |
---|
356 | required = False, |
---|
357 | ) |
---|
358 | screening_venue = schema.TextLine( |
---|
359 | title = _(u'Screening Venue'), |
---|
360 | required = False, |
---|
361 | ) |
---|
362 | screening_date = schema.TextLine( |
---|
363 | title = _(u'Screening Date'), |
---|
364 | required = False, |
---|
365 | ) |
---|
366 | screening_score = schema.Int( |
---|
367 | title = _(u'Screening Score (%)'), |
---|
368 | required = False, |
---|
369 | ) |
---|
370 | aggregate = schema.Int( |
---|
371 | title = _(u'Aggregate Score (%)'), |
---|
372 | description = _(u'(average of relative JAMB and PUTME scores)'), |
---|
373 | required = False, |
---|
374 | ) |
---|
375 | result_uploaded = schema.Bool( |
---|
376 | title = _(u'Result uploaded'), |
---|
377 | default = False, |
---|
378 | required = False, |
---|
379 | ) |
---|
380 | student_id = schema.TextLine( |
---|
381 | title = _(u'Student Id'), |
---|
382 | required = False, |
---|
383 | readonly = False, |
---|
384 | ) |
---|
385 | course_admitted = schema.Choice( |
---|
386 | title = _(u'Admitted Course of Study'), |
---|
387 | source = CertificateSource(), |
---|
388 | required = False, |
---|
389 | ) |
---|
390 | locked = schema.Bool( |
---|
391 | title = _(u'Form locked'), |
---|
392 | default = False, |
---|
393 | required = False, |
---|
394 | ) |
---|
395 | |
---|
396 | ICustomUGApplicant[ |
---|
397 | 'subtype'].order = ICustomUGApplicant['lga'].order |
---|
398 | ICustomUGApplicant[ |
---|
399 | 'locked'].order = ICustomUGApplicant['suspended'].order |
---|
400 | ICustomUGApplicant[ |
---|
401 | 'result_uploaded'].order = ICustomUGApplicant['suspended'].order |
---|
402 | |
---|
403 | class ICustomPGApplicant(INigeriaPGApplicant): |
---|
404 | """A postgraduate applicant. |
---|
405 | |
---|
406 | This interface defines the least common multiple of all fields |
---|
407 | in pg application forms. In customized forms, fields can be excluded by |
---|
408 | adding them to the PG_OMIT* tuples. |
---|
409 | """ |
---|
410 | |
---|
411 | email = TextLineChoice( |
---|
412 | title = _(u'Email Address'), |
---|
413 | required = True, |
---|
414 | constraint=validate_email, |
---|
415 | source = contextual_email_source, |
---|
416 | ) |
---|
417 | |
---|
418 | perm_address = schema.Text( |
---|
419 | title = _(u'Residential Address'), |
---|
420 | required = True, |
---|
421 | ) |
---|
422 | |
---|
423 | sponsor = schema.Choice( |
---|
424 | title = _(u'Sponsor'), |
---|
425 | vocabulary = sponsors_vocab, |
---|
426 | required = False, |
---|
427 | ) |
---|
428 | |
---|
429 | heard_about = schema.Choice( |
---|
430 | title = _(u'How did you hear about IU?'), |
---|
431 | vocabulary = heard_about_types_vocab, |
---|
432 | required = False, |
---|
433 | ) |
---|
434 | |
---|
435 | nysc_number = schema.Int( |
---|
436 | title = _(u'Nysc Number'), |
---|
437 | required = False, |
---|
438 | readonly = False, |
---|
439 | ) |
---|
440 | |
---|
441 | referees = schema.List( |
---|
442 | title = _(u'Referees'), |
---|
443 | value_type = RefereeEntryField(), |
---|
444 | required = False, |
---|
445 | defaultFactory=list, |
---|
446 | ) |
---|
447 | |
---|
448 | ICustomPGApplicant[ |
---|
449 | 'referees'].order = INigeriaPGApplicant['emp2_reason'].order |
---|
450 | ICustomPGApplicant[ |
---|
451 | 'sponsor'].order = ICustomPGApplicant['lga'].order |
---|
452 | ICustomPGApplicant[ |
---|
453 | 'heard_about'].order = ICustomPGApplicant['lga'].order |
---|
454 | ICustomPGApplicant[ |
---|
455 | 'sponsor'].order = ICustomPGApplicant['lga'].order |
---|
456 | ICustomPGApplicant[ |
---|
457 | 'lga'].order = ICustomPGApplicant['nationality'].order |
---|
458 | ICustomPGApplicant[ |
---|
459 | 'nysc_number'].order = ICustomPGApplicant['nysc_year'].order |
---|
460 | ICustomPGApplicant[ |
---|
461 | 'perm_address'].order = ICustomPGApplicant['lga'].order |
---|
462 | ICustomPGApplicant[ |
---|
463 | 'email'].order = ICustomPGApplicant['lga'].order |
---|
464 | |
---|
465 | class ITranscriptApplicant(IKofaObject): |
---|
466 | """A transcript applicant. |
---|
467 | """ |
---|
468 | |
---|
469 | suspended = schema.Bool( |
---|
470 | title = _(u'Account suspended'), |
---|
471 | default = False, |
---|
472 | required = False, |
---|
473 | ) |
---|
474 | |
---|
475 | locked = schema.Bool( |
---|
476 | title = _(u'Form locked'), |
---|
477 | default = False, |
---|
478 | required = False, |
---|
479 | ) |
---|
480 | |
---|
481 | applicant_id = schema.TextLine( |
---|
482 | title = _(u'Transcript Application Id'), |
---|
483 | required = False, |
---|
484 | readonly = False, |
---|
485 | ) |
---|
486 | |
---|
487 | matric_number = schema.TextLine( |
---|
488 | title = _(u'Matriculation Number'), |
---|
489 | readonly = False, |
---|
490 | required = True, |
---|
491 | ) |
---|
492 | |
---|
493 | firstname = schema.TextLine( |
---|
494 | title = _(u'First Name'), |
---|
495 | required = True, |
---|
496 | ) |
---|
497 | |
---|
498 | middlename = schema.TextLine( |
---|
499 | title = _(u'Middle Name'), |
---|
500 | required = False, |
---|
501 | ) |
---|
502 | |
---|
503 | lastname = schema.TextLine( |
---|
504 | title = _(u'Last Name (Surname)'), |
---|
505 | required = True, |
---|
506 | ) |
---|
507 | |
---|
508 | #date_of_birth = FormattedDate( |
---|
509 | # title = _(u'Date of Birth'), |
---|
510 | # required = False, |
---|
511 | # #date_format = u'%d/%m/%Y', # Use grok-instance-wide default |
---|
512 | # show_year = True, |
---|
513 | # ) |
---|
514 | |
---|
515 | sex = schema.Choice( |
---|
516 | title = _(u'Gender'), |
---|
517 | source = GenderSource(), |
---|
518 | required = True, |
---|
519 | ) |
---|
520 | |
---|
521 | #nationality = schema.Choice( |
---|
522 | # vocabulary = nats_vocab, |
---|
523 | # title = _(u'Nationality'), |
---|
524 | # required = False, |
---|
525 | # ) |
---|
526 | |
---|
527 | email = schema.ASCIILine( |
---|
528 | title = _(u'Email Address'), |
---|
529 | required = True, |
---|
530 | constraint=validate_email, |
---|
531 | ) |
---|
532 | |
---|
533 | #phone = PhoneNumber( |
---|
534 | # title = _(u'Phone'), |
---|
535 | # description = u'', |
---|
536 | # required = False, |
---|
537 | # ) |
---|
538 | |
---|
539 | #perm_address = schema.Text( |
---|
540 | # title = _(u'Current Local Address'), |
---|
541 | # required = False, |
---|
542 | # readonly = False, |
---|
543 | # ) |
---|
544 | |
---|
545 | dispatch_address = schema.Text( |
---|
546 | title = _(u'Dispatch Addresses'), |
---|
547 | description = u'Addresses to which transcripts should be posted. ' |
---|
548 | 'Addresses must involve same courier charges.', |
---|
549 | required = False, |
---|
550 | readonly = False, |
---|
551 | ) |
---|
552 | |
---|
553 | charge = schema.Choice( |
---|
554 | title = _(u'Courier Charge'), |
---|
555 | source = DestinationCostSource(), |
---|
556 | required = True, |
---|
557 | ) |
---|
558 | |
---|
559 | #entry_mode = schema.Choice( |
---|
560 | # title = _(u'Entry Mode'), |
---|
561 | # source = StudyModeSource(), |
---|
562 | # required = False, |
---|
563 | # readonly = False, |
---|
564 | # ) |
---|
565 | |
---|
566 | #entry_session = schema.Choice( |
---|
567 | # title = _(u'Entry Session'), |
---|
568 | # source = academic_sessions_vocab, |
---|
569 | # required = False, |
---|
570 | # readonly = False, |
---|
571 | # ) |
---|
572 | |
---|
573 | end_session = schema.Choice( |
---|
574 | title = _(u'Academic Session of Graduation'), |
---|
575 | source = academic_sessions_vocab, |
---|
576 | required = False, |
---|
577 | readonly = False, |
---|
578 | ) |
---|
579 | |
---|
580 | course_studied = schema.Choice( |
---|
581 | title = _(u'Course of Study'), |
---|
582 | source = TranscriptCertificateSource(), |
---|
583 | description = u'Faculty / Department / Course', |
---|
584 | required = False, |
---|
585 | readonly = False, |
---|
586 | ) |
---|
587 | |
---|
588 | #course_changed = schema.Choice( |
---|
589 | # title = _(u'Change of Study Course'), |
---|
590 | # description = u'If yes, select previous course of study.', |
---|
591 | # source = CertificateSource(), |
---|
592 | # readonly = False, |
---|
593 | # required = False, |
---|
594 | # ) |
---|
595 | |
---|
596 | #change_level = schema.Choice( |
---|
597 | # title = _(u'Change Level'), |
---|
598 | # description = u'If yes, select level at which you changed course of study.', |
---|
599 | # source = StudyLevelSource(), |
---|
600 | # required = False, |
---|
601 | # readonly = False, |
---|
602 | # ) |
---|
603 | |
---|
604 | no_copies = schema.Choice( |
---|
605 | title = _(u'Number of Copies'), |
---|
606 | description = u'Must correspond with the number of dispatch addresses above.', |
---|
607 | values=[1, 2, 3, 4], |
---|
608 | required = False, |
---|
609 | readonly = False, |
---|
610 | default = 1, |
---|
611 | ) |
---|
612 | |
---|
613 | class ICustomApplicant(ICustomUGApplicant, ICustomPGApplicant, |
---|
614 | ITranscriptApplicant): |
---|
615 | """An interface for both types of applicants. |
---|
616 | |
---|
617 | Attention: The ICustomPGApplicant field seetings will be overwritten |
---|
618 | by ICustomPGApplicant field settings. If a field is defined |
---|
619 | in both interfaces zope.schema validates only against the |
---|
620 | constraints in ICustomUGApplicant. This does not affect the forms |
---|
621 | since they are build on either ICustomUGApplicant or ICustomPGApplicant. |
---|
622 | """ |
---|
623 | |
---|
624 | def writeLogMessage(view, comment): |
---|
625 | """Adds an INFO message to the log file |
---|
626 | """ |
---|
627 | |
---|
628 | def createStudent(): |
---|
629 | """Create a student object from applicant data |
---|
630 | and copy applicant object. |
---|
631 | """ |
---|
632 | |
---|
633 | class ICustomUGApplicantEdit(ICustomUGApplicant): |
---|
634 | """An undergraduate applicant interface for edit forms. |
---|
635 | |
---|
636 | Here we can repeat the fields from base data and set the |
---|
637 | `required` and `readonly` attributes to True to further restrict |
---|
638 | the data access. Or we can allow only certain certificates to be |
---|
639 | selected by choosing the appropriate source. |
---|
640 | |
---|
641 | We cannot omit fields here. This has to be done in the |
---|
642 | respective form page. |
---|
643 | """ |
---|
644 | |
---|
645 | phone = PhoneNumber( |
---|
646 | title = _(u'Phone'), |
---|
647 | description = u'', |
---|
648 | required = True, |
---|
649 | ) |
---|
650 | email = TextLineChoice( |
---|
651 | title = _(u'Email Address'), |
---|
652 | constraint=validate_email, |
---|
653 | source = contextual_email_source, |
---|
654 | required = True, |
---|
655 | ) |
---|
656 | date_of_birth = FormattedDate( |
---|
657 | title = _(u'Date of Birth'), |
---|
658 | required = True, |
---|
659 | show_year = True, |
---|
660 | ) |
---|
661 | |
---|
662 | parents_name = schema.TextLine( |
---|
663 | title = _(u'Full Name'), |
---|
664 | required = True, |
---|
665 | readonly = False, |
---|
666 | ) |
---|
667 | |
---|
668 | parents_email = schema.ASCIILine( |
---|
669 | title = _(u'Email Address'), |
---|
670 | required = True, |
---|
671 | constraint=validate_email, |
---|
672 | ) |
---|
673 | |
---|
674 | parents_phone = PhoneNumber( |
---|
675 | title = _(u'Phone'), |
---|
676 | required = True, |
---|
677 | ) |
---|
678 | |
---|
679 | fst_sit_fname = schema.TextLine( |
---|
680 | title = _(u'Full Name'), |
---|
681 | description = _(u'As it is written on your WAEC/NECO result.'), |
---|
682 | required = False, |
---|
683 | readonly = False, |
---|
684 | ) |
---|
685 | |
---|
686 | scd_sit_fname = schema.TextLine( |
---|
687 | title = _(u'Full Name'), |
---|
688 | description = _(u'As it is written on your WAEC/NECO result.'), |
---|
689 | required = False, |
---|
690 | readonly = False, |
---|
691 | ) |
---|
692 | |
---|
693 | jamb_fname = schema.TextLine( |
---|
694 | title = _(u'Full Name'), |
---|
695 | description = _(u'As it is written on your JAMB result slip.'), |
---|
696 | required = True, |
---|
697 | readonly = False, |
---|
698 | ) |
---|
699 | |
---|
700 | jamb_score = schema.Int( |
---|
701 | title = _(u'Total JAMB Score'), |
---|
702 | required = False, |
---|
703 | ) |
---|
704 | |
---|
705 | jamb_reg_number = schema.TextLine( |
---|
706 | title = _(u'JAMB Registration Number'), |
---|
707 | required = False, |
---|
708 | constraint=validate_jamb_reg_number_2, # temporarily in 2021 |
---|
709 | description = _(u'Use all CAPS when entering the field.'), |
---|
710 | ) |
---|
711 | |
---|
712 | ICustomUGApplicantEdit[ |
---|
713 | 'date_of_birth'].order = ICustomUGApplicant['date_of_birth'].order |
---|
714 | ICustomUGApplicantEdit[ |
---|
715 | 'email'].order = ICustomUGApplicant['email'].order |
---|
716 | ICustomUGApplicantEdit[ |
---|
717 | 'phone'].order = ICustomUGApplicantEdit['email'].order |
---|
718 | ICustomUGApplicantEdit[ |
---|
719 | 'fst_sit_fname'].order = ICustomUGApplicant['fst_sit_fname'].order |
---|
720 | ICustomUGApplicantEdit[ |
---|
721 | 'scd_sit_fname'].order = ICustomUGApplicant['scd_sit_fname'].order |
---|
722 | ICustomUGApplicantEdit[ |
---|
723 | 'jamb_fname'].order = ICustomUGApplicant['jamb_fname'].order |
---|
724 | ICustomUGApplicantEdit[ |
---|
725 | 'jamb_score'].order = ICustomUGApplicant['jamb_score'].order |
---|
726 | ICustomUGApplicantEdit[ |
---|
727 | 'jamb_reg_number'].order = ICustomUGApplicant['jamb_reg_number'].order |
---|
728 | ICustomUGApplicantEdit[ |
---|
729 | 'parents_name'].order = ICustomUGApplicant['parents_name'].order |
---|
730 | ICustomUGApplicantEdit[ |
---|
731 | 'parents_email'].order = ICustomUGApplicant['parents_email'].order |
---|
732 | ICustomUGApplicantEdit[ |
---|
733 | 'parents_phone'].order = ICustomUGApplicant['parents_phone'].order |
---|
734 | |
---|
735 | class ICustomPGApplicantEdit(ICustomPGApplicant): |
---|
736 | """A postgraduate applicant interface for editing. |
---|
737 | |
---|
738 | Here we can repeat the fields from base data and set the |
---|
739 | `required` and `readonly` attributes to True to further restrict |
---|
740 | the data access. Or we can allow only certain certificates to be |
---|
741 | selected by choosing the appropriate source. |
---|
742 | |
---|
743 | We cannot omit fields here. This has to be done in the |
---|
744 | respective form page. |
---|
745 | """ |
---|
746 | |
---|
747 | phone = PhoneNumber( |
---|
748 | title = _(u'Phone'), |
---|
749 | description = u'', |
---|
750 | required = True, |
---|
751 | ) |
---|
752 | email = TextLineChoice( |
---|
753 | title = _(u'Email Address'), |
---|
754 | required = False, |
---|
755 | constraint=validate_email, |
---|
756 | source = contextual_email_source, |
---|
757 | ) |
---|
758 | date_of_birth = FormattedDate( |
---|
759 | title = _(u'Date of Birth'), |
---|
760 | required = True, |
---|
761 | show_year = True, |
---|
762 | ) |
---|
763 | |
---|
764 | ICustomPGApplicantEdit[ |
---|
765 | 'date_of_birth'].order = ICustomPGApplicant['date_of_birth'].order |
---|
766 | ICustomPGApplicantEdit[ |
---|
767 | 'email'].order = ICustomPGApplicant['email'].order |
---|
768 | ICustomPGApplicantEdit[ |
---|
769 | 'phone'].order = ICustomPGApplicantEdit['email'].order |
---|
770 | |
---|
771 | class ICustomApplicantRegisterUpdate(IApplicantRegisterUpdate): |
---|
772 | """This is a representation of an applicant for first-time registration. |
---|
773 | This interface is used when applicants use the registration page to |
---|
774 | update their records. |
---|
775 | """ |
---|
776 | |
---|
777 | email = TextLineChoice( |
---|
778 | title = _(u'Email Address'), |
---|
779 | required = False, |
---|
780 | constraint=validate_email, |
---|
781 | source = contextual_email_source, |
---|
782 | ) |
---|
783 | |
---|
784 | class ICustomApplicantOnlinePayment(INigeriaApplicantOnlinePayment): |
---|
785 | """An applicant payment via payment gateways. |
---|
786 | |
---|
787 | """ |
---|
788 | |
---|
789 | class IPUTMEApplicantEdit(IPUTMEApplicantEdit): |
---|
790 | """An undergraduate applicant interface for editing. |
---|
791 | |
---|
792 | Here we can repeat the fields from base data and set the |
---|
793 | `required` and `readonly` attributes to True to further restrict |
---|
794 | the data access. Or we can allow only certain certificates to be |
---|
795 | selected by choosing the appropriate source. |
---|
796 | |
---|
797 | We cannot omit fields here. This has to be done in the |
---|
798 | respective form page. |
---|
799 | """ |
---|
800 | |
---|
801 | class ICustomApplicantUpdateByRegNo(INigeriaApplicantUpdateByRegNo): |
---|
802 | """Representation of an applicant. |
---|
803 | |
---|
804 | Skip regular reg_number validation if reg_number is used for finding |
---|
805 | the applicant object. |
---|
806 | """ |
---|
807 | |
---|
808 | class ICustomApplicantRefereeReport(IApplicantRefereeReport): |
---|
809 | """A referee report. |
---|
810 | """ |
---|
811 | |
---|
812 | duration = schema.Text( |
---|
813 | title = _(u'How long and in what capacity have you known the candidate?'), |
---|
814 | required = False, |
---|
815 | ) |
---|
816 | |
---|
817 | itellectual = schema.Choice( |
---|
818 | title = _(u'Intellectual Capacity'), |
---|
819 | required = False, |
---|
820 | readonly = False, |
---|
821 | vocabulary = rating_vocab, |
---|
822 | ) |
---|
823 | |
---|
824 | persistent = schema.Choice( |
---|
825 | title = _(u'Capacity for Persistent and Independent Academic Study'), |
---|
826 | required = False, |
---|
827 | readonly = False, |
---|
828 | vocabulary = rating_vocab, |
---|
829 | ) |
---|
830 | |
---|
831 | imaginative = schema.Choice( |
---|
832 | title = _(u'Ability for Imaginative Thought'), |
---|
833 | required = False, |
---|
834 | readonly = False, |
---|
835 | vocabulary = rating_vocab, |
---|
836 | ) |
---|
837 | |
---|
838 | productive = schema.Choice( |
---|
839 | title = _(u'Promise of Productive Scholarship'), |
---|
840 | required = False, |
---|
841 | readonly = False, |
---|
842 | vocabulary = rating_vocab, |
---|
843 | ) |
---|
844 | |
---|
845 | previous = schema.Choice( |
---|
846 | title = _(u'Quality of Previous Work'), |
---|
847 | required = False, |
---|
848 | readonly = False, |
---|
849 | vocabulary = rating_vocab, |
---|
850 | ) |
---|
851 | |
---|
852 | expression = schema.Choice( |
---|
853 | title = _(u'Oral and Written Expression in English'), |
---|
854 | required = False, |
---|
855 | readonly = False, |
---|
856 | vocabulary = rating_vocab, |
---|
857 | ) |
---|
858 | |
---|
859 | personality = schema.Text( |
---|
860 | title = _(u'Please comment on the candidate\'s personality ' |
---|
861 | 'with particular reference to his/her moral character, emotional ' |
---|
862 | 'and physical stabilty'), |
---|
863 | required = False, |
---|
864 | ) |
---|
865 | |
---|
866 | promise = schema.Choice( |
---|
867 | title = _(u'Candidate\'s overall promise'), |
---|
868 | required = False, |
---|
869 | readonly = False, |
---|
870 | vocabulary = overallpromise_vocab, |
---|
871 | ) |
---|
872 | |
---|
873 | report = schema.Text( |
---|
874 | title = _(u'Any other relevant information which would help ' |
---|
875 | 'in determining the candidate\'s suitability?'), |
---|
876 | required = False, |
---|
877 | ) |
---|
878 | |
---|
879 | objection = schema.Text( |
---|
880 | title = _(u'Have you any objection to the contents of this ' |
---|
881 | 'evaluation being disclosed to any award-given body if ' |
---|
882 | 'the need arises?'), |
---|
883 | required = False, |
---|
884 | ) |
---|