source: main/kofacustom.edopoly/trunk/src/kofacustom/edopoly/applicants/interfaces.py @ 16593

Last change on this file since 16593 was 15218, checked in by Henrik Bettermann, 6 years ago

Implement special application (for supplementary payments).

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