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