1 | ## $Id: interfaces.py 14468 2017-01-27 12:18:15Z henrik $ |
---|
2 | ## |
---|
3 | ## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann |
---|
4 | ## This program is free software; you can redistribute it and/or modify |
---|
5 | ## it under the terms of the GNU General Public License as published by |
---|
6 | ## the Free Software Foundation; either version 2 of the License, or |
---|
7 | ## (at your option) any later version. |
---|
8 | ## |
---|
9 | ## This program is distributed in the hope that it will be useful, |
---|
10 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
11 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
12 | ## GNU General Public License for more details. |
---|
13 | ## |
---|
14 | ## You should have received a copy of the GNU General Public License |
---|
15 | ## along with this program; if not, write to the Free Software |
---|
16 | ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
17 | ## |
---|
18 | """Customized interfaces of the university application package. |
---|
19 | """ |
---|
20 | |
---|
21 | from zope import schema |
---|
22 | from zope.interface import Attribute, invariant, Invalid |
---|
23 | from waeup.kofa.applicants.interfaces import ( |
---|
24 | IApplicantBaseData, |
---|
25 | AppCatCertificateSource, CertificateSource) |
---|
26 | from waeup.kofa.schoolgrades import ResultEntryField |
---|
27 | from waeup.kofa.interfaces import ( |
---|
28 | SimpleKofaVocabulary, academic_sessions_vocab, validate_email) |
---|
29 | from waeup.kofa.schema import FormattedDate, TextLineChoice, PhoneNumber |
---|
30 | from waeup.kofa.interfaces import IKofaObject |
---|
31 | from waeup.kofa.students.vocabularies import ( |
---|
32 | nats_vocab, GenderSource, StudyLevelSource) |
---|
33 | from waeup.kofa.applicants.interfaces import ( |
---|
34 | contextual_reg_num_source, |
---|
35 | IApplicantBaseData) |
---|
36 | from waeup.kofa.university.vocabularies import StudyModeSource |
---|
37 | from kofacustom.nigeria.applicants.interfaces import ( |
---|
38 | LGASource, high_qual, high_grade, exam_types, |
---|
39 | INigeriaUGApplicant, INigeriaPGApplicant, |
---|
40 | INigeriaApplicantOnlinePayment, |
---|
41 | INigeriaUGApplicantEdit, INigeriaPGApplicantEdit, |
---|
42 | INigeriaApplicantUpdateByRegNo, |
---|
43 | IPUTMEApplicantEdit, |
---|
44 | ) |
---|
45 | from waeup.aaue.interfaces import MessageFactory as _ |
---|
46 | from waeup.aaue.payments.interfaces import ICustomOnlinePayment |
---|
47 | |
---|
48 | programme_types_vocab = SimpleKofaVocabulary( |
---|
49 | (_('Undergraduate Programme (100 level)'), 'regular'), |
---|
50 | (_('Direct Entry (200 level)'), 'direct'), |
---|
51 | (_('not applicable'), 'na'), |
---|
52 | ) |
---|
53 | |
---|
54 | class ICustomUGApplicant(IApplicantBaseData): |
---|
55 | """An undergraduate applicant. |
---|
56 | |
---|
57 | This interface defines the least common multiple of all fields |
---|
58 | in ug application forms. In customized forms, fields can be excluded by |
---|
59 | adding them to the UG_OMIT* tuples. |
---|
60 | """ |
---|
61 | |
---|
62 | #programme_type = schema.Choice( |
---|
63 | # title = _(u'Programme Type'), |
---|
64 | # vocabulary = programme_types_vocab, |
---|
65 | # required = False, |
---|
66 | # ) |
---|
67 | |
---|
68 | nationality = schema.Choice( |
---|
69 | source = nats_vocab, |
---|
70 | title = _(u'Nationality'), |
---|
71 | required = True, |
---|
72 | ) |
---|
73 | lga = schema.Choice( |
---|
74 | source = LGASource(), |
---|
75 | title = _(u'State/LGA (Nigerians only)'), |
---|
76 | required = False, |
---|
77 | ) |
---|
78 | perm_address = schema.Text( |
---|
79 | title = _(u'Permanent Address'), |
---|
80 | required = False, |
---|
81 | ) |
---|
82 | home_town = schema.TextLine( |
---|
83 | title = _(u'Home Town'), |
---|
84 | required = False, |
---|
85 | ) |
---|
86 | #jamb_reg_number = schema.TextLine( |
---|
87 | # title = _(u'JAMB Registration Number'), |
---|
88 | # required = False, |
---|
89 | # ) |
---|
90 | jamb_score = schema.Int( |
---|
91 | title = _(u'Total JAMB Score'), |
---|
92 | required = False, |
---|
93 | ) |
---|
94 | jamb_subjects = schema.Text( |
---|
95 | title = _(u'JAMB Subjects and Scores'), |
---|
96 | required = False, |
---|
97 | ) |
---|
98 | course1 = schema.Choice( |
---|
99 | title = _(u'1st Choice Course of Study'), |
---|
100 | source = AppCatCertificateSource(), |
---|
101 | required = False, |
---|
102 | ) |
---|
103 | course2 = schema.Choice( |
---|
104 | title = _(u'2nd Choice Course of Study'), |
---|
105 | source = AppCatCertificateSource(), |
---|
106 | required = False, |
---|
107 | ) |
---|
108 | fst_sit_fname = schema.TextLine( |
---|
109 | title = _(u'Full Name'), |
---|
110 | required = False, |
---|
111 | readonly = False, |
---|
112 | ) |
---|
113 | fst_sit_no = schema.TextLine( |
---|
114 | title = _(u'Exam Number'), |
---|
115 | required = False, |
---|
116 | readonly = False, |
---|
117 | ) |
---|
118 | fst_sit_date = FormattedDate( |
---|
119 | title = _(u'Exam Date'), |
---|
120 | required = False, |
---|
121 | readonly = False, |
---|
122 | show_year = True, |
---|
123 | ) |
---|
124 | fst_sit_type = schema.Choice( |
---|
125 | title = _(u'Exam Type'), |
---|
126 | required = False, |
---|
127 | readonly = False, |
---|
128 | vocabulary = exam_types, |
---|
129 | ) |
---|
130 | fst_sit_results = schema.List( |
---|
131 | title = _(u'Exam Results'), |
---|
132 | value_type = ResultEntryField(), |
---|
133 | required = False, |
---|
134 | readonly = False, |
---|
135 | defaultFactory=list, |
---|
136 | ) |
---|
137 | scd_sit_fname = schema.TextLine( |
---|
138 | title = _(u'Full Name'), |
---|
139 | required = False, |
---|
140 | readonly = False, |
---|
141 | ) |
---|
142 | scd_sit_no = schema.TextLine( |
---|
143 | title = _(u'Exam Number'), |
---|
144 | required = False, |
---|
145 | readonly = False, |
---|
146 | ) |
---|
147 | scd_sit_date = FormattedDate( |
---|
148 | title = _(u'Exam Date'), |
---|
149 | required = False, |
---|
150 | readonly = False, |
---|
151 | show_year = True, |
---|
152 | ) |
---|
153 | scd_sit_type = schema.Choice( |
---|
154 | title = _(u'Exam Type'), |
---|
155 | required = False, |
---|
156 | readonly = False, |
---|
157 | vocabulary = exam_types, |
---|
158 | ) |
---|
159 | scd_sit_results = schema.List( |
---|
160 | title = _(u'Exam Results'), |
---|
161 | value_type = ResultEntryField(), |
---|
162 | required = False, |
---|
163 | readonly = False, |
---|
164 | defaultFactory=list, |
---|
165 | ) |
---|
166 | alr_fname = schema.TextLine( |
---|
167 | title = _(u'Full Name'), |
---|
168 | required = False, |
---|
169 | readonly = False, |
---|
170 | ) |
---|
171 | alr_no = schema.TextLine( |
---|
172 | title = _(u'Exam Number'), |
---|
173 | required = False, |
---|
174 | readonly = False, |
---|
175 | ) |
---|
176 | alr_date = FormattedDate( |
---|
177 | title = _(u'Exam Date'), |
---|
178 | required = False, |
---|
179 | readonly = False, |
---|
180 | show_year = True, |
---|
181 | ) |
---|
182 | alr_results = schema.List( |
---|
183 | title = _(u'Exam Results'), |
---|
184 | value_type = ResultEntryField(), |
---|
185 | required = False, |
---|
186 | readonly = False, |
---|
187 | defaultFactory=list, |
---|
188 | ) |
---|
189 | hq_type = schema.Choice( |
---|
190 | title = _(u'Qualification Obtained'), |
---|
191 | required = False, |
---|
192 | readonly = False, |
---|
193 | vocabulary = high_qual, |
---|
194 | ) |
---|
195 | |
---|
196 | hq_fname = schema.TextLine( |
---|
197 | title = _(u'Full Name'), |
---|
198 | required = False, |
---|
199 | readonly = False, |
---|
200 | ) |
---|
201 | |
---|
202 | hq_matric_no = schema.TextLine( |
---|
203 | title = _(u'Former Matric Number'), |
---|
204 | required = False, |
---|
205 | readonly = False, |
---|
206 | ) |
---|
207 | |
---|
208 | hq_degree = schema.Choice( |
---|
209 | title = _(u'Class of Degree'), |
---|
210 | required = False, |
---|
211 | readonly = False, |
---|
212 | vocabulary = high_grade, |
---|
213 | ) |
---|
214 | |
---|
215 | hq_school = schema.TextLine( |
---|
216 | title = _(u'Institution Attended'), |
---|
217 | required = False, |
---|
218 | readonly = False, |
---|
219 | ) |
---|
220 | |
---|
221 | hq_session = schema.TextLine( |
---|
222 | title = _(u'Years Attended'), |
---|
223 | required = False, |
---|
224 | readonly = False, |
---|
225 | ) |
---|
226 | |
---|
227 | hq_disc = schema.TextLine( |
---|
228 | title = _(u'Discipline'), |
---|
229 | required = False, |
---|
230 | readonly = False, |
---|
231 | ) |
---|
232 | |
---|
233 | hq_type2 = schema.Choice( |
---|
234 | title = _(u'Qualification Obtained'), |
---|
235 | required = False, |
---|
236 | readonly = False, |
---|
237 | vocabulary = high_qual, |
---|
238 | ) |
---|
239 | |
---|
240 | hq_fname2 = schema.TextLine( |
---|
241 | title = _(u'Full Name'), |
---|
242 | required = False, |
---|
243 | readonly = False, |
---|
244 | ) |
---|
245 | |
---|
246 | hq_matric_no2 = schema.TextLine( |
---|
247 | title = _(u'Former Matric Number'), |
---|
248 | required = False, |
---|
249 | readonly = False, |
---|
250 | ) |
---|
251 | |
---|
252 | hq_degree2 = schema.Choice( |
---|
253 | title = _(u'Class of Degree'), |
---|
254 | required = False, |
---|
255 | readonly = False, |
---|
256 | vocabulary = high_grade, |
---|
257 | ) |
---|
258 | |
---|
259 | hq_school2 = schema.TextLine( |
---|
260 | title = _(u'Institution Attended'), |
---|
261 | required = False, |
---|
262 | readonly = False, |
---|
263 | ) |
---|
264 | |
---|
265 | hq_session2 = schema.TextLine( |
---|
266 | title = _(u'Years Attended'), |
---|
267 | required = False, |
---|
268 | readonly = False, |
---|
269 | ) |
---|
270 | |
---|
271 | hq_disc2 = schema.TextLine( |
---|
272 | title = _(u'Discipline'), |
---|
273 | required = False, |
---|
274 | readonly = False, |
---|
275 | ) |
---|
276 | |
---|
277 | hq_type3 = schema.Choice( |
---|
278 | title = _(u'Qualification Obtained'), |
---|
279 | required = False, |
---|
280 | readonly = False, |
---|
281 | vocabulary = high_qual, |
---|
282 | ) |
---|
283 | |
---|
284 | hq_fname3 = schema.TextLine( |
---|
285 | title = _(u'Full Name'), |
---|
286 | required = False, |
---|
287 | readonly = False, |
---|
288 | ) |
---|
289 | |
---|
290 | hq_matric_no3 = schema.TextLine( |
---|
291 | title = _(u'Former Matric Number'), |
---|
292 | required = False, |
---|
293 | readonly = False, |
---|
294 | ) |
---|
295 | |
---|
296 | hq_degree3 = schema.Choice( |
---|
297 | title = _(u'Class of Degree'), |
---|
298 | required = False, |
---|
299 | readonly = False, |
---|
300 | vocabulary = high_grade, |
---|
301 | ) |
---|
302 | |
---|
303 | hq_school3 = schema.TextLine( |
---|
304 | title = _(u'Institution Attended'), |
---|
305 | required = False, |
---|
306 | readonly = False, |
---|
307 | ) |
---|
308 | |
---|
309 | hq_session3 = schema.TextLine( |
---|
310 | title = _(u'Years Attended'), |
---|
311 | required = False, |
---|
312 | readonly = False, |
---|
313 | ) |
---|
314 | |
---|
315 | hq_disc3 = schema.TextLine( |
---|
316 | title = _(u'Discipline'), |
---|
317 | required = False, |
---|
318 | readonly = False, |
---|
319 | ) |
---|
320 | |
---|
321 | nysc_year = schema.Int( |
---|
322 | title = _(u'Nysc Year'), |
---|
323 | required = False, |
---|
324 | readonly = False, |
---|
325 | ) |
---|
326 | |
---|
327 | nysc_location = schema.TextLine( |
---|
328 | title = _(u'Nysc Location'), |
---|
329 | required = False, |
---|
330 | ) |
---|
331 | |
---|
332 | nysc_lga = schema.Choice( |
---|
333 | source = LGASource(), |
---|
334 | title = _(u'Nysc LGA'), |
---|
335 | required = False, |
---|
336 | ) |
---|
337 | |
---|
338 | employer = schema.TextLine( |
---|
339 | title = _(u'Employer'), |
---|
340 | required = False, |
---|
341 | readonly = False, |
---|
342 | ) |
---|
343 | |
---|
344 | emp_position = schema.TextLine( |
---|
345 | title = _(u'Employer Position'), |
---|
346 | required = False, |
---|
347 | readonly = False, |
---|
348 | ) |
---|
349 | |
---|
350 | emp_start = FormattedDate( |
---|
351 | title = _(u'Start Date'), |
---|
352 | required = False, |
---|
353 | readonly = False, |
---|
354 | show_year = True, |
---|
355 | ) |
---|
356 | |
---|
357 | emp_end = FormattedDate( |
---|
358 | title = _(u'End Date'), |
---|
359 | required = False, |
---|
360 | readonly = False, |
---|
361 | show_year = True, |
---|
362 | ) |
---|
363 | |
---|
364 | emp_reason = schema.TextLine( |
---|
365 | title = _(u'Reason for Leaving'), |
---|
366 | required = False, |
---|
367 | readonly = False, |
---|
368 | ) |
---|
369 | |
---|
370 | employer2 = schema.TextLine( |
---|
371 | title = _(u'2nd Employer'), |
---|
372 | required = False, |
---|
373 | readonly = False, |
---|
374 | ) |
---|
375 | |
---|
376 | emp2_position = schema.TextLine( |
---|
377 | title = _(u'2nd Employer Position'), |
---|
378 | required = False, |
---|
379 | readonly = False, |
---|
380 | ) |
---|
381 | |
---|
382 | emp2_start = FormattedDate( |
---|
383 | title = _(u'Start Date'), |
---|
384 | required = False, |
---|
385 | readonly = False, |
---|
386 | show_year = True, |
---|
387 | ) |
---|
388 | |
---|
389 | emp2_end = FormattedDate( |
---|
390 | title = _(u'End Date'), |
---|
391 | required = False, |
---|
392 | readonly = False, |
---|
393 | show_year = True, |
---|
394 | ) |
---|
395 | |
---|
396 | emp2_reason = schema.TextLine( |
---|
397 | title = _(u'Reason for Leaving'), |
---|
398 | required = False, |
---|
399 | readonly = False, |
---|
400 | ) |
---|
401 | |
---|
402 | former_matric = schema.TextLine( |
---|
403 | title = _(u'If yes, matric number'), |
---|
404 | required = False, |
---|
405 | readonly = False, |
---|
406 | ) |
---|
407 | |
---|
408 | notice = schema.Text( |
---|
409 | title = _(u'Notice'), |
---|
410 | required = False, |
---|
411 | ) |
---|
412 | |
---|
413 | |
---|
414 | master_sheet_number = schema.TextLine( |
---|
415 | title = _(u'Master Sheet Number'), |
---|
416 | required = False, |
---|
417 | readonly = False, |
---|
418 | ) |
---|
419 | |
---|
420 | screening_venue = schema.TextLine( |
---|
421 | title = _(u'Screening Venue'), |
---|
422 | required = False, |
---|
423 | ) |
---|
424 | screening_date = schema.TextLine( |
---|
425 | title = _(u'Screening Date'), |
---|
426 | required = False, |
---|
427 | ) |
---|
428 | screening_score = schema.Int( |
---|
429 | title = _(u'Screening Points'), |
---|
430 | required = False, |
---|
431 | ) |
---|
432 | #aggregate = schema.Int( |
---|
433 | # title = _(u'Aggregate Score (%)'), |
---|
434 | # description = _(u'(average of relative JAMB and PUTME scores)'), |
---|
435 | # required = False, |
---|
436 | # ) |
---|
437 | result_uploaded = schema.Bool( |
---|
438 | title = _(u'Result uploaded'), |
---|
439 | default = False, |
---|
440 | ) |
---|
441 | student_id = schema.TextLine( |
---|
442 | title = _(u'Student Id'), |
---|
443 | required = False, |
---|
444 | readonly = False, |
---|
445 | ) |
---|
446 | course_admitted = schema.Choice( |
---|
447 | title = _(u'Admitted Course of Study'), |
---|
448 | source = CertificateSource(), |
---|
449 | required = False, |
---|
450 | ) |
---|
451 | locked = schema.Bool( |
---|
452 | title = _(u'Form locked'), |
---|
453 | default = False, |
---|
454 | ) |
---|
455 | |
---|
456 | @invariant |
---|
457 | def second_choice(applicant): |
---|
458 | if applicant.course1 == applicant.course2: |
---|
459 | raise Invalid(_("2nd choice course must differ from 1st choice course.")) |
---|
460 | |
---|
461 | #ICustomUGApplicant['programme_type'].order = IApplicantBaseData[ |
---|
462 | # 'reg_number'].order |
---|
463 | |
---|
464 | class ICustomPGApplicant(INigeriaPGApplicant): |
---|
465 | """A postgraduate applicant. |
---|
466 | |
---|
467 | This interface defines the least common multiple of all fields |
---|
468 | in pg application forms. In customized forms, fields can be excluded by |
---|
469 | adding them to the PG_OMIT* tuples. |
---|
470 | """ |
---|
471 | |
---|
472 | class ITranscriptApplicant(IKofaObject): |
---|
473 | """A transcript applicant. |
---|
474 | """ |
---|
475 | |
---|
476 | suspended = schema.Bool( |
---|
477 | title = _(u'Account suspended'), |
---|
478 | default = False, |
---|
479 | required = False, |
---|
480 | ) |
---|
481 | |
---|
482 | locked = schema.Bool( |
---|
483 | title = _(u'Form locked'), |
---|
484 | default = False, |
---|
485 | required = False, |
---|
486 | ) |
---|
487 | |
---|
488 | applicant_id = schema.TextLine( |
---|
489 | title = _(u'Applicant Id'), |
---|
490 | required = False, |
---|
491 | readonly = False, |
---|
492 | ) |
---|
493 | |
---|
494 | firstname = schema.TextLine( |
---|
495 | title = _(u'First Name'), |
---|
496 | required = True, |
---|
497 | ) |
---|
498 | |
---|
499 | middlename = schema.TextLine( |
---|
500 | title = _(u'Middle Name'), |
---|
501 | required = False, |
---|
502 | ) |
---|
503 | |
---|
504 | lastname = schema.TextLine( |
---|
505 | title = _(u'Last Name (Surname)'), |
---|
506 | required = True, |
---|
507 | ) |
---|
508 | |
---|
509 | matric_number = schema.TextLine( |
---|
510 | title = _(u'Matriculation Number'), |
---|
511 | readonly = False, |
---|
512 | required = False, |
---|
513 | ) |
---|
514 | |
---|
515 | date_of_birth = FormattedDate( |
---|
516 | title = _(u'Date of Birth'), |
---|
517 | required = False, |
---|
518 | #date_format = u'%d/%m/%Y', # Use grok-instance-wide default |
---|
519 | show_year = True, |
---|
520 | ) |
---|
521 | |
---|
522 | place_of_birth = schema.TextLine( |
---|
523 | title = _(u'Place of Birth'), |
---|
524 | readonly = False, |
---|
525 | required = False, |
---|
526 | ) |
---|
527 | |
---|
528 | nationality = schema.Choice( |
---|
529 | vocabulary = nats_vocab, |
---|
530 | title = _(u'Nationality'), |
---|
531 | required = False, |
---|
532 | ) |
---|
533 | |
---|
534 | email = schema.ASCIILine( |
---|
535 | title = _(u'Email Address'), |
---|
536 | required = True, |
---|
537 | constraint=validate_email, |
---|
538 | ) |
---|
539 | |
---|
540 | phone = PhoneNumber( |
---|
541 | title = _(u'Phone'), |
---|
542 | description = u'', |
---|
543 | required = False, |
---|
544 | ) |
---|
545 | |
---|
546 | perm_address = schema.Text( |
---|
547 | title = _(u'Current Local Address'), |
---|
548 | required = False, |
---|
549 | readonly = False, |
---|
550 | ) |
---|
551 | |
---|
552 | dispatch_address = schema.Text( |
---|
553 | title = _(u'Dispatch Addresses'), |
---|
554 | description = u'Addresses to which transcript should be posted.', |
---|
555 | required = False, |
---|
556 | readonly = False, |
---|
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'End Session'), |
---|
575 | source = academic_sessions_vocab, |
---|
576 | required = False, |
---|
577 | readonly = False, |
---|
578 | ) |
---|
579 | |
---|
580 | course_studied = schema.Choice( |
---|
581 | title = _(u'Course of Study / Degree'), |
---|
582 | source = CertificateSource(), |
---|
583 | required = False, |
---|
584 | readonly = False, |
---|
585 | ) |
---|
586 | |
---|
587 | purpose = schema.TextLine( |
---|
588 | title = _(u'Purpose of this Application'), |
---|
589 | readonly = False, |
---|
590 | required = False, |
---|
591 | ) |
---|
592 | |
---|
593 | course_changed = schema.Choice( |
---|
594 | title = _(u'Change of Study Course'), |
---|
595 | description = u'If yes, select previous course of study.', |
---|
596 | source = CertificateSource(), |
---|
597 | readonly = False, |
---|
598 | required = False, |
---|
599 | ) |
---|
600 | |
---|
601 | change_level = schema.Choice( |
---|
602 | title = _(u'Change Level'), |
---|
603 | description = u'If yes, select level at which you changed course of study.', |
---|
604 | source = StudyLevelSource(), |
---|
605 | required = False, |
---|
606 | readonly = False, |
---|
607 | ) |
---|
608 | |
---|
609 | no_copies = schema.Choice( |
---|
610 | title = _(u'Number of Copies'), |
---|
611 | description = u'Must correspond with the number of dispatch addresses above.', |
---|
612 | values=[1, 2, 3, 4], |
---|
613 | required = False, |
---|
614 | readonly = False, |
---|
615 | default = 1, |
---|
616 | ) |
---|
617 | |
---|
618 | class ICertificateRequest(IKofaObject): |
---|
619 | """A transcript applicant. |
---|
620 | """ |
---|
621 | |
---|
622 | suspended = schema.Bool( |
---|
623 | title = _(u'Account suspended'), |
---|
624 | default = False, |
---|
625 | required = False, |
---|
626 | ) |
---|
627 | |
---|
628 | locked = schema.Bool( |
---|
629 | title = _(u'Form locked'), |
---|
630 | default = False, |
---|
631 | required = False, |
---|
632 | ) |
---|
633 | |
---|
634 | applicant_id = schema.TextLine( |
---|
635 | title = _(u'Applicant Id'), |
---|
636 | required = False, |
---|
637 | readonly = False, |
---|
638 | ) |
---|
639 | |
---|
640 | firstname = schema.TextLine( |
---|
641 | title = _(u'First Name'), |
---|
642 | required = True, |
---|
643 | ) |
---|
644 | |
---|
645 | middlename = schema.TextLine( |
---|
646 | title = _(u'Middle Name'), |
---|
647 | required = False, |
---|
648 | ) |
---|
649 | |
---|
650 | lastname = schema.TextLine( |
---|
651 | title = _(u'Last Name (Surname)'), |
---|
652 | required = True, |
---|
653 | ) |
---|
654 | |
---|
655 | matric_number = schema.TextLine( |
---|
656 | title = _(u'Matriculation Number'), |
---|
657 | readonly = False, |
---|
658 | required = False, |
---|
659 | ) |
---|
660 | |
---|
661 | date_of_birth = FormattedDate( |
---|
662 | title = _(u'Date of Birth'), |
---|
663 | required = False, |
---|
664 | #date_format = u'%d/%m/%Y', # Use grok-instance-wide default |
---|
665 | show_year = True, |
---|
666 | ) |
---|
667 | |
---|
668 | place_of_birth = schema.TextLine( |
---|
669 | title = _(u'Place of Birth'), |
---|
670 | readonly = False, |
---|
671 | required = False, |
---|
672 | ) |
---|
673 | |
---|
674 | nationality = schema.Choice( |
---|
675 | vocabulary = nats_vocab, |
---|
676 | title = _(u'Nationality'), |
---|
677 | required = False, |
---|
678 | ) |
---|
679 | |
---|
680 | email = schema.ASCIILine( |
---|
681 | title = _(u'Email Address'), |
---|
682 | required = True, |
---|
683 | constraint=validate_email, |
---|
684 | ) |
---|
685 | |
---|
686 | phone = PhoneNumber( |
---|
687 | title = _(u'Phone'), |
---|
688 | description = u'', |
---|
689 | required = False, |
---|
690 | ) |
---|
691 | |
---|
692 | perm_address = schema.Text( |
---|
693 | title = _(u'Current Local Address'), |
---|
694 | required = False, |
---|
695 | readonly = False, |
---|
696 | ) |
---|
697 | |
---|
698 | dispatch_address = schema.Text( |
---|
699 | title = _(u'Dispatch Addresses'), |
---|
700 | description = u'Addresses to which certificate should be posted.', |
---|
701 | required = False, |
---|
702 | readonly = False, |
---|
703 | ) |
---|
704 | |
---|
705 | entry_session = schema.Choice( |
---|
706 | title = _(u'Entry Session'), |
---|
707 | source = academic_sessions_vocab, |
---|
708 | required = False, |
---|
709 | readonly = False, |
---|
710 | ) |
---|
711 | |
---|
712 | end_session = schema.Choice( |
---|
713 | title = _(u'End Session'), |
---|
714 | source = academic_sessions_vocab, |
---|
715 | required = False, |
---|
716 | readonly = False, |
---|
717 | ) |
---|
718 | |
---|
719 | course_studied = schema.Choice( |
---|
720 | title = _(u'Course of Study / Degree'), |
---|
721 | source = CertificateSource(), |
---|
722 | required = False, |
---|
723 | readonly = False, |
---|
724 | ) |
---|
725 | |
---|
726 | no_copies = schema.Choice( |
---|
727 | title = _(u'Number of Copies'), |
---|
728 | description = u'Must correspond with the number of dispatch addresses above.', |
---|
729 | values=[1, 2, 3, 4], |
---|
730 | required = False, |
---|
731 | readonly = False, |
---|
732 | default = 1, |
---|
733 | ) |
---|
734 | |
---|
735 | class ICustomApplicant(ICustomUGApplicant, ICustomPGApplicant, |
---|
736 | ITranscriptApplicant, ICertificateRequest): |
---|
737 | """An interface for all three types of applicants. |
---|
738 | |
---|
739 | Attention: The ICustomPGApplicant field seetings will be overwritten |
---|
740 | by ICustomPGApplicant field settings. If a field is defined |
---|
741 | in both interfaces zope.schema validates only against the |
---|
742 | constraints in ICustomUGApplicant. This does not affect the forms |
---|
743 | since they are build on either ICustomUGApplicant or ICustomPGApplicant. |
---|
744 | """ |
---|
745 | |
---|
746 | def writeLogMessage(view, comment): |
---|
747 | """Adds an INFO message to the log file |
---|
748 | """ |
---|
749 | |
---|
750 | def createStudent(): |
---|
751 | """Create a student object from applicatnt data |
---|
752 | and copy applicant object. |
---|
753 | """ |
---|
754 | |
---|
755 | class ICustomUGApplicantEdit(ICustomUGApplicant): |
---|
756 | """An undergraduate applicant interface for edit forms. |
---|
757 | |
---|
758 | Here we can repeat the fields from base data and set the |
---|
759 | `required` and `readonly` attributes to True to further restrict |
---|
760 | the data access. Or we can allow only certain certificates to be |
---|
761 | selected by choosing the appropriate source. |
---|
762 | |
---|
763 | We cannot omit fields here. This has to be done in the |
---|
764 | respective form page. |
---|
765 | """ |
---|
766 | |
---|
767 | #programme_type = schema.Choice( |
---|
768 | # title = _(u'Programme Type'), |
---|
769 | # vocabulary = programme_types_vocab, |
---|
770 | # required = True, |
---|
771 | # ) |
---|
772 | |
---|
773 | date_of_birth = FormattedDate( |
---|
774 | title = _(u'Date of Birth'), |
---|
775 | required = True, |
---|
776 | show_year = True, |
---|
777 | ) |
---|
778 | |
---|
779 | #ICustomUGApplicantEdit['programme_type'].order = ICustomUGApplicant[ |
---|
780 | # 'programme_type'].order |
---|
781 | ICustomUGApplicantEdit['date_of_birth'].order = ICustomUGApplicant[ |
---|
782 | 'date_of_birth'].order |
---|
783 | |
---|
784 | class ICustomPGApplicantEdit(INigeriaPGApplicantEdit): |
---|
785 | """A postgraduate applicant interface for editing. |
---|
786 | |
---|
787 | Here we can repeat the fields from base data and set the |
---|
788 | `required` and `readonly` attributes to True to further restrict |
---|
789 | the data access. Or we can allow only certain certificates to be |
---|
790 | selected by choosing the appropriate source. |
---|
791 | |
---|
792 | We cannot omit fields here. This has to be done in the |
---|
793 | respective form page. |
---|
794 | """ |
---|
795 | |
---|
796 | class ICustomApplicantOnlinePayment(INigeriaApplicantOnlinePayment): |
---|
797 | """An applicant payment via payment gateways. |
---|
798 | |
---|
799 | """ |
---|
800 | |
---|
801 | class IPUTMEApplicantEdit(IPUTMEApplicantEdit): |
---|
802 | """An undergraduate applicant interface for editing. |
---|
803 | |
---|
804 | Here we can repeat the fields from base data and set the |
---|
805 | `required` and `readonly` attributes to True to further restrict |
---|
806 | the data access. Or we can allow only certain certificates to be |
---|
807 | selected by choosing the appropriate source. |
---|
808 | |
---|
809 | We cannot omit fields here. This has to be done in the |
---|
810 | respective form page. |
---|
811 | """ |
---|
812 | |
---|
813 | class ICustomApplicantUpdateByRegNo(INigeriaApplicantUpdateByRegNo): |
---|
814 | """Representation of an applicant. |
---|
815 | |
---|
816 | Skip regular reg_number validation if reg_number is used for finding |
---|
817 | the applicant object. |
---|
818 | """ |
---|
819 | |
---|
820 | |
---|
821 | |
---|