source: main/kofacustom.nigeria/branches/0.1/src/kofacustom/nigeria/students/interfaces.py @ 17944

Last change on this file since 17944 was 10690, checked in by Henrik Bettermann, 11 years ago

Insert some whitespaces in title.

  • Property svn:keywords set to Id
File size: 13.5 KB
Line 
1## $Id: interfaces.py 10690 2013-11-04 06:55:14Z 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##
18from zope import schema
19from zope.interface import Attribute
20from waeup.kofa.schema import TextLineChoice
21from waeup.kofa.interfaces import SimpleKofaVocabulary, academic_sessions_vocab
22from waeup.kofa.schema import FormattedDate, PhoneNumber
23from waeup.kofa.schoolgrades import ResultEntryField
24from waeup.kofa.students.vocabularies import nats_vocab
25from waeup.kofa.students.interfaces import (
26    IStudentBase, IUGStudentClearance, IPGStudentClearance,
27    IStudentPersonal, IStudentNavigation, IStudentStudyLevel,
28    IStudentStudyCourse, ICourseTicket
29    )
30from waeup.kofa.students.vocabularies import (
31    nats_vocab, contextual_reg_num_source)
32from kofacustom.nigeria.interfaces import (
33    high_qual, high_grade, exam_types, LGASource)
34from kofacustom.nigeria.interfaces import MessageFactory as _
35from kofacustom.nigeria.payments.interfaces import INigeriaOnlinePayment
36
37
38class INigeriaStudentBase(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    is_staff = schema.Bool(
51        title = _(u'Staff Member'),
52        required = False,
53        readonly = False,
54        default = False,
55        )
56
57INigeriaStudentBase['reg_number'].order = IStudentBase[
58    'reg_number'].order
59
60
61class INigeriaUGStudentClearance(IUGStudentClearance):
62    """Representation of ug student clearance data.
63
64    """
65    officer_comment = schema.Text(
66        title = _(u"Officer's Comment"),
67        required = False,
68        )
69
70    clearance_locked = schema.Bool(
71        title = _(u'Clearance form locked'),
72        default = False,
73        required = False,
74        )
75
76    clr_code = schema.TextLine(
77        title = _(u'CLR Activation Code'),
78        required = False,
79        readonly = False,
80        )
81
82    date_of_birth = FormattedDate(
83        title = _(u'Date of Birth'),
84        required = False,
85        show_year = True,
86        )
87
88    nationality = schema.Choice(
89        source = nats_vocab,
90        title = _(u'Nationality'),
91        required = True,
92        )
93
94    lga = schema.Choice(
95        source = LGASource(),
96        title = _(u'State / LGA'),
97        required = False,
98        )
99
100    def_adm = schema.Bool(
101        title = _(u'Deferent of Admission'),
102        required = False,
103        readonly = False,
104        )
105
106    fst_sit_fname = schema.TextLine(
107        title = _(u'Full Name'),
108        required = False,
109        readonly = False,
110        )
111    fst_sit_no = schema.TextLine(
112        title = _(u'Exam Number'),
113        required = False,
114        readonly = False,
115        )
116
117    fst_sit_date = FormattedDate(
118        title = _(u'Exam Date'),
119        required = False,
120        readonly = False,
121        show_year = True,
122        )
123
124    fst_sit_type = schema.Choice(
125        title = _(u'Exam Type'),
126        required = False,
127        readonly = False,
128        vocabulary = exam_types,
129        )
130
131    fst_sit_results = schema.List(
132        title = _(u'Exam Results'),
133        value_type = ResultEntryField(),
134        required = False,
135        readonly = False,
136        default = [],
137        )
138
139    scd_sit_fname = schema.TextLine(
140        title = _(u'Full Name'),
141        required = False,
142        readonly = False,
143        )
144    scd_sit_no = schema.TextLine(
145        title = _(u'Exam Number'),
146        required = False,
147        readonly = False,
148        )
149
150    scd_sit_date = FormattedDate(
151        title = _(u'Exam Date'),
152        required = False,
153        readonly = False,
154        show_year = True,
155        )
156
157    scd_sit_type = schema.Choice(
158        title = _(u'Exam Type'),
159        required = False,
160        readonly = False,
161        vocabulary = exam_types,
162        )
163
164    scd_sit_results = schema.List(
165        title = _(u'Exam Results'),
166        value_type = ResultEntryField(),
167        required = False,
168        readonly = False,
169        default = [],
170        )
171
172    alr_fname = schema.TextLine(
173        title = _(u'Full Name'),
174        required = False,
175        readonly = False,
176        )
177    alr_no = schema.TextLine(
178        title = _(u'Exam Number'),
179        required = False,
180        readonly = False,
181        )
182
183    alr_date = FormattedDate(
184        title = _(u'Exam Date'),
185        required = False,
186        readonly = False,
187        show_year = True,
188        )
189
190    alr_results = schema.List(
191        title = _(u'Exam Results'),
192        value_type = ResultEntryField(),
193        required = False,
194        readonly = False,
195        default = [],
196        )
197
198    hq_type = schema.Choice(
199        title = _(u'Qualification Obtained'),
200        required = False,
201        readonly = False,
202        vocabulary = high_qual,
203        )
204
205    hq_fname = schema.TextLine(
206        title = _(u'Full Name'),
207        required = False,
208        readonly = False,
209        )
210
211    hq_matric_no = schema.TextLine(
212        title = _(u'Former Matric Number'),
213        required = False,
214        readonly = False,
215        )
216
217    hq_degree = schema.Choice(
218        title = _(u'Class of Degree'),
219        required = False,
220        readonly = False,
221        vocabulary = high_grade,
222        )
223
224    hq_school = schema.TextLine(
225        title = _(u'Institution Attended'),
226        required = False,
227        readonly = False,
228        )
229
230    hq_session = schema.TextLine(
231        title = _(u'Years Attended'),
232        required = False,
233        readonly = False,
234        )
235
236    hq_disc = schema.TextLine(
237        title = _(u'Discipline'),
238        required = False,
239        readonly = False,
240        )
241
242
243class INigeriaPGStudentClearance(INigeriaUGStudentClearance):
244    """Representation of pg student clearance data.
245
246    """
247
248    hq2_type = schema.Choice(
249        title = _(u'Qualification Obtained'),
250        required = False,
251        readonly = False,
252        vocabulary = high_qual,
253        )
254
255    hq2_matric_no = schema.TextLine(
256        title = _(u'Former Matric Number'),
257        required = False,
258        readonly = False,
259        )
260
261    hq2_degree = schema.Choice(
262        title = _(u'Class of Degree'),
263        required = False,
264        readonly = False,
265        vocabulary = high_grade,
266        )
267
268    hq2_school = schema.TextLine(
269        title = _(u'Institution Attended'),
270        required = False,
271        readonly = False,
272        )
273
274    hq2_session = schema.TextLine(
275        title = _(u'Years Attended'),
276        required = False,
277        readonly = False,
278        )
279
280    hq2_disc = schema.TextLine(
281        title = _(u'Discipline'),
282        required = False,
283        readonly = False,
284        )
285
286    nysc_year = schema.Int(
287        title = _(u'Nysc Year'),
288        required = False,
289        readonly = False,
290        )
291
292    nysc_location = schema.TextLine(
293        title = _(u'Nysc Location'),
294        required = False,
295        )
296
297    nysc_lga = schema.Choice(
298        source = LGASource(),
299        title = _(u'Nysc LGA'),
300        required = False,
301        )
302
303    employer = schema.TextLine(
304        title = _(u'Employer'),
305        required = False,
306        readonly = False,
307        )
308
309    emp_position = schema.TextLine(
310        title = _(u'Employer Position'),
311        required = False,
312        readonly = False,
313        )
314
315    emp_start = FormattedDate(
316        title = _(u'Start Date'),
317        required = False,
318        readonly = False,
319        show_year = True,
320        )
321
322    emp_end = FormattedDate(
323        title = _(u'End Date'),
324        required = False,
325        readonly = False,
326        show_year = True,
327        )
328
329    emp_reason = schema.TextLine(
330        title = _(u'Reason for Leaving'),
331        required = False,
332        readonly = False,
333        )
334
335    employer2 = schema.TextLine(
336        title = _(u'2nd Employer'),
337        required = False,
338        readonly = False,
339        )
340
341    emp2_position = schema.TextLine(
342        title = _(u'2nd Employer Position'),
343        required = False,
344        readonly = False,
345        )
346
347    emp2_start = FormattedDate(
348        title = _(u'Start Date'),
349        required = False,
350        readonly = False,
351        show_year = True,
352        )
353    emp2_end = FormattedDate(
354        title = _(u'End Date'),
355        required = False,
356        readonly = False,
357        show_year = True,
358        )
359
360    emp2_reason = schema.TextLine(
361        title = _(u'Reason for Leaving'),
362        required = False,
363        readonly = False,
364        )
365
366    former_matric = schema.TextLine(
367        title = _(u'If yes, matric number'),
368        required = False,
369        readonly = False,
370        )
371
372class INigeriaStudentPersonal(IStudentPersonal):
373    """Student personal data.
374
375    """
376
377    is_foreigner = Attribute('True if student is non-Nigerian')
378
379    next_kin_name = schema.TextLine(
380        title = _(u'Next of Kin Name'),
381        required = False,
382        readonly = False,
383        )
384
385    next_kin_relation = schema.TextLine(
386        title = _(u'Next of Kin Relationship'),
387        required = False,
388        readonly = False,
389        )
390
391    next_kin_address = schema.Text(
392        title = _(u'Next of Kin Address'),
393        required = False,
394        readonly = False,
395        )
396
397    next_kin_phone = PhoneNumber(
398        title = _(u'Next of Kin Phone'),
399        description = u'',
400        required = False,
401        readonly = False,
402        )
403
404    marit_stat = schema.Choice(
405        title = u'Maritual Status',
406        default = 'unmarried',
407        required = False,
408        vocabulary = SimpleKofaVocabulary(
409            (_('Unmarried'), 'unmarried'),
410            (_('Married'), 'married'),)
411        )
412
413    religion = schema.Choice(
414        title = u'Religion',
415        default = 'no_say',
416        required = False,
417        vocabulary = SimpleKofaVocabulary(
418            (_('Muslim'), 'muslim'),
419            (_('Christian'), 'christian'),
420            (_('Others'), 'others'),
421            (_('Prefer not to say'), 'no_say'),)
422        )
423
424    disabled = schema.Bool(
425        title = u'Disabled',
426        default = False,
427        required = False,
428        )
429
430
431class INigeriaStudent(INigeriaStudentBase,INigeriaUGStudentClearance,
432    INigeriaPGStudentClearance,INigeriaStudentPersonal):
433    """Representation of a student.
434
435    """
436
437class INigeriaStudentPersonalEdit(INigeriaStudentPersonal):
438    """Interface for editing personal data by students.
439
440    Here we can repeat the fields from IStudentPersonal and set the
441    `required` if necessary.
442    """
443
444    perm_address = schema.Text(
445        title = _(u'Permanent Address'),
446        required = True,
447        )
448
449    next_kin_name = schema.TextLine(
450        title = _(u'Next of Kin Name'),
451        required = True,
452        readonly = False,
453        )
454
455    next_kin_relation = schema.TextLine(
456        title = _(u'Next of Kin Relationship'),
457        required = True,
458        readonly = False,
459        )
460
461    next_kin_address = schema.Text(
462        title = _(u'Next of Kin Address'),
463        required = True,
464        readonly = False,
465        )
466
467    next_kin_phone = PhoneNumber(
468        title = _(u'Next of Kin Phone'),
469        description = u'',
470        required = True,
471        readonly = False,
472        )
473
474INigeriaStudentPersonalEdit['perm_address'].order = INigeriaStudentPersonal[
475    'perm_address'].order
476INigeriaStudentPersonalEdit['next_kin_name'].order = INigeriaStudentPersonal[
477    'next_kin_name'].order
478INigeriaStudentPersonalEdit['next_kin_relation'].order = INigeriaStudentPersonal[
479    'next_kin_relation'].order
480INigeriaStudentPersonalEdit['next_kin_address'].order = INigeriaStudentPersonal[
481    'next_kin_address'].order
482INigeriaStudentPersonalEdit['next_kin_phone'].order = INigeriaStudentPersonal[
483    'next_kin_phone'].order
484
485class INigeriaStudentStudyCourse(IStudentStudyCourse):
486    """A container for student study levels.
487
488    """
489
490class INigeriaStudentStudyLevel(IStudentStudyLevel):
491    """A container for course tickets.
492
493    """
494
495class INigeriaStudentOnlinePayment(INigeriaOnlinePayment):
496    """A student payment via payment gateways.
497
498    This Interface does not inherit from IStudentOnlinePayment.
499    Thus all fields from IStudentOnlinePayment have to be repeated here.
500    """
501
502    p_current = schema.Bool(
503        title = _(u'Current Session Payment'),
504        default = True,
505        required = False,
506        )
507
508    p_level = schema.Int(
509        title = _(u'Payment Level'),
510        required = False,
511        )
512
513INigeriaStudentOnlinePayment['p_level'].order = INigeriaStudentOnlinePayment[
514    'p_session'].order
515
516class INigeriaCourseTicket(ICourseTicket):
517    """A course ticket.
518
519    """
520
521class INigeriaStudentUpdateByRegNo(INigeriaStudent):
522    """Representation of a student. Skip regular reg_number validation.
523
524    """
525    reg_number = schema.TextLine(
526        title = _(u'Registration Number'),
527        required = False,
528        )
529
530class INigeriaStudentUpdateByMatricNo(INigeriaStudent):
531    """Representation of a student. Skip regular matric_number validation.
532
533    """
534    matric_number = schema.TextLine(
535        title = _(u'Matriculation Number'),
536        required = False,
537        )
Note: See TracBrowser for help on using the repository browser.