source: main/waeup.uniben/trunk/src/waeup/uniben/applicants/interfaces.py @ 8535

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

Application fee is now determined in base package.

Add jamb_subjects field.

  • Property svn:keywords set to Id
File size: 10.6 KB
Line 
1## $Id: interfaces.py 8535 2012-05-28 05:24: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 waeup.uniben.interfaces import (
32    LGASource, high_qual, high_grade, exam_types)
33from waeup.uniben.interfaces import MessageFactory as _
34from waeup.uniben.payments.interfaces import ICustomOnlinePayment
35
36UG_OMIT_DISPLAY_FIELDS = ('locked', 'course_admitted', 'password')
37UG_OMIT_MANAGE_FIELDS = ()
38UG_OMIT_EDIT_FIELDS = UG_OMIT_MANAGE_FIELDS + ('locked', 'course_admitted',
39    'student_id', 'screening_score', 'screening_venue')
40PUTME_OMIT_EDIT_FIELDS = UG_OMIT_EDIT_FIELDS + (
41    'firstname', 'middlename', 'lastname', 'sex',
42    'course1', 'lga', 'jamb_score', 'jamb_subjects')
43
44PG_OMIT_DISPLAY_FIELDS = ('locked', 'course_admitted', 'password')
45PG_OMIT_MANAGE_FIELDS = ()
46PG_OMIT_EDIT_FIELDS = PG_OMIT_MANAGE_FIELDS + (
47    'locked', 'course_admitted',
48    'student_id', 'screening_score', 'screening_venue')
49
50class IUGApplicant(IApplicantBaseData):
51    """An undergraduate applicant.
52
53    This interface defines the least common multiple of all fields
54    in ug application forms. In customized forms, fields can be excluded by
55    adding them to the UG_OMIT* tuples.
56    """
57
58    nationality = schema.Choice(
59        source = nats_vocab,
60        title = _(u'Nationality'),
61        required = False,
62        )
63    lga = schema.Choice(
64        source = LGASource(),
65        title = _(u'State/LGA (Nigerians only)'),
66        required = False,
67        )
68    perm_address = schema.Text(
69        title = _(u'Permanent Address'),
70        required = False,
71        )
72    course1 = schema.Choice(
73        title = _(u'1st Choice Course of Study'),
74        source = AppCatCertificateSource(),
75        required = True,
76        )
77    course2 = schema.Choice(
78        title = _(u'2nd Choice Course of Study'),
79        source = AppCatCertificateSource(),
80        required = False,
81        )
82    jamb_subjects = schema.Text(
83        title = _(u'Subjects and Scores'),
84        required = False,
85        )
86    jamb_score = schema.Int(
87        title = _(u'Total Score'),
88        required = False,
89        )
90    notice = schema.Text(
91        title = _(u'Notice'),
92        required = False,
93        )
94    screening_venue = schema.TextLine(
95        title = _(u'Screening Venue'),
96        required = False,
97        )
98    screening_score = schema.Int(
99        title = _(u'Screening Score'),
100        required = False,
101        )
102    student_id = schema.TextLine(
103        title = _(u'Student Id'),
104        required = False,
105        readonly = False,
106        )
107    course_admitted = schema.Choice(
108        title = _(u'Admitted Course of Study'),
109        source = CertificateSource(),
110        required = False,
111        )
112    locked = schema.Bool(
113        title = _(u'Form locked'),
114        default = False,
115        )
116
117class IPGApplicant(IApplicantBaseData):
118    """A postgraduate applicant.
119
120    This interface defines the least common multiple of all fields
121    in pg application forms. In customized forms, fields can be excluded by
122    adding them to the PG_OMIT* tuples.
123    """
124
125    nationality = schema.Choice(
126        source = nats_vocab,
127        title = _(u'Nationality'),
128        required = False,
129        )
130    lga = schema.Choice(
131        source = LGASource(),
132        title = _(u'State/LGA (Nigerians only)'),
133        required = False,
134        )
135    perm_address = schema.Text(
136        title = _(u'Permanent Address'),
137        required = False,
138        )
139    course1 = schema.Choice(
140        title = _(u'1st Choice Course of Study'),
141        source = AppCatCertificateSource(),
142        required = True,
143        )
144    course2 = schema.Choice(
145        title = _(u'2nd Choice Course of Study'),
146        source = AppCatCertificateSource(),
147        required = False,
148        )
149    hq_type = schema.Choice(
150        title = _(u'Qualification Obtained'),
151        required = False,
152        readonly = False,
153        vocabulary = high_qual,
154        )
155    hq_matric_no = schema.TextLine(
156        title = _(u'Former Matric Number'),
157        required = False,
158        readonly = False,
159        )
160    hq_degree = schema.Choice(
161        title = _(u'Class of Degree'),
162        required = False,
163        readonly = False,
164        vocabulary = high_grade,
165        )
166    hq_school = schema.TextLine(
167        title = _(u'Institution Attended'),
168        required = False,
169        readonly = False,
170        )
171    hq_session = schema.TextLine(
172        title = _(u'Years Attended'),
173        required = False,
174        readonly = False,
175        )
176    hq_disc = schema.TextLine(
177        title = _(u'Discipline'),
178        required = False,
179        readonly = False,
180        )
181    pp_school = schema.Choice(
182        title = _(u'Qualification Obtained'),
183        required = False,
184        readonly = False,
185        vocabulary = exam_types,
186        )
187    #presently = schema.Bool(
188    #    title = _(u'Attending'),
189    #    required = False,
190    #    readonly = False,
191    #    )
192    presently_inst = schema.TextLine(
193        title = _(u'If yes, name of institution'),
194        required = False,
195        readonly = False,
196        )
197    nysc_year = schema.Int(
198        title = _(u'Nysc Year'),
199        required = False,
200        readonly = False,
201        )
202    nysc_lga = schema.Choice(
203        source = LGASource(),
204        title = _(u'Nysc Location'),
205        required = False,
206        )
207    employer = schema.TextLine(
208        title = _(u'Employer'),
209        required = False,
210        readonly = False,
211        )
212    emp_position = schema.TextLine(
213        title = _(u'Employer Position'),
214        required = False,
215        readonly = False,
216        )
217    emp_start = FormattedDate(
218        title = _(u'Start Date'),
219        required = False,
220        readonly = False,
221        show_year = True,
222        )
223    emp_end = FormattedDate(
224        title = _(u'End Date'),
225        required = False,
226        readonly = False,
227        show_year = True,
228        )
229    emp_reason = schema.TextLine(
230        title = _(u'Reason for Leaving'),
231        required = False,
232        readonly = False,
233        )
234    employer2 = schema.TextLine(
235        title = _(u'2nd Employer'),
236        required = False,
237        readonly = False,
238        )
239    emp2_position = schema.TextLine(
240        title = _(u'2nd Employer Position'),
241        required = False,
242        readonly = False,
243        )
244    emp2_start = FormattedDate(
245        title = _(u'Start Date'),
246        required = False,
247        readonly = False,
248        show_year = True,
249        )
250    emp2_end = FormattedDate(
251        title = _(u'End Date'),
252        required = False,
253        readonly = False,
254        show_year = True,
255        )
256    emp2_reason = schema.TextLine(
257        title = _(u'Reason for Leaving'),
258        required = False,
259        readonly = False,
260        )
261    notice = schema.Text(
262        title = _(u'Notice'),
263        required = False,
264        readonly = False,
265        )
266    screening_venue = schema.TextLine(
267        title = _(u'Screening Venue'),
268        required = False,
269        readonly = False,
270        )
271    screening_score = schema.Int(
272        title = _(u'Screening Score'),
273        required = False,
274        readonly = False,
275        )
276    student_id = schema.TextLine(
277        title = _(u'Student Id'),
278        required = False,
279        readonly = False,
280        )
281    course_admitted = schema.Choice(
282        title = _(u'Admitted Course of Study'),
283        source = CertificateSource(),
284        required = False,
285        readonly = False,
286        )
287    locked = schema.Bool(
288        title = _(u'Form locked'),
289        default = False,
290        )
291
292class ICustomApplicant(IUGApplicant,IPGApplicant):
293    """An interface for both types of applicants.
294
295    """
296
297    def loggerInfo(ob_class, comment):
298        """Adds an INFO message to the log file
299        """
300
301    def createStudent():
302        """Create a student object from applicatnt data
303        and copy applicant object.
304        """
305
306class IUGApplicantEdit(IUGApplicant):
307    """An undergraduate applicant interface for editing.
308
309    Here we can repeat the fields from base data and set the
310    `required` and `readonly` attributes to True to further restrict
311    the data access. Or we can allow only certain certificates to be
312    selected by choosing the appropriate source.
313
314    We cannot omit fields here. This has to be done in the
315    respective form page.
316    """
317
318class IPGApplicantEdit(IPGApplicant):
319    """A postgraduate applicant interface for editing.
320
321    Here we can repeat the fields from base data and set the
322    `required` and `readonly` attributes to True to further restrict
323    the data access. Or we can allow only certain certificates to be
324    selected by choosing the appropriate source.
325
326    We cannot omit fields here. This has to be done in the
327    respective form page.
328    """
329
330class ICustomApplicantOnlinePayment(ICustomOnlinePayment):
331    """An applicant payment via payment gateways.
332
333    """
334
335class IPUTMEApplicantEdit(IUGApplicant):
336    """An undergraduate applicant interface for editing.
337
338    Here we can repeat the fields from base data and set the
339    `required` and `readonly` attributes to True to further restrict
340    the data access. Or we can allow only certain certificates to be
341    selected by choosing the appropriate source.
342
343    We cannot omit fields here. This has to be done in the
344    respective form page.
345    """
346    email = schema.ASCIILine(
347        title = _(u'Email Address'),
348        required = True,
349        constraint=validate_email,
350        )
351
352IPUTMEApplicantEdit[
353    'email'].order =  IUGApplicant['email'].order
Note: See TracBrowser for help on using the repository browser.