source: main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/students/interfaces.py @ 12120

Last change on this file since 12120 was 12120, checked in by Henrik Bettermann, 10 years ago

Rename field.

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