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

Last change on this file since 8599 was 8584, checked in by Henrik Bettermann, 13 years ago

Update according to r8577 - r8582.

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