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