source: main/kofacustom.edocons/trunk/src/kofacustom/edocons/applicants/interfaces.py @ 16767

Last change on this file since 16767 was 16767, checked in by Henrik Bettermann, 3 years ago

Add CBT fields.

  • Property svn:keywords set to Id
File size: 11.0 KB
Line 
1## $Id: interfaces.py 16767 2022-02-01 17:59:34Z henrik $
2##
3## Copyright (C) 2011 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"""Customized interfaces of the university application package.
19"""
20
21from zope import schema
22from waeup.kofa.applicants.interfaces import (
23    IApplicantBaseData,
24    AppCatCertificateSource, CertificateSource)
25from waeup.kofa.schoolgrades import ResultEntryField
26from waeup.kofa.interfaces import (
27    SimpleKofaVocabulary, academic_sessions_vocab, validate_email)
28from waeup.kofa.schema import FormattedDate, TextLineChoice, PhoneNumber
29from waeup.kofa.students.vocabularies import nats_vocab, GenderSource
30from waeup.kofa.applicants.interfaces import (
31    contextual_reg_num_source,
32    IApplicantBaseData)
33from kofacustom.nigeria.applicants.interfaces import (
34    LGASource, high_qual, high_grade, exam_types,
35    jambsubjects,
36    INigeriaUGApplicant, INigeriaPGApplicant,
37    INigeriaApplicantOnlinePayment,
38    INigeriaUGApplicantEdit, INigeriaPGApplicantEdit,
39    INigeriaApplicantUpdateByRegNo,
40    IPUTMEApplicantEdit,
41    )
42from kofacustom.nigeria.interfaces import (
43    LGASource, DisabilitiesSource,
44    high_qual, high_grade, exam_types, validate_jamb_reg_number)
45
46from kofacustom.edocons.interfaces import MessageFactory as _
47from kofacustom.edocons.payments.interfaces import ICustomOnlinePayment
48
49programme_types_vocab = SimpleKofaVocabulary(
50    (_('Post UTME'), 'putme'),
51    (_('Post DE'), 'pude'),
52    (_('Admission Screening Exercise'), 'ase'),
53    (_('not applicable'), 'na'),
54    )
55
56class ICustomUGApplicant(INigeriaUGApplicant):
57    """An undergraduate applicant.
58    """
59
60    disabilities = schema.Choice(
61        title = _(u'Disability'),
62        source = DisabilitiesSource(),
63        required = False,
64        )
65    nationality = schema.Choice(
66        source = nats_vocab,
67        title = _(u'Nationality'),
68        required = False,
69        )
70    lga = schema.Choice(
71        source = LGASource(),
72        title = _(u'State/LGA (Nigerians only)'),
73        required = False,
74        )
75    perm_address = schema.Text(
76        title = _(u'Permanent Address'),
77        required = False,
78        )
79
80    next_kin_name = schema.TextLine(
81        title = _(u'Next of Kin Name'),
82        required = False,
83        readonly = False,
84        )
85
86    next_kin_relation = schema.TextLine(
87        title = _(u'Next of Kin Relationship'),
88        required = False,
89        readonly = False,
90        )
91
92    next_kin_address = schema.Text(
93        title = _(u'Next of Kin Address'),
94        required = False,
95        readonly = False,
96        )
97
98    next_kin_phone = PhoneNumber(
99        title = _(u'Next of Kin Phone'),
100        description = u'',
101        required = False,
102        readonly = False,
103        )
104
105    course1 = schema.Choice(
106        title = _(u'1st Choice Course of Study'),
107        source = AppCatCertificateSource(),
108        required = True,
109        )
110    course2 = schema.Choice(
111        title = _(u'2nd Choice Course of Study'),
112        source = AppCatCertificateSource(),
113        required = False,
114        )
115
116    fst_sit_fname = schema.TextLine(
117        title = _(u'Full Name'),
118        required = False,
119        readonly = False,
120        )
121
122    fst_sit_no = schema.TextLine(
123        title = _(u'Exam Number'),
124        required = False,
125        readonly = False,
126        )
127
128    fst_sit_date = FormattedDate(
129        title = _(u'Exam Date'),
130        required = False,
131        readonly = False,
132        show_year = True,
133        )
134
135    fst_sit_type = schema.Choice(
136        title = _(u'Exam Type'),
137        required = False,
138        readonly = False,
139        vocabulary = exam_types,
140        )
141
142    fst_sit_results = schema.List(
143        title = _(u'Exam Results'),
144        value_type = ResultEntryField(),
145        required = False,
146        readonly = False,
147        defaultFactory=list,
148        )
149
150    scd_sit_fname = schema.TextLine(
151        title = _(u'Full Name'),
152        required = False,
153        readonly = False,
154        )
155
156    scd_sit_no = schema.TextLine(
157        title = _(u'Exam Number'),
158        required = False,
159        readonly = False,
160        )
161
162    scd_sit_date = FormattedDate(
163        title = _(u'Exam Date'),
164        required = False,
165        readonly = False,
166        show_year = True,
167        )
168
169    scd_sit_type = schema.Choice(
170        title = _(u'Exam Type'),
171        required = False,
172        readonly = False,
173        vocabulary = exam_types,
174        )
175
176    scd_sit_results = schema.List(
177        title = _(u'Exam Results'),
178        value_type = ResultEntryField(),
179        required = False,
180        readonly = False,
181        defaultFactory=list,
182        )
183
184    programme_type = schema.Choice(
185        title = _(u'Programme Type'),
186        vocabulary = programme_types_vocab,
187        required = False,
188        )
189
190    hq_type = schema.Choice(
191        title = _(u'Qualification Obtained'),
192        required = False,
193        readonly = False,
194        vocabulary = high_qual,
195        )
196    hq_matric_no = schema.TextLine(
197        title = _(u'Former Matric Number'),
198        required = False,
199        readonly = False,
200        )
201    hq_degree = schema.Choice(
202        title = _(u'Class of Degree'),
203        required = False,
204        readonly = False,
205        vocabulary = high_grade,
206        )
207    hq_school = schema.TextLine(
208        title = _(u'Institution Attended'),
209        required = False,
210        readonly = False,
211        )
212    hq_session = schema.TextLine(
213        title = _(u'Years Attended'),
214        required = False,
215        readonly = False,
216        )
217    hq_disc = schema.TextLine(
218        title = _(u'Discipline'),
219        required = False,
220        readonly = False,
221        )
222    jamb_subjects = schema.Text(
223        title = _(u'Subjects and Scores'),
224        required = False,
225        )
226    jamb_subjects_list = schema.List(
227        title = _(u'JAMB Subjects'),
228        required = False,
229        defaultFactory=list,
230        value_type = schema.Choice(
231            vocabulary = jambsubjects
232            #source = JAMBSubjectSource(),
233            ),
234        )
235    jamb_score = schema.Int(
236        title = _(u'Total JAMB Score'),
237        required = False,
238        )
239    #jamb_age = schema.Int(
240    #    title = _(u'Age (provided by JAMB)'),
241    #    required = False,
242    #    )
243    jamb_reg_number = schema.TextLine(
244        title = _(u'JAMB Registration Number'),
245        required = False,
246        constraint=validate_jamb_reg_number,
247        )
248    cbt_score = schema.Int(
249        title = _(u'CBT Score'),
250        required = False,
251        )
252    cbt_venue = schema.TextLine(
253        title = _(u'CBT Venue'),
254        required = False,
255        )
256    cbt_date = FormattedDate(
257        title = _(u'CBT Date'),
258        required = False,
259        )
260    notice = schema.Text(
261        title = _(u'Notice'),
262        required = False,
263        )
264    screening_venue = schema.TextLine(
265        title = _(u'Screening Venue'),
266        required = False,
267        )
268    screening_date = schema.TextLine(
269        title = _(u'Screening Date'),
270        required = False,
271        )
272    screening_score = schema.Int(
273        title = _(u'Screening Score (%)'),
274        required = False,
275        )
276    aggregate = schema.Int(
277        title = _(u'Aggregate Score (%)'),
278        description = _(u'(average of relative JAMB and PUTME scores)'),
279        required = False,
280        )
281    result_uploaded = schema.Bool(
282        title = _(u'Result uploaded'),
283        default = False,
284        required = False,
285        )
286    student_id = schema.TextLine(
287        title = _(u'Student Id'),
288        required = False,
289        readonly = False,
290        )
291    course_admitted = schema.Choice(
292        title = _(u'Admitted Course of Study'),
293        source = CertificateSource(),
294        required = False,
295        )
296    locked = schema.Bool(
297        title = _(u'Form locked'),
298        default = False,
299        required = False,
300        )
301
302class ICustomPGApplicant(INigeriaPGApplicant):
303    """A postgraduate applicant.
304
305    This interface defines the least common multiple of all fields
306    in pg application forms. In customized forms, fields can be excluded by
307    adding them to the PG_OMIT* tuples.
308    """
309
310
311class ICustomApplicant(ICustomUGApplicant, ICustomPGApplicant):
312    """An interface for both types of applicants.
313
314    Attention: The ICustomPGApplicant field seetings will be overwritten
315    by ICustomPGApplicant field settings. If a field is defined
316    in both interfaces zope.schema validates only against the
317    constraints in ICustomUGApplicant. This does not affect the forms
318    since they are build on either ICustomUGApplicant or ICustomPGApplicant.
319    """
320
321    def writeLogMessage(view, comment):
322        """Adds an INFO message to the log file
323        """
324
325    def createStudent():
326        """Create a student object from applicant data
327        and copy applicant object.
328        """
329
330class ICustomUGApplicantEdit(ICustomUGApplicant):
331    """An undergraduate applicant interface for edit forms.
332
333    Here we can repeat the fields from base data and set the
334    `required` and `readonly` attributes to True to further restrict
335    the data access. Or we can allow only certain certificates to be
336    selected by choosing the appropriate source.
337
338    We cannot omit fields here. This has to be done in the
339    respective form page.
340    """
341
342class ICustomPGApplicantEdit(INigeriaPGApplicantEdit):
343    """A postgraduate applicant interface for editing.
344
345    Here we can repeat the fields from base data and set the
346    `required` and `readonly` attributes to True to further restrict
347    the data access. Or we can allow only certain certificates to be
348    selected by choosing the appropriate source.
349
350    We cannot omit fields here. This has to be done in the
351    respective form page.
352    """
353
354class ICustomApplicantOnlinePayment(INigeriaApplicantOnlinePayment):
355    """An applicant payment via payment gateways.
356
357    """
358
359class IPUTMEApplicantEdit(IPUTMEApplicantEdit):
360    """An undergraduate applicant interface for editing.
361
362    Here we can repeat the fields from base data and set the
363    `required` and `readonly` attributes to True to further restrict
364    the data access. Or we can allow only certain certificates to be
365    selected by choosing the appropriate source.
366
367    We cannot omit fields here. This has to be done in the
368    respective form page.
369    """
370
371class ICustomApplicantUpdateByRegNo(INigeriaApplicantUpdateByRegNo):
372    """Representation of an applicant.
373
374    Skip regular reg_number validation if reg_number is used for finding
375    the applicant object.
376    """
Note: See TracBrowser for help on using the repository browser.