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