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

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

UG applicants: make jamb_subjects' and jamb_score editable.

  • Property svn:keywords set to Id
File size: 8.4 KB
Line 
1## $Id: interfaces.py 10590 2013-09-05 21:23:45Z 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        description = _(u'(one subject with score per line)'),
166        required = False,
167        )
168    jamb_score = schema.Int(
169        title = _(u'Total JAMB Score'),
170        required = False,
171        )
172    notice = schema.Text(
173        title = _(u'Notice'),
174        required = False,
175        )
176    screening_venue = schema.TextLine(
177        title = _(u'Screening Venue'),
178        required = False,
179        )
180    screening_date = schema.TextLine(
181        title = _(u'Screening Date'),
182        required = False,
183        )
184    screening_score = schema.Int(
185        title = _(u'Screening Score (%)'),
186        required = False,
187        )
188    aggregate = schema.Int(
189        title = _(u'Aggregate Score (%)'),
190        description = _(u'(average of relative JAMB and PUTME scores)'),
191        required = False,
192        )
193    result_uploaded = schema.Bool(
194        title = _(u'Result uploaded'),
195        default = False,
196        )
197    student_id = schema.TextLine(
198        title = _(u'Student Id'),
199        required = False,
200        readonly = False,
201        )
202    course_admitted = schema.Choice(
203        title = _(u'Admitted Course of Study'),
204        source = CertificateSource(),
205        required = False,
206        )
207    locked = schema.Bool(
208        title = _(u'Form locked'),
209        default = False,
210        )
211
212class ICustomPGApplicant(INigeriaPGApplicant):
213    """A postgraduate applicant.
214
215    This interface defines the least common multiple of all fields
216    in pg application forms. In customized forms, fields can be excluded by
217    adding them to the PG_OMIT* tuples.
218    """
219
220class ICustomApplicant(ICustomUGApplicant, ICustomPGApplicant):
221    """An interface for both types of applicants.
222
223    Attention: The ICustomPGApplicant field seetings will be overwritten
224    by ICustomPGApplicant field settings. If a field is defined
225    in both interfaces zope.schema validates only against the
226    constraints in ICustomUGApplicant. This does not affect the forms
227    since they are build on either ICustomUGApplicant or ICustomPGApplicant.
228    """
229
230    def writeLogMessage(view, comment):
231        """Adds an INFO message to the log file
232        """
233
234    def createStudent():
235        """Create a student object from applicatnt data
236        and copy applicant object.
237        """
238
239class ICustomUGApplicantEdit(ICustomUGApplicant):
240    """An undergraduate applicant interface for edit forms.
241
242    Here we can repeat the fields from base data and set the
243    `required` and `readonly` attributes to True to further restrict
244    the data access. Or we can allow only certain certificates to be
245    selected by choosing the appropriate source.
246
247    We cannot omit fields here. This has to be done in the
248    respective form page.
249    """
250
251class ICustomPGApplicantEdit(INigeriaPGApplicantEdit):
252    """A postgraduate applicant interface for editing.
253
254    Here we can repeat the fields from base data and set the
255    `required` and `readonly` attributes to True to further restrict
256    the data access. Or we can allow only certain certificates to be
257    selected by choosing the appropriate source.
258
259    We cannot omit fields here. This has to be done in the
260    respective form page.
261    """
262
263class ICustomApplicantOnlinePayment(INigeriaApplicantOnlinePayment):
264    """An applicant payment via payment gateways.
265
266    """
267
Note: See TracBrowser for help on using the repository browser.