source: main/kofacustom.udss/trunk/src/kofacustom/udss/applicants/interfaces.py @ 17932

Last change on this file since 17932 was 17714, checked in by Henrik Bettermann, 8 months ago

Further customizations

  • Property svn:keywords set to Id
File size: 8.6 KB
Line 
1## $Id: interfaces.py 17714 2024-03-11 11:28:19Z 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,
28    IKofaObject)
29from waeup.kofa.schema import FormattedDate, TextLineChoice, PhoneNumber
30from waeup.kofa.students.vocabularies import nats_vocab, GenderSource
31from waeup.kofa.applicants.interfaces import (
32    contextual_reg_num_source, IApplicantBaseData, IApplicantOnlinePayment,
33    IApplicantUpdateByRegNo)
34from kofacustom.nigeria.applicants.interfaces import (
35    LGASource, high_qual, high_grade, exam_types,
36    INigeriaApplicantOnlinePayment)
37from kofacustom.udss.interfaces import MessageFactory as _
38from kofacustom.udss.payments.interfaces import ICustomOnlinePayment
39
40class ICustomUGApplicant(IKofaObject):
41    """A pupil.
42
43    """
44
45    suspended = schema.Bool(
46        title = _(u'Account suspended'),
47        default = False,
48        required = False,
49        )
50    applicant_id = schema.TextLine(
51        title = _(u'Applicant Id'),
52        required = False,
53        readonly = False,
54        )
55    reg_number = TextLineChoice(
56        title = _(u'Registration Number'),
57        readonly = False,
58        required = False,
59        source = contextual_reg_num_source,
60        )
61    firstname = schema.TextLine(
62        title = _(u'First Name'),
63        required = True,
64        )
65    middlename = schema.TextLine(
66        title = _(u'Middle Name'),
67        required = False,
68        )
69    lastname = schema.TextLine(
70        title = _(u'Last Name (Surname)'),
71        required = True,
72        )
73    date_of_birth = FormattedDate(
74        title = _(u'Date of Birth'),
75        required = False,
76        show_year = True,
77        )
78    sex = schema.Choice(
79        title = _(u'Gender'),
80        source = GenderSource(),
81        required = True,
82        )
83    nationality = schema.Choice(
84        source = nats_vocab,
85        title = _(u'Nationality'),
86        required = False,
87        )
88    religion = schema.Choice(
89        title = u'Religion',
90        default = 'no_say',
91        required = False,
92        vocabulary = SimpleKofaVocabulary(
93            (_('Muslim'), 'muslim'),
94            (_('Christian'), 'christian'),
95            (_('Others'), 'others'),
96            (_('Prefer not to say'), 'no_say'),)
97        )
98    email = schema.ASCIILine(
99        title = _(u'Email Address'),
100        required = False,
101        constraint=validate_email,
102        )
103    phone = PhoneNumber(
104        title = _(u'Phone'),
105        description = u'',
106        required = False,
107        )
108    recent_schools_comment = schema.Text(
109        title = _(u'Recent Schools Attended (with dates)'),
110        required = False,
111        )
112    present_class_comment = schema.Text(
113        title = _(u'Child\'s Present Class'),
114        description = u'Indicate the child\'s present class. Please upload a '
115                       'copy of the first term result of the present class. '
116                       'Children in Basic Four or less than 10yrs by October '
117                       'should not apply.',
118        required = False,
119        )
120    handicapped_comment = schema.Text(
121        title = _(u'Health Problems'),
122        description = u'Does the child has any special health problem or handicap? '
123                       'If yes, give details.',
124        required = False,
125        )
126    bloodgroup = schema.TextLine(
127        title = _(u'Blood Group'),
128        required = False,
129        )
130    genotype = schema.TextLine(
131        title = _(u'Genotype'),
132        required = False,
133        )
134    father_firstname = schema.TextLine(
135        title = _(u'First Name of Father'),
136        required = False,
137        )
138    father_middlename = schema.TextLine(
139        title = _(u'Middle Name of Father'),
140        required = False,
141        )
142    father_lastname = schema.TextLine(
143        title = _(u'Last Name (Surname) of Father'),
144        required = False,
145        )
146    father_status = schema.TextLine(
147        title = _(u'Father\'s Status and Rank'),
148        required = False,
149        )
150    father_employer = schema.TextLine(
151        title = _(u'Father\'s Employer'),
152        required = False,
153        )
154    father_res_address = schema.Text(
155        title = _(u'Father\'s Residential Address'),
156        required = False,
157        )
158    father_contact_address = schema.Text(
159        title = _(u'Father\'s Contact Address (incl. P.O. Box)'),
160        required = False,
161        )
162    mother_firstname = schema.TextLine(
163        title = _(u'First Name of Mother'),
164        required = False,
165        )
166    mother_middlename = schema.TextLine(
167        title = _(u'Middle Name of Mother'),
168        required = False,
169        )
170    mother_lastname = schema.TextLine(
171        title = _(u'Last Name (Surname) of Mother'),
172        required = False,
173        )
174    mother_status = schema.TextLine(
175        title = _(u'Mother\'s Status and Rank'),
176        required = False,
177        )
178    mother_employer = schema.TextLine(
179        title = _(u'Mother\'s Employer'),
180        required = False,
181        )
182    mother_res_address = schema.Text(
183        title = _(u'Mother\'s Residential Address'),
184        required = False,
185        )
186    mother_contact_address = schema.Text(
187        title = _(u'Mother\'s Contact Address (incl. P.O. Box)'),
188        required = False,
189        )
190    responsible = schema.TextLine(
191        title = _(u'Financial Responsibility'),
192        description = u'Who will responsible for for the child\'s school '
193                       'fees and other fiancial commitments?',
194        required = False,
195        )
196    notice = schema.Text(
197        title = _(u'Notice'),
198        required = False,
199        )
200    student_id = schema.TextLine(
201        title = _(u'Student Id'),
202        required = False,
203        readonly = False,
204        )
205    locked = schema.Bool(
206        title = _(u'Form locked'),
207        default = False,
208        required = False,
209        )
210
211class ICustomApplicant(ICustomUGApplicant):
212    """An interface for both types of applicants.
213
214    Attention: The ICustomPGApplicant field seetings will be overwritten
215    by ICustomPGApplicant field settings. If a field is defined
216    in both interfaces zope.schema validates only against the
217    constraints in ICustomUGApplicant. This does not affect the forms
218    since they are build on either ICustomUGApplicant or ICustomPGApplicant.
219    """
220
221    def writeLogMessage(view, comment):
222        """Adds an INFO message to the log file
223        """
224
225    def createStudent():
226        """Create a student object from applicant data
227        and copy applicant object.
228        """
229
230class ICustomUGApplicantEdit(ICustomUGApplicant):
231    """An undergraduate applicant interface for edit forms.
232
233    Here we can repeat the fields from base data and set the
234    `required` and `readonly` attributes to True to further restrict
235    the data access. Or we can allow only certain certificates to be
236    selected by choosing the appropriate source.
237
238    We cannot omit fields here. This has to be done in the
239    respective form page.
240    """
241
242    email = schema.ASCIILine(
243        title = _(u'Email Address'),
244        required = True,
245        constraint=validate_email,
246        )
247    date_of_birth = FormattedDate(
248        title = _(u'Date of Birth'),
249        required = True,
250        show_year = True,
251        )
252ICustomUGApplicantEdit[
253    'date_of_birth'].order = ICustomUGApplicant['date_of_birth'].order
254ICustomUGApplicantEdit[
255    'email'].order = ICustomUGApplicant['email'].order
256
257class ICustomApplicantOnlinePayment(INigeriaApplicantOnlinePayment):
258    """An applicant payment via payment gateways.
259
260    """
261
262class ICustomApplicantUpdateByRegNo(IApplicantUpdateByRegNo):
263    """Representation of an applicant.
264
265    Skip regular reg_number validation if reg_number is used for finding
266    the applicant object.
267    """
Note: See TracBrowser for help on using the repository browser.