source: main/waeup.futminna/trunk/src/waeup/futminna/applicants/interfaces.py @ 10216

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

Start customization of ICustomUGApplicant.

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