source: main/waeup.aaue/trunk/src/waeup/aaue/applicants/interfaces.py @ 11150

Last change on this file since 11150 was 10998, checked in by Henrik Bettermann, 11 years ago

Add higher education fields.

  • Property svn:keywords set to Id
File size: 10.7 KB
RevLine 
[7853]1## $Id: interfaces.py 10998 2014-01-29 06:54:33Z 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
[8012]21from zope import schema
[10298]22from zope.interface import Attribute, invariant, Invalid
[8051]23from waeup.kofa.applicants.interfaces import (
[8053]24    IApplicantBaseData,
[8051]25    AppCatCertificateSource, CertificateSource)
26from waeup.kofa.schoolgrades import ResultEntryField
[8532]27from waeup.kofa.interfaces import (
28    SimpleKofaVocabulary, academic_sessions_vocab, validate_email)
29from waeup.kofa.schema import FormattedDate, TextLineChoice
30from waeup.kofa.students.vocabularies import nats_vocab, GenderSource
[10298]31from waeup.kofa.applicants.interfaces import (
32    contextual_reg_num_source,
33    IApplicantBaseData)
[8931]34from kofacustom.nigeria.applicants.interfaces import (
35    LGASource, high_qual, high_grade, exam_types,
36    INigeriaUGApplicant, INigeriaPGApplicant,
37    INigeriaApplicantOnlinePayment,
[8980]38    INigeriaUGApplicantEdit, INigeriaPGApplicantEdit,
39    INigeriaApplicantUpdateByRegNo,
40    IPUTMEApplicantEdit,
[8931]41    )
[8444]42from waeup.aaue.interfaces import MessageFactory as _
43from waeup.aaue.payments.interfaces import ICustomOnlinePayment
[7853]44
[10924]45programme_types_vocab = SimpleKofaVocabulary(
46    (_('5-Year Undergraduate Programme'), 'regular'),
47    (_('4-Year Undergraduate Programme (Direct Entry)'), 'direct'),
48    (_('not applicable'), 'na'),
49    )
50
[10298]51class ICustomUGApplicant(IApplicantBaseData):
[8012]52    """An undergraduate applicant.
53
[8521]54    This interface defines the least common multiple of all fields
55    in ug application forms. In customized forms, fields can be excluded by
56    adding them to the UG_OMIT* tuples.
[8012]57    """
58
[10924]59    programme_type = schema.Choice(
60        title = _(u'Programme Type'),
61        vocabulary = programme_types_vocab,
62        required = True,
63        )
64
[10298]65    nationality = schema.Choice(
66        source = nats_vocab,
67        title = _(u'Nationality'),
68        required = True,
69        )
70    lga = schema.Choice(
71        source = LGASource(),
72        title = _(u'State/LGA (Nigerians only)'),
73        required = False,
74        )
75    perm_address = schema.Text(
76        title = _(u'Permanent Address'),
77        required = False,
78        )
[10308]79    home_town = schema.TextLine(
[10306]80        title = _(u'Home Town'),
81        required = False,
82        )
[10311]83    jamb_reg_number = schema.TextLine(
84        title = _(u'JAMB Registration Number'),
85        required = False,
86        )
87    jamb_score = schema.Int(
88        title = _(u'Total JAMB Score'),
89        required = False,
90        )
[10298]91    course1 = schema.Choice(
92        title = _(u'1st Choice Course of Study'),
93        source = AppCatCertificateSource(),
94        required = True,
95        )
96    course2 = schema.Choice(
97        title = _(u'2nd Choice Course of Study'),
98        source = AppCatCertificateSource(),
99        required = False,
100        )
101    fst_sit_fname = schema.TextLine(
102        title = _(u'Full Name'),
103        required = False,
104        readonly = False,
105        )
106    fst_sit_no = schema.TextLine(
107        title = _(u'Exam Number'),
108        required = False,
109        readonly = False,
110        )
111    fst_sit_date = FormattedDate(
112        title = _(u'Exam Date'),
113        required = False,
114        readonly = False,
115        show_year = True,
116        )
117    fst_sit_type = schema.Choice(
118        title = _(u'Exam Type'),
119        required = False,
120        readonly = False,
121        vocabulary = exam_types,
122        )
123    fst_sit_results = schema.List(
124        title = _(u'Exam Results'),
125        value_type = ResultEntryField(),
126        required = False,
127        readonly = False,
128        default = [],
129        )
130    scd_sit_fname = schema.TextLine(
131        title = _(u'Full Name'),
132        required = False,
133        readonly = False,
134        )
135    scd_sit_no = schema.TextLine(
136        title = _(u'Exam Number'),
137        required = False,
138        readonly = False,
139        )
140    scd_sit_date = FormattedDate(
141        title = _(u'Exam Date'),
142        required = False,
143        readonly = False,
144        show_year = True,
145        )
146    scd_sit_type = schema.Choice(
147        title = _(u'Exam Type'),
148        required = False,
149        readonly = False,
150        vocabulary = exam_types,
151        )
152    scd_sit_results = schema.List(
153        title = _(u'Exam Results'),
154        value_type = ResultEntryField(),
155        required = False,
156        readonly = False,
157        default = [],
158        )
159    alr_fname = schema.TextLine(
160        title = _(u'Full Name'),
161        required = False,
162        readonly = False,
163        )
164    alr_no = schema.TextLine(
165        title = _(u'Exam Number'),
166        required = False,
167        readonly = False,
168        )
169    alr_date = FormattedDate(
170        title = _(u'Exam Date'),
171        required = False,
172        readonly = False,
173        show_year = True,
174        )
175    alr_results = schema.List(
176        title = _(u'Exam Results'),
177        value_type = ResultEntryField(),
178        required = False,
179        readonly = False,
180        default = [],
181        )
[10998]182    hq_type = schema.Choice(
183        title = _(u'Qualification Obtained'),
184        required = False,
185        readonly = False,
186        vocabulary = high_qual,
187        )
188
189    hq_fname = schema.TextLine(
190        title = _(u'Full Name'),
191        required = False,
192        readonly = False,
193        )
194
195    hq_matric_no = schema.TextLine(
196        title = _(u'Former Matric Number'),
197        required = False,
198        readonly = False,
199        )
200
201    hq_degree = schema.Choice(
202        title = _(u'Class of Degree'),
203        required = False,
204        readonly = False,
205        vocabulary = high_grade,
206        )
207
208    hq_school = schema.TextLine(
209        title = _(u'Institution Attended'),
210        required = False,
211        readonly = False,
212        )
213
214    hq_session = schema.TextLine(
215        title = _(u'Years Attended'),
216        required = False,
217        readonly = False,
218        )
219
220    hq_disc = schema.TextLine(
221        title = _(u'Discipline'),
222        required = False,
223        readonly = False,
224        )
[10298]225    notice = schema.Text(
226        title = _(u'Notice'),
227        required = False,
228        )
[10309]229    #screening_venue = schema.TextLine(
230    #    title = _(u'Screening Venue'),
231    #    required = False,
232    #    )
233    #screening_date = schema.TextLine(
234    #    title = _(u'Screening Date'),
235    #    required = False,
236    #    )
237    #screening_score = schema.Int(
238    #    title = _(u'Screening Score (%)'),
239    #    required = False,
240    #    )
241    #aggregate = schema.Int(
242    #    title = _(u'Aggregate Score (%)'),
243    #    description = _(u'(average of relative JAMB and PUTME scores)'),
244    #    required = False,
245    #    )
[10298]246    result_uploaded = schema.Bool(
247        title = _(u'Result uploaded'),
248        default = False,
249        )
250    student_id = schema.TextLine(
251        title = _(u'Student Id'),
252        required = False,
253        readonly = False,
254        )
255    course_admitted = schema.Choice(
256        title = _(u'Admitted Course of Study'),
257        source = CertificateSource(),
258        required = False,
259        )
260    locked = schema.Bool(
261        title = _(u'Form locked'),
262        default = False,
263        )
264
265    @invariant
266    def second_choice(applicant):
267        if applicant.course1 == applicant.course2:
268            raise Invalid(_("2nd choice course must differ from 1st choice course."))
269
[10924]270ICustomUGApplicant['programme_type'].order = IApplicantBaseData[
271    'reg_number'].order
272
[8931]273class ICustomPGApplicant(INigeriaPGApplicant):
[7853]274    """A postgraduate applicant.
275
[8521]276    This interface defines the least common multiple of all fields
277    in pg application forms. In customized forms, fields can be excluded by
278    adding them to the PG_OMIT* tuples.
[7866]279    """
280
[8931]281class ICustomApplicant(ICustomUGApplicant, ICustomPGApplicant):
[8012]282    """An interface for both types of applicants.
283
[8931]284    Attention: The ICustomPGApplicant field seetings will be overwritten
285    by ICustomPGApplicant field settings. If a field is defined
[8728]286    in both interfaces zope.schema validates only against the
[8931]287    constraints in ICustomUGApplicant. This does not affect the forms
288    since they are build on either ICustomUGApplicant or ICustomPGApplicant.
[8012]289    """
290
[8746]291    def writeLogMessage(view, comment):
[8053]292        """Adds an INFO message to the log file
293        """
294
295    def createStudent():
296        """Create a student object from applicatnt data
297        and copy applicant object.
298        """
299
[10298]300class ICustomUGApplicantEdit(ICustomUGApplicant):
[8728]301    """An undergraduate applicant interface for edit forms.
[8012]302
303    Here we can repeat the fields from base data and set the
304    `required` and `readonly` attributes to True to further restrict
305    the data access. Or we can allow only certain certificates to be
306    selected by choosing the appropriate source.
307
308    We cannot omit fields here. This has to be done in the
309    respective form page.
310    """
311
[10924]312    date_of_birth = FormattedDate(
313        title = _(u'Date of Birth'),
314        required = True,
315        show_year = True,
316        )
317
318ICustomUGApplicantEdit['date_of_birth'].order = ICustomUGApplicant[
319    'date_of_birth'].order
320
[8980]321class ICustomPGApplicantEdit(INigeriaPGApplicantEdit):
[7866]322    """A postgraduate applicant interface for editing.
323
324    Here we can repeat the fields from base data and set the
325    `required` and `readonly` attributes to True to further restrict
326    the data access. Or we can allow only certain certificates to be
327    selected by choosing the appropriate source.
328
329    We cannot omit fields here. This has to be done in the
330    respective form page.
[8017]331    """
[8455]332
[8931]333class ICustomApplicantOnlinePayment(INigeriaApplicantOnlinePayment):
[8247]334    """An applicant payment via payment gateways.
335
336    """
[8532]337
[8980]338class IPUTMEApplicantEdit(IPUTMEApplicantEdit):
[8532]339    """An undergraduate 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
[8980]350class ICustomApplicantUpdateByRegNo(INigeriaApplicantUpdateByRegNo):
[8583]351    """Representation of an applicant.
352
353    Skip regular reg_number validation if reg_number is used for finding
354    the applicant object.
355    """
[8980]356
Note: See TracBrowser for help on using the repository browser.