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

Last change on this file since 9954 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
RevLine 
[7853]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
[8012]21from zope import schema
[8051]22from waeup.kofa.applicants.interfaces import (
[8053]23    IApplicantBaseData,
[8051]24    AppCatCertificateSource, CertificateSource)
25from waeup.kofa.schoolgrades import ResultEntryField
[8531]26from waeup.kofa.interfaces import (
27    SimpleKofaVocabulary, academic_sessions_vocab, validate_email)
28from waeup.kofa.schema import FormattedDate, TextLineChoice
[9465]29from waeup.kofa.schoolgrades import ResultEntryField
[8531]30from waeup.kofa.students.vocabularies import nats_vocab, GenderSource
31from waeup.kofa.applicants.interfaces import contextual_reg_num_source
[8933]32from kofacustom.nigeria.applicants.interfaces import (
33    LGASource, high_qual, high_grade, exam_types,
34    INigeriaUGApplicant, INigeriaPGApplicant,
35    INigeriaApplicantOnlinePayment,
[9497]36    INigeriaUGApplicantEdit,
[8979]37    INigeriaApplicantUpdateByRegNo,
38    IPUTMEApplicantEdit,
[9463]39    OMIT_DISPLAY_FIELDS
[8933]40    )
[8460]41from waeup.fceokene.interfaces import MessageFactory as _
[7853]42
[9463]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
[8933]55class ICustomUGApplicant(INigeriaUGApplicant):
[8012]56    """An undergraduate applicant.
57
[8520]58    This interface defines the least common multiple of all fields
59    in ug application forms. In customized forms, fields can be excluded by
[9463]60    adding them to the OMIT* tuples.
[8012]61    """
62
[9465]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        )
[9463]87    olevel_type = schema.Choice(
[9500]88        title = _(u'1st Qualification Obtained'),
[9463]89        required = False,
90        readonly = False,
[9465]91        vocabulary = exam_types,
92        )
93    olevel_school = schema.TextLine(
[9500]94        title = _(u'1st Institution Attended'),
[9465]95        required = False,
96        readonly = False,
97        )
98    olevel_exam_number = schema.TextLine(
[9500]99        title = _(u'1st Exam Number'),
[9465]100        required = False,
101        readonly = False,
102        )
103    olevel_exam_date = FormattedDate(
[9500]104        title = _(u'1st Exam Date'),
[9465]105        required = False,
106        readonly = False,
107        show_year = True,
108        )
109    olevel_results = schema.List(
[9500]110        title = _(u'1st Exam Results'),
[9465]111        value_type = ResultEntryField(),
112        required = False,
113        readonly = False,
114        default = [],
115        )
[9500]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        )
[9465]145    hq_type = schema.Choice(
146        title = _(u'Qualification Obtained'),
147        required = False,
148        readonly = False,
[9463]149        vocabulary = high_qual,
150        )
[9465]151    hq_matric_no = schema.TextLine(
[9463]152        title = _(u'Former Matric Number'),
153        required = False,
154        readonly = False,
155        )
[9465]156    hq_degree = schema.Choice(
[9463]157        title = _(u'Class of Degree'),
158        required = False,
159        readonly = False,
160        vocabulary = high_grade,
161        )
[9465]162    hq_school = schema.TextLine(
[9463]163        title = _(u'Institution Attended'),
164        required = False,
165        readonly = False,
166        )
[9465]167    hq_session = schema.TextLine(
[9463]168        title = _(u'Years Attended'),
169        required = False,
170        readonly = False,
171        )
[9465]172    hq_disc = schema.TextLine(
[9463]173        title = _(u'Discipline'),
174        required = False,
175        readonly = False,
176        )
[9465]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        )
[9463]224
225
[8933]226class ICustomPGApplicant(INigeriaPGApplicant):
[7853]227    """A postgraduate applicant.
228
[8520]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.
[7866]232    """
233
[8933]234class ICustomApplicant(ICustomUGApplicant, ICustomPGApplicant):
[8012]235    """An interface for both types of applicants.
236
[8933]237    Attention: The ICustomPGApplicant field seetings will be overwritten
238    by ICustomPGApplicant field settings. If a field is defined
[8729]239    in both interfaces zope.schema validates only against the
[8933]240    constraints in ICustomUGApplicant. This does not affect the forms
241    since they are build on either ICustomUGApplicant or ICustomPGApplicant.
[8012]242    """
243
[8745]244    def writeLogMessage(view, comment):
[8053]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
[9497]253class ICustomUGApplicantEdit(ICustomUGApplicant):
[8729]254    """An undergraduate applicant interface for edit forms.
[8012]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
[9497]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):
[7866]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.
[8017]287    """
[8454]288
[9497]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
[8933]300class ICustomApplicantOnlinePayment(INigeriaApplicantOnlinePayment):
[8247]301    """An applicant payment via payment gateways.
302
303    """
[8531]304
[8979]305class IPUTMEApplicantEdit(IPUTMEApplicantEdit):
[8531]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
[8979]317class ICustomApplicantUpdateByRegNo(INigeriaApplicantUpdateByRegNo):
[8584]318    """Representation of an applicant.
319
320    Skip regular reg_number validation if reg_number is used for finding
321    the applicant object.
322    """
[8979]323
Note: See TracBrowser for help on using the repository browser.