source: main/waeup.fceokene/trunk/src/waeup/fceokene/applicants/interfaces.py @ 9500

Last change on this file since 9500 was 9500, checked in by Henrik Bettermann, 12 years ago

Add second 'O' level record.

  • Property svn:keywords set to Id
File size: 9.9 KB
Line 
1## $Id: interfaces.py 9500 2012-11-02 05:02:41Z 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.schoolgrades import ResultEntryField
30from waeup.kofa.students.vocabularies import nats_vocab, GenderSource
31from waeup.kofa.applicants.interfaces import contextual_reg_num_source
32from kofacustom.nigeria.applicants.interfaces import (
33    LGASource, high_qual, high_grade, exam_types,
34    INigeriaUGApplicant, INigeriaPGApplicant,
35    INigeriaApplicantOnlinePayment,
36    INigeriaUGApplicantEdit,
37    INigeriaApplicantUpdateByRegNo,
38    IPUTMEApplicantEdit,
39    OMIT_DISPLAY_FIELDS
40    )
41from waeup.fceokene.interfaces import MessageFactory as _
42
43BEC_OMIT_DISPLAY_FIELDS = OMIT_DISPLAY_FIELDS
44BEC_OMIT_PDF_FIELDS = BEC_OMIT_DISPLAY_FIELDS + ('phone',)
45BEC_OMIT_MANAGE_FIELDS = ()
46BEC_OMIT_EDIT_FIELDS = BEC_OMIT_MANAGE_FIELDS + OMIT_DISPLAY_FIELDS + (
47    'student_id', 'notice',
48    'screening_score',
49    'screening_venue',
50    'screening_date',
51    #'jamb_subjects',
52    #'jamb_score',
53    'aggregate')
54
55class ICustomUGApplicant(INigeriaUGApplicant):
56    """An undergraduate applicant.
57
58    This interface defines the least common multiple of all fields
59    in ug application forms. In customized forms, fields can be excluded by
60    adding them to the OMIT* tuples.
61    """
62
63    nationality = schema.Choice(
64        source = nats_vocab,
65        title = _(u'Nationality'),
66        required = True,
67        )
68    lga = schema.Choice(
69        source = LGASource(),
70        title = _(u'State/LGA (Nigerians only)'),
71        required = False,
72        )
73    #perm_address = schema.Text(
74    #    title = _(u'Permanent Address'),
75    #    required = False,
76    #    )
77    course1 = schema.Choice(
78        title = _(u'1st Choice Course of Study'),
79        source = AppCatCertificateSource(),
80        required = True,
81        )
82    course2 = schema.Choice(
83        title = _(u'2nd Choice Course of Study'),
84        source = AppCatCertificateSource(),
85        required = False,
86        )
87    olevel_type = schema.Choice(
88        title = _(u'1st Qualification Obtained'),
89        required = False,
90        readonly = False,
91        vocabulary = exam_types,
92        )
93    olevel_school = schema.TextLine(
94        title = _(u'1st Institution Attended'),
95        required = False,
96        readonly = False,
97        )
98    olevel_exam_number = schema.TextLine(
99        title = _(u'1st Exam Number'),
100        required = False,
101        readonly = False,
102        )
103    olevel_exam_date = FormattedDate(
104        title = _(u'1st Exam Date'),
105        required = False,
106        readonly = False,
107        show_year = True,
108        )
109    olevel_results = schema.List(
110        title = _(u'1st Exam Results'),
111        value_type = ResultEntryField(),
112        required = False,
113        readonly = False,
114        default = [],
115        )
116    olevel_type2 = schema.Choice(
117        title = _(u'2nd Qualification Obtained'),
118        required = False,
119        readonly = False,
120        vocabulary = exam_types,
121        )
122    olevel_school2 = schema.TextLine(
123        title = _(u'2nd Institution Attended'),
124        required = False,
125        readonly = False,
126        )
127    olevel_exam_number2 = schema.TextLine(
128        title = _(u'2nd Exam Number'),
129        required = False,
130        readonly = False,
131        )
132    olevel_exam_date2 = FormattedDate(
133        title = _(u'2nd Exam Date'),
134        required = False,
135        readonly = False,
136        show_year = True,
137        )
138    olevel_results2 = schema.List(
139        title = _(u'2nd Exam Results'),
140        value_type = ResultEntryField(),
141        required = False,
142        readonly = False,
143        default = [],
144        )
145    hq_type = schema.Choice(
146        title = _(u'Qualification Obtained'),
147        required = False,
148        readonly = False,
149        vocabulary = high_qual,
150        )
151    hq_matric_no = schema.TextLine(
152        title = _(u'Former Matric Number'),
153        required = False,
154        readonly = False,
155        )
156    hq_degree = schema.Choice(
157        title = _(u'Class of Degree'),
158        required = False,
159        readonly = False,
160        vocabulary = high_grade,
161        )
162    hq_school = schema.TextLine(
163        title = _(u'Institution Attended'),
164        required = False,
165        readonly = False,
166        )
167    hq_session = schema.TextLine(
168        title = _(u'Years Attended'),
169        required = False,
170        readonly = False,
171        )
172    hq_disc = schema.TextLine(
173        title = _(u'Discipline'),
174        required = False,
175        readonly = False,
176        )
177    jamb_subjects = schema.Text(
178        title = _(u'Subjects and Scores'),
179        required = False,
180        )
181    jamb_score = schema.Int(
182        title = _(u'Total JAMB Score'),
183        required = False,
184        )
185    notice = schema.Text(
186        title = _(u'Notice'),
187        required = False,
188        )
189    screening_venue = schema.TextLine(
190        title = _(u'Screening Venue'),
191        required = False,
192        )
193    screening_date = schema.TextLine(
194        title = _(u'Screening Date'),
195        required = False,
196        )
197    screening_score = schema.Int(
198        title = _(u'Screening Score (%)'),
199        required = False,
200        )
201    aggregate = schema.Int(
202        title = _(u'Aggregate Score (%)'),
203        description = _(u'(average of relative JAMB and PUTME scores)'),
204        required = False,
205        )
206    result_uploaded = schema.Bool(
207        title = _(u'Result uploaded'),
208        default = False,
209        )
210    student_id = schema.TextLine(
211        title = _(u'Student Id'),
212        required = False,
213        readonly = False,
214        )
215    course_admitted = schema.Choice(
216        title = _(u'Admitted Course of Study'),
217        source = CertificateSource(),
218        required = False,
219        )
220    locked = schema.Bool(
221        title = _(u'Form locked'),
222        default = False,
223        )
224
225
226class ICustomPGApplicant(INigeriaPGApplicant):
227    """A postgraduate applicant.
228
229    This interface defines the least common multiple of all fields
230    in pg application forms. In customized forms, fields can be excluded by
231    adding them to the PG_OMIT* tuples.
232    """
233
234class ICustomApplicant(ICustomUGApplicant, ICustomPGApplicant):
235    """An interface for both types of applicants.
236
237    Attention: The ICustomPGApplicant field seetings will be overwritten
238    by ICustomPGApplicant field settings. If a field is defined
239    in both interfaces zope.schema validates only against the
240    constraints in ICustomUGApplicant. This does not affect the forms
241    since they are build on either ICustomUGApplicant or ICustomPGApplicant.
242    """
243
244    def writeLogMessage(view, comment):
245        """Adds an INFO message to the log file
246        """
247
248    def createStudent():
249        """Create a student object from applicatnt data
250        and copy applicant object.
251        """
252
253class ICustomUGApplicantEdit(ICustomUGApplicant):
254    """An undergraduate applicant interface for edit forms.
255
256    Here we can repeat the fields from base data and set the
257    `required` and `readonly` attributes to True to further restrict
258    the data access. Or we can allow only certain certificates to be
259    selected by choosing the appropriate source.
260
261    We cannot omit fields here. This has to be done in the
262    respective form page.
263    """
264
265
266    email = schema.ASCIILine(
267        title = _(u'Email Address'),
268        required = True,
269        constraint=validate_email,
270        )
271    date_of_birth = FormattedDate(
272        title = _(u'Date of Birth'),
273        required = True,
274        show_year = True,
275        )
276
277class ICustomPGApplicantEdit(ICustomPGApplicant):
278    """A postgraduate applicant interface for editing.
279
280    Here we can repeat the fields from base data and set the
281    `required` and `readonly` attributes to True to further restrict
282    the data access. Or we can allow only certain certificates to be
283    selected by choosing the appropriate source.
284
285    We cannot omit fields here. This has to be done in the
286    respective form page.
287    """
288
289    email = schema.ASCIILine(
290        title = _(u'Email Address'),
291        required = True,
292        constraint=validate_email,
293        )
294    date_of_birth = FormattedDate(
295        title = _(u'Date of Birth'),
296        required = True,
297        show_year = True,
298        )
299
300class ICustomApplicantOnlinePayment(INigeriaApplicantOnlinePayment):
301    """An applicant payment via payment gateways.
302
303    """
304
305class IPUTMEApplicantEdit(IPUTMEApplicantEdit):
306    """An undergraduate applicant interface for editing.
307
308    Here we can repeat the fields from base data and set the
309    `required` and `readonly` attributes to True to further restrict
310    the data access. Or we can allow only certain certificates to be
311    selected by choosing the appropriate source.
312
313    We cannot omit fields here. This has to be done in the
314    respective form page.
315    """
316
317class ICustomApplicantUpdateByRegNo(INigeriaApplicantUpdateByRegNo):
318    """Representation of an applicant.
319
320    Skip regular reg_number validation if reg_number is used for finding
321    the applicant object.
322    """
323
Note: See TracBrowser for help on using the repository browser.