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

Last change on this file since 12887 was 12887, checked in by Henrik Bettermann, 10 years ago

Customize PUTME and PUDE forms.

  • Property svn:keywords set to Id
File size: 11.5 KB
RevLine 
[10765]1## $Id: interfaces.py 12887 2015-04-26 12:50:43Z 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    )
[11940]39from kofacustom.wdu.interfaces import MessageFactory as _
40from kofacustom.wdu.payments.interfaces import ICustomOnlinePayment
[10765]41
[12887]42class ICustomUGApplicant(IApplicantBaseData):
[10765]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    """
[12887]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    jamb_subjects = schema.Text(
237        title = _(u'Subjects and Scores'),
238        description = _(u'(one subject with score per line)'),
239        required = False,
240        )
241    jamb_score = schema.Int(
242        title = _(u'Total JAMB Score'),
243        required = False,
244        )
245    jamb_reg_number = schema.TextLine(
246        title = _(u'JAMB Registration Number'),
247        required = False,
248        )
249    jamb_age = schema.Int(
250        title = _(u'Age (provided by JAMB)'),
251        required = False,
252        )
253    notice = schema.Text(
254        title = _(u'Notice'),
255        required = False,
256        )
257    screening_venue = schema.TextLine(
258        title = _(u'Screening Venue'),
259        required = False,
260        )
261    screening_date = schema.TextLine(
262        title = _(u'Screening Date'),
263        required = False,
264        )
265    screening_score = schema.Int(
266        title = _(u'Screening Score (%)'),
267        required = False,
268        )
269    aggregate = schema.Int(
270        title = _(u'Aggregate Score (%)'),
271        description = _(u'(average of relative JAMB and PUTME scores)'),
272        required = False,
273        )
274    result_uploaded = schema.Bool(
275        title = _(u'Result uploaded'),
276        default = False,
277        required = False,
278        )
279    student_id = schema.TextLine(
280        title = _(u'Student Id'),
281        required = False,
282        readonly = False,
283        )
284    course_admitted = schema.Choice(
285        title = _(u'Admitted Course of Study'),
286        source = CertificateSource(),
287        required = False,
288        )
289    locked = schema.Bool(
290        title = _(u'Form locked'),
291        default = False,
292        required = False,
293        )
[10765]294
[12887]295ICustomUGApplicant[
296    'sex'].order =  IApplicantBaseData['sex'].order
297
[10765]298class ICustomPGApplicant(INigeriaPGApplicant):
299    """A postgraduate applicant.
300
301    This interface defines the least common multiple of all fields
302    in pg application forms. In customized forms, fields can be excluded by
303    adding them to the PG_OMIT* tuples.
304    """
305
306
307class ICustomApplicant(ICustomUGApplicant, ICustomPGApplicant):
308    """An interface for both types of applicants.
309
310    Attention: The ICustomPGApplicant field seetings will be overwritten
311    by ICustomPGApplicant field settings. If a field is defined
312    in both interfaces zope.schema validates only against the
313    constraints in ICustomUGApplicant. This does not affect the forms
314    since they are build on either ICustomUGApplicant or ICustomPGApplicant.
315    """
316
317    def writeLogMessage(view, comment):
318        """Adds an INFO message to the log file
319        """
320
321    def createStudent():
322        """Create a student object from applicant data
323        and copy applicant object.
324        """
325
[12887]326class ICustomUGApplicantEdit(ICustomUGApplicant):
[10765]327    """An undergraduate applicant interface for edit forms.
328
329    Here we can repeat the fields from base data and set the
330    `required` and `readonly` attributes to True to further restrict
331    the data access. Or we can allow only certain certificates to be
332    selected by choosing the appropriate source.
333
334    We cannot omit fields here. This has to be done in the
335    respective form page.
336    """
337
338class ICustomPGApplicantEdit(INigeriaPGApplicantEdit):
339    """A postgraduate applicant interface for editing.
340
341    Here we can repeat the fields from base data and set the
342    `required` and `readonly` attributes to True to further restrict
343    the data access. Or we can allow only certain certificates to be
344    selected by choosing the appropriate source.
345
346    We cannot omit fields here. This has to be done in the
347    respective form page.
348    """
349
350class ICustomApplicantOnlinePayment(INigeriaApplicantOnlinePayment):
351    """An applicant payment via payment gateways.
352
353    """
354
[12887]355class ICustomPUTMEApplicantEdit(ICustomUGApplicant):
[10765]356    """An undergraduate applicant interface for editing.
357
358    Here we can repeat the fields from base data and set the
359    `required` and `readonly` attributes to True to further restrict
360    the data access. Or we can allow only certain certificates to be
361    selected by choosing the appropriate source.
362
363    We cannot omit fields here. This has to be done in the
364    respective form page.
365    """
366
367class ICustomApplicantUpdateByRegNo(INigeriaApplicantUpdateByRegNo):
368    """Representation of an applicant.
369
370    Skip regular reg_number validation if reg_number is used for finding
371    the applicant object.
372    """
Note: See TracBrowser for help on using the repository browser.