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

Last change on this file since 9474 was 9465, checked in by Henrik Bettermann, 12 years ago

Customize INigeriaUGApplicant for BEC application.

  • Property svn:keywords set to Id
File size: 8.6 KB
Line 
1## $Id: interfaces.py 9465 2012-10-30 12:25:09Z 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.schoolgrades import ResultEntryField
30from waeup.kofa.students.vocabularies import nats_vocab, GenderSource
31from waeup.kofa.applicants.interfaces import contextual_reg_num_source
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    OMIT_DISPLAY_FIELDS
40    )
41from waeup.fceokene.interfaces import MessageFactory as _
42
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
55class ICustomUGApplicant(INigeriaUGApplicant):
56    """An undergraduate applicant.
57
58    This interface defines the least common multiple of all fields
59    in ug application forms. In customized forms, fields can be excluded by
60    adding them to the OMIT* tuples.
61    """
62
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        )
87    olevel_type = schema.Choice(
88        title = _(u'Qualification Obtained'),
89        required = False,
90        readonly = False,
91        vocabulary = exam_types,
92        )
93    olevel_school = schema.TextLine(
94        title = _(u'Institution Attended'),
95        required = False,
96        readonly = False,
97        )
98    olevel_exam_number = schema.TextLine(
99        title = _(u'Exam Number'),
100        required = False,
101        readonly = False,
102        )
103    olevel_exam_date = FormattedDate(
104        title = _(u'Exam Date'),
105        required = False,
106        readonly = False,
107        show_year = True,
108        )
109    olevel_results = schema.List(
110        title = _(u'Exam Results'),
111        value_type = ResultEntryField(),
112        required = False,
113        readonly = False,
114        default = [],
115        )
116    hq_type = schema.Choice(
117        title = _(u'Qualification Obtained'),
118        required = False,
119        readonly = False,
120        vocabulary = high_qual,
121        )
122    hq_matric_no = schema.TextLine(
123        title = _(u'Former Matric Number'),
124        required = False,
125        readonly = False,
126        )
127    hq_degree = schema.Choice(
128        title = _(u'Class of Degree'),
129        required = False,
130        readonly = False,
131        vocabulary = high_grade,
132        )
133    hq_school = schema.TextLine(
134        title = _(u'Institution Attended'),
135        required = False,
136        readonly = False,
137        )
138    hq_session = schema.TextLine(
139        title = _(u'Years Attended'),
140        required = False,
141        readonly = False,
142        )
143    hq_disc = schema.TextLine(
144        title = _(u'Discipline'),
145        required = False,
146        readonly = False,
147        )
148    jamb_subjects = schema.Text(
149        title = _(u'Subjects and Scores'),
150        required = False,
151        )
152    jamb_score = schema.Int(
153        title = _(u'Total JAMB Score'),
154        required = False,
155        )
156    notice = schema.Text(
157        title = _(u'Notice'),
158        required = False,
159        )
160    screening_venue = schema.TextLine(
161        title = _(u'Screening Venue'),
162        required = False,
163        )
164    screening_date = schema.TextLine(
165        title = _(u'Screening Date'),
166        required = False,
167        )
168    screening_score = schema.Int(
169        title = _(u'Screening Score (%)'),
170        required = False,
171        )
172    aggregate = schema.Int(
173        title = _(u'Aggregate Score (%)'),
174        description = _(u'(average of relative JAMB and PUTME scores)'),
175        required = False,
176        )
177    result_uploaded = schema.Bool(
178        title = _(u'Result uploaded'),
179        default = False,
180        )
181    student_id = schema.TextLine(
182        title = _(u'Student Id'),
183        required = False,
184        readonly = False,
185        )
186    course_admitted = schema.Choice(
187        title = _(u'Admitted Course of Study'),
188        source = CertificateSource(),
189        required = False,
190        )
191    locked = schema.Bool(
192        title = _(u'Form locked'),
193        default = False,
194        )
195
196
197class ICustomPGApplicant(INigeriaPGApplicant):
198    """A postgraduate applicant.
199
200    This interface defines the least common multiple of all fields
201    in pg application forms. In customized forms, fields can be excluded by
202    adding them to the PG_OMIT* tuples.
203    """
204
205class ICustomApplicant(ICustomUGApplicant, ICustomPGApplicant):
206    """An interface for both types of applicants.
207
208    Attention: The ICustomPGApplicant field seetings will be overwritten
209    by ICustomPGApplicant field settings. If a field is defined
210    in both interfaces zope.schema validates only against the
211    constraints in ICustomUGApplicant. This does not affect the forms
212    since they are build on either ICustomUGApplicant or ICustomPGApplicant.
213    """
214
215    def writeLogMessage(view, comment):
216        """Adds an INFO message to the log file
217        """
218
219    def createStudent():
220        """Create a student object from applicatnt data
221        and copy applicant object.
222        """
223
224class ICustomUGApplicantEdit(INigeriaUGApplicantEdit):
225    """An undergraduate applicant interface for edit forms.
226
227    Here we can repeat the fields from base data and set the
228    `required` and `readonly` attributes to True to further restrict
229    the data access. Or we can allow only certain certificates to be
230    selected by choosing the appropriate source.
231
232    We cannot omit fields here. This has to be done in the
233    respective form page.
234    """
235
236class ICustomPGApplicantEdit(INigeriaPGApplicantEdit):
237    """A postgraduate applicant interface for editing.
238
239    Here we can repeat the fields from base data and set the
240    `required` and `readonly` attributes to True to further restrict
241    the data access. Or we can allow only certain certificates to be
242    selected by choosing the appropriate source.
243
244    We cannot omit fields here. This has to be done in the
245    respective form page.
246    """
247
248class ICustomApplicantOnlinePayment(INigeriaApplicantOnlinePayment):
249    """An applicant payment via payment gateways.
250
251    """
252
253class IPUTMEApplicantEdit(IPUTMEApplicantEdit):
254    """An undergraduate applicant interface for editing.
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
265class ICustomApplicantUpdateByRegNo(INigeriaApplicantUpdateByRegNo):
266    """Representation of an applicant.
267
268    Skip regular reg_number validation if reg_number is used for finding
269    the applicant object.
270    """
271
Note: See TracBrowser for help on using the repository browser.