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

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

Add imported_gpa and imported_cgpa fields and adjust exporters and batch processors.

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