source: main/waeup.aaue/trunk/src/waeup/aaue/students/interfaces.py @ 14195

Last change on this file since 14195 was 14113, checked in by Henrik Bettermann, 8 years ago

Define max values for score and ca.

  • Property svn:keywords set to Id
File size: 10.3 KB
Line 
1## $Id: interfaces.py 14113 2016-08-23 07:00:13Z 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
19from zope import schema
20from zc.sourcefactory.contextual import BasicContextualSourceFactory
21from zope.catalog.interfaces import ICatalog
22from zope.component import getUtility
23from waeup.kofa.interfaces import (IKofaObject, academic_sessions_vocab)
24from waeup.kofa.students.vocabularies import (
25    StudyLevelSource, contextual_reg_num_source
26    )
27from waeup.kofa.schema import PhoneNumber, FormattedDate, TextLineChoice
28from kofacustom.nigeria.interfaces import LGASource
29from kofacustom.nigeria.students.interfaces import (
30    INigeriaStudentBase, INigeriaUGStudentClearance, INigeriaPGStudentClearance,
31    INigeriaStudentPersonal, INigeriaStudentStudyLevel,
32    INigeriaStudentStudyCourse, INigeriaCourseTicket,
33    INigeriaStudentUpdateByRegNo, INigeriaStudentUpdateByMatricNo,
34    )
35from waeup.aaue.payments.interfaces import ICustomOnlinePayment
36from waeup.aaue.interfaces import MessageFactory as _
37
38class ICustomStudentBase(INigeriaStudentBase):
39    """Representation of student base data.
40
41    """
42
43    reg_number = TextLineChoice(
44        title = _(u'JAMB Registration Number'),
45        required = False,
46        readonly = False,
47        source = contextual_reg_num_source,
48        )
49
50    application_number = schema.TextLine(
51        title = _(u'Application Number'),
52        required = False,
53        readonly = False,
54        )
55
56ICustomStudentBase['reg_number'].order = INigeriaStudentBase[
57    'reg_number'].order
58
59ICustomStudentBase['application_number'].order = ICustomStudentBase[
60    'reg_number'].order
61
62
63class ICustomStudentPersonal(INigeriaStudentPersonal):
64    """Student personal data.
65
66    """
67
68    father_name = schema.TextLine(
69        title = _(u'Father\'s Name'),
70        required = False,
71        readonly = False,
72        )
73
74    father_address = schema.Text(
75        title = _(u'Father\'s Permanent Address'),
76        required = False,
77        readonly = False,
78        )
79
80    father_work = schema.TextLine(
81        title = _(u'Father\'s Place of Work'),
82        required = False,
83        readonly = False,
84        )
85
86    father_phone = PhoneNumber(
87        title = _(u'Father\'s Phone'),
88        required = False,
89        readonly = False,
90        )
91
92    mother_name = schema.TextLine(
93        title = _(u'Mother\'s Name'),
94        required = False,
95        readonly = False,
96        )
97
98    mother_address = schema.Text(
99        title = _(u'Mother\'s Permanent Address'),
100        required = False,
101        readonly = False,
102        )
103
104    mother_work = schema.TextLine(
105        title = _(u'Mother\'s Place of Work'),
106        required = False,
107        readonly = False,
108        )
109
110    mother_phone = PhoneNumber(
111        title = _(u'Mother\'s Phone'),
112        required = False,
113        readonly = False,
114        )
115
116    phone_personal = PhoneNumber(
117        title = _(u'Student\'s Personal Phone'),
118        description = u'',
119        required = False,
120        readonly = False,
121        )
122
123class ICustomStudentPersonalEdit(ICustomStudentPersonal):
124    """Interface for editing personal data by students.
125
126    Here we can repeat the fields from IStudentPersonal and set the
127    `required` if necessary.
128    """
129
130    perm_address = schema.Text(
131        title = _(u'Permanent Address'),
132        required = True,
133        )
134
135    next_kin_name = schema.TextLine(
136        title = _(u'Next of Kin Name'),
137        required = True,
138        readonly = False,
139        )
140
141    next_kin_relation = schema.TextLine(
142        title = _(u'Next of Kin Relationship'),
143        required = True,
144        readonly = False,
145        )
146
147    next_kin_address = schema.Text(
148        title = _(u'Next of Kin Address'),
149        required = True,
150        readonly = False,
151        )
152
153    next_kin_phone = PhoneNumber(
154        title = _(u'Next of Kin Phone'),
155        description = u'',
156        required = True,
157        readonly = False,
158        )
159
160    father_name = schema.TextLine(
161        title = _(u'Father\'s Name'),
162        required = True,
163        readonly = False,
164        )
165
166    father_address = schema.Text(
167        title = _(u'Father\'s Permanent Address'),
168        required = True,
169        readonly = False,
170        )
171
172    father_work = schema.TextLine(
173        title = _(u'Father\'s Place of Work'),
174        required = True,
175        readonly = False,
176        )
177
178    father_phone = PhoneNumber(
179        title = _(u'Father\'s Phone'),
180        required = True,
181        readonly = False,
182        )
183
184    mother_name = schema.TextLine(
185        title = _(u'Mother\'s Name'),
186        required = True,
187        readonly = False,
188        )
189
190    mother_address = schema.Text(
191        title = _(u'Mother\'s Permanent Address'),
192        required = True,
193        readonly = False,
194        )
195
196    mother_work = schema.TextLine(
197        title = _(u'Mother\'s Place of Work'),
198        required = True,
199        readonly = False,
200        )
201
202    mother_phone = PhoneNumber(
203        title = _(u'Mother\'s Phone'),
204        required = True,
205        readonly = False,
206        )
207
208    phone_personal = PhoneNumber(
209        title = _(u'Student\'s Personal Phone'),
210        description = u'',
211        required = True,
212        readonly = False,
213        )
214
215class ICustomUGStudentClearance(INigeriaUGStudentClearance):
216    """Representation of ug student clearance data.
217
218    """
219
220    #date_of_birth = FormattedDate(
221    #    title = _(u'Date of Birth'),
222    #    required = True,
223    #    show_year = True,
224    #    )
225
226    lga = schema.Choice(
227        source = LGASource(),
228        title = _(u'State / LGA'),
229        required = True,
230        )
231
232    fst_sit_sc_pin = schema.TextLine(
233        title = _(u'Scratch Card Pin'),
234        required = False,
235        readonly = False,
236        )
237
238    fst_sit_sc_serial_number = schema.TextLine(
239        title = _(u'Scratch Card Serial Number'),
240        required = False,
241        readonly = False,
242        )
243
244    scd_sit_sc_pin = schema.TextLine(
245        title = _(u'Scratch Card Pin'),
246        required = False,
247        readonly = False,
248        )
249
250    scd_sit_sc_serial_number = schema.TextLine(
251        title = _(u'Scratch Card Serial Number'),
252        required = False,
253        readonly = False,
254        )
255
256ICustomUGStudentClearance['lga'].order = INigeriaUGStudentClearance[
257    'lga'].order
258#ICustomUGStudentClearance['date_of_birth'].order = INigeriaUGStudentClearance[
259#    'date_of_birth'].order
260ICustomUGStudentClearance['fst_sit_sc_pin'].order = INigeriaUGStudentClearance['fst_sit_date'].order
261ICustomUGStudentClearance['scd_sit_sc_pin'].order = INigeriaUGStudentClearance['scd_sit_date'].order
262ICustomUGStudentClearance['fst_sit_sc_serial_number'].order = INigeriaUGStudentClearance['fst_sit_date'].order
263ICustomUGStudentClearance['scd_sit_sc_serial_number'].order = INigeriaUGStudentClearance['scd_sit_date'].order
264ICustomUGStudentClearance['scd_sit_date'].order = ICustomUGStudentClearance['scd_sit_type'].order
265ICustomUGStudentClearance['fst_sit_date'].order = ICustomUGStudentClearance['fst_sit_type'].order
266
267
268class ICustomPGStudentClearance(INigeriaPGStudentClearance):
269    """Representation of pg student clearance data.
270
271    """
272
273
274class ICustomStudent(ICustomStudentBase,ICustomUGStudentClearance,
275    ICustomPGStudentClearance,ICustomStudentPersonal):
276    """Representation of a student.
277
278    """
279
280class ICustomStudentStudyCourse(INigeriaStudentStudyCourse):
281    """A container for student study levels.
282
283    """
284
285class ICustomStudentStudyLevel(INigeriaStudentStudyLevel):
286    """A container for course tickets.
287
288    """
289
290    total_credits_s1 = schema.Int(
291        title = _(u'1st Semester Units'),
292        required = False,
293        readonly = True,
294        )
295
296    total_credits_s2 = schema.Int(
297        title = _(u'2nd Semester Units'),
298        required = False,
299        readonly = True,
300        )
301
302    total_credits = schema.Int(
303        title = _(u'Total Units'),
304        required = False,
305        readonly = True,
306        )
307
308class ICustomStudentOnlinePayment(ICustomOnlinePayment):
309    """A student payment via payment gateways.
310
311    This Interface does not inherit from IStudentOnlinePayment.
312    Thus all fields from IStudentOnlinePayment have to be repeated here.
313    """
314
315    p_current = schema.Bool(
316        title = _(u'Current Session Payment'),
317        default = True,
318        required = False,
319        )
320
321    p_level = schema.Choice(
322        title = _(u'Payment Level'),
323        source = StudyLevelSource(),
324        required = False,
325        )
326
327ICustomStudentOnlinePayment['p_level'].order = ICustomStudentOnlinePayment[
328    'p_session'].order
329
330class ICustomCourseTicket(INigeriaCourseTicket):
331    """A course ticket.
332
333    """
334
335    score = schema.Int(
336        title = _(u'Score'),
337        required = False,
338        readonly = False,
339        max = 70,
340        )
341
342    ca = schema.Int(
343        title = _(u'CA'),
344        default = None,
345        required = False,
346        missing_value = None,
347        max = 30,
348        )
349
350class ICustomCourseTicketImport(ICustomCourseTicket):
351    """An interface for importing course results and nothing more.
352    """
353    score = schema.Int(
354        title = _(u'Score'),
355        required = False,
356        readonly = False,
357        max = 70,
358        )
359
360    ca = schema.Int(
361        title = _(u'CA'),
362        required = False,
363        readonly = False,
364        max = 30,
365        )
366
367    level_session = schema.Choice(
368        title = _(u'Level Session'),
369        source = academic_sessions_vocab,
370        required = False,
371        readonly = False,
372        )
373
374ICustomCourseTicket['ca'].order = ICustomCourseTicket['score'].order
375
376class ICustomStudentUpdateByRegNo(INigeriaStudentUpdateByRegNo):
377    """Representation of a student. Skip regular reg_number validation.
378
379    """
380
381class ICustomStudentUpdateByMatricNo(INigeriaStudentUpdateByMatricNo):
382    """Representation of a student. Skip regular matric_number validation.
383
384    """
Note: See TracBrowser for help on using the repository browser.