source: main/waeup.uniben/trunk/src/waeup/uniben/students/interfaces.py @ 17932

Last change on this file since 17932 was 17852, checked in by Henrik Bettermann, 4 months ago

Change form.

  • Property svn:keywords set to Id
File size: 10.0 KB
Line 
1## $Id: interfaces.py 17852 2024-07-18 11:58:40Z 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 waeup.kofa.interfaces import (
21    validate_email, IKofaObject,
22    academic_sessions_vocab)
23from waeup.kofa.students.vocabularies import StudyLevelSource
24from waeup.kofa.students.interfaces import VerdictSource
25from kofacustom.nigeria.interfaces import GradingSystemSource
26from waeup.kofa.schema import FormattedDate
27from kofacustom.nigeria.students.interfaces import (
28    INigeriaStudentBase, INigeriaUGStudentClearance, INigeriaPGStudentClearance,
29    INigeriaStudentPersonal, INigeriaStudentPersonalEdit,
30    INigeriaStudentStudyLevel,
31    INigeriaStudentStudyCourse, INigeriaCourseTicket,
32    INigeriaStudentUpdateByRegNo, INigeriaStudentUpdateByMatricNo,
33    )
34from waeup.uniben.payments.interfaces import ICustomOnlinePayment
35from waeup.uniben.interfaces import MessageFactory as _
36
37
38class ICustomStudentBase(INigeriaStudentBase):
39    """Representation of student base data.
40    """
41
42    library = schema.Bool(
43        title = _(u'Library Id Card'),
44        default = False,
45        required = False,
46        )
47
48    email2 = schema.ASCIILine(
49        title = _(u'Institution Email'),
50        required = False,
51        constraint=validate_email,
52        )
53
54ICustomStudentBase['email2'].order = ICustomStudentBase[
55    'phone'].order
56ICustomStudentBase['phone'].order = ICustomStudentBase[
57    'email'].order
58
59class IMedicalHistory(IKofaObject):
60    """Students Medical History Questionnaire.
61    """
62
63    medical_updated = schema.Datetime(
64        title = _(u'Last updated'),
65        required = False,
66        readonly = False,
67        )
68
69    # History of Symptoms
70
71    fever = schema.Bool(
72        title = _(u'Fever'),
73        default = False,
74        required = True,
75        )
76
77    headaches = schema.Bool(
78        title = _(u'Headaches'),
79        default = False,
80        required = True,
81        )
82
83    catarrh = schema.Bool(
84        title = _(u'Catarrh'),
85        default = False,
86        required = True,
87        )
88
89    cough = schema.Bool(
90        title = _(u'Cough'),
91        default = False,
92        required = True,
93        )
94
95    sore_throat = schema.Bool(
96        title = _(u'Sore throat'),
97        default = False,
98        required = True,
99        )
100
101    breathing = schema.Bool(
102        title = _(u'Difficulty with breathing'),
103        default = False,
104        required = True,
105        )
106
107    sneezing = schema.Bool(
108        title = _(u'Sneezing'),
109        default = False,
110        required = True,
111        )
112
113    weakness = schema.Bool(
114        title = _(u'Weakness/tiredness'),
115        default = False,
116        required = True,
117        )
118
119    body_pains = schema.Bool(
120        title = _(u'Body pains'),
121        default = False,
122        required = True,
123        )
124
125    smell = schema.Bool(
126        title = _(u'Loss of smell (inability to smell)'),
127        default = False,
128        required = True,
129        )
130
131    taste = schema.Bool(
132        title = _(u'Loss of taste'),
133        default = False,
134        required = True,
135        )
136
137    # Medical History
138
139    asthma = schema.Bool(
140        title = _(u'Asthma'),
141        default = False,
142        required = True,
143        )
144
145    hypertension = schema.Bool(
146        title = _(u'Hypertension'),
147        default = False,
148        required = True,
149        )
150
151    diabetes = schema.Bool(
152        title = _(u'Diabetes'),
153        default = False,
154        required = True,
155        )
156
157    obesity = schema.Bool(
158        title = _(u'Obesity'),
159        default = False,
160        required = True,
161        )
162
163    others = schema.TextLine(
164        title = _(u'Others'),
165        required = False,
166        )
167
168    medicines = schema.TextLine(
169        title = _(u'Are you on a regular medication? If yes, list the medicines'),
170        required = False,
171        )
172
173    # Travel History
174
175    lagos_abuja = schema.Bool(
176        title = _(u'Have you travelled to Lagos or Abuja in the last two weeks?'),
177        default = False,
178        required = True,
179        )
180
181    outside = schema.Bool(
182        title = _(u'Have you travelled outside the country in the last 4 weeks?'),
183        default = False,
184        required = True,
185        )
186
187    # History of contact/infection
188
189    company_suspected = schema.Bool(
190        title = _(u'Were you in the company of a suspected case of COVID 19 in the last two weeks?'),
191        default = False,
192        required = True,
193        )
194
195    company_confirmed = schema.Bool(
196        title = _(u'Were you in the company of a confirmed case of COVID 19 in the last two weeks?'),
197        default = False,
198        required = True,
199        )
200
201    positive = schema.Bool(
202        title = _(u'Have you had a positive COVID 19 test done?'),
203        default = False,
204        required = True,
205        )
206
207    negative = schema.Bool(
208        title = _(u'Have you had a negative COVID 19 test done?'),
209        default = False,
210        required = True,
211        )
212
213    vaccination = schema.Bool(
214        title = _(u'Have you had COVID 19 vaccination?'),
215        default = False,
216        required = True,
217        )
218
219class INYSC(IKofaObject):
220    """Student NYSC data.
221    """
222
223    nysc = schema.Bool(
224        title = u'NYSC',
225        default = False,
226        required = True,
227        )
228
229    nysc_processed = schema.Bool(
230        title = u'NYSC processed',
231        default = False,
232        required = True,
233        )
234
235    nysc_updated = schema.Datetime(
236        title = _(u'NYSC request data last updated by student'),
237        )
238
239    nysc_date_of_graduation = FormattedDate(
240        title = _(u'Date of Graduation'),
241        required = False,
242        show_year = True,
243        )
244
245    nysc_verdict = schema.Choice(
246        title = _(u'Verdict'),
247        source = VerdictSource(),
248        default = '0',
249        required = False,
250        )
251
252    nysc_senate_info = schema.TextLine(
253        title = _(u'Serial No from Student Affairs'),
254        required = False,
255        #description = u'Serial No from Student Affairs',
256        )
257
258class ITiship(IKofaObject):
259    """Student tiship data.
260    """
261
262    genotype = schema.TextLine(
263        title = _(u'Genotype'),
264        required = False,
265        )
266
267    bloodgroup = schema.TextLine(
268        title = _(u'Blood Group'),
269        required = False,
270        )
271
272class ICustomStudentPersonal(INigeriaStudentPersonal):
273    """Student personal data.
274    """
275
276    parent_email = schema.ASCIILine(
277        title = _(u'Parent Email'),
278        required = False,
279        constraint=validate_email,
280        )
281
282class ICustomStudentPersonalEdit(INigeriaStudentPersonalEdit):
283    """Interface for editing personal data by students.
284    """
285
286    parent_email = schema.ASCIILine(
287        title = _(u'Parent Email'),
288        required = False,
289        constraint=validate_email,
290        )
291
292class ICustomUGStudentClearance(INigeriaUGStudentClearance):
293    """Representation of ug student clearance data.
294    """
295
296class ICustomPGStudentClearance(INigeriaPGStudentClearance):
297    """Representation of pg student clearance data.
298    """
299
300class ICustomStudent(ICustomStudentBase, ICustomUGStudentClearance,
301    ICustomPGStudentClearance, ICustomStudentPersonal, IMedicalHistory,
302    ITiship, INYSC):
303    """Representation of a student.
304    """
305
306class ICustomStudentStudyCourse(INigeriaStudentStudyCourse):
307    """A container for student study levels.
308    """
309
310class ICustomStudentStudyLevel(INigeriaStudentStudyLevel):
311    """A container for course tickets.
312    """
313
314class ICustomStudentOnlinePayment(ICustomOnlinePayment):
315    """A student payment via payment gateways.
316
317    This Interface does not inherit from IStudentOnlinePayment.
318    Thus all fields from IStudentOnlinePayment have to be repeated here.
319    """
320
321    p_current = schema.Bool(
322        title = _(u'Current Session Payment'),
323        default = True,
324        required = False,
325        )
326
327    p_level = schema.Choice(
328        title = _(u'Payment Level'),
329        source = StudyLevelSource(),
330        required = False,
331        )
332
333    staff_rebate = schema.Bool(
334        title = _(u'Staff Rebate Payment'),
335        default = False,
336        required = False,
337        )
338
339    rebate_amount = schema.Float(
340        title = _(u'Rebate'),
341        default = 0.0,
342        required = False,
343        readonly = False,
344        )
345
346ICustomStudentOnlinePayment['p_level'].order = ICustomStudentOnlinePayment[
347    'p_session'].order
348
349class ICustomCourseTicket(INigeriaCourseTicket):
350    """A course ticket.
351    """
352
353    grading_sys = schema.Choice(
354        title = _(u'Grading System'),
355        source = GradingSystemSource(),
356        required = True,
357        default = 'A',
358        )
359
360class ICustomCourseTicketImport(ICustomCourseTicket):
361    """An interface for importing course results and nothing more.
362    """
363
364    score = schema.Int(
365        title = _(u'Score'),
366        required = False,
367        readonly = False,
368        )
369
370    level_session = schema.Choice(
371        title = _(u'Level Session'),
372        source = academic_sessions_vocab,
373        required = False,
374        readonly = False,
375        )
376
377    grading_sys = schema.Choice(
378        title = _(u'Grading System'),
379        source = GradingSystemSource(),
380        required = False,
381        default = 'A',
382        )
383
384class ICustomStudentUpdateByRegNo(INigeriaStudentUpdateByRegNo):
385    """Representation of a student. Skip regular reg_number validation.
386    """
387
388class ICustomStudentUpdateByMatricNo(INigeriaStudentUpdateByMatricNo):
389    """Representation of a student. Skip regular matric_number validation.
390    """
Note: See TracBrowser for help on using the repository browser.