source: main/waeup.kwarapoly/trunk/src/waeup/kwarapoly/applicants/interfaces.py @ 10167

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

Add JAMB Registration Number.

  • Property svn:keywords set to Id
File size: 8.3 KB
Line 
1## $Id: interfaces.py 10167 2013-05-10 13:48:20Z 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 kofacustom.nigeria.applicants.interfaces import (
32    LGASource, high_qual, high_grade, exam_types,
33    OMIT_DISPLAY_FIELDS,
34    INigeriaUGApplicant, INigeriaPGApplicant,
35    INigeriaApplicantOnlinePayment,
36    INigeriaUGApplicantEdit, INigeriaPGApplicantEdit,
37    INigeriaApplicantUpdateByRegNo,
38    IPUTMEApplicantEdit,
39    )
40from waeup.kwarapoly.interfaces import MessageFactory as _
41from waeup.kwarapoly.payments.interfaces import ICustomOnlinePayment
42
43ND_OMIT_DISPLAY_FIELDS = OMIT_DISPLAY_FIELDS + (
44    'hq_type',
45    'hq_matric_no',
46    'hq_degree',
47    'hq_school',
48    'hq_session',
49    'hq_disc',
50    'hq_type')
51ND_OMIT_PDF_FIELDS = ND_OMIT_DISPLAY_FIELDS + ('phone',)
52ND_OMIT_MANAGE_FIELDS = ()
53ND_OMIT_EDIT_FIELDS = ND_OMIT_MANAGE_FIELDS + ND_OMIT_DISPLAY_FIELDS + (
54    'student_id', 'notice',
55    'screening_score',
56    'screening_venue',
57    'screening_date',
58    'jamb_subjects',
59    'jamb_score',
60    'aggregate')
61
62class ICustomUGApplicant(IApplicantBaseData):
63    """An undergraduate applicant.
64
65    This interface defines the least common multiple of all fields
66    in ug application forms. In customized forms, fields can be excluded by
67    adding them to the UG_OMIT* tuples.
68    """
69
70    nationality = schema.Choice(
71        source = nats_vocab,
72        title = _(u'Nationality'),
73        required = True,
74        )
75    lga = schema.Choice(
76        source = LGASource(),
77        title = _(u'State/LGA (Nigerians only)'),
78        required = False,
79        )
80    #perm_address = schema.Text(
81    #    title = _(u'Permanent Address'),
82    #    required = False,
83    #    )
84    next_kin_address = schema.Text(
85        title = _(u'Next of Kin Address'),
86        required = False,
87        )
88    jamb_reg_number = schema.TextLine(
89        title = _(u'JAMB Registration Number'),
90        required = False,
91        )
92    course1 = schema.Choice(
93        title = _(u'1st Choice Course of Study'),
94        source = AppCatCertificateSource(),
95        required = True,
96        )
97    course2 = schema.Choice(
98        title = _(u'2nd Choice Course of Study'),
99        source = AppCatCertificateSource(),
100        required = False,
101        )
102    olevel_type = schema.Choice(
103        title = _(u'Qualification Obtained'),
104        required = False,
105        readonly = False,
106        vocabulary = exam_types,
107        )
108    olevel_school = schema.TextLine(
109        title = _(u'Institution Attended'),
110        required = False,
111        readonly = False,
112        )
113    olevel_exam_number = schema.TextLine(
114        title = _(u'Exam Number'),
115        required = False,
116        readonly = False,
117        )
118    olevel_exam_date = FormattedDate(
119        title = _(u'Exam Date'),
120        required = False,
121        readonly = False,
122        show_year = True,
123        )
124    olevel_results = schema.List(
125        title = _(u'Exam Results'),
126        value_type = ResultEntryField(),
127        required = False,
128        readonly = False,
129        default = [],
130        )
131    hq_type = schema.Choice(
132        title = _(u'Qualification Obtained'),
133        required = False,
134        readonly = False,
135        vocabulary = high_qual,
136        )
137    hq_matric_no = schema.TextLine(
138        title = _(u'Former Matric Number'),
139        required = False,
140        readonly = False,
141        )
142    hq_degree = schema.Choice(
143        title = _(u'Class of Degree'),
144        required = False,
145        readonly = False,
146        vocabulary = high_grade,
147        )
148    hq_school = schema.TextLine(
149        title = _(u'Institution Attended'),
150        required = False,
151        readonly = False,
152        )
153    hq_session = schema.TextLine(
154        title = _(u'Years Attended'),
155        required = False,
156        readonly = False,
157        )
158    hq_disc = schema.TextLine(
159        title = _(u'Discipline'),
160        required = False,
161        readonly = False,
162        )
163    jamb_subjects = schema.Text(
164        title = _(u'Subjects and Scores'),
165        required = False,
166        )
167    jamb_score = schema.Int(
168        title = _(u'Total JAMB Score'),
169        required = False,
170        )
171    notice = schema.Text(
172        title = _(u'Notice'),
173        required = False,
174        )
175    screening_venue = schema.TextLine(
176        title = _(u'Screening Venue'),
177        required = False,
178        )
179    screening_date = schema.TextLine(
180        title = _(u'Screening Date'),
181        required = False,
182        )
183    screening_score = schema.Int(
184        title = _(u'Screening Score (%)'),
185        required = False,
186        )
187    aggregate = schema.Int(
188        title = _(u'Aggregate Score (%)'),
189        description = _(u'(average of relative JAMB and PUTME scores)'),
190        required = False,
191        )
192    result_uploaded = schema.Bool(
193        title = _(u'Result uploaded'),
194        default = False,
195        )
196    student_id = schema.TextLine(
197        title = _(u'Student Id'),
198        required = False,
199        readonly = False,
200        )
201    course_admitted = schema.Choice(
202        title = _(u'Admitted Course of Study'),
203        source = CertificateSource(),
204        required = False,
205        )
206    locked = schema.Bool(
207        title = _(u'Form locked'),
208        default = False,
209        )
210
211class ICustomPGApplicant(INigeriaPGApplicant):
212    """A postgraduate applicant.
213
214    This interface defines the least common multiple of all fields
215    in pg application forms. In customized forms, fields can be excluded by
216    adding them to the PG_OMIT* tuples.
217    """
218
219class ICustomApplicant(ICustomUGApplicant, ICustomPGApplicant):
220    """An interface for both types of applicants.
221
222    Attention: The ICustomPGApplicant field seetings will be overwritten
223    by ICustomPGApplicant field settings. If a field is defined
224    in both interfaces zope.schema validates only against the
225    constraints in ICustomUGApplicant. This does not affect the forms
226    since they are build on either ICustomUGApplicant or ICustomPGApplicant.
227    """
228
229    def writeLogMessage(view, comment):
230        """Adds an INFO message to the log file
231        """
232
233    def createStudent():
234        """Create a student object from applicatnt data
235        and copy applicant object.
236        """
237
238class ICustomUGApplicantEdit(ICustomUGApplicant):
239    """An undergraduate applicant interface for edit forms.
240
241    Here we can repeat the fields from base data and set the
242    `required` and `readonly` attributes to True to further restrict
243    the data access. Or we can allow only certain certificates to be
244    selected by choosing the appropriate source.
245
246    We cannot omit fields here. This has to be done in the
247    respective form page.
248    """
249
250class ICustomPGApplicantEdit(INigeriaPGApplicantEdit):
251    """A postgraduate applicant interface for editing.
252
253    Here we can repeat the fields from base data and set the
254    `required` and `readonly` attributes to True to further restrict
255    the data access. Or we can allow only certain certificates to be
256    selected by choosing the appropriate source.
257
258    We cannot omit fields here. This has to be done in the
259    respective form page.
260    """
261
262class ICustomApplicantOnlinePayment(INigeriaApplicantOnlinePayment):
263    """An applicant payment via payment gateways.
264
265    """
266
Note: See TracBrowser for help on using the repository browser.