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