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