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