1 | ## $Id: interfaces.py 9541 2012-11-05 17:48:22Z henrik $ |
---|
2 | ## |
---|
3 | ## Copyright (C) 2012 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 | from zope import schema |
---|
19 | from zope.interface import Attribute |
---|
20 | from waeup.kofa.schema import TextLineChoice |
---|
21 | from waeup.kofa.interfaces import SimpleKofaVocabulary, academic_sessions_vocab |
---|
22 | from waeup.kofa.schema import FormattedDate |
---|
23 | from waeup.kofa.schoolgrades import ResultEntryField |
---|
24 | from waeup.kofa.students.vocabularies import nats_vocab |
---|
25 | from waeup.kofa.students.interfaces import ( |
---|
26 | IStudentBase, IUGStudentClearance, IPGStudentClearance, |
---|
27 | IStudentPersonal, IStudentNavigation, IStudentStudyLevel, |
---|
28 | IStudentStudyCourse, ICourseTicket |
---|
29 | ) |
---|
30 | from waeup.kofa.students.vocabularies import ( |
---|
31 | nats_vocab, contextual_reg_num_source) |
---|
32 | from kofacustom.nigeria.interfaces import ( |
---|
33 | high_qual, high_grade, exam_types, LGASource) |
---|
34 | from kofacustom.nigeria.interfaces import MessageFactory as _ |
---|
35 | from kofacustom.nigeria.payments.interfaces import INigeriaOnlinePayment |
---|
36 | |
---|
37 | |
---|
38 | class INigeriaStudentBase(IStudentBase): |
---|
39 | """Representation of student base data. |
---|
40 | |
---|
41 | """ |
---|
42 | |
---|
43 | reg_number = TextLineChoice( |
---|
44 | title = _(u'Registration Number'), |
---|
45 | required = False, |
---|
46 | readonly = False, |
---|
47 | source = contextual_reg_num_source, |
---|
48 | ) |
---|
49 | |
---|
50 | is_staff = schema.Bool( |
---|
51 | title = _(u'Staff Member'), |
---|
52 | required = False, |
---|
53 | readonly = False, |
---|
54 | default = False, |
---|
55 | ) |
---|
56 | |
---|
57 | INigeriaStudentBase['reg_number'].order = IStudentBase[ |
---|
58 | 'reg_number'].order |
---|
59 | |
---|
60 | class INigeriaStudentPersonal(IStudentPersonal): |
---|
61 | """Student personal data. |
---|
62 | |
---|
63 | """ |
---|
64 | |
---|
65 | is_foreigner = Attribute('True if student is non-Nigerian') |
---|
66 | |
---|
67 | marit_stat = schema.Choice( |
---|
68 | title = u'Maritual Status', |
---|
69 | default = 'unmarried', |
---|
70 | required = False, |
---|
71 | vocabulary = SimpleKofaVocabulary( |
---|
72 | (_('Unmarried'), 'unmarried'), |
---|
73 | (_('Married'), 'married'),) |
---|
74 | ) |
---|
75 | |
---|
76 | religion = schema.Choice( |
---|
77 | title = u'Religion', |
---|
78 | default = 'no_say', |
---|
79 | required = False, |
---|
80 | vocabulary = SimpleKofaVocabulary( |
---|
81 | (_('Muslim'), 'muslim'), |
---|
82 | (_('Christian'), 'christian'), |
---|
83 | (_('Others'), 'others'), |
---|
84 | (_('Prefer not to say'), 'no_say'),) |
---|
85 | ) |
---|
86 | |
---|
87 | next_kin_name = schema.TextLine( |
---|
88 | title = _(u'Next of Kin Name'), |
---|
89 | required = False, |
---|
90 | readonly = False, |
---|
91 | ) |
---|
92 | |
---|
93 | next_kin_relation = schema.TextLine( |
---|
94 | title = _(u'Next of Kin Relationship'), |
---|
95 | required = False, |
---|
96 | readonly = False, |
---|
97 | ) |
---|
98 | |
---|
99 | next_kin_address = schema.Text( |
---|
100 | title = _(u'Next of Kin Address'), |
---|
101 | required = False, |
---|
102 | readonly = False, |
---|
103 | description = _(u'Please provide email address and/or phone number.'), |
---|
104 | ) |
---|
105 | |
---|
106 | disabled = schema.Bool( |
---|
107 | title = u'Disabled', |
---|
108 | default = False, |
---|
109 | required = False, |
---|
110 | ) |
---|
111 | |
---|
112 | class INigeriaUGStudentClearance(IUGStudentClearance): |
---|
113 | """Representation of ug student clearance data. |
---|
114 | |
---|
115 | """ |
---|
116 | officer_comment = schema.Text( |
---|
117 | title = _(u"Officer's Comment"), |
---|
118 | required = False, |
---|
119 | ) |
---|
120 | |
---|
121 | clearance_locked = schema.Bool( |
---|
122 | title = _(u'Clearance form locked'), |
---|
123 | default = False, |
---|
124 | required = False, |
---|
125 | ) |
---|
126 | |
---|
127 | clr_code = schema.TextLine( |
---|
128 | title = _(u'CLR Activation Code'), |
---|
129 | required = False, |
---|
130 | readonly = False, |
---|
131 | ) |
---|
132 | |
---|
133 | date_of_birth = FormattedDate( |
---|
134 | title = _(u'Date of Birth'), |
---|
135 | required = False, |
---|
136 | show_year = True, |
---|
137 | ) |
---|
138 | |
---|
139 | nationality = schema.Choice( |
---|
140 | source = nats_vocab, |
---|
141 | title = _(u'Nationality'), |
---|
142 | required = True, |
---|
143 | ) |
---|
144 | |
---|
145 | lga = schema.Choice( |
---|
146 | source = LGASource(), |
---|
147 | title = _(u'State/LGA (Nigerians only)'), |
---|
148 | required = False, |
---|
149 | ) |
---|
150 | |
---|
151 | def_adm = schema.Bool( |
---|
152 | title = _(u'Deferent of Admission'), |
---|
153 | required = False, |
---|
154 | readonly = False, |
---|
155 | ) |
---|
156 | |
---|
157 | fst_sit_fname = schema.TextLine( |
---|
158 | title = _(u'Full Name'), |
---|
159 | required = False, |
---|
160 | readonly = False, |
---|
161 | ) |
---|
162 | fst_sit_no = schema.TextLine( |
---|
163 | title = _(u'Exam Number'), |
---|
164 | required = False, |
---|
165 | readonly = False, |
---|
166 | ) |
---|
167 | |
---|
168 | fst_sit_date = FormattedDate( |
---|
169 | title = _(u'Exam Date'), |
---|
170 | required = False, |
---|
171 | readonly = False, |
---|
172 | show_year = True, |
---|
173 | ) |
---|
174 | |
---|
175 | fst_sit_type = schema.Choice( |
---|
176 | title = _(u'Exam Type'), |
---|
177 | required = False, |
---|
178 | readonly = False, |
---|
179 | vocabulary = exam_types, |
---|
180 | ) |
---|
181 | |
---|
182 | fst_sit_results = schema.List( |
---|
183 | title = _(u'Exam Results'), |
---|
184 | value_type = ResultEntryField(), |
---|
185 | required = False, |
---|
186 | readonly = False, |
---|
187 | default = [], |
---|
188 | ) |
---|
189 | |
---|
190 | scd_sit_fname = schema.TextLine( |
---|
191 | title = _(u'Full Name'), |
---|
192 | required = False, |
---|
193 | readonly = False, |
---|
194 | ) |
---|
195 | scd_sit_no = schema.TextLine( |
---|
196 | title = _(u'Exam Number'), |
---|
197 | required = False, |
---|
198 | readonly = False, |
---|
199 | ) |
---|
200 | |
---|
201 | scd_sit_date = FormattedDate( |
---|
202 | title = _(u'Exam Date'), |
---|
203 | required = False, |
---|
204 | readonly = False, |
---|
205 | show_year = True, |
---|
206 | ) |
---|
207 | |
---|
208 | scd_sit_type = schema.Choice( |
---|
209 | title = _(u'Exam Type'), |
---|
210 | required = False, |
---|
211 | readonly = False, |
---|
212 | vocabulary = exam_types, |
---|
213 | ) |
---|
214 | |
---|
215 | scd_sit_results = schema.List( |
---|
216 | title = _(u'Exam Results'), |
---|
217 | value_type = ResultEntryField(), |
---|
218 | required = False, |
---|
219 | readonly = False, |
---|
220 | default = [], |
---|
221 | ) |
---|
222 | |
---|
223 | alr_fname = schema.TextLine( |
---|
224 | title = _(u'Full Name'), |
---|
225 | required = False, |
---|
226 | readonly = False, |
---|
227 | ) |
---|
228 | alr_no = schema.TextLine( |
---|
229 | title = _(u'Exam Number'), |
---|
230 | required = False, |
---|
231 | readonly = False, |
---|
232 | ) |
---|
233 | |
---|
234 | alr_date = FormattedDate( |
---|
235 | title = _(u'Exam Date'), |
---|
236 | required = False, |
---|
237 | readonly = False, |
---|
238 | show_year = True, |
---|
239 | ) |
---|
240 | |
---|
241 | alr_results = schema.List( |
---|
242 | title = _(u'Exam Results'), |
---|
243 | value_type = ResultEntryField(), |
---|
244 | required = False, |
---|
245 | readonly = False, |
---|
246 | default = [], |
---|
247 | ) |
---|
248 | |
---|
249 | hq_type = schema.Choice( |
---|
250 | title = _(u'Qualification Obtained'), |
---|
251 | required = False, |
---|
252 | readonly = False, |
---|
253 | vocabulary = high_qual, |
---|
254 | ) |
---|
255 | |
---|
256 | hq_matric_no = schema.TextLine( |
---|
257 | title = _(u'Former Matric Number'), |
---|
258 | required = False, |
---|
259 | readonly = False, |
---|
260 | ) |
---|
261 | |
---|
262 | hq_degree = schema.Choice( |
---|
263 | title = _(u'Class of Degree'), |
---|
264 | required = False, |
---|
265 | readonly = False, |
---|
266 | vocabulary = high_grade, |
---|
267 | ) |
---|
268 | |
---|
269 | hq_school = schema.TextLine( |
---|
270 | title = _(u'Institution Attended'), |
---|
271 | required = False, |
---|
272 | readonly = False, |
---|
273 | ) |
---|
274 | |
---|
275 | hq_session = schema.TextLine( |
---|
276 | title = _(u'Years Attended'), |
---|
277 | required = False, |
---|
278 | readonly = False, |
---|
279 | ) |
---|
280 | |
---|
281 | hq_disc = schema.TextLine( |
---|
282 | title = _(u'Discipline'), |
---|
283 | required = False, |
---|
284 | readonly = False, |
---|
285 | ) |
---|
286 | |
---|
287 | |
---|
288 | class INigeriaPGStudentClearance(INigeriaUGStudentClearance): |
---|
289 | """Representation of pg student clearance data. |
---|
290 | |
---|
291 | """ |
---|
292 | |
---|
293 | hq2_type = schema.Choice( |
---|
294 | title = _(u'Qualification Obtained'), |
---|
295 | required = False, |
---|
296 | readonly = False, |
---|
297 | vocabulary = high_qual, |
---|
298 | ) |
---|
299 | |
---|
300 | hq2_matric_no = schema.TextLine( |
---|
301 | title = _(u'Former Matric Number'), |
---|
302 | required = False, |
---|
303 | readonly = False, |
---|
304 | ) |
---|
305 | |
---|
306 | hq2_degree = schema.Choice( |
---|
307 | title = _(u'Class of Degree'), |
---|
308 | required = False, |
---|
309 | readonly = False, |
---|
310 | vocabulary = high_grade, |
---|
311 | ) |
---|
312 | |
---|
313 | hq2_school = schema.TextLine( |
---|
314 | title = _(u'Institution Attended'), |
---|
315 | required = False, |
---|
316 | readonly = False, |
---|
317 | ) |
---|
318 | |
---|
319 | hq2_session = schema.TextLine( |
---|
320 | title = _(u'Years Attended'), |
---|
321 | required = False, |
---|
322 | readonly = False, |
---|
323 | ) |
---|
324 | |
---|
325 | hq2_disc = schema.TextLine( |
---|
326 | title = _(u'Discipline'), |
---|
327 | required = False, |
---|
328 | readonly = False, |
---|
329 | ) |
---|
330 | |
---|
331 | nysc_year = schema.Int( |
---|
332 | title = _(u'Nysc Year'), |
---|
333 | required = False, |
---|
334 | readonly = False, |
---|
335 | ) |
---|
336 | |
---|
337 | nysc_location = schema.TextLine( |
---|
338 | title = _(u'Nysc Location'), |
---|
339 | required = False, |
---|
340 | ) |
---|
341 | |
---|
342 | nysc_lga = schema.Choice( |
---|
343 | source = LGASource(), |
---|
344 | title = _(u'Nysc LGA'), |
---|
345 | required = False, |
---|
346 | ) |
---|
347 | |
---|
348 | employer = schema.TextLine( |
---|
349 | title = _(u'Employer'), |
---|
350 | required = False, |
---|
351 | readonly = False, |
---|
352 | ) |
---|
353 | |
---|
354 | emp_position = schema.TextLine( |
---|
355 | title = _(u'Employer Position'), |
---|
356 | required = False, |
---|
357 | readonly = False, |
---|
358 | ) |
---|
359 | |
---|
360 | emp_start = FormattedDate( |
---|
361 | title = _(u'Start Date'), |
---|
362 | required = False, |
---|
363 | readonly = False, |
---|
364 | show_year = True, |
---|
365 | ) |
---|
366 | |
---|
367 | emp_end = FormattedDate( |
---|
368 | title = _(u'End Date'), |
---|
369 | required = False, |
---|
370 | readonly = False, |
---|
371 | show_year = True, |
---|
372 | ) |
---|
373 | |
---|
374 | emp_reason = schema.TextLine( |
---|
375 | title = _(u'Reason for Leaving'), |
---|
376 | required = False, |
---|
377 | readonly = False, |
---|
378 | ) |
---|
379 | |
---|
380 | employer2 = schema.TextLine( |
---|
381 | title = _(u'2nd Employer'), |
---|
382 | required = False, |
---|
383 | readonly = False, |
---|
384 | ) |
---|
385 | |
---|
386 | emp2_position = schema.TextLine( |
---|
387 | title = _(u'2nd Employer Position'), |
---|
388 | required = False, |
---|
389 | readonly = False, |
---|
390 | ) |
---|
391 | |
---|
392 | emp2_start = FormattedDate( |
---|
393 | title = _(u'Start Date'), |
---|
394 | required = False, |
---|
395 | readonly = False, |
---|
396 | show_year = True, |
---|
397 | ) |
---|
398 | emp2_end = FormattedDate( |
---|
399 | title = _(u'End Date'), |
---|
400 | required = False, |
---|
401 | readonly = False, |
---|
402 | show_year = True, |
---|
403 | ) |
---|
404 | |
---|
405 | emp2_reason = schema.TextLine( |
---|
406 | title = _(u'Reason for Leaving'), |
---|
407 | required = False, |
---|
408 | readonly = False, |
---|
409 | ) |
---|
410 | |
---|
411 | former_matric = schema.TextLine( |
---|
412 | title = _(u'If yes, matric number'), |
---|
413 | required = False, |
---|
414 | readonly = False, |
---|
415 | ) |
---|
416 | |
---|
417 | |
---|
418 | class INigeriaStudent(INigeriaStudentBase,INigeriaUGStudentClearance, |
---|
419 | INigeriaPGStudentClearance,INigeriaStudentPersonal): |
---|
420 | """Representation of a student. |
---|
421 | |
---|
422 | """ |
---|
423 | |
---|
424 | class INigeriaStudentStudyCourse(IStudentStudyCourse): |
---|
425 | """A container for student study levels. |
---|
426 | |
---|
427 | """ |
---|
428 | |
---|
429 | class INigeriaStudentStudyLevel(IStudentStudyLevel): |
---|
430 | """A container for course tickets. |
---|
431 | |
---|
432 | """ |
---|
433 | |
---|
434 | class INigeriaStudentOnlinePayment(INigeriaOnlinePayment): |
---|
435 | """A student payment via payment gateways. |
---|
436 | |
---|
437 | This Interface does not inherit from IStudentOnlinePayment. |
---|
438 | Thus all fields from IStudentOnlinePayment have to be repeated here. |
---|
439 | """ |
---|
440 | |
---|
441 | p_current = schema.Bool( |
---|
442 | title = _(u'Current Session Payment'), |
---|
443 | default = True, |
---|
444 | required = False, |
---|
445 | ) |
---|
446 | |
---|
447 | p_level = schema.Int( |
---|
448 | title = _(u'Payment Level'), |
---|
449 | required = False, |
---|
450 | ) |
---|
451 | |
---|
452 | INigeriaStudentOnlinePayment['p_level'].order = INigeriaStudentOnlinePayment[ |
---|
453 | 'p_session'].order |
---|
454 | |
---|
455 | class INigeriaCourseTicket(ICourseTicket): |
---|
456 | """A course ticket. |
---|
457 | |
---|
458 | """ |
---|
459 | |
---|
460 | class INigeriaStudentUpdateByRegNo(INigeriaStudent): |
---|
461 | """Representation of a student. Skip regular reg_number validation. |
---|
462 | |
---|
463 | """ |
---|
464 | reg_number = schema.TextLine( |
---|
465 | title = _(u'Registration Number'), |
---|
466 | required = False, |
---|
467 | ) |
---|
468 | |
---|
469 | class INigeriaStudentUpdateByMatricNo(INigeriaStudent): |
---|
470 | """Representation of a student. Skip regular matric_number validation. |
---|
471 | |
---|
472 | """ |
---|
473 | matric_number = schema.TextLine( |
---|
474 | title = _(u'Matriculation Number'), |
---|
475 | required = False, |
---|
476 | ) |
---|