source: main/kofacustom.coewarri/trunk/src/kofacustom/coewarri/applicants/interfaces.py @ 14292

Last change on this file since 14292 was 14128, checked in by Henrik Bettermann, 8 years ago

Customize ICustomUGApplicant and browser views which are using this interface.

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