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

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

See r8530

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