source: main/kofacustom.wdu/trunk/src/kofacustom/wdu/applicants/interfaces.py @ 12888

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

More fields and declarations.

  • Property svn:keywords set to Id
File size: 11.9 KB
Line 
1## $Id: interfaces.py 12888 2015-04-26 19:45:46Z 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
29from waeup.kofa.students.vocabularies import nats_vocab, GenderSource
30from waeup.kofa.applicants.interfaces import contextual_reg_num_source
31from kofacustom.nigeria.applicants.interfaces import (
32    LGASource, high_qual, high_grade, exam_types,
33    INigeriaUGApplicant, INigeriaPGApplicant,
34    INigeriaApplicantOnlinePayment,
35    INigeriaUGApplicantEdit, INigeriaPGApplicantEdit,
36    INigeriaApplicantUpdateByRegNo,
37    IPUTMEApplicantEdit,
38    )
39from kofacustom.wdu.interfaces import MessageFactory as _
40from kofacustom.wdu.payments.interfaces import ICustomOnlinePayment
41
42class ICustomUGApplicant(IApplicantBaseData):
43    """An undergraduate applicant.
44
45    This interface defines the least common multiple of all fields
46    in ug application forms. In customized forms, fields can be excluded by
47    adding them to the UG_OMIT* tuples.
48    """
49    sex = schema.Choice(
50        title = _(u'Sex'),
51        source = GenderSource(),
52        required = False,
53        )
54    marit_stat = schema.Choice(
55        title = u'Maritual Status',
56        required = False,
57        vocabulary = SimpleKofaVocabulary(
58            (_('Single'), 'single'),
59            (_('Married'), 'married'),
60            (_('Widowed'), 'widowed'),
61            (_('Divorced'), 'divorced'),
62            (_('Separated'), 'separated'),)
63        )
64    nationality = schema.Choice(
65        source = nats_vocab,
66        title = _(u'Nationality'),
67        required = False,
68        )
69    lga = schema.Choice(
70        source = LGASource(),
71        title = _(u'State/LGA (Nigerians only)'),
72        required = False,
73        )
74    religion = schema.Choice(
75        title = u'Religion',
76        default = 'no_say',
77        required = False,
78        vocabulary = SimpleKofaVocabulary(
79            (_('Muslim'), 'muslim'),
80            (_('Christian'), 'christian'),
81            (_('Others'), 'others'),
82            (_('Prefer not to say'), 'no_say'),)
83        )
84    #perm_address = schema.Text(
85    #    title = _(u'Permanent Address'),
86    #    required = False,
87    #    )
88    next_kin_address = schema.Text(
89        title = _(u'Next of Kin Address'),
90        required = False,
91        )
92    course1 = schema.Choice(
93        title = _(u'1st Choice Course of Study'),
94        source = AppCatCertificateSource(),
95        required = False,
96        )
97    course2 = schema.Choice(
98        title = _(u'2nd Choice Course of Study'),
99        source = AppCatCertificateSource(),
100        required = False,
101        )
102    olevel_type = schema.Choice(
103        title = _(u'Qualification Obtained'),
104        required = False,
105        readonly = False,
106        vocabulary = exam_types,
107        )
108    olevel_school = schema.TextLine(
109        title = _(u'Institution Attended'),
110        required = False,
111        readonly = False,
112        )
113    olevel_exam_number = schema.TextLine(
114        title = _(u'Exam Number'),
115        required = False,
116        readonly = False,
117        )
118    olevel_exam_date = FormattedDate(
119        title = _(u'Exam Date'),
120        required = False,
121        readonly = False,
122        show_year = True,
123        )
124    olevel_results = schema.List(
125        title = _(u'Exam Results'),
126        value_type = ResultEntryField(),
127        required = False,
128        readonly = False,
129        default = [],
130        )
131    olevel_type2 = schema.Choice(
132        title = _(u'2nd Qualification Obtained'),
133        required = False,
134        readonly = False,
135        vocabulary = exam_types,
136        )
137    olevel_school2 = schema.TextLine(
138        title = _(u'2nd Institution Attended'),
139        required = False,
140        readonly = False,
141        )
142    olevel_exam_number2 = schema.TextLine(
143        title = _(u'2nd Exam Number'),
144        required = False,
145        readonly = False,
146        )
147    olevel_exam_date2 = FormattedDate(
148        title = _(u'2nd Exam Date'),
149        required = False,
150        readonly = False,
151        show_year = True,
152        )
153    olevel_results2 = schema.List(
154        title = _(u'2nd Exam Results'),
155        value_type = ResultEntryField(),
156        required = False,
157        readonly = False,
158        default = [],
159        )
160    hq_type = schema.Choice(
161        title = _(u'Qualification Obtained'),
162        required = False,
163        readonly = False,
164        vocabulary = high_qual,
165        )
166    hq_matric_no = schema.TextLine(
167        title = _(u'Former Matric Number'),
168        required = False,
169        readonly = False,
170        )
171    hq_degree = schema.Choice(
172        title = _(u'Class of Degree'),
173        required = False,
174        readonly = False,
175        vocabulary = high_grade,
176        )
177    hq_school = schema.TextLine(
178        title = _(u'Institution Attended'),
179        required = False,
180        readonly = False,
181        )
182    hq_session = schema.TextLine(
183        title = _(u'Years Attended'),
184        required = False,
185        readonly = False,
186        )
187    hq_disc = schema.TextLine(
188        title = _(u'Discipline'),
189        required = False,
190        readonly = False,
191        )
192    employer = schema.TextLine(
193        title = _(u'Employer'),
194        required = False,
195        readonly = False,
196        )
197    emp_position = schema.TextLine(
198        title = _(u'Employer Position'),
199        required = False,
200        readonly = False,
201        )
202    emp_start = FormattedDate(
203        title = _(u'Start Date'),
204        required = False,
205        readonly = False,
206        show_year = True,
207        )
208    emp_end = FormattedDate(
209        title = _(u'End Date'),
210        required = False,
211        readonly = False,
212        show_year = True,
213        )
214    employer2 = schema.TextLine(
215        title = _(u'2nd Employer'),
216        required = False,
217        readonly = False,
218        )
219    emp2_position = schema.TextLine(
220        title = _(u'2nd Employer Position'),
221        required = False,
222        readonly = False,
223        )
224    emp2_start = FormattedDate(
225        title = _(u'Start Date'),
226        required = False,
227        readonly = False,
228        show_year = True,
229        )
230    emp2_end = FormattedDate(
231        title = _(u'End Date'),
232        required = False,
233        readonly = False,
234        show_year = True,
235        )
236    body_responsible_address = schema.Text(
237        title = _(u'Name and Adress of Body'),
238        description = _(
239         'Name and address of body who will be responsible for the fees. '
240         'If admission to the university is offered '
241         'a guarantor\'s form that all the fees will be paid will be sworn to '
242         'by the person or body named. The student will not be allowed into the '
243         'university until the guarantor\'s form is signed and returned '
244         'to the institution.'),
245        required = False,
246       )
247    jamb_subjects = schema.Text(
248        title = _(u'Subjects and Scores'),
249        description = _(u'(one subject with score per line)'),
250        required = False,
251        )
252    jamb_score = schema.Int(
253        title = _(u'Total JAMB Score'),
254        required = False,
255        )
256    jamb_reg_number = schema.TextLine(
257        title = _(u'JAMB Registration Number'),
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
302ICustomUGApplicant[
303    'sex'].order =  IApplicantBaseData['sex'].order
304
305class ICustomPGApplicant(INigeriaPGApplicant):
306    """A postgraduate applicant.
307
308    This interface defines the least common multiple of all fields
309    in pg application forms. In customized forms, fields can be excluded by
310    adding them to the PG_OMIT* tuples.
311    """
312
313
314class ICustomApplicant(ICustomUGApplicant, ICustomPGApplicant):
315    """An interface for both types of applicants.
316
317    Attention: The ICustomPGApplicant field seetings will be overwritten
318    by ICustomPGApplicant field settings. If a field is defined
319    in both interfaces zope.schema validates only against the
320    constraints in ICustomUGApplicant. This does not affect the forms
321    since they are build on either ICustomUGApplicant or ICustomPGApplicant.
322    """
323
324    def writeLogMessage(view, comment):
325        """Adds an INFO message to the log file
326        """
327
328    def createStudent():
329        """Create a student object from applicant data
330        and copy applicant object.
331        """
332
333class ICustomUGApplicantEdit(ICustomUGApplicant):
334    """An undergraduate applicant interface for edit forms.
335
336    Here we can repeat the fields from base data and set the
337    `required` and `readonly` attributes to True to further restrict
338    the data access. Or we can allow only certain certificates to be
339    selected by choosing the appropriate source.
340
341    We cannot omit fields here. This has to be done in the
342    respective form page.
343    """
344
345class ICustomPGApplicantEdit(INigeriaPGApplicantEdit):
346    """A postgraduate applicant interface for editing.
347
348    Here we can repeat the fields from base data and set the
349    `required` and `readonly` attributes to True to further restrict
350    the data access. Or we can allow only certain certificates to be
351    selected by choosing the appropriate source.
352
353    We cannot omit fields here. This has to be done in the
354    respective form page.
355    """
356
357class ICustomApplicantOnlinePayment(INigeriaApplicantOnlinePayment):
358    """An applicant payment via payment gateways.
359
360    """
361
362class ICustomPUTMEApplicantEdit(ICustomUGApplicant):
363    """An undergraduate applicant interface for editing.
364
365    Here we can repeat the fields from base data and set the
366    `required` and `readonly` attributes to True to further restrict
367    the data access. Or we can allow only certain certificates to be
368    selected by choosing the appropriate source.
369
370    We cannot omit fields here. This has to be done in the
371    respective form page.
372    """
373
374class ICustomApplicantUpdateByRegNo(INigeriaApplicantUpdateByRegNo):
375    """Representation of an applicant.
376
377    Skip regular reg_number validation if reg_number is used for finding
378    the applicant object.
379    """
Note: See TracBrowser for help on using the repository browser.