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

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

Add screening_date textline field.

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