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

Last change on this file since 14212 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
RevLine 
[7505]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##
[8867]18
[7505]19from zope import schema
[14206]20from zope.interface import Attribute
[9496]21from zc.sourcefactory.contextual import BasicContextualSourceFactory
22from zope.catalog.interfaces import ICatalog
23from zope.component import getUtility
[13865]24from waeup.kofa.interfaces import (IKofaObject, academic_sessions_vocab)
[13795]25from waeup.kofa.students.vocabularies import (
26    StudyLevelSource, contextual_reg_num_source
27    )
28from waeup.kofa.schema import PhoneNumber, FormattedDate, TextLineChoice
[13362]29from kofacustom.nigeria.interfaces import LGASource
[8867]30from kofacustom.nigeria.students.interfaces import (
31    INigeriaStudentBase, INigeriaUGStudentClearance, INigeriaPGStudentClearance,
32    INigeriaStudentPersonal, INigeriaStudentStudyLevel,
33    INigeriaStudentStudyCourse, INigeriaCourseTicket,
34    INigeriaStudentUpdateByRegNo, INigeriaStudentUpdateByMatricNo,
[7505]35    )
[8867]36from waeup.aaue.payments.interfaces import ICustomOnlinePayment
[8444]37from waeup.aaue.interfaces import MessageFactory as _
[7505]38
[8867]39class ICustomStudentBase(INigeriaStudentBase):
[7618]40    """Representation of student base data.
[7505]41
42    """
[7618]43
[13795]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
[8867]64class ICustomStudentPersonal(INigeriaStudentPersonal):
[7618]65    """Student personal data.
66
67    """
68
[13351]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'',
[13573]120        required = False,
[13351]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
[8867]216class ICustomUGStudentClearance(INigeriaUGStudentClearance):
[7995]217    """Representation of ug student clearance data.
[7505]218
219    """
220
[13368]221    #date_of_birth = FormattedDate(
222    #    title = _(u'Date of Birth'),
223    #    required = True,
224    #    show_year = True,
225    #    )
[13362]226
227    lga = schema.Choice(
228        source = LGASource(),
229        title = _(u'State / LGA'),
230        required = True,
231        )
232
[14107]233    fst_sit_sc_pin = schema.TextLine(
[14084]234        title = _(u'Scratch Card Pin'),
235        required = False,
236        readonly = False,
237        )
238
[14107]239    fst_sit_sc_serial_number = schema.TextLine(
[14084]240        title = _(u'Scratch Card Serial Number'),
241        required = False,
242        readonly = False,
243        )
244
[14107]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
[13362]257ICustomUGStudentClearance['lga'].order = INigeriaUGStudentClearance[
258    'lga'].order
[13368]259#ICustomUGStudentClearance['date_of_birth'].order = INigeriaUGStudentClearance[
260#    'date_of_birth'].order
[14107]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
[13362]267
268
[8867]269class ICustomPGStudentClearance(INigeriaPGStudentClearance):
[7995]270    """Representation of pg student clearance data.
[7505]271
272    """
273
[8101]274
[8204]275class ICustomStudent(ICustomStudentBase,ICustomUGStudentClearance,
276    ICustomPGStudentClearance,ICustomStudentPersonal):
[7995]277    """Representation of a student.
[7505]278
279    """
[8247]280
[8867]281class ICustomStudentStudyCourse(INigeriaStudentStudyCourse):
[8326]282    """A container for student study levels.
283
284    """
285
[14206]286    imported_cgpa = schema.Float(
287        title = _(u'Imported Cumulative GPA'),
288        required = False,
289        readonly = True,
290        )
291
[8867]292class ICustomStudentStudyLevel(INigeriaStudentStudyLevel):
[8326]293    """A container for course tickets.
294
295    """
296
[9914]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
[10102]309    total_credits = schema.Int(
310        title = _(u'Total Units'),
311        required = False,
312        readonly = True,
313        )
314
[14206]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
[8247]328class ICustomStudentOnlinePayment(ICustomOnlinePayment):
329    """A student payment via payment gateways.
330
[8270]331    This Interface does not inherit from IStudentOnlinePayment.
332    Thus all fields from IStudentOnlinePayment have to be repeated here.
333    """
334
[9154]335    p_current = schema.Bool(
336        title = _(u'Current Session Payment'),
337        default = True,
338        required = False,
339        )
340
[13735]341    p_level = schema.Choice(
[8270]342        title = _(u'Payment Level'),
[13735]343        source = StudyLevelSource(),
[8270]344        required = False,
345        )
[8430]346
[8270]347ICustomStudentOnlinePayment['p_level'].order = ICustomStudentOnlinePayment[
[8326]348    'p_session'].order
349
[8867]350class ICustomCourseTicket(INigeriaCourseTicket):
[8326]351    """A course ticket.
352
[8583]353    """
354
[14113]355    score = schema.Int(
356        title = _(u'Score'),
357        required = False,
358        readonly = False,
359        max = 70,
360        )
361
[13770]362    ca = schema.Int(
[13834]363        title = _(u'CA'),
[13770]364        default = None,
365        required = False,
366        missing_value = None,
[14113]367        max = 30,
[13770]368        )
369
[13865]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,
[14113]377        max = 70,
[13865]378        )
379
380    ca = schema.Int(
381        title = _(u'CA'),
382        required = False,
383        readonly = False,
[14113]384        max = 30,
[13865]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
[13834]394ICustomCourseTicket['ca'].order = ICustomCourseTicket['score'].order
[13770]395
[8867]396class ICustomStudentUpdateByRegNo(INigeriaStudentUpdateByRegNo):
[8583]397    """Representation of a student. Skip regular reg_number validation.
398
399    """
400
[8867]401class ICustomStudentUpdateByMatricNo(INigeriaStudentUpdateByMatricNo):
[8583]402    """Representation of a student. Skip regular matric_number validation.
403
[8867]404    """
Note: See TracBrowser for help on using the repository browser.