source: main/waeup.aaue/trunk/src/waeup/aaue/applicants/interfaces.py @ 8527

Last change on this file since 8527 was 8521, checked in by Henrik Bettermann, 13 years ago

See previous revision.

  • Property svn:keywords set to Id
File size: 8.5 KB
Line 
1## $Id: interfaces.py 8521 2012-05-25 10:33:48Z 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 SimpleKofaVocabulary, academic_sessions_vocab
27from waeup.kofa.schema import FormattedDate
28from waeup.kofa.students.vocabularies import nats_vocab
29from waeup.aaue.interfaces import (
30    LGASource, high_qual, high_grade, exam_types)
31from waeup.aaue.interfaces import MessageFactory as _
32from waeup.aaue.payments.interfaces import ICustomOnlinePayment
33
34UG_OMIT_DISPLAY_FIELDS = ('locked', 'course_admitted', 'password')
35UG_OMIT_MANAGE_FIELDS = ()
36UG_OMIT_EDIT_FIELDS = UG_OMIT_MANAGE_FIELDS + ('locked', 'course_admitted',
37    'student_id', 'screening_score', 'screening_venue')
38
39PG_OMIT_DISPLAY_FIELDS = ('locked', 'course_admitted', 'password')
40PG_OMIT_MANAGE_FIELDS = ()
41PG_OMIT_EDIT_FIELDS = PG_OMIT_MANAGE_FIELDS + ('locked', 'course_admitted',
42    'student_id', 'screening_score', 'screening_venue')
43
44class IUGApplicant(IApplicantBaseData):
45    """An undergraduate applicant.
46
47    This interface defines the least common multiple of all fields
48    in ug application forms. In customized forms, fields can be excluded by
49    adding them to the UG_OMIT* tuples.
50    """
51
52    nationality = schema.Choice(
53        source = nats_vocab,
54        title = _(u'Nationality'),
55        required = False,
56        )
57    lga = schema.Choice(
58        source = LGASource(),
59        title = _(u'State/LGA (Nigerians only)'),
60        required = False,
61        )
62
63# This ordering doesn't work properly.
64IUGApplicant[
65    'nationality'].order =  IApplicantBaseData['sex'].order
66IUGApplicant[
67    'lga'].order =  IUGApplicant['nationality'].order
68
69
70class IPGApplicant(IApplicantBaseData):
71    """A postgraduate applicant.
72
73    This interface defines the least common multiple of all fields
74    in pg application forms. In customized forms, fields can be excluded by
75    adding them to the PG_OMIT* tuples.
76    """
77
78    nationality = schema.Choice(
79        source = nats_vocab,
80        title = _(u'Nationality'),
81        required = False,
82        )
83    lga = schema.Choice(
84        source = LGASource(),
85        title = _(u'State/LGA (Nigerians only)'),
86        required = False,
87        )
88    perm_address = schema.Text(
89        title = _(u'Permanent Address'),
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    hq_type = schema.Choice(
103        title = _(u'Qualification Obtained'),
104        required = False,
105        readonly = False,
106        vocabulary = high_qual,
107        )
108    hq_matric_no = schema.TextLine(
109        title = _(u'Former Matric Number'),
110        required = False,
111        readonly = False,
112        )
113    hq_degree = schema.Choice(
114        title = _(u'Class of Degree'),
115        required = False,
116        readonly = False,
117        vocabulary = high_grade,
118        )
119    hq_school = schema.TextLine(
120        title = _(u'Institution Attended'),
121        required = False,
122        readonly = False,
123        )
124    hq_session = schema.TextLine(
125        title = _(u'Years Attended'),
126        required = False,
127        readonly = False,
128        )
129    hq_disc = schema.TextLine(
130        title = _(u'Discipline'),
131        required = False,
132        readonly = False,
133        )
134    pp_school = schema.Choice(
135        title = _(u'Qualification Obtained'),
136        required = False,
137        readonly = False,
138        vocabulary = exam_types,
139        )
140    #presently = schema.Bool(
141    #    title = _(u'Attending'),
142    #    required = False,
143    #    readonly = False,
144    #    )
145    presently_inst = schema.TextLine(
146        title = _(u'If yes, name of institution'),
147        required = False,
148        readonly = False,
149        )
150    nysc_year = schema.Int(
151        title = _(u'Nysc Year'),
152        required = False,
153        readonly = False,
154        )
155    nysc_lga = schema.Choice(
156        source = LGASource(),
157        title = _(u'Nysc Location'),
158        required = False,
159        )
160    employer = schema.TextLine(
161        title = _(u'Employer'),
162        required = False,
163        readonly = False,
164        )
165    emp_position = schema.TextLine(
166        title = _(u'Employer Position'),
167        required = False,
168        readonly = False,
169        )
170    emp_start = FormattedDate(
171        title = _(u'Start Date'),
172        required = False,
173        readonly = False,
174        show_year = True,
175        )
176    emp_end = FormattedDate(
177        title = _(u'End Date'),
178        required = False,
179        readonly = False,
180        show_year = True,
181        )
182    emp_reason = schema.TextLine(
183        title = _(u'Reason for Leaving'),
184        required = False,
185        readonly = False,
186        )
187    employer2 = schema.TextLine(
188        title = _(u'2nd Employer'),
189        required = False,
190        readonly = False,
191        )
192    emp2_position = schema.TextLine(
193        title = _(u'2nd Employer Position'),
194        required = False,
195        readonly = False,
196        )
197    emp2_start = FormattedDate(
198        title = _(u'Start Date'),
199        required = False,
200        readonly = False,
201        show_year = True,
202        )
203    emp2_end = FormattedDate(
204        title = _(u'End Date'),
205        required = False,
206        readonly = False,
207        show_year = True,
208        )
209    emp2_reason = schema.TextLine(
210        title = _(u'Reason for Leaving'),
211        required = False,
212        readonly = False,
213        )
214    notice = schema.Text(
215        title = _(u'Notice'),
216        required = False,
217        readonly = False,
218        )
219    screening_venue = schema.TextLine(
220        title = _(u'Screening Venue'),
221        required = False,
222        readonly = False,
223        )
224    screening_score = schema.Int(
225        title = _(u'Screening Score'),
226        required = False,
227        readonly = False,
228        )
229    course_admitted = schema.Choice(
230        title = _(u'Admitted Course of Study'),
231        source = CertificateSource(),
232        required = False,
233        readonly = False,
234        )
235
236
237# This ordering doesn't work properly.
238IPGApplicant[
239    'nationality'].order =  IApplicantBaseData['sex'].order
240IPGApplicant[
241    'lga'].order =  IPGApplicant['nationality'].order
242IPGApplicant[
243    'student_id'].order =  IPGApplicant['notice'].order
244
245
246class ICustomApplicant(IUGApplicant,IPGApplicant):
247    """An interface for both types of applicants.
248
249    """
250
251    def loggerInfo(ob_class, comment):
252        """Adds an INFO message to the log file
253        """
254
255    def createStudent():
256        """Create a student object from applicatnt data
257        and copy applicant object.
258        """
259
260class IUGApplicantEdit(IUGApplicant):
261    """An undergraduate applicant interface for editing.
262
263    Here we can repeat the fields from base data and set the
264    `required` and `readonly` attributes to True to further restrict
265    the data access. Or we can allow only certain certificates to be
266    selected by choosing the appropriate source.
267
268    We cannot omit fields here. This has to be done in the
269    respective form page.
270    """
271
272class IPGApplicantEdit(IPGApplicant):
273    """A postgraduate applicant interface for editing.
274
275    Here we can repeat the fields from base data and set the
276    `required` and `readonly` attributes to True to further restrict
277    the data access. Or we can allow only certain certificates to be
278    selected by choosing the appropriate source.
279
280    We cannot omit fields here. This has to be done in the
281    respective form page.
282    """
283
284class ICustomApplicantOnlinePayment(ICustomOnlinePayment):
285    """An applicant payment via payment gateways.
286
287    """
Note: See TracBrowser for help on using the repository browser.