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

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

Catch up on changes made in waeup.uniben.

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