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

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

We must set a default value. Otherwise dfm_adm appears always in the logfile when the form is being saved for the first time.

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