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

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

Customize application forms. KwaraPoly? distinguishes nd and hnd ug applicants. This causes a lot of customization.

  • Property svn:keywords set to Id
File size: 8.2 KB
Line 
1## $Id: interfaces.py 10132 2013-05-01 06:53:18Z 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    course1 = schema.Choice(
89        title = _(u'1st Choice Course of Study'),
90        source = AppCatCertificateSource(),
91        required = True,
92        )
93    course2 = schema.Choice(
94        title = _(u'2nd Choice Course of Study'),
95        source = AppCatCertificateSource(),
96        required = False,
97        )
98    olevel_type = schema.Choice(
99        title = _(u'Qualification Obtained'),
100        required = False,
101        readonly = False,
102        vocabulary = exam_types,
103        )
104    olevel_school = schema.TextLine(
105        title = _(u'Institution Attended'),
106        required = False,
107        readonly = False,
108        )
109    olevel_exam_number = schema.TextLine(
110        title = _(u'Exam Number'),
111        required = False,
112        readonly = False,
113        )
114    olevel_exam_date = FormattedDate(
115        title = _(u'Exam Date'),
116        required = False,
117        readonly = False,
118        show_year = True,
119        )
120    olevel_results = schema.List(
121        title = _(u'Exam Results'),
122        value_type = ResultEntryField(),
123        required = False,
124        readonly = False,
125        default = [],
126        )
127    hq_type = schema.Choice(
128        title = _(u'Qualification Obtained'),
129        required = False,
130        readonly = False,
131        vocabulary = high_qual,
132        )
133    hq_matric_no = schema.TextLine(
134        title = _(u'Former Matric Number'),
135        required = False,
136        readonly = False,
137        )
138    hq_degree = schema.Choice(
139        title = _(u'Class of Degree'),
140        required = False,
141        readonly = False,
142        vocabulary = high_grade,
143        )
144    hq_school = schema.TextLine(
145        title = _(u'Institution Attended'),
146        required = False,
147        readonly = False,
148        )
149    hq_session = schema.TextLine(
150        title = _(u'Years Attended'),
151        required = False,
152        readonly = False,
153        )
154    hq_disc = schema.TextLine(
155        title = _(u'Discipline'),
156        required = False,
157        readonly = False,
158        )
159    jamb_subjects = schema.Text(
160        title = _(u'Subjects and Scores'),
161        required = False,
162        )
163    jamb_score = schema.Int(
164        title = _(u'Total JAMB Score'),
165        required = False,
166        )
167    notice = schema.Text(
168        title = _(u'Notice'),
169        required = False,
170        )
171    screening_venue = schema.TextLine(
172        title = _(u'Screening Venue'),
173        required = False,
174        )
175    screening_date = schema.TextLine(
176        title = _(u'Screening Date'),
177        required = False,
178        )
179    screening_score = schema.Int(
180        title = _(u'Screening Score (%)'),
181        required = False,
182        )
183    aggregate = schema.Int(
184        title = _(u'Aggregate Score (%)'),
185        description = _(u'(average of relative JAMB and PUTME scores)'),
186        required = False,
187        )
188    result_uploaded = schema.Bool(
189        title = _(u'Result uploaded'),
190        default = False,
191        )
192    student_id = schema.TextLine(
193        title = _(u'Student Id'),
194        required = False,
195        readonly = False,
196        )
197    course_admitted = schema.Choice(
198        title = _(u'Admitted Course of Study'),
199        source = CertificateSource(),
200        required = False,
201        )
202    locked = schema.Bool(
203        title = _(u'Form locked'),
204        default = False,
205        )
206
207class ICustomPGApplicant(INigeriaPGApplicant):
208    """A postgraduate applicant.
209
210    This interface defines the least common multiple of all fields
211    in pg application forms. In customized forms, fields can be excluded by
212    adding them to the PG_OMIT* tuples.
213    """
214
215class ICustomApplicant(ICustomUGApplicant, ICustomPGApplicant):
216    """An interface for both types of applicants.
217
218    Attention: The ICustomPGApplicant field seetings will be overwritten
219    by ICustomPGApplicant field settings. If a field is defined
220    in both interfaces zope.schema validates only against the
221    constraints in ICustomUGApplicant. This does not affect the forms
222    since they are build on either ICustomUGApplicant or ICustomPGApplicant.
223    """
224
225    def writeLogMessage(view, comment):
226        """Adds an INFO message to the log file
227        """
228
229    def createStudent():
230        """Create a student object from applicatnt data
231        and copy applicant object.
232        """
233
234class ICustomUGApplicantEdit(ICustomUGApplicant):
235    """An undergraduate applicant interface for edit forms.
236
237    Here we can repeat the fields from base data and set the
238    `required` and `readonly` attributes to True to further restrict
239    the data access. Or we can allow only certain certificates to be
240    selected by choosing the appropriate source.
241
242    We cannot omit fields here. This has to be done in the
243    respective form page.
244    """
245
246class ICustomPGApplicantEdit(INigeriaPGApplicantEdit):
247    """A postgraduate applicant interface for editing.
248
249    Here we can repeat the fields from base data and set the
250    `required` and `readonly` attributes to True to further restrict
251    the data access. Or we can allow only certain certificates to be
252    selected by choosing the appropriate source.
253
254    We cannot omit fields here. This has to be done in the
255    respective form page.
256    """
257
258class ICustomApplicantOnlinePayment(INigeriaApplicantOnlinePayment):
259    """An applicant payment via payment gateways.
260
261    """
262
Note: See TracBrowser for help on using the repository browser.