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

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

Add 'home town' field.

  • Property svn:keywords set to Id
File size: 9.1 KB
Line 
1## $Id: interfaces.py 10306 2013-06-16 20:24:10Z 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.Text(
68        title = _(u'Home Town'),
69        required = False,
70        )
71    course1 = schema.Choice(
72        title = _(u'1st Choice Course of Study'),
73        source = AppCatCertificateSource(),
74        required = True,
75        )
76    course2 = schema.Choice(
77        title = _(u'2nd Choice Course of Study'),
78        source = AppCatCertificateSource(),
79        required = False,
80        )
81    fst_sit_fname = schema.TextLine(
82        title = _(u'Full Name'),
83        required = False,
84        readonly = False,
85        )
86    fst_sit_no = schema.TextLine(
87        title = _(u'Exam Number'),
88        required = False,
89        readonly = False,
90        )
91    fst_sit_date = FormattedDate(
92        title = _(u'Exam Date'),
93        required = False,
94        readonly = False,
95        show_year = True,
96        )
97    fst_sit_type = schema.Choice(
98        title = _(u'Exam Type'),
99        required = False,
100        readonly = False,
101        vocabulary = exam_types,
102        )
103    fst_sit_results = schema.List(
104        title = _(u'Exam Results'),
105        value_type = ResultEntryField(),
106        required = False,
107        readonly = False,
108        default = [],
109        )
110    scd_sit_fname = schema.TextLine(
111        title = _(u'Full Name'),
112        required = False,
113        readonly = False,
114        )
115    scd_sit_no = schema.TextLine(
116        title = _(u'Exam Number'),
117        required = False,
118        readonly = False,
119        )
120    scd_sit_date = FormattedDate(
121        title = _(u'Exam Date'),
122        required = False,
123        readonly = False,
124        show_year = True,
125        )
126    scd_sit_type = schema.Choice(
127        title = _(u'Exam Type'),
128        required = False,
129        readonly = False,
130        vocabulary = exam_types,
131        )
132    scd_sit_results = schema.List(
133        title = _(u'Exam Results'),
134        value_type = ResultEntryField(),
135        required = False,
136        readonly = False,
137        default = [],
138        )
139    alr_fname = schema.TextLine(
140        title = _(u'Full Name'),
141        required = False,
142        readonly = False,
143        )
144    alr_no = schema.TextLine(
145        title = _(u'Exam Number'),
146        required = False,
147        readonly = False,
148        )
149    alr_date = FormattedDate(
150        title = _(u'Exam Date'),
151        required = False,
152        readonly = False,
153        show_year = True,
154        )
155    alr_results = schema.List(
156        title = _(u'Exam Results'),
157        value_type = ResultEntryField(),
158        required = False,
159        readonly = False,
160        default = [],
161        )
162    jamb_subjects = schema.Text(
163        title = _(u'Subjects and Scores'),
164        required = False,
165        )
166    jamb_score = schema.Int(
167        title = _(u'Total JAMB Score'),
168        required = False,
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.