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

Last change on this file since 14075 was 13865, checked in by Henrik Bettermann, 9 years ago

Customize Course Ticket Processor.

  • Property svn:keywords set to Id
File size: 9.0 KB
Line 
1## $Id: interfaces.py 13865 2016-05-26 13:44:09Z 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
232ICustomUGStudentClearance['lga'].order = INigeriaUGStudentClearance[
233    'lga'].order
234#ICustomUGStudentClearance['date_of_birth'].order = INigeriaUGStudentClearance[
235#    'date_of_birth'].order
236
237
238class ICustomPGStudentClearance(INigeriaPGStudentClearance):
239    """Representation of pg student clearance data.
240
241    """
242
243
244class ICustomStudent(ICustomStudentBase,ICustomUGStudentClearance,
245    ICustomPGStudentClearance,ICustomStudentPersonal):
246    """Representation of a student.
247
248    """
249
250class ICustomStudentStudyCourse(INigeriaStudentStudyCourse):
251    """A container for student study levels.
252
253    """
254
255class ICustomStudentStudyLevel(INigeriaStudentStudyLevel):
256    """A container for course tickets.
257
258    """
259
260    total_credits_s1 = schema.Int(
261        title = _(u'1st Semester Units'),
262        required = False,
263        readonly = True,
264        )
265
266    total_credits_s2 = schema.Int(
267        title = _(u'2nd Semester Units'),
268        required = False,
269        readonly = True,
270        )
271
272    total_credits = schema.Int(
273        title = _(u'Total Units'),
274        required = False,
275        readonly = True,
276        )
277
278class ICustomStudentOnlinePayment(ICustomOnlinePayment):
279    """A student payment via payment gateways.
280
281    This Interface does not inherit from IStudentOnlinePayment.
282    Thus all fields from IStudentOnlinePayment have to be repeated here.
283    """
284
285    p_current = schema.Bool(
286        title = _(u'Current Session Payment'),
287        default = True,
288        required = False,
289        )
290
291    p_level = schema.Choice(
292        title = _(u'Payment Level'),
293        source = StudyLevelSource(),
294        required = False,
295        )
296
297ICustomStudentOnlinePayment['p_level'].order = ICustomStudentOnlinePayment[
298    'p_session'].order
299
300class ICustomCourseTicket(INigeriaCourseTicket):
301    """A course ticket.
302
303    """
304
305    ca = schema.Int(
306        title = _(u'CA'),
307        default = None,
308        required = False,
309        missing_value = None,
310        )
311
312class ICustomCourseTicketImport(ICustomCourseTicket):
313    """An interface for importing course results and nothing more.
314    """
315    score = schema.Int(
316        title = _(u'Score'),
317        required = False,
318        readonly = False,
319        )
320
321    ca = schema.Int(
322        title = _(u'CA'),
323        required = False,
324        readonly = False,
325        )
326
327    level_session = schema.Choice(
328        title = _(u'Level Session'),
329        source = academic_sessions_vocab,
330        required = False,
331        readonly = False,
332        )
333
334ICustomCourseTicket['ca'].order = ICustomCourseTicket['score'].order
335
336class ICustomStudentUpdateByRegNo(INigeriaStudentUpdateByRegNo):
337    """Representation of a student. Skip regular reg_number validation.
338
339    """
340
341class ICustomStudentUpdateByMatricNo(INigeriaStudentUpdateByMatricNo):
342    """Representation of a student. Skip regular matric_number validation.
343
344    """
Note: See TracBrowser for help on using the repository browser.