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