1 | ## $Id: browser.py 17538 2023-08-15 09:47:00Z 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 | """UI components for basic applicants and related components. |
---|
19 | """ |
---|
20 | import grok |
---|
21 | from time import time |
---|
22 | from zope.component import getUtility, createObject |
---|
23 | from zope.formlib.textwidgets import BytesDisplayWidget |
---|
24 | from zope.security import checkPermission |
---|
25 | from zope.i18n import translate |
---|
26 | from hurry.workflow.interfaces import IWorkflowState |
---|
27 | from waeup.kofa.browser.layout import action, UtilityView |
---|
28 | from waeup.kofa.interfaces import IExtFileStore, IKofaUtils |
---|
29 | from waeup.kofa.applicants.browser import ( |
---|
30 | ApplicantRegistrationPage, ApplicantsContainerPage, |
---|
31 | ApplicationFeePaymentAddPage, |
---|
32 | OnlinePaymentApprovePage, |
---|
33 | ExportPDFPageApplicationSlip, |
---|
34 | ApplicantBaseDisplayFormPage, |
---|
35 | CheckTranscriptStatus, |
---|
36 | AdditionalFile,) |
---|
37 | from waeup.kofa.students.interfaces import IStudentsUtils |
---|
38 | from waeup.kofa.applicants.interfaces import ( |
---|
39 | ISpecialApplicant, IApplicantsUtils) |
---|
40 | from waeup.kofa.browser.interfaces import IPDFCreator |
---|
41 | from kofacustom.nigeria.applicants.browser import ( |
---|
42 | NigeriaApplicantDisplayFormPage, |
---|
43 | NigeriaApplicantManageFormPage, |
---|
44 | NigeriaApplicantEditFormPage, |
---|
45 | NigeriaPDFApplicationSlip, |
---|
46 | NigeriaExportPDFPaymentSlipPage) |
---|
47 | from waeup.uniben.applicants.interfaces import ( |
---|
48 | ICustomApplicant, |
---|
49 | IUnibenRegistration, |
---|
50 | ICustomUGApplicant, |
---|
51 | ICustomPGApplicant, |
---|
52 | ICustomPGApplicantEdit, |
---|
53 | ICustomUGApplicantEdit, |
---|
54 | IPUTMEApplicantEdit, |
---|
55 | ITranscriptApplicant, |
---|
56 | IFrenchApplicant) |
---|
57 | from waeup.kofa.applicants.workflow import ADMITTED, PAID, STARTED |
---|
58 | from kofacustom.nigeria.applicants.interfaces import ( |
---|
59 | OMIT_DISPLAY_FIELDS, |
---|
60 | UG_OMIT_DISPLAY_FIELDS, |
---|
61 | UG_OMIT_PDF_FIELDS, |
---|
62 | UG_OMIT_MANAGE_FIELDS, |
---|
63 | UG_OMIT_EDIT_FIELDS, |
---|
64 | CBT_OMIT_DISPLAY_FIELDS, |
---|
65 | CBT_OMIT_PDF_FIELDS, |
---|
66 | CBT_OMIT_MANAGE_FIELDS, |
---|
67 | CBT_OMIT_EDIT_FIELDS, |
---|
68 | AFFIL_OMIT_DISPLAY_FIELDS, |
---|
69 | AFFIL_OMIT_PDF_FIELDS, |
---|
70 | AFFIL_OMIT_MANAGE_FIELDS, |
---|
71 | AFFIL_OMIT_EDIT_FIELDS, |
---|
72 | PG_OMIT_DISPLAY_FIELDS, |
---|
73 | PG_OMIT_PDF_FIELDS, |
---|
74 | PG_OMIT_MANAGE_FIELDS, |
---|
75 | PG_OMIT_EDIT_FIELDS, |
---|
76 | PUTME_OMIT_DISPLAY_FIELDS, |
---|
77 | PUTME_OMIT_PDF_FIELDS, |
---|
78 | PUTME_OMIT_MANAGE_FIELDS, |
---|
79 | PUTME_OMIT_EDIT_FIELDS, |
---|
80 | PUTME_OMIT_RESULT_SLIP_FIELDS, |
---|
81 | PUDE_OMIT_DISPLAY_FIELDS, |
---|
82 | PUDE_OMIT_PDF_FIELDS, |
---|
83 | PUDE_OMIT_MANAGE_FIELDS, |
---|
84 | PUDE_OMIT_EDIT_FIELDS, |
---|
85 | PUDE_OMIT_RESULT_SLIP_FIELDS, |
---|
86 | PRE_OMIT_DISPLAY_FIELDS, |
---|
87 | PRE_OMIT_PDF_FIELDS, |
---|
88 | PRE_OMIT_MANAGE_FIELDS, |
---|
89 | PRE_OMIT_EDIT_FIELDS, |
---|
90 | ) |
---|
91 | |
---|
92 | from waeup.uniben.interfaces import MessageFactory as _ |
---|
93 | |
---|
94 | PASTQ_ALL = ['ADT','CIT','DEF','DEM','EPCS','ESM','HEK','HSE','VTE'] |
---|
95 | |
---|
96 | PASTQ_AL = ['ENL','FAA','FOL','HIS','LAL', 'PHL','THR','BUL','JIL', |
---|
97 | 'LAW','PPL','PUL'] + PASTQ_ALL |
---|
98 | |
---|
99 | PASTQ_BS = ['ANT','ANY','CHH','COH','HAE','MED','MEH','PHS','SUR', |
---|
100 | 'PCG','PCH','PCO', 'PCT','PHA','PHM','PMB','ANA','MBC', |
---|
101 | 'MLS','NSC','PSY','DPV','ODR','OSP','PER', 'RES','AEB', |
---|
102 | 'BCH','BOT','CED','EVL','MCB','OPT','PBB','SLT','ZOO', |
---|
103 | 'AEE','ANS', 'CRS','FIS','FOW','SOS'] + PASTQ_ALL |
---|
104 | |
---|
105 | PASTQ_EPS = ['ARC','CHE','CVE','DMIC','EEE','GEM','MCH','PEE','PRE','CHM', |
---|
106 | 'CSC','GLY','MTH','QSV','PHY','CPE','STR'] + PASTQ_ALL |
---|
107 | |
---|
108 | PASTQ_MSS = ['ACC','BNK','BUS','ECO','ESM','GEO','POL','SAA','SWK', |
---|
109 | 'ACT','ENT','HRM','INS','MKT'] + PASTQ_ALL |
---|
110 | |
---|
111 | PT_OMIT_FIELDS = ( |
---|
112 | 'student_id', |
---|
113 | 'notice', |
---|
114 | 'screening_score', |
---|
115 | 'screening_venue', |
---|
116 | 'screening_date', |
---|
117 | 'jamb_age', |
---|
118 | 'jamb_subjects', |
---|
119 | 'jamb_score', |
---|
120 | #'jamb_reg_number', |
---|
121 | 'aggregate', |
---|
122 | 'hq_type', 'hq_matric_no', |
---|
123 | 'hq_degree', 'hq_school', |
---|
124 | 'hq_session', 'hq_disc', |
---|
125 | 'jamb_subjects_list', 'programme_type') |
---|
126 | |
---|
127 | PT_OMIT_DISPLAY_FIELDS = OMIT_DISPLAY_FIELDS + PT_OMIT_FIELDS |
---|
128 | |
---|
129 | PT_OMIT_MANAGE_FIELDS = UG_OMIT_MANAGE_FIELDS + PT_OMIT_FIELDS |
---|
130 | |
---|
131 | PT_OMIT_EDIT_FIELDS = UG_OMIT_MANAGE_FIELDS + OMIT_DISPLAY_FIELDS + PT_OMIT_FIELDS |
---|
132 | |
---|
133 | PT_OMIT_PDF_FIELDS = PT_OMIT_DISPLAY_FIELDS + ('phone',) |
---|
134 | PT_OMIT_RESULT_SLIP_FIELDS = PT_OMIT_DISPLAY_FIELDS + ( |
---|
135 | 'phone', |
---|
136 | 'date_of_birth', 'sex', |
---|
137 | 'nationality', 'lga', #'perm_address', |
---|
138 | 'course2', 'screening_venue', |
---|
139 | 'screening_date') |
---|
140 | |
---|
141 | |
---|
142 | REGISTRATION_OMIT_DISPLAY_FIELDS = ( |
---|
143 | 'locked', |
---|
144 | 'suspended', |
---|
145 | 'course_admitted', |
---|
146 | ) |
---|
147 | |
---|
148 | REGISTRATION_OMIT_EDIT_FIELDS = ( |
---|
149 | 'locked', |
---|
150 | 'suspended', |
---|
151 | 'applicant_id', |
---|
152 | 'course_admitted', |
---|
153 | ) |
---|
154 | |
---|
155 | REGISTRATION_OMIT_MANAGE_FIELDS = ( |
---|
156 | 'applicant_id', |
---|
157 | ) |
---|
158 | |
---|
159 | |
---|
160 | REGISTRATION_OMIT_PDF_FIELDS = ( |
---|
161 | 'locked', |
---|
162 | 'suspended', |
---|
163 | 'course_admitted', |
---|
164 | ) |
---|
165 | |
---|
166 | PUTME_OMIT_PDF_FIELDS = PUTME_OMIT_PDF_FIELDS + ( |
---|
167 | 'fst_sit_results', 'scd_sit_results') |
---|
168 | |
---|
169 | TRANS_OMIT_FIELDS = ('suspended',) |
---|
170 | |
---|
171 | #TRANS_SHORT_OMIT_FIELDS = TRANS_OMIT_FIELDS + ( |
---|
172 | # 'date_of_birth', |
---|
173 | # 'sex', |
---|
174 | # #'nationality', |
---|
175 | # 'entry_mode', |
---|
176 | # 'entry_session', |
---|
177 | # 'end_session', |
---|
178 | # 'course_studied', |
---|
179 | # 'course_changed', |
---|
180 | # #'change_level', |
---|
181 | # ) |
---|
182 | |
---|
183 | TRANS_SHORT_OMIT_FIELDS = TRANS_OMIT_FIELDS |
---|
184 | |
---|
185 | TRANS_OMIT_EDIT_FIELDS = TRANS_OMIT_FIELDS + ('applicant_id', ) |
---|
186 | |
---|
187 | TRANS_SHORT_OMIT_EDIT_FIELDS = TRANS_SHORT_OMIT_FIELDS + ('applicant_id', ) |
---|
188 | |
---|
189 | TRANS_OMIT_PDF_FIELDS = TRANS_OMIT_FIELDS + ('locked', ) |
---|
190 | |
---|
191 | TRANS_SHORT_OMIT_PDF_FIELDS = TRANS_SHORT_OMIT_FIELDS + ('locked', ) |
---|
192 | |
---|
193 | class CustomApplicantsContainerPage(ApplicantsContainerPage): |
---|
194 | """The standard view for regular applicant containers. |
---|
195 | """ |
---|
196 | |
---|
197 | @property |
---|
198 | def form_fields(self): |
---|
199 | form_fields = super(CustomApplicantsContainerPage, self).form_fields |
---|
200 | usertype = getattr(self.request.principal, 'user_type', None) |
---|
201 | if self.request.principal.id == 'zope.anybody' or \ |
---|
202 | usertype in ('applicant', 'student'): |
---|
203 | return form_fields.omit('application_fee') |
---|
204 | return form_fields |
---|
205 | |
---|
206 | class CustomApplicantRegistrationPage(ApplicantRegistrationPage): |
---|
207 | """Captcha'd registration page for applicants. |
---|
208 | """ |
---|
209 | |
---|
210 | def _redirect(self, email, password, applicant_id): |
---|
211 | # Forward email and credentials to landing page. |
---|
212 | self.redirect(self.url(self.context, 'registration_complete', |
---|
213 | data = dict(email=email, password=password, |
---|
214 | applicant_id=applicant_id))) |
---|
215 | return |
---|
216 | |
---|
217 | @property |
---|
218 | def label(self): |
---|
219 | if self.context.prefix.startswith('tsc'): |
---|
220 | return _('Request for ${a}', |
---|
221 | mapping = {'a':self.context.title}) |
---|
222 | return _('Apply for ${a}', |
---|
223 | mapping = {'a':self.context.title}) |
---|
224 | |
---|
225 | class CustomApplicantDisplayFormPage(NigeriaApplicantDisplayFormPage): |
---|
226 | """A display view for applicant data. |
---|
227 | """ |
---|
228 | grok.template('applicantdisplaypage') |
---|
229 | |
---|
230 | @property |
---|
231 | def display_payments(self): |
---|
232 | if self.context.special or self.target == 'ictwk': |
---|
233 | return True |
---|
234 | return getattr(self.context.__parent__, 'application_fee', None) |
---|
235 | |
---|
236 | def _show_pastq_putme(self): |
---|
237 | return self.target.startswith('pre') \ |
---|
238 | and self.context.state in ('paid', 'submitted') \ |
---|
239 | and getattr(self.context, 'course1') is not None |
---|
240 | # return False |
---|
241 | |
---|
242 | @property |
---|
243 | def depcode(self): |
---|
244 | try: |
---|
245 | code = self.context.course1.__parent__.__parent__.code |
---|
246 | return code |
---|
247 | except: |
---|
248 | return |
---|
249 | |
---|
250 | @property |
---|
251 | def show_pastq_al(self): |
---|
252 | return self._show_pastq_putme() # and self.depcode in PASTQ_AL |
---|
253 | |
---|
254 | @property |
---|
255 | def show_pastq_bs(self): |
---|
256 | return self._show_pastq_putme() # and self.depcode in PASTQ_BS |
---|
257 | |
---|
258 | @property |
---|
259 | def show_pastq_eps(self): |
---|
260 | return self._show_pastq_putme() # and self.depcode in PASTQ_EPS |
---|
261 | |
---|
262 | @property |
---|
263 | def show_pastq_mss(self): |
---|
264 | return self._show_pastq_putme() # and self.depcode in PASTQ_MSS |
---|
265 | |
---|
266 | @property |
---|
267 | def show_pastq_pude(self): |
---|
268 | return self.target.startswith('pude') \ |
---|
269 | and self.context.state in ('paid', 'submitted') |
---|
270 | |
---|
271 | @property |
---|
272 | def label(self): |
---|
273 | if self.target == 'ictwk': |
---|
274 | container_title = self.context.__parent__.title |
---|
275 | return _('${a} <br /> Registration Record ${b}', mapping = { |
---|
276 | 'a':container_title, 'b':self.context.application_number}) |
---|
277 | return super(CustomApplicantDisplayFormPage, self).label |
---|
278 | |
---|
279 | @property |
---|
280 | def form_fields(self): |
---|
281 | if self.target is not None and self.target == 'tscf': |
---|
282 | form_fields = grok.AutoFields(ITranscriptApplicant) |
---|
283 | for field in TRANS_OMIT_FIELDS: |
---|
284 | form_fields = form_fields.omit(field) |
---|
285 | form_fields['dispatch_address'].custom_widget = BytesDisplayWidget |
---|
286 | #form_fields['perm_address'].custom_widget = BytesDisplayWidget |
---|
287 | return form_fields |
---|
288 | if self.target is not None and self.target == 'tscs': |
---|
289 | form_fields = grok.AutoFields(ITranscriptApplicant) |
---|
290 | for field in TRANS_SHORT_OMIT_FIELDS: |
---|
291 | form_fields = form_fields.omit(field) |
---|
292 | form_fields['dispatch_address'].custom_widget = BytesDisplayWidget |
---|
293 | #form_fields['perm_address'].custom_widget = BytesDisplayWidget |
---|
294 | return form_fields |
---|
295 | if self.target is not None and self.target == 'flc': |
---|
296 | form_fields = grok.AutoFields(IFrenchApplicant) |
---|
297 | for field in REGISTRATION_OMIT_DISPLAY_FIELDS: |
---|
298 | form_fields = form_fields.omit(field) |
---|
299 | return form_fields |
---|
300 | if self.target == 'ictwk': |
---|
301 | form_fields = grok.AutoFields(IUnibenRegistration) |
---|
302 | for field in REGISTRATION_OMIT_DISPLAY_FIELDS: |
---|
303 | form_fields = form_fields.omit(field) |
---|
304 | return form_fields |
---|
305 | elif self.target is not None and self.target.startswith('pg'): |
---|
306 | form_fields = grok.AutoFields(ICustomPGApplicant) |
---|
307 | for field in PG_OMIT_DISPLAY_FIELDS: |
---|
308 | form_fields = form_fields.omit(field) |
---|
309 | elif self.target is not None and self.target.startswith('pre'): |
---|
310 | form_fields = grok.AutoFields(ICustomPGApplicant) |
---|
311 | for field in PRE_OMIT_DISPLAY_FIELDS: |
---|
312 | form_fields = form_fields.omit(field) |
---|
313 | elif self.target is not None and self.target.startswith('cbt'): |
---|
314 | form_fields = grok.AutoFields(ICustomUGApplicant) |
---|
315 | for field in CBT_OMIT_DISPLAY_FIELDS: |
---|
316 | form_fields = form_fields.omit(field) |
---|
317 | elif self.target is not None and self.target.startswith('akj'): |
---|
318 | form_fields = grok.AutoFields(ICustomPGApplicant) |
---|
319 | for field in PRE_OMIT_DISPLAY_FIELDS: |
---|
320 | form_fields = form_fields.omit(field) |
---|
321 | elif self.target is not None and self.target.startswith('ak'): |
---|
322 | form_fields = grok.AutoFields(ICustomUGApplicant) |
---|
323 | for field in AFFIL_OMIT_DISPLAY_FIELDS: |
---|
324 | form_fields = form_fields.omit(field) |
---|
325 | elif self.target is not None and self.target.startswith('ase'): # was putme |
---|
326 | form_fields = grok.AutoFields(ICustomUGApplicant) |
---|
327 | for field in PUTME_OMIT_DISPLAY_FIELDS: |
---|
328 | form_fields = form_fields.omit(field) |
---|
329 | elif self.target is not None and self.target.startswith('pt'): |
---|
330 | form_fields = grok.AutoFields(ICustomUGApplicant) |
---|
331 | for field in PT_OMIT_DISPLAY_FIELDS: |
---|
332 | form_fields = form_fields.omit(field) |
---|
333 | elif self.target is not None and self.target.startswith('pude'): |
---|
334 | form_fields = grok.AutoFields(ICustomUGApplicant) |
---|
335 | for field in PUDE_OMIT_DISPLAY_FIELDS: |
---|
336 | form_fields = form_fields.omit(field) |
---|
337 | else: |
---|
338 | form_fields = grok.AutoFields(ICustomUGApplicant) |
---|
339 | for field in UG_OMIT_DISPLAY_FIELDS: |
---|
340 | form_fields = form_fields.omit(field) |
---|
341 | #form_fields['perm_address'].custom_widget = BytesDisplayWidget |
---|
342 | try: |
---|
343 | form_fields['notice'].custom_widget = BytesDisplayWidget |
---|
344 | except: |
---|
345 | pass |
---|
346 | if not getattr(self.context, 'student_id'): |
---|
347 | form_fields = form_fields.omit('student_id') |
---|
348 | if not getattr(self.context, 'screening_score'): |
---|
349 | form_fields = form_fields.omit('screening_score') |
---|
350 | if not getattr(self.context, 'screening_venue') or self._not_paid(): |
---|
351 | form_fields = form_fields.omit('screening_venue') |
---|
352 | if not getattr(self.context, 'screening_date') or self._not_paid(): |
---|
353 | form_fields = form_fields.omit('screening_date') |
---|
354 | if not self.context.admchecking_fee_paid(): |
---|
355 | form_fields = form_fields.omit( |
---|
356 | 'screening_score', 'aggregate', 'student_id') |
---|
357 | return form_fields |
---|
358 | |
---|
359 | @property |
---|
360 | def display_actions(self): |
---|
361 | state = IWorkflowState(self.context).getState() |
---|
362 | actions = [] |
---|
363 | if state == ADMITTED and not self.context.admchecking_fee_paid(): |
---|
364 | actions = [_('Add admission checking payment ticket')] |
---|
365 | return actions |
---|
366 | |
---|
367 | |
---|
368 | def getCourseAdmitted(self): |
---|
369 | """Return link, title and code in html format to the certificate |
---|
370 | admitted. |
---|
371 | """ |
---|
372 | if self.admission_checking_info: |
---|
373 | return '<span class="hint">%s</span>' % self.admission_checking_info |
---|
374 | return super(CustomApplicantDisplayFormPage, self).getCourseAdmitted() |
---|
375 | |
---|
376 | @property |
---|
377 | def admission_checking_info(self): |
---|
378 | if self.context.state == ADMITTED and \ |
---|
379 | not self.context.admchecking_fee_paid(): |
---|
380 | return _('You must pay the admission checking fee ' |
---|
381 | 'to view your screening results and your course admitted.') |
---|
382 | return |
---|
383 | |
---|
384 | @action(_('Add admission checking payment ticket'), style='primary') |
---|
385 | def addPaymentTicket(self, **data): |
---|
386 | self.redirect(self.url(self.context, '@@addacp')) |
---|
387 | return |
---|
388 | |
---|
389 | class CustomApplicationFeePaymentAddPage(ApplicationFeePaymentAddPage): |
---|
390 | """ Page to add an online payment ticket |
---|
391 | """ |
---|
392 | |
---|
393 | @property |
---|
394 | def custom_requirements(self): |
---|
395 | if self.context.__parent__.with_picture: |
---|
396 | store = getUtility(IExtFileStore) |
---|
397 | if self.context.__parent__.picture_editable \ |
---|
398 | and not store.getFileByContext(self.context, attr=u'passport.jpg'): |
---|
399 | return _('Upload your 1"x1" Red background passport photo before making payment.') |
---|
400 | return '' |
---|
401 | |
---|
402 | class AdmissionCheckingFeePaymentAddPage(UtilityView, grok.View): |
---|
403 | """ Page to add an admission checking online payment ticket. |
---|
404 | """ |
---|
405 | grok.context(ICustomApplicant) |
---|
406 | grok.name('addacp') |
---|
407 | grok.require('waeup.payApplicant') |
---|
408 | factory = u'waeup.ApplicantOnlinePayment' |
---|
409 | |
---|
410 | def _setPaymentDetails(self, payment): |
---|
411 | container = self.context.__parent__ |
---|
412 | timestamp = ("%d" % int(time()*10000))[1:] |
---|
413 | session = str(container.year) |
---|
414 | try: |
---|
415 | session_config = grok.getSite()['configuration'][session] |
---|
416 | except KeyError: |
---|
417 | return _(u'Session configuration object is not available.'), None |
---|
418 | payment.p_id = "p%s" % timestamp |
---|
419 | payment.p_item = container.title |
---|
420 | payment.p_session = container.year |
---|
421 | payment.amount_auth = 0.0 |
---|
422 | payment.p_category = 'admission_checking' |
---|
423 | payment.amount_auth = session_config.admchecking_fee |
---|
424 | if payment.amount_auth in (0.0, None): |
---|
425 | return _('Amount could not be determined.'), None |
---|
426 | return |
---|
427 | |
---|
428 | def update(self): |
---|
429 | if self.context.admchecking_fee_paid(): |
---|
430 | self.flash( |
---|
431 | _('Admission checking payment has already been made.'), |
---|
432 | type='warning') |
---|
433 | self.redirect(self.url(self.context)) |
---|
434 | return |
---|
435 | payment = createObject(self.factory) |
---|
436 | failure = self._setPaymentDetails(payment) |
---|
437 | if failure is not None: |
---|
438 | self.flash(failure[0], type='danger') |
---|
439 | self.redirect(self.url(self.context)) |
---|
440 | return |
---|
441 | self.context[payment.p_id] = payment |
---|
442 | self.flash(_('Payment ticket created.')) |
---|
443 | self.redirect(self.url(payment)) |
---|
444 | return |
---|
445 | |
---|
446 | def render(self): |
---|
447 | return |
---|
448 | |
---|
449 | |
---|
450 | class CustomApplicantManageFormPage(NigeriaApplicantManageFormPage): |
---|
451 | |
---|
452 | @property |
---|
453 | def display_payments(self): |
---|
454 | if self.context.special or self.target == 'ictwk': |
---|
455 | return True |
---|
456 | return getattr(self.context.__parent__, 'application_fee', None) |
---|
457 | |
---|
458 | @property |
---|
459 | def custom_upload_requirements(self): |
---|
460 | if not checkPermission('waeup.uploadPassportPictures', self.context): |
---|
461 | return _('You are not entitled to upload passport pictures.') |
---|
462 | |
---|
463 | def display_fileupload(self, filename): |
---|
464 | if filename[1] == 'res_stat' \ |
---|
465 | and self.target is not None \ |
---|
466 | and not self.target.startswith('tsc'): |
---|
467 | return False |
---|
468 | if filename[1] == 'eligibility' \ |
---|
469 | and self.target is not None \ |
---|
470 | and not self.target.startswith('tsc'): |
---|
471 | return False |
---|
472 | return True |
---|
473 | |
---|
474 | @property |
---|
475 | def label(self): |
---|
476 | if self.target == 'ictwk': |
---|
477 | container_title = self.context.__parent__.title |
---|
478 | return _('${a} <br /> Registration Record ${b}', mapping = { |
---|
479 | 'a':container_title, 'b':self.context.application_number}) |
---|
480 | return super(CustomApplicantManageFormPage, self).label |
---|
481 | |
---|
482 | @property |
---|
483 | def form_fields(self): |
---|
484 | if self.target is not None and self.target == 'tscf': |
---|
485 | form_fields = grok.AutoFields(ITranscriptApplicant) |
---|
486 | for field in TRANS_OMIT_EDIT_FIELDS: |
---|
487 | form_fields = form_fields.omit(field) |
---|
488 | return form_fields |
---|
489 | if self.target is not None and self.target == 'tscs': |
---|
490 | form_fields = grok.AutoFields(ITranscriptApplicant) |
---|
491 | for field in TRANS_SHORT_OMIT_EDIT_FIELDS: |
---|
492 | form_fields = form_fields.omit(field) |
---|
493 | return form_fields |
---|
494 | if self.target == 'ictwk': |
---|
495 | form_fields = grok.AutoFields(IUnibenRegistration) |
---|
496 | for field in REGISTRATION_OMIT_MANAGE_FIELDS: |
---|
497 | form_fields = form_fields.omit(field) |
---|
498 | state = IWorkflowState(self.context).getState() |
---|
499 | if state != STARTED: |
---|
500 | form_fields['registration_cats'].for_display = True |
---|
501 | return form_fields |
---|
502 | if self.target is not None and self.target == 'flc': |
---|
503 | form_fields = grok.AutoFields(IFrenchApplicant) |
---|
504 | for field in REGISTRATION_OMIT_MANAGE_FIELDS: |
---|
505 | form_fields = form_fields.omit(field) |
---|
506 | return form_fields |
---|
507 | if self.target is not None and self.target.startswith('pg'): |
---|
508 | form_fields = grok.AutoFields(ICustomPGApplicant) |
---|
509 | for field in PG_OMIT_MANAGE_FIELDS: |
---|
510 | form_fields = form_fields.omit(field) |
---|
511 | elif self.target is not None and self.target.startswith('pre'): |
---|
512 | form_fields = grok.AutoFields(ICustomPGApplicant) |
---|
513 | for field in PRE_OMIT_MANAGE_FIELDS: |
---|
514 | form_fields = form_fields.omit(field) |
---|
515 | elif self.target is not None and self.target.startswith('cbt'): |
---|
516 | form_fields = grok.AutoFields(ICustomUGApplicant) |
---|
517 | for field in CBT_OMIT_MANAGE_FIELDS: |
---|
518 | form_fields = form_fields.omit(field) |
---|
519 | elif self.target is not None and self.target.startswith('akj'): |
---|
520 | form_fields = grok.AutoFields(ICustomPGApplicant) |
---|
521 | for field in PRE_OMIT_MANAGE_FIELDS: |
---|
522 | form_fields = form_fields.omit(field) |
---|
523 | elif self.target is not None and self.target.startswith('ak'): |
---|
524 | form_fields = grok.AutoFields(ICustomUGApplicant) |
---|
525 | for field in AFFIL_OMIT_MANAGE_FIELDS: |
---|
526 | form_fields = form_fields.omit(field) |
---|
527 | elif self.target is not None and self.target.startswith('ase'): # was putme |
---|
528 | form_fields = grok.AutoFields(ICustomUGApplicant) |
---|
529 | for field in PUTME_OMIT_MANAGE_FIELDS: |
---|
530 | form_fields = form_fields.omit(field) |
---|
531 | elif self.target is not None and self.target.startswith('pt'): |
---|
532 | form_fields = grok.AutoFields(ICustomUGApplicant) |
---|
533 | for field in PT_OMIT_MANAGE_FIELDS: |
---|
534 | form_fields = form_fields.omit(field) |
---|
535 | elif self.target is not None and self.target.startswith('pude'): |
---|
536 | form_fields = grok.AutoFields(ICustomUGApplicant) |
---|
537 | for field in PUDE_OMIT_MANAGE_FIELDS: |
---|
538 | form_fields = form_fields.omit(field) |
---|
539 | else: |
---|
540 | form_fields = grok.AutoFields(ICustomUGApplicant) |
---|
541 | for field in UG_OMIT_MANAGE_FIELDS: |
---|
542 | form_fields = form_fields.omit(field) |
---|
543 | try: |
---|
544 | form_fields['student_id'].for_display = True |
---|
545 | except: |
---|
546 | pass |
---|
547 | try: |
---|
548 | form_fields['applicant_id'].for_display = True |
---|
549 | except: |
---|
550 | pass |
---|
551 | return form_fields |
---|
552 | |
---|
553 | |
---|
554 | class CustomApplicantEditFormPage(NigeriaApplicantEditFormPage): |
---|
555 | """An applicant-centered edit view for applicant data. |
---|
556 | """ |
---|
557 | |
---|
558 | def unremovable(self, ticket): |
---|
559 | return True |
---|
560 | |
---|
561 | @property |
---|
562 | def display_payments(self): |
---|
563 | if self.context.special or self.target == 'ictwk': |
---|
564 | return True |
---|
565 | return getattr(self.context.__parent__, 'application_fee', None) |
---|
566 | |
---|
567 | @property |
---|
568 | def form_fields(self): |
---|
569 | state = IWorkflowState(self.context).getState() |
---|
570 | if self.target is not None and self.target == 'tscf': |
---|
571 | form_fields = grok.AutoFields(ITranscriptApplicant) |
---|
572 | form_fields['courier_tno'].for_display = True |
---|
573 | form_fields['proc_date'].for_display = True |
---|
574 | for field in TRANS_OMIT_EDIT_FIELDS: |
---|
575 | form_fields = form_fields.omit(field) |
---|
576 | if state == PAID: |
---|
577 | form_fields['order'].for_display = True |
---|
578 | form_fields = form_fields.omit('locked') |
---|
579 | return form_fields |
---|
580 | if self.target is not None and self.target == 'tscs': |
---|
581 | form_fields = grok.AutoFields(ITranscriptApplicant) |
---|
582 | form_fields['courier_tno'].for_display = True |
---|
583 | form_fields['proc_date'].for_display = True |
---|
584 | for field in TRANS_SHORT_OMIT_EDIT_FIELDS: |
---|
585 | form_fields = form_fields.omit(field) |
---|
586 | form_fields = form_fields.omit('locked') |
---|
587 | if state == PAID: |
---|
588 | form_fields['order'].for_display = True |
---|
589 | return form_fields |
---|
590 | if self.target == 'ictwk': |
---|
591 | form_fields = grok.AutoFields(IUnibenRegistration) |
---|
592 | for field in REGISTRATION_OMIT_EDIT_FIELDS: |
---|
593 | form_fields = form_fields.omit(field) |
---|
594 | if state != STARTED: |
---|
595 | form_fields['registration_cats'].for_display = True |
---|
596 | return form_fields |
---|
597 | if self.target is not None and self.target == 'flc': |
---|
598 | form_fields = grok.AutoFields(IFrenchApplicant) |
---|
599 | for field in REGISTRATION_OMIT_EDIT_FIELDS: |
---|
600 | form_fields = form_fields.omit(field) |
---|
601 | return form_fields |
---|
602 | if self.target is not None and self.target.startswith('pg'): |
---|
603 | form_fields = grok.AutoFields(ICustomPGApplicantEdit) |
---|
604 | for field in PG_OMIT_EDIT_FIELDS: |
---|
605 | form_fields = form_fields.omit(field) |
---|
606 | elif self.target is not None and self.target.startswith('pre'): |
---|
607 | form_fields = grok.AutoFields(ICustomPGApplicantEdit) |
---|
608 | for field in PRE_OMIT_EDIT_FIELDS: |
---|
609 | form_fields = form_fields.omit(field) |
---|
610 | elif self.target is not None and self.target.startswith('cbt'): |
---|
611 | form_fields = grok.AutoFields(ICustomUGApplicantEdit) |
---|
612 | for field in CBT_OMIT_EDIT_FIELDS: |
---|
613 | form_fields = form_fields.omit(field) |
---|
614 | elif self.target is not None and self.target.startswith('akj'): |
---|
615 | form_fields = grok.AutoFields(ICustomPGApplicant) |
---|
616 | for field in PRE_OMIT_EDIT_FIELDS: |
---|
617 | form_fields = form_fields.omit(field) |
---|
618 | elif self.target is not None and self.target.startswith('ak'): |
---|
619 | form_fields = grok.AutoFields(ICustomUGApplicantEdit) |
---|
620 | for field in AFFIL_OMIT_EDIT_FIELDS: |
---|
621 | form_fields = form_fields.omit(field) |
---|
622 | elif self.target is not None and self.target.startswith('ase'): # was putme |
---|
623 | form_fields = grok.AutoFields(IPUTMEApplicantEdit) |
---|
624 | for field in PUTME_OMIT_EDIT_FIELDS: |
---|
625 | form_fields = form_fields.omit(field) |
---|
626 | elif self.target is not None and self.target.startswith('pt'): |
---|
627 | form_fields = grok.AutoFields(IPUTMEApplicantEdit) |
---|
628 | for field in PT_OMIT_EDIT_FIELDS: |
---|
629 | form_fields = form_fields.omit(field) |
---|
630 | elif self.target is not None and self.target.startswith('pude'): |
---|
631 | form_fields = grok.AutoFields(ICustomUGApplicantEdit) |
---|
632 | for field in PUDE_OMIT_EDIT_FIELDS: |
---|
633 | form_fields = form_fields.omit(field) |
---|
634 | else: |
---|
635 | form_fields = grok.AutoFields(ICustomUGApplicantEdit) |
---|
636 | for field in UG_OMIT_EDIT_FIELDS: |
---|
637 | form_fields = form_fields.omit(field) |
---|
638 | form_fields['applicant_id'].for_display = True |
---|
639 | form_fields['reg_number'].for_display = True |
---|
640 | return form_fields |
---|
641 | |
---|
642 | @property |
---|
643 | def label(self): |
---|
644 | if self.target == 'ictwk': |
---|
645 | container_title = self.context.__parent__.title |
---|
646 | return _('${a} <br /> Registration Record ${b}', mapping = { |
---|
647 | 'a':container_title, 'b':self.context.application_number}) |
---|
648 | return super(CustomApplicantEditFormPage, self).label |
---|
649 | |
---|
650 | def display_fileupload(self, filename): |
---|
651 | if filename[1] == 'res_stat' \ |
---|
652 | and self.target is not None \ |
---|
653 | and not self.target.startswith('tsc'): |
---|
654 | return False |
---|
655 | if filename[1] == 'eligibility' \ |
---|
656 | and self.target is not None \ |
---|
657 | and not self.target.startswith('tsc'): |
---|
658 | return False |
---|
659 | return True |
---|
660 | |
---|
661 | def dataNotComplete(self, data): |
---|
662 | store = getUtility(IExtFileStore) |
---|
663 | if self.context.__parent__.with_picture \ |
---|
664 | and self.context.__parent__.picture_editable: |
---|
665 | store = getUtility(IExtFileStore) |
---|
666 | if not store.getFileByContext(self.context, attr=u'passport.jpg'): |
---|
667 | return _('No passport picture uploaded.') |
---|
668 | if self.target is not None \ |
---|
669 | and self.target.startswith('tscf') \ |
---|
670 | and not store.getFileByContext(self.context, attr=u'res_stat.pdf'): |
---|
671 | return _('No statement of result pdf file uploaded.') |
---|
672 | if self.target is not None \ |
---|
673 | and self.target.startswith('tsc') \ |
---|
674 | and (not self.context.order or not self.context.charge): |
---|
675 | return _('Please select Type of Order and Transcript Charge.') |
---|
676 | if self.target is not None \ |
---|
677 | and self.target.startswith('pt') \ |
---|
678 | and not self.context.jamb_reg_number: |
---|
679 | return _('Please enter your JAMB Registration Number.') |
---|
680 | return False |
---|
681 | |
---|
682 | class CustomOnlinePaymentApprovePage(OnlinePaymentApprovePage): |
---|
683 | """ Approval view |
---|
684 | """ |
---|
685 | |
---|
686 | def update(self): |
---|
687 | if self.context.p_category == 'admission_checking': |
---|
688 | if self.context.p_state == 'paid': |
---|
689 | flashtype = 'warning' |
---|
690 | msg = _('This ticket has already been paid.') |
---|
691 | log = None |
---|
692 | else: |
---|
693 | self.context.approve() |
---|
694 | log = 'payment approved: %s' % self.context.p_id |
---|
695 | msg = _('Payment approved') |
---|
696 | flashtype = 'success' |
---|
697 | else: |
---|
698 | flashtype, msg, log = self.context.approveApplicantPayment() |
---|
699 | if log is not None: |
---|
700 | applicant = self.context.__parent__ |
---|
701 | # Add log message to applicants.log |
---|
702 | applicant.writeLogMessage(self, log) |
---|
703 | # Add log message to payments.log |
---|
704 | self.context.logger.info( |
---|
705 | '%s,%s,%s,%s,%s,,,,,,' % ( |
---|
706 | applicant.applicant_id, |
---|
707 | self.context.p_id, self.context.p_category, |
---|
708 | self.context.amount_auth, self.context.r_code)) |
---|
709 | self.flash(msg, type=flashtype) |
---|
710 | return |
---|
711 | |
---|
712 | class CustomExportPDFPageApplicationSlip(ExportPDFPageApplicationSlip): |
---|
713 | """Deliver a PDF slip of the context. |
---|
714 | """ |
---|
715 | |
---|
716 | def update(self): |
---|
717 | super(CustomExportPDFPageApplicationSlip, self).update() |
---|
718 | if self.context.state == ADMITTED and \ |
---|
719 | not self.context.admchecking_fee_paid(): |
---|
720 | self.flash( |
---|
721 | _('Please pay admission checking fee before trying to download ' |
---|
722 | 'the application slip.'), type='warning') |
---|
723 | return self.redirect(self.url(self.context)) |
---|
724 | return |
---|
725 | |
---|
726 | class CustomPDFApplicationSlip(NigeriaPDFApplicationSlip): |
---|
727 | |
---|
728 | def _getPDFCreator(self): |
---|
729 | if self.target.startswith('ak'): |
---|
730 | return getUtility(IPDFCreator, name='akoka_pdfcreator') |
---|
731 | return getUtility(IPDFCreator) |
---|
732 | |
---|
733 | @property |
---|
734 | def form_fields(self): |
---|
735 | if self.target is not None and self.target == 'tscf': |
---|
736 | form_fields = grok.AutoFields(ITranscriptApplicant) |
---|
737 | for field in TRANS_OMIT_PDF_FIELDS: |
---|
738 | form_fields = form_fields.omit(field) |
---|
739 | elif self.target is not None and self.target == 'tscs': |
---|
740 | form_fields = grok.AutoFields(ITranscriptApplicant) |
---|
741 | for field in TRANS_SHORT_OMIT_PDF_FIELDS: |
---|
742 | form_fields = form_fields.omit(field) |
---|
743 | elif self.target is not None and self.target == 'ictwk': |
---|
744 | form_fields = grok.AutoFields(IUnibenRegistration) |
---|
745 | for field in REGISTRATION_OMIT_PDF_FIELDS: |
---|
746 | form_fields = form_fields.omit(field) |
---|
747 | elif self.target is not None and self.target.startswith('pg'): |
---|
748 | form_fields = grok.AutoFields(ICustomPGApplicant) |
---|
749 | for field in PG_OMIT_PDF_FIELDS: |
---|
750 | form_fields = form_fields.omit(field) |
---|
751 | elif self.target is not None and self.target.startswith('pre'): |
---|
752 | form_fields = grok.AutoFields(ICustomPGApplicant) |
---|
753 | for field in PRE_OMIT_PDF_FIELDS: |
---|
754 | form_fields = form_fields.omit(field) |
---|
755 | elif self.target is not None and self.target.startswith('cbt'): # uniben |
---|
756 | form_fields = grok.AutoFields(ICustomUGApplicant) |
---|
757 | for field in CBT_OMIT_PDF_FIELDS: |
---|
758 | form_fields = form_fields.omit(field) |
---|
759 | elif self.target is not None and self.target.startswith('akj'): # uniben |
---|
760 | form_fields = grok.AutoFields(ICustomPGApplicant) |
---|
761 | for field in PRE_OMIT_PDF_FIELDS: |
---|
762 | form_fields = form_fields.omit(field) |
---|
763 | elif self.target is not None and self.target.startswith('ak'): # uniben |
---|
764 | form_fields = grok.AutoFields(ICustomUGApplicant) |
---|
765 | for field in AFFIL_OMIT_PDF_FIELDS: |
---|
766 | form_fields = form_fields.omit(field) |
---|
767 | elif self.target is not None and self.target.startswith('ase'): # was putme |
---|
768 | form_fields = grok.AutoFields(ICustomUGApplicant) |
---|
769 | if self._reduced_slip(): |
---|
770 | for field in PUTME_OMIT_RESULT_SLIP_FIELDS: |
---|
771 | form_fields = form_fields.omit(field) |
---|
772 | else: |
---|
773 | for field in PUTME_OMIT_PDF_FIELDS: |
---|
774 | form_fields = form_fields.omit(field) |
---|
775 | elif self.target is not None and self.target.startswith('pt'): |
---|
776 | form_fields = grok.AutoFields(ICustomUGApplicant) |
---|
777 | if self._reduced_slip(): |
---|
778 | for field in PT_OMIT_RESULT_SLIP_FIELDS: |
---|
779 | form_fields = form_fields.omit(field) |
---|
780 | else: |
---|
781 | for field in PT_OMIT_PDF_FIELDS: |
---|
782 | form_fields = form_fields.omit(field) |
---|
783 | elif self.target is not None and self.target.startswith('pude'): |
---|
784 | form_fields = grok.AutoFields(ICustomUGApplicant) |
---|
785 | if self._reduced_slip(): |
---|
786 | for field in PUDE_OMIT_RESULT_SLIP_FIELDS: |
---|
787 | form_fields = form_fields.omit(field) |
---|
788 | else: |
---|
789 | for field in PUDE_OMIT_PDF_FIELDS: |
---|
790 | form_fields = form_fields.omit(field) |
---|
791 | elif self.target is not None and self.target == 'flc': |
---|
792 | form_fields = grok.AutoFields(IFrenchApplicant) |
---|
793 | for field in REGISTRATION_OMIT_PDF_FIELDS: |
---|
794 | form_fields = form_fields.omit(field) |
---|
795 | else: |
---|
796 | form_fields = grok.AutoFields(ICustomUGApplicant) |
---|
797 | for field in UG_OMIT_PDF_FIELDS: |
---|
798 | form_fields = form_fields.omit(field) |
---|
799 | if not getattr(self.context, 'student_id'): |
---|
800 | form_fields = form_fields.omit('student_id') |
---|
801 | if not getattr(self.context, 'screening_score'): |
---|
802 | form_fields = form_fields.omit('screening_score') |
---|
803 | if not getattr(self.context, 'screening_venue'): |
---|
804 | form_fields = form_fields.omit('screening_venue') |
---|
805 | if not getattr(self.context, 'screening_date'): |
---|
806 | form_fields = form_fields.omit('screening_date') |
---|
807 | return form_fields |
---|
808 | |
---|
809 | @property |
---|
810 | def title(self): |
---|
811 | container_title = self.context.__parent__.title |
---|
812 | portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE |
---|
813 | ar_translation = translate(_('Application Record'), |
---|
814 | 'waeup.kofa', target_language=portal_language) |
---|
815 | if self.target == 'ictwk': |
---|
816 | return '%s - Registration Record %s' % (container_title, |
---|
817 | self.context.application_number) |
---|
818 | elif self.target.startswith('ab'): |
---|
819 | return 'Federal College of Education (Technical) Asaba - %s %s %s' % ( |
---|
820 | container_title, ar_translation, |
---|
821 | self.context.application_number) |
---|
822 | elif self.target.startswith('ak'): |
---|
823 | return 'Federal College of Education (Technical) Akoka - %s - %s %s' % ( |
---|
824 | container_title, ar_translation, |
---|
825 | self.context.application_number) |
---|
826 | elif self.target == 'pgn': |
---|
827 | return 'National Institute for Legislative Studies (NILS) - %s %s %s' % ( |
---|
828 | container_title, ar_translation, |
---|
829 | self.context.application_number) |
---|
830 | return '%s - %s %s' % (container_title, |
---|
831 | ar_translation, self.context.application_number) |
---|
832 | |
---|
833 | class CustomApplicantBaseDisplayFormPage(ApplicantBaseDisplayFormPage): |
---|
834 | |
---|
835 | @property |
---|
836 | def form_fields(self): |
---|
837 | target = getattr(self.context.__parent__, 'prefix', None) |
---|
838 | if target.startswith('tsc'): |
---|
839 | form_fields = grok.AutoFields(ICustomApplicant).select( |
---|
840 | 'applicant_id', 'email', 'dispatch_address') |
---|
841 | else: |
---|
842 | form_fields = grok.AutoFields(ICustomApplicant).select( |
---|
843 | 'applicant_id', 'reg_number', 'email', 'course1') |
---|
844 | if self.context.__parent__.prefix in ('special',): |
---|
845 | form_fields['reg_number'].field.title = u'Identification Number' |
---|
846 | return form_fields |
---|
847 | return form_fields |
---|
848 | |
---|
849 | class CustomExportPDFPaymentSlipPage(NigeriaExportPDFPaymentSlipPage): |
---|
850 | """Deliver a PDF slip of the context. |
---|
851 | """ |
---|
852 | |
---|
853 | @property |
---|
854 | def omit_fields(self): |
---|
855 | target = getattr(self.context.__parent__.__parent__, 'prefix', None) |
---|
856 | if target.startswith('tsc'): |
---|
857 | return ('date_of_birth', 'course1') |
---|
858 | return () |
---|
859 | |
---|
860 | @property |
---|
861 | def note(self): |
---|
862 | return |
---|
863 | |
---|
864 | def render(self): |
---|
865 | if self.payment_slip_download_warning: |
---|
866 | self.flash(self.payment_slip_download_warning, type='danger') |
---|
867 | self.redirect(self.url(self.context)) |
---|
868 | return |
---|
869 | applicantview = CustomApplicantBaseDisplayFormPage(self.context.__parent__, |
---|
870 | self.request) |
---|
871 | students_utils = getUtility(IStudentsUtils) |
---|
872 | return students_utils.renderPDF(self,'payment_slip.pdf', |
---|
873 | self.context.__parent__, applicantview, |
---|
874 | note=self.note, omit_fields=self.omit_fields) |
---|
875 | |
---|
876 | class ExportScreeningInvitationSlip(UtilityView, grok.View): |
---|
877 | """Deliver a PDF slip of the context. |
---|
878 | """ |
---|
879 | grok.context(ICustomApplicant) |
---|
880 | grok.name('screening_invitation_slip.pdf') |
---|
881 | grok.require('waeup.viewApplication') |
---|
882 | form_fields = None |
---|
883 | label = u'Invitation Letter for Pre-Admission Screening' |
---|
884 | |
---|
885 | |
---|
886 | @property |
---|
887 | def note(self): |
---|
888 | notice = getattr(self.context.__parent__, 'application_slip_notice') |
---|
889 | if notice is None: |
---|
890 | notice = '' |
---|
891 | if self.context.screening_date: |
---|
892 | return """ |
---|
893 | <br /><br /><br /><br /><font size='12'> |
---|
894 | Dear %s, |
---|
895 | <br /><br /><br /> |
---|
896 | You are invited for your Uniben Admission Screening Exercise on: |
---|
897 | <br /><br /> |
---|
898 | <strong>%s</strong>. |
---|
899 | <br /><br /> |
---|
900 | Please bring along this letter of invitation to the |
---|
901 | <br /><br /> |
---|
902 | <strong>%s</strong> |
---|
903 | <br /><br /> |
---|
904 | on your screening date. |
---|
905 | <br /><br /><br /> |
---|
906 | Signed, |
---|
907 | <br /><br /> |
---|
908 | The Registrar<br /> |
---|
909 | <br /><br /> |
---|
910 | <br /><br /> |
---|
911 | %s |
---|
912 | </font> |
---|
913 | |
---|
914 | """ % (self.context.display_fullname, self.context.screening_date, |
---|
915 | self.context.screening_venue, notice) |
---|
916 | return |
---|
917 | |
---|
918 | def update(self): |
---|
919 | if not self.context.screening_date: |
---|
920 | self.flash(_('Forbidden'), type="warning") |
---|
921 | self.redirect(self.url(self.context)) |
---|
922 | |
---|
923 | def render(self): |
---|
924 | applicantview = ApplicantBaseDisplayFormPage(self.context, self.request) |
---|
925 | students_utils = getUtility(IStudentsUtils) |
---|
926 | return students_utils.renderPDF(self,'screening_invitation_slip.pdf', |
---|
927 | self.context, applicantview, note=self.note) |
---|
928 | |
---|
929 | class CustomCheckTranscriptStatus(CheckTranscriptStatus): |
---|
930 | """A display page for checking transcript processing status. |
---|
931 | """ |
---|
932 | grok.template('checktranscriptstatus') |
---|
933 | |
---|
934 | websites = (('Uniben Alumni Portal', 'https://alumni.uniben.edu/'), |
---|
935 | ('Uniben Student Portal', 'https://waeup.uniben.edu/'),) |
---|
936 | appl_url1 = 'https://alumni.uniben.edu/applicants/tscf1/register' |
---|
937 | appl_url2 = 'https://alumni.uniben.edu/applicants/tscs1/register' |
---|
938 | |
---|
939 | class CreateGraduatedPage(UtilityView, grok.View): |
---|
940 | """Create a student object from transcript application data. |
---|
941 | """ |
---|
942 | grok.context(ICustomApplicant) |
---|
943 | grok.name('creategraduated') |
---|
944 | grok.require('waeup.createStudents') |
---|
945 | |
---|
946 | def update(self): |
---|
947 | success, msg = self.context.createStudent(view=self, graduated=True) |
---|
948 | if success: |
---|
949 | self.flash(msg) |
---|
950 | else: |
---|
951 | self.flash(msg, type='warning') |
---|
952 | self.redirect(self.url(self.context)) |
---|
953 | return |
---|
954 | |
---|
955 | def render(self): |
---|
956 | return |
---|
957 | |
---|
958 | class ResultStatement(AdditionalFile): |
---|
959 | grok.name('res_stat') |
---|
960 | |
---|
961 | class EligibilityForm(AdditionalFile): |
---|
962 | grok.name('eligibility') |
---|