source: main/waeup.aaue/trunk/src/waeup/aaue/applicants/interfaces.py @ 10757

Last change on this file since 10757 was 10311, checked in by Henrik Bettermann, 11 years ago

Add jamb_reg_number.

Move jamb fields.

Add phone number on slip.

  • Property svn:keywords set to Id
File size: 9.1 KB
Line 
1## $Id: interfaces.py 10311 2013-06-17 08:34:22Z 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 zope.interface import Attribute, invariant, Invalid
23from waeup.kofa.applicants.interfaces import (
24    IApplicantBaseData,
25    AppCatCertificateSource, CertificateSource)
26from waeup.kofa.schoolgrades import ResultEntryField
27from waeup.kofa.interfaces import (
28    SimpleKofaVocabulary, academic_sessions_vocab, validate_email)
29from waeup.kofa.schema import FormattedDate, TextLineChoice
30from waeup.kofa.students.vocabularies import nats_vocab, GenderSource
31from waeup.kofa.applicants.interfaces import (
32    contextual_reg_num_source,
33    IApplicantBaseData)
34from kofacustom.nigeria.applicants.interfaces import (
35    LGASource, high_qual, high_grade, exam_types,
36    INigeriaUGApplicant, INigeriaPGApplicant,
37    INigeriaApplicantOnlinePayment,
38    INigeriaUGApplicantEdit, INigeriaPGApplicantEdit,
39    INigeriaApplicantUpdateByRegNo,
40    IPUTMEApplicantEdit,
41    )
42from waeup.aaue.interfaces import MessageFactory as _
43from waeup.aaue.payments.interfaces import ICustomOnlinePayment
44
45class ICustomUGApplicant(IApplicantBaseData):
46    """An undergraduate applicant.
47
48    This interface defines the least common multiple of all fields
49    in ug application forms. In customized forms, fields can be excluded by
50    adding them to the UG_OMIT* tuples.
51    """
52
53    nationality = schema.Choice(
54        source = nats_vocab,
55        title = _(u'Nationality'),
56        required = True,
57        )
58    lga = schema.Choice(
59        source = LGASource(),
60        title = _(u'State/LGA (Nigerians only)'),
61        required = False,
62        )
63    perm_address = schema.Text(
64        title = _(u'Permanent Address'),
65        required = False,
66        )
67    home_town = schema.TextLine(
68        title = _(u'Home Town'),
69        required = False,
70        )
71    jamb_reg_number = schema.TextLine(
72        title = _(u'JAMB Registration Number'),
73        required = False,
74        )
75    jamb_score = schema.Int(
76        title = _(u'Total JAMB Score'),
77        required = False,
78        )
79    course1 = schema.Choice(
80        title = _(u'1st Choice Course of Study'),
81        source = AppCatCertificateSource(),
82        required = True,
83        )
84    course2 = schema.Choice(
85        title = _(u'2nd Choice Course of Study'),
86        source = AppCatCertificateSource(),
87        required = False,
88        )
89    fst_sit_fname = schema.TextLine(
90        title = _(u'Full Name'),
91        required = False,
92        readonly = False,
93        )
94    fst_sit_no = schema.TextLine(
95        title = _(u'Exam Number'),
96        required = False,
97        readonly = False,
98        )
99    fst_sit_date = FormattedDate(
100        title = _(u'Exam Date'),
101        required = False,
102        readonly = False,
103        show_year = True,
104        )
105    fst_sit_type = schema.Choice(
106        title = _(u'Exam Type'),
107        required = False,
108        readonly = False,
109        vocabulary = exam_types,
110        )
111    fst_sit_results = schema.List(
112        title = _(u'Exam Results'),
113        value_type = ResultEntryField(),
114        required = False,
115        readonly = False,
116        default = [],
117        )
118    scd_sit_fname = schema.TextLine(
119        title = _(u'Full Name'),
120        required = False,
121        readonly = False,
122        )
123    scd_sit_no = schema.TextLine(
124        title = _(u'Exam Number'),
125        required = False,
126        readonly = False,
127        )
128    scd_sit_date = FormattedDate(
129        title = _(u'Exam Date'),
130        required = False,
131        readonly = False,
132        show_year = True,
133        )
134    scd_sit_type = schema.Choice(
135        title = _(u'Exam Type'),
136        required = False,
137        readonly = False,
138        vocabulary = exam_types,
139        )
140    scd_sit_results = schema.List(
141        title = _(u'Exam Results'),
142        value_type = ResultEntryField(),
143        required = False,
144        readonly = False,
145        default = [],
146        )
147    alr_fname = schema.TextLine(
148        title = _(u'Full Name'),
149        required = False,
150        readonly = False,
151        )
152    alr_no = schema.TextLine(
153        title = _(u'Exam Number'),
154        required = False,
155        readonly = False,
156        )
157    alr_date = FormattedDate(
158        title = _(u'Exam Date'),
159        required = False,
160        readonly = False,
161        show_year = True,
162        )
163    alr_results = schema.List(
164        title = _(u'Exam Results'),
165        value_type = ResultEntryField(),
166        required = False,
167        readonly = False,
168        default = [],
169        )
170    notice = schema.Text(
171        title = _(u'Notice'),
172        required = False,
173        )
174    #screening_venue = schema.TextLine(
175    #    title = _(u'Screening Venue'),
176    #    required = False,
177    #    )
178    #screening_date = schema.TextLine(
179    #    title = _(u'Screening Date'),
180    #    required = False,
181    #    )
182    #screening_score = schema.Int(
183    #    title = _(u'Screening Score (%)'),
184    #    required = False,
185    #    )
186    #aggregate = schema.Int(
187    #    title = _(u'Aggregate Score (%)'),
188    #    description = _(u'(average of relative JAMB and PUTME scores)'),
189    #    required = False,
190    #    )
191    result_uploaded = schema.Bool(
192        title = _(u'Result uploaded'),
193        default = False,
194        )
195    student_id = schema.TextLine(
196        title = _(u'Student Id'),
197        required = False,
198        readonly = False,
199        )
200    course_admitted = schema.Choice(
201        title = _(u'Admitted Course of Study'),
202        source = CertificateSource(),
203        required = False,
204        )
205    locked = schema.Bool(
206        title = _(u'Form locked'),
207        default = False,
208        )
209
210    @invariant
211    def second_choice(applicant):
212        if applicant.course1 == applicant.course2:
213            raise Invalid(_("2nd choice course must differ from 1st choice course."))
214
215class ICustomPGApplicant(INigeriaPGApplicant):
216    """A postgraduate applicant.
217
218    This interface defines the least common multiple of all fields
219    in pg application forms. In customized forms, fields can be excluded by
220    adding them to the PG_OMIT* tuples.
221    """
222
223class ICustomApplicant(ICustomUGApplicant, ICustomPGApplicant):
224    """An interface for both types of applicants.
225
226    Attention: The ICustomPGApplicant field seetings will be overwritten
227    by ICustomPGApplicant field settings. If a field is defined
228    in both interfaces zope.schema validates only against the
229    constraints in ICustomUGApplicant. This does not affect the forms
230    since they are build on either ICustomUGApplicant or ICustomPGApplicant.
231    """
232
233    def writeLogMessage(view, comment):
234        """Adds an INFO message to the log file
235        """
236
237    def createStudent():
238        """Create a student object from applicatnt data
239        and copy applicant object.
240        """
241
242class ICustomUGApplicantEdit(ICustomUGApplicant):
243    """An undergraduate applicant interface for edit forms.
244
245    Here we can repeat the fields from base data and set the
246    `required` and `readonly` attributes to True to further restrict
247    the data access. Or we can allow only certain certificates to be
248    selected by choosing the appropriate source.
249
250    We cannot omit fields here. This has to be done in the
251    respective form page.
252    """
253
254class ICustomPGApplicantEdit(INigeriaPGApplicantEdit):
255    """A postgraduate applicant interface for editing.
256
257    Here we can repeat the fields from base data and set the
258    `required` and `readonly` attributes to True to further restrict
259    the data access. Or we can allow only certain certificates to be
260    selected by choosing the appropriate source.
261
262    We cannot omit fields here. This has to be done in the
263    respective form page.
264    """
265
266class ICustomApplicantOnlinePayment(INigeriaApplicantOnlinePayment):
267    """An applicant payment via payment gateways.
268
269    """
270
271class IPUTMEApplicantEdit(IPUTMEApplicantEdit):
272    """An undergraduate applicant interface for editing.
273
274    Here we can repeat the fields from base data and set the
275    `required` and `readonly` attributes to True to further restrict
276    the data access. Or we can allow only certain certificates to be
277    selected by choosing the appropriate source.
278
279    We cannot omit fields here. This has to be done in the
280    respective form page.
281    """
282
283class ICustomApplicantUpdateByRegNo(INigeriaApplicantUpdateByRegNo):
284    """Representation of an applicant.
285
286    Skip regular reg_number validation if reg_number is used for finding
287    the applicant object.
288    """
289
Note: See TracBrowser for help on using the repository browser.