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