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

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

Enable import of empty sex and course1 cells.

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