[5273] | 1 | ## $Id: browser.py 13076 2015-06-19 05:49:57Z henrik $ |
---|
[6078] | 2 | ## |
---|
[7192] | 3 | ## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann |
---|
[5273] | 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. |
---|
[6078] | 8 | ## |
---|
[5273] | 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. |
---|
[6078] | 13 | ## |
---|
[5273] | 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 | ## |
---|
[5824] | 18 | """UI components for basic applicants and related components. |
---|
[5273] | 19 | """ |
---|
[7063] | 20 | import os |
---|
[6082] | 21 | import sys |
---|
[5273] | 22 | import grok |
---|
[7370] | 23 | from datetime import datetime, date |
---|
[8042] | 24 | from zope.event import notify |
---|
[7392] | 25 | from zope.component import getUtility, createObject, getAdapter |
---|
[8033] | 26 | from zope.catalog.interfaces import ICatalog |
---|
[7714] | 27 | from zope.i18n import translate |
---|
[7322] | 28 | from hurry.workflow.interfaces import ( |
---|
| 29 | IWorkflowInfo, IWorkflowState, InvalidTransitionError) |
---|
[7811] | 30 | from waeup.kofa.applicants.interfaces import ( |
---|
[7363] | 31 | IApplicant, IApplicantEdit, IApplicantsRoot, |
---|
[7683] | 32 | IApplicantsContainer, IApplicantsContainerAdd, |
---|
[8033] | 33 | MAX_UPLOAD_SIZE, IApplicantOnlinePayment, IApplicantsUtils, |
---|
[10845] | 34 | IApplicantRegisterUpdate, ISpecialApplicant |
---|
[7363] | 35 | ) |
---|
[12247] | 36 | from waeup.kofa.utils.helpers import html2dict |
---|
[10655] | 37 | from waeup.kofa.applicants.container import ( |
---|
| 38 | ApplicantsContainer, VirtualApplicantsExportJobContainer) |
---|
[8404] | 39 | from waeup.kofa.applicants.applicant import search |
---|
[8636] | 40 | from waeup.kofa.applicants.workflow import ( |
---|
| 41 | INITIALIZED, STARTED, PAID, SUBMITTED, ADMITTED) |
---|
[7811] | 42 | from waeup.kofa.browser import ( |
---|
[9217] | 43 | # KofaPage, KofaEditFormPage, KofaAddFormPage, KofaDisplayFormPage, |
---|
[7363] | 44 | DEFAULT_PASSPORT_IMAGE_PATH) |
---|
[9217] | 45 | from waeup.kofa.browser.layout import ( |
---|
| 46 | KofaPage, KofaEditFormPage, KofaAddFormPage, KofaDisplayFormPage) |
---|
[7811] | 47 | from waeup.kofa.browser.interfaces import ICaptchaManager |
---|
| 48 | from waeup.kofa.browser.breadcrumbs import Breadcrumb |
---|
| 49 | from waeup.kofa.browser.layout import ( |
---|
[11437] | 50 | NullValidator, jsaction, action, UtilityView) |
---|
[10655] | 51 | from waeup.kofa.browser.pages import ( |
---|
| 52 | add_local_role, del_local_roles, doll_up, ExportCSVView) |
---|
[7811] | 53 | from waeup.kofa.interfaces import ( |
---|
[7819] | 54 | IKofaObject, ILocalRolesAssignable, IExtFileStore, IPDF, |
---|
| 55 | IFileStoreNameChooser, IPasswordValidator, IUserAccount, IKofaUtils) |
---|
[7811] | 56 | from waeup.kofa.interfaces import MessageFactory as _ |
---|
| 57 | from waeup.kofa.permissions import get_users_with_local_roles |
---|
| 58 | from waeup.kofa.students.interfaces import IStudentsUtils |
---|
[8186] | 59 | from waeup.kofa.utils.helpers import string_from_bytes, file_size, now |
---|
[8170] | 60 | from waeup.kofa.widgets.datewidget import ( |
---|
[10831] | 61 | FriendlyDateDisplayWidget, |
---|
[8170] | 62 | FriendlyDatetimeDisplayWidget) |
---|
[5320] | 63 | |
---|
[7819] | 64 | grok.context(IKofaObject) # Make IKofaObject the default context |
---|
[5273] | 65 | |
---|
[11437] | 66 | WARNING = _('You can not edit your application records after final submission.' |
---|
| 67 | ' You really want to submit?') |
---|
[8550] | 68 | |
---|
[8388] | 69 | class ApplicantsRootPage(KofaDisplayFormPage): |
---|
[5822] | 70 | grok.context(IApplicantsRoot) |
---|
| 71 | grok.name('index') |
---|
[6153] | 72 | grok.require('waeup.Public') |
---|
[8388] | 73 | form_fields = grok.AutoFields(IApplicantsRoot) |
---|
[13076] | 74 | label = _('Applicants Section') |
---|
[5843] | 75 | pnav = 3 |
---|
[6012] | 76 | |
---|
| 77 | def update(self): |
---|
[6067] | 78 | super(ApplicantsRootPage, self).update() |
---|
[6012] | 79 | return |
---|
| 80 | |
---|
[8388] | 81 | @property |
---|
| 82 | def introduction(self): |
---|
| 83 | # Here we know that the cookie has been set |
---|
| 84 | lang = self.request.cookies.get('kofa.language') |
---|
| 85 | html = self.context.description_dict.get(lang,'') |
---|
| 86 | if html == '': |
---|
| 87 | portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE |
---|
| 88 | html = self.context.description_dict.get(portal_language,'') |
---|
| 89 | return html |
---|
| 90 | |
---|
[10097] | 91 | @property |
---|
| 92 | def containers(self): |
---|
[10098] | 93 | if self.layout.isAuthenticated(): |
---|
| 94 | return self.context.values() |
---|
[10097] | 95 | return [value for value in self.context.values() if not value.hidden] |
---|
| 96 | |
---|
[8404] | 97 | class ApplicantsSearchPage(KofaPage): |
---|
| 98 | grok.context(IApplicantsRoot) |
---|
| 99 | grok.name('search') |
---|
| 100 | grok.require('waeup.viewApplication') |
---|
[10644] | 101 | label = _('Find applicants') |
---|
[10645] | 102 | search_button = _('Find applicant') |
---|
[8404] | 103 | pnav = 3 |
---|
| 104 | |
---|
| 105 | def update(self, *args, **kw): |
---|
| 106 | form = self.request.form |
---|
| 107 | self.results = [] |
---|
| 108 | if 'searchterm' in form and form['searchterm']: |
---|
| 109 | self.searchterm = form['searchterm'] |
---|
| 110 | self.searchtype = form['searchtype'] |
---|
| 111 | elif 'old_searchterm' in form: |
---|
| 112 | self.searchterm = form['old_searchterm'] |
---|
| 113 | self.searchtype = form['old_searchtype'] |
---|
| 114 | else: |
---|
| 115 | if 'search' in form: |
---|
[11254] | 116 | self.flash(_('Empty search string'), type='warning') |
---|
[8404] | 117 | return |
---|
| 118 | self.results = search(query=self.searchterm, |
---|
| 119 | searchtype=self.searchtype, view=self) |
---|
| 120 | if not self.results: |
---|
[11254] | 121 | self.flash(_('No applicant found.'), type='warning') |
---|
[8404] | 122 | return |
---|
| 123 | |
---|
[7819] | 124 | class ApplicantsRootManageFormPage(KofaEditFormPage): |
---|
[5828] | 125 | grok.context(IApplicantsRoot) |
---|
| 126 | grok.name('manage') |
---|
[6107] | 127 | grok.template('applicantsrootmanagepage') |
---|
[8388] | 128 | form_fields = grok.AutoFields(IApplicantsRoot) |
---|
[13076] | 129 | label = _('Manage applicants section') |
---|
[5843] | 130 | pnav = 3 |
---|
[7136] | 131 | grok.require('waeup.manageApplication') |
---|
[8388] | 132 | taboneactions = [_('Save')] |
---|
| 133 | tabtwoactions = [_('Add applicants container'), _('Remove selected')] |
---|
| 134 | tabthreeactions1 = [_('Remove selected local roles')] |
---|
| 135 | tabthreeactions2 = [_('Add local role')] |
---|
[7710] | 136 | subunits = _('Applicants Containers') |
---|
[6078] | 137 | |
---|
[6184] | 138 | def getLocalRoles(self): |
---|
| 139 | roles = ILocalRolesAssignable(self.context) |
---|
| 140 | return roles() |
---|
| 141 | |
---|
| 142 | def getUsers(self): |
---|
| 143 | """Get a list of all users. |
---|
| 144 | """ |
---|
| 145 | for key, val in grok.getSite()['users'].items(): |
---|
| 146 | url = self.url(val) |
---|
| 147 | yield(dict(url=url, name=key, val=val)) |
---|
| 148 | |
---|
| 149 | def getUsersWithLocalRoles(self): |
---|
| 150 | return get_users_with_local_roles(self.context) |
---|
| 151 | |
---|
[7710] | 152 | @jsaction(_('Remove selected')) |
---|
[6069] | 153 | def delApplicantsContainers(self, **data): |
---|
| 154 | form = self.request.form |
---|
[9701] | 155 | if 'val_id' in form: |
---|
[8388] | 156 | child_id = form['val_id'] |
---|
| 157 | else: |
---|
[11254] | 158 | self.flash(_('No container selected!'), type='warning') |
---|
| 159 | self.redirect(self.url(self.context, '@@manage')+'#tab2') |
---|
[8388] | 160 | return |
---|
[6069] | 161 | if not isinstance(child_id, list): |
---|
| 162 | child_id = [child_id] |
---|
| 163 | deleted = [] |
---|
| 164 | for id in child_id: |
---|
| 165 | try: |
---|
| 166 | del self.context[id] |
---|
| 167 | deleted.append(id) |
---|
| 168 | except: |
---|
[7710] | 169 | self.flash(_('Could not delete:') + ' %s: %s: %s' % ( |
---|
[11254] | 170 | id, sys.exc_info()[0], sys.exc_info()[1]), type='danger') |
---|
[6069] | 171 | if len(deleted): |
---|
[7738] | 172 | self.flash(_('Successfully removed: ${a}', |
---|
| 173 | mapping = {'a':', '.join(deleted)})) |
---|
[12892] | 174 | ob_class = self.__implemented__.__name__.replace('waeup.kofa.','') |
---|
| 175 | self.context.logger.info( |
---|
| 176 | '%s - removed: %s' % (ob_class, ', '.join(deleted))) |
---|
[11254] | 177 | self.redirect(self.url(self.context, '@@manage')+'#tab2') |
---|
[6078] | 178 | return |
---|
[5828] | 179 | |
---|
[7710] | 180 | @action(_('Add applicants container'), validator=NullValidator) |
---|
[6069] | 181 | def addApplicantsContainer(self, **data): |
---|
| 182 | self.redirect(self.url(self.context, '@@add')) |
---|
[6078] | 183 | return |
---|
| 184 | |
---|
[7710] | 185 | @action(_('Add local role'), validator=NullValidator) |
---|
[6184] | 186 | def addLocalRole(self, **data): |
---|
[7484] | 187 | return add_local_role(self,3, **data) |
---|
[6184] | 188 | |
---|
[7710] | 189 | @action(_('Remove selected local roles')) |
---|
[6184] | 190 | def delLocalRoles(self, **data): |
---|
[7484] | 191 | return del_local_roles(self,3,**data) |
---|
[6184] | 192 | |
---|
[8388] | 193 | @action(_('Save'), style='primary') |
---|
| 194 | def save(self, **data): |
---|
| 195 | self.applyData(self.context, **data) |
---|
[12247] | 196 | description = getattr(self.context, 'description', None) |
---|
| 197 | portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE |
---|
| 198 | self.context.description_dict = html2dict(description, portal_language) |
---|
[8390] | 199 | self.flash(_('Form has been saved.')) |
---|
[8388] | 200 | return |
---|
| 201 | |
---|
[7819] | 202 | class ApplicantsContainerAddFormPage(KofaAddFormPage): |
---|
[5822] | 203 | grok.context(IApplicantsRoot) |
---|
[7136] | 204 | grok.require('waeup.manageApplication') |
---|
[5822] | 205 | grok.name('add') |
---|
[6107] | 206 | grok.template('applicantscontaineraddpage') |
---|
[7710] | 207 | label = _('Add applicants container') |
---|
[5843] | 208 | pnav = 3 |
---|
[6078] | 209 | |
---|
[6103] | 210 | form_fields = grok.AutoFields( |
---|
[7903] | 211 | IApplicantsContainerAdd).omit('code').omit('title') |
---|
[6078] | 212 | |
---|
[7710] | 213 | @action(_('Add applicants container')) |
---|
[6069] | 214 | def addApplicantsContainer(self, **data): |
---|
[6103] | 215 | year = data['year'] |
---|
| 216 | code = u'%s%s' % (data['prefix'], year) |
---|
[9529] | 217 | apptypes_dict = getUtility(IApplicantsUtils).APP_TYPES_DICT |
---|
| 218 | title = apptypes_dict[data['prefix']][0] |
---|
[7685] | 219 | title = u'%s %s/%s' % (title, year, year + 1) |
---|
[6087] | 220 | if code in self.context.keys(): |
---|
[6105] | 221 | self.flash( |
---|
[11254] | 222 | _('An applicants container for the same application ' |
---|
| 223 | 'type and entrance year exists already in the database.'), |
---|
| 224 | type='warning') |
---|
[5822] | 225 | return |
---|
| 226 | # Add new applicants container... |
---|
[8009] | 227 | container = createObject(u'waeup.ApplicantsContainer') |
---|
[6069] | 228 | self.applyData(container, **data) |
---|
[6087] | 229 | container.code = code |
---|
| 230 | container.title = title |
---|
| 231 | self.context[code] = container |
---|
[7710] | 232 | self.flash(_('Added:') + ' "%s".' % code) |
---|
[12892] | 233 | ob_class = self.__implemented__.__name__.replace('waeup.kofa.','') |
---|
| 234 | self.context.logger.info('%s - added: %s' % (ob_class, code)) |
---|
[7484] | 235 | self.redirect(self.url(self.context, u'@@manage')) |
---|
[5822] | 236 | return |
---|
[6078] | 237 | |
---|
[7710] | 238 | @action(_('Cancel'), validator=NullValidator) |
---|
[6069] | 239 | def cancel(self, **data): |
---|
[7484] | 240 | self.redirect(self.url(self.context, '@@manage')) |
---|
[6078] | 241 | |
---|
[5845] | 242 | class ApplicantsRootBreadcrumb(Breadcrumb): |
---|
| 243 | """A breadcrumb for applicantsroot. |
---|
| 244 | """ |
---|
| 245 | grok.context(IApplicantsRoot) |
---|
[7710] | 246 | title = _(u'Applicants') |
---|
[6078] | 247 | |
---|
[5845] | 248 | class ApplicantsContainerBreadcrumb(Breadcrumb): |
---|
| 249 | """A breadcrumb for applicantscontainers. |
---|
| 250 | """ |
---|
| 251 | grok.context(IApplicantsContainer) |
---|
[6319] | 252 | |
---|
[10655] | 253 | |
---|
| 254 | class ApplicantsExportsBreadcrumb(Breadcrumb): |
---|
| 255 | """A breadcrumb for exports. |
---|
| 256 | """ |
---|
| 257 | grok.context(VirtualApplicantsExportJobContainer) |
---|
| 258 | title = _(u'Applicant Data Exports') |
---|
| 259 | target = None |
---|
| 260 | |
---|
[6153] | 261 | class ApplicantBreadcrumb(Breadcrumb): |
---|
| 262 | """A breadcrumb for applicants. |
---|
| 263 | """ |
---|
| 264 | grok.context(IApplicant) |
---|
[6319] | 265 | |
---|
[6153] | 266 | @property |
---|
| 267 | def title(self): |
---|
| 268 | """Get a title for a context. |
---|
| 269 | """ |
---|
[7240] | 270 | return self.context.application_number |
---|
[5828] | 271 | |
---|
[7250] | 272 | class OnlinePaymentBreadcrumb(Breadcrumb): |
---|
| 273 | """A breadcrumb for payments. |
---|
| 274 | """ |
---|
| 275 | grok.context(IApplicantOnlinePayment) |
---|
| 276 | |
---|
| 277 | @property |
---|
| 278 | def title(self): |
---|
| 279 | return self.context.p_id |
---|
| 280 | |
---|
[8563] | 281 | class ApplicantsStatisticsPage(KofaDisplayFormPage): |
---|
| 282 | """Some statistics about applicants in a container. |
---|
| 283 | """ |
---|
| 284 | grok.context(IApplicantsContainer) |
---|
| 285 | grok.name('statistics') |
---|
[8565] | 286 | grok.require('waeup.viewApplicationStatistics') |
---|
[8563] | 287 | grok.template('applicantcontainerstatistics') |
---|
| 288 | |
---|
| 289 | @property |
---|
| 290 | def label(self): |
---|
| 291 | return "%s" % self.context.title |
---|
| 292 | |
---|
[7819] | 293 | class ApplicantsContainerPage(KofaDisplayFormPage): |
---|
[5830] | 294 | """The standard view for regular applicant containers. |
---|
| 295 | """ |
---|
| 296 | grok.context(IApplicantsContainer) |
---|
| 297 | grok.name('index') |
---|
[6153] | 298 | grok.require('waeup.Public') |
---|
[6029] | 299 | grok.template('applicantscontainerpage') |
---|
[5850] | 300 | pnav = 3 |
---|
[6053] | 301 | |
---|
[9078] | 302 | @property |
---|
| 303 | def form_fields(self): |
---|
[12247] | 304 | form_fields = grok.AutoFields(IApplicantsContainer).omit( |
---|
| 305 | 'title', 'description') |
---|
[9078] | 306 | form_fields[ |
---|
| 307 | 'startdate'].custom_widget = FriendlyDatetimeDisplayWidget('le') |
---|
| 308 | form_fields[ |
---|
| 309 | 'enddate'].custom_widget = FriendlyDatetimeDisplayWidget('le') |
---|
| 310 | if self.request.principal.id == 'zope.anybody': |
---|
| 311 | form_fields = form_fields.omit( |
---|
[10101] | 312 | 'code', 'prefix', 'year', 'mode', 'hidden', |
---|
[11870] | 313 | 'strict_deadline', 'application_category', |
---|
| 314 | 'application_slip_notice') |
---|
[9078] | 315 | return form_fields |
---|
[6053] | 316 | |
---|
[5837] | 317 | @property |
---|
[7708] | 318 | def introduction(self): |
---|
[7833] | 319 | # Here we know that the cookie has been set |
---|
| 320 | lang = self.request.cookies.get('kofa.language') |
---|
[7708] | 321 | html = self.context.description_dict.get(lang,'') |
---|
[8388] | 322 | if html == '': |
---|
[7833] | 323 | portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE |
---|
[7708] | 324 | html = self.context.description_dict.get(portal_language,'') |
---|
[8388] | 325 | return html |
---|
[7708] | 326 | |
---|
| 327 | @property |
---|
[7467] | 328 | def label(self): |
---|
[7493] | 329 | return "%s" % self.context.title |
---|
[5837] | 330 | |
---|
[7819] | 331 | class ApplicantsContainerManageFormPage(KofaEditFormPage): |
---|
[5837] | 332 | grok.context(IApplicantsContainer) |
---|
[5850] | 333 | grok.name('manage') |
---|
[6107] | 334 | grok.template('applicantscontainermanagepage') |
---|
[10625] | 335 | form_fields = grok.AutoFields(IApplicantsContainer) |
---|
[7710] | 336 | taboneactions = [_('Save'),_('Cancel')] |
---|
[8684] | 337 | tabtwoactions = [_('Remove selected'),_('Cancel'), |
---|
[8314] | 338 | _('Create students from selected')] |
---|
[7710] | 339 | tabthreeactions1 = [_('Remove selected local roles')] |
---|
| 340 | tabthreeactions2 = [_('Add local role')] |
---|
[5844] | 341 | # Use friendlier date widget... |
---|
[7136] | 342 | grok.require('waeup.manageApplication') |
---|
[5850] | 343 | |
---|
| 344 | @property |
---|
| 345 | def label(self): |
---|
[7710] | 346 | return _('Manage applicants container') |
---|
[5850] | 347 | |
---|
[5845] | 348 | pnav = 3 |
---|
[5837] | 349 | |
---|
[8547] | 350 | @property |
---|
| 351 | def showApplicants(self): |
---|
| 352 | if len(self.context) < 5000: |
---|
| 353 | return True |
---|
| 354 | return False |
---|
| 355 | |
---|
[6184] | 356 | def getLocalRoles(self): |
---|
| 357 | roles = ILocalRolesAssignable(self.context) |
---|
| 358 | return roles() |
---|
| 359 | |
---|
| 360 | def getUsers(self): |
---|
| 361 | """Get a list of all users. |
---|
| 362 | """ |
---|
| 363 | for key, val in grok.getSite()['users'].items(): |
---|
| 364 | url = self.url(val) |
---|
| 365 | yield(dict(url=url, name=key, val=val)) |
---|
| 366 | |
---|
| 367 | def getUsersWithLocalRoles(self): |
---|
| 368 | return get_users_with_local_roles(self.context) |
---|
| 369 | |
---|
[7714] | 370 | @action(_('Save'), style='primary') |
---|
[7489] | 371 | def save(self, **data): |
---|
[9531] | 372 | changed_fields = self.applyData(self.context, **data) |
---|
| 373 | if changed_fields: |
---|
| 374 | changed_fields = reduce(lambda x,y: x+y, changed_fields.values()) |
---|
| 375 | else: |
---|
| 376 | changed_fields = [] |
---|
[12247] | 377 | description = getattr(self.context, 'description', None) |
---|
| 378 | portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE |
---|
| 379 | self.context.description_dict = html2dict(description, portal_language) |
---|
[8562] | 380 | # Always refresh title. So we can change titles |
---|
| 381 | # if APP_TYPES_DICT has been edited. |
---|
[9529] | 382 | apptypes_dict = getUtility(IApplicantsUtils).APP_TYPES_DICT |
---|
| 383 | title = apptypes_dict[self.context.prefix][0] |
---|
[10625] | 384 | #self.context.title = u'%s %s/%s' % ( |
---|
| 385 | # title, self.context.year, self.context.year + 1) |
---|
[7710] | 386 | self.flash(_('Form has been saved.')) |
---|
[9531] | 387 | fields_string = ' + '.join(changed_fields) |
---|
[12892] | 388 | self.context.writeLogMessage(self, 'saved: %s' % fields_string) |
---|
[5837] | 389 | return |
---|
[6078] | 390 | |
---|
[7710] | 391 | @jsaction(_('Remove selected')) |
---|
[6105] | 392 | def delApplicant(self, **data): |
---|
[6189] | 393 | form = self.request.form |
---|
[9701] | 394 | if 'val_id' in form: |
---|
[6189] | 395 | child_id = form['val_id'] |
---|
| 396 | else: |
---|
[11254] | 397 | self.flash(_('No applicant selected!'), type='warning') |
---|
| 398 | self.redirect(self.url(self.context, '@@manage')+'#tab2') |
---|
[6189] | 399 | return |
---|
| 400 | if not isinstance(child_id, list): |
---|
| 401 | child_id = [child_id] |
---|
| 402 | deleted = [] |
---|
| 403 | for id in child_id: |
---|
| 404 | try: |
---|
| 405 | del self.context[id] |
---|
| 406 | deleted.append(id) |
---|
| 407 | except: |
---|
[7710] | 408 | self.flash(_('Could not delete:') + ' %s: %s: %s' % ( |
---|
[11254] | 409 | id, sys.exc_info()[0], sys.exc_info()[1]), type='danger') |
---|
[6189] | 410 | if len(deleted): |
---|
[7741] | 411 | self.flash(_('Successfully removed: ${a}', |
---|
[7738] | 412 | mapping = {'a':', '.join(deleted)})) |
---|
[11254] | 413 | self.redirect(self.url(self.context, u'@@manage')+'#tab2') |
---|
[6189] | 414 | return |
---|
[6105] | 415 | |
---|
[8314] | 416 | @action(_('Create students from selected')) |
---|
| 417 | def createStudents(self, **data): |
---|
| 418 | form = self.request.form |
---|
[9701] | 419 | if 'val_id' in form: |
---|
[8314] | 420 | child_id = form['val_id'] |
---|
| 421 | else: |
---|
[11254] | 422 | self.flash(_('No applicant selected!'), type='warning') |
---|
| 423 | self.redirect(self.url(self.context, '@@manage')+'#tab2') |
---|
[8314] | 424 | return |
---|
| 425 | if not isinstance(child_id, list): |
---|
| 426 | child_id = [child_id] |
---|
| 427 | created = [] |
---|
| 428 | for id in child_id: |
---|
| 429 | success, msg = self.context[id].createStudent(view=self) |
---|
| 430 | if success: |
---|
| 431 | created.append(id) |
---|
| 432 | if len(created): |
---|
| 433 | self.flash(_('${a} students successfully created.', |
---|
| 434 | mapping = {'a': len(created)})) |
---|
| 435 | else: |
---|
[11254] | 436 | self.flash(_('No student could be created.'), type='warning') |
---|
| 437 | self.redirect(self.url(self.context, u'@@manage')+'#tab2') |
---|
[8314] | 438 | return |
---|
| 439 | |
---|
[7710] | 440 | @action(_('Cancel'), validator=NullValidator) |
---|
[5837] | 441 | def cancel(self, **data): |
---|
| 442 | self.redirect(self.url(self.context)) |
---|
| 443 | return |
---|
[5886] | 444 | |
---|
[7710] | 445 | @action(_('Add local role'), validator=NullValidator) |
---|
[6184] | 446 | def addLocalRole(self, **data): |
---|
| 447 | return add_local_role(self,3, **data) |
---|
[6105] | 448 | |
---|
[7710] | 449 | @action(_('Remove selected local roles')) |
---|
[6184] | 450 | def delLocalRoles(self, **data): |
---|
| 451 | return del_local_roles(self,3,**data) |
---|
| 452 | |
---|
[7819] | 453 | class ApplicantAddFormPage(KofaAddFormPage): |
---|
[6622] | 454 | """Add-form to add an applicant. |
---|
[6327] | 455 | """ |
---|
| 456 | grok.context(IApplicantsContainer) |
---|
[7136] | 457 | grok.require('waeup.manageApplication') |
---|
[6327] | 458 | grok.name('addapplicant') |
---|
[7240] | 459 | #grok.template('applicantaddpage') |
---|
| 460 | form_fields = grok.AutoFields(IApplicant).select( |
---|
[7356] | 461 | 'firstname', 'middlename', 'lastname', |
---|
[7240] | 462 | 'email', 'phone') |
---|
[7714] | 463 | label = _('Add applicant') |
---|
[6327] | 464 | pnav = 3 |
---|
| 465 | |
---|
[7714] | 466 | @action(_('Create application record')) |
---|
[6327] | 467 | def addApplicant(self, **data): |
---|
[8008] | 468 | applicant = createObject(u'waeup.Applicant') |
---|
[7240] | 469 | self.applyData(applicant, **data) |
---|
| 470 | self.context.addApplicant(applicant) |
---|
[13073] | 471 | self.flash(_('Application record created.')) |
---|
[7363] | 472 | self.redirect( |
---|
| 473 | self.url(self.context[applicant.application_number], 'index')) |
---|
[6327] | 474 | return |
---|
| 475 | |
---|
[7819] | 476 | class ApplicantDisplayFormPage(KofaDisplayFormPage): |
---|
[8014] | 477 | """A display view for applicant data. |
---|
| 478 | """ |
---|
[5273] | 479 | grok.context(IApplicant) |
---|
| 480 | grok.name('index') |
---|
[7113] | 481 | grok.require('waeup.viewApplication') |
---|
[7200] | 482 | grok.template('applicantdisplaypage') |
---|
[7714] | 483 | label = _('Applicant') |
---|
[5843] | 484 | pnav = 3 |
---|
[8922] | 485 | hide_hint = False |
---|
[5273] | 486 | |
---|
[8046] | 487 | @property |
---|
[10831] | 488 | def form_fields(self): |
---|
| 489 | if self.context.special: |
---|
[11599] | 490 | form_fields = grok.AutoFields(ISpecialApplicant).omit('locked') |
---|
[10831] | 491 | else: |
---|
| 492 | form_fields = grok.AutoFields(IApplicant).omit( |
---|
[10845] | 493 | 'locked', 'course_admitted', 'password', 'suspended') |
---|
[10831] | 494 | return form_fields |
---|
| 495 | |
---|
| 496 | @property |
---|
[10534] | 497 | def target(self): |
---|
| 498 | return getattr(self.context.__parent__, 'prefix', None) |
---|
| 499 | |
---|
| 500 | @property |
---|
[8046] | 501 | def separators(self): |
---|
| 502 | return getUtility(IApplicantsUtils).SEPARATORS_DICT |
---|
| 503 | |
---|
[7063] | 504 | def update(self): |
---|
| 505 | self.passport_url = self.url(self.context, 'passport.jpg') |
---|
[7240] | 506 | # Mark application as started if applicant logs in for the first time |
---|
[7272] | 507 | usertype = getattr(self.request.principal, 'user_type', None) |
---|
| 508 | if usertype == 'applicant' and \ |
---|
| 509 | IWorkflowState(self.context).getState() == INITIALIZED: |
---|
[7240] | 510 | IWorkflowInfo(self.context).fireTransition('start') |
---|
[10895] | 511 | if usertype == 'applicant' and self.context.state == 'created': |
---|
[10908] | 512 | session = '%s/%s' % (self.context.__parent__.year, |
---|
| 513 | self.context.__parent__.year+1) |
---|
| 514 | title = getattr(grok.getSite()['configuration'], 'name', u'Sample University') |
---|
[10895] | 515 | msg = _( |
---|
| 516 | '\n <strong>Congratulations!</strong>' + |
---|
[10933] | 517 | ' You have been offered provisional admission into the' + |
---|
[10908] | 518 | ' ${c} Academic Session of ${d}.' |
---|
| 519 | ' Your student record has been created for you.' + |
---|
| 520 | ' Please, logout again and proceed to the' + |
---|
| 521 | ' login page of the portal.' |
---|
[10895] | 522 | ' Then enter your new student credentials:' + |
---|
| 523 | ' user name= ${a}, password = ${b}.' + |
---|
| 524 | ' Change your password when you have logged in.', |
---|
| 525 | mapping = { |
---|
| 526 | 'a':self.context.student_id, |
---|
[10908] | 527 | 'b':self.context.application_number, |
---|
| 528 | 'c':session, |
---|
| 529 | 'd':title} |
---|
[10895] | 530 | ) |
---|
| 531 | self.flash(msg) |
---|
[7063] | 532 | return |
---|
| 533 | |
---|
[6196] | 534 | @property |
---|
[7240] | 535 | def hasPassword(self): |
---|
| 536 | if self.context.password: |
---|
[7714] | 537 | return _('set') |
---|
| 538 | return _('unset') |
---|
[7240] | 539 | |
---|
| 540 | @property |
---|
[6196] | 541 | def label(self): |
---|
| 542 | container_title = self.context.__parent__.title |
---|
[8096] | 543 | return _('${a} <br /> Application Record ${b}', mapping = { |
---|
[7714] | 544 | 'a':container_title, 'b':self.context.application_number}) |
---|
[6196] | 545 | |
---|
[7347] | 546 | def getCourseAdmitted(self): |
---|
| 547 | """Return link, title and code in html format to the certificate |
---|
| 548 | admitted. |
---|
| 549 | """ |
---|
| 550 | course_admitted = self.context.course_admitted |
---|
[7351] | 551 | if getattr(course_admitted, '__parent__',None): |
---|
[7347] | 552 | url = self.url(course_admitted) |
---|
| 553 | title = course_admitted.title |
---|
| 554 | code = course_admitted.code |
---|
| 555 | return '<a href="%s">%s - %s</a>' %(url,code,title) |
---|
| 556 | return '' |
---|
[6254] | 557 | |
---|
[7259] | 558 | class ApplicantBaseDisplayFormPage(ApplicantDisplayFormPage): |
---|
| 559 | grok.context(IApplicant) |
---|
| 560 | grok.name('base') |
---|
| 561 | form_fields = grok.AutoFields(IApplicant).select( |
---|
[9141] | 562 | 'applicant_id','email', 'course1') |
---|
[7259] | 563 | |
---|
[7459] | 564 | class CreateStudentPage(UtilityView, grok.View): |
---|
[8636] | 565 | """Create a student object from applicant data. |
---|
[7341] | 566 | """ |
---|
| 567 | grok.context(IApplicant) |
---|
| 568 | grok.name('createstudent') |
---|
| 569 | grok.require('waeup.manageStudent') |
---|
| 570 | |
---|
| 571 | def update(self): |
---|
[8314] | 572 | msg = self.context.createStudent(view=self)[1] |
---|
[11254] | 573 | self.flash(msg, type='warning') |
---|
[7341] | 574 | self.redirect(self.url(self.context)) |
---|
| 575 | return |
---|
| 576 | |
---|
| 577 | def render(self): |
---|
| 578 | return |
---|
| 579 | |
---|
[8636] | 580 | class CreateAllStudentsPage(UtilityView, grok.View): |
---|
| 581 | """Create all student objects from applicant data |
---|
[11874] | 582 | in the root container or in a specific applicants container only. |
---|
[8636] | 583 | |
---|
[11826] | 584 | Only PortalManagers can do this. |
---|
[8636] | 585 | """ |
---|
[9900] | 586 | #grok.context(IApplicantsContainer) |
---|
[8636] | 587 | grok.name('createallstudents') |
---|
| 588 | grok.require('waeup.managePortal') |
---|
| 589 | |
---|
| 590 | def update(self): |
---|
| 591 | cat = getUtility(ICatalog, name='applicants_catalog') |
---|
| 592 | results = list(cat.searchResults(state=(ADMITTED, ADMITTED))) |
---|
| 593 | created = [] |
---|
[9900] | 594 | container_only = False |
---|
| 595 | applicants_root = grok.getSite()['applicants'] |
---|
| 596 | if isinstance(self.context, ApplicantsContainer): |
---|
| 597 | container_only = True |
---|
[8636] | 598 | for result in results: |
---|
[9900] | 599 | if container_only and result.__parent__ is not self.context: |
---|
[8636] | 600 | continue |
---|
| 601 | success, msg = result.createStudent(view=self) |
---|
| 602 | if success: |
---|
| 603 | created.append(result.applicant_id) |
---|
| 604 | else: |
---|
[12893] | 605 | ob_class = self.__implemented__.__name__.replace( |
---|
| 606 | 'waeup.kofa.','') |
---|
[9900] | 607 | applicants_root.logger.info( |
---|
[8742] | 608 | '%s - %s - %s' % (ob_class, result.applicant_id, msg)) |
---|
[8636] | 609 | if len(created): |
---|
| 610 | self.flash(_('${a} students successfully created.', |
---|
| 611 | mapping = {'a': len(created)})) |
---|
| 612 | else: |
---|
[11254] | 613 | self.flash(_('No student could be created.'), type='warning') |
---|
[9900] | 614 | self.redirect(self.url(self.context)) |
---|
[8636] | 615 | return |
---|
| 616 | |
---|
| 617 | def render(self): |
---|
| 618 | return |
---|
| 619 | |
---|
[8260] | 620 | class ApplicationFeePaymentAddPage(UtilityView, grok.View): |
---|
[7250] | 621 | """ Page to add an online payment ticket |
---|
| 622 | """ |
---|
| 623 | grok.context(IApplicant) |
---|
| 624 | grok.name('addafp') |
---|
| 625 | grok.require('waeup.payApplicant') |
---|
[8243] | 626 | factory = u'waeup.ApplicantOnlinePayment' |
---|
[7250] | 627 | |
---|
[11726] | 628 | @property |
---|
| 629 | def custom_requirements(self): |
---|
| 630 | return '' |
---|
| 631 | |
---|
[7250] | 632 | def update(self): |
---|
[11726] | 633 | # Additional requirements in custom packages. |
---|
| 634 | if self.custom_requirements: |
---|
| 635 | self.flash( |
---|
| 636 | self.custom_requirements, |
---|
| 637 | type='danger') |
---|
| 638 | self.redirect(self.url(self.context)) |
---|
[11727] | 639 | return |
---|
[11575] | 640 | if not self.context.special: |
---|
| 641 | for key in self.context.keys(): |
---|
| 642 | ticket = self.context[key] |
---|
| 643 | if ticket.p_state == 'paid': |
---|
| 644 | self.flash( |
---|
| 645 | _('This type of payment has already been made.'), |
---|
| 646 | type='warning') |
---|
| 647 | self.redirect(self.url(self.context)) |
---|
| 648 | return |
---|
[8524] | 649 | applicants_utils = getUtility(IApplicantsUtils) |
---|
| 650 | container = self.context.__parent__ |
---|
[8243] | 651 | payment = createObject(self.factory) |
---|
[11254] | 652 | failure = applicants_utils.setPaymentDetails( |
---|
[10831] | 653 | container, payment, self.context) |
---|
[11254] | 654 | if failure is not None: |
---|
| 655 | self.flash(failure[0], type='danger') |
---|
[8524] | 656 | self.redirect(self.url(self.context)) |
---|
| 657 | return |
---|
[7250] | 658 | self.context[payment.p_id] = payment |
---|
[12893] | 659 | self.context.writeLogMessage(self, 'added: %s' % payment.p_id) |
---|
[7714] | 660 | self.flash(_('Payment ticket created.')) |
---|
[8280] | 661 | self.redirect(self.url(payment)) |
---|
[7250] | 662 | return |
---|
| 663 | |
---|
| 664 | def render(self): |
---|
| 665 | return |
---|
| 666 | |
---|
| 667 | |
---|
[7819] | 668 | class OnlinePaymentDisplayFormPage(KofaDisplayFormPage): |
---|
[7250] | 669 | """ Page to view an online payment ticket |
---|
| 670 | """ |
---|
| 671 | grok.context(IApplicantOnlinePayment) |
---|
| 672 | grok.name('index') |
---|
| 673 | grok.require('waeup.viewApplication') |
---|
[9984] | 674 | form_fields = grok.AutoFields(IApplicantOnlinePayment).omit('p_item') |
---|
[8170] | 675 | form_fields[ |
---|
| 676 | 'creation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le') |
---|
| 677 | form_fields[ |
---|
| 678 | 'payment_date'].custom_widget = FriendlyDatetimeDisplayWidget('le') |
---|
[7250] | 679 | pnav = 3 |
---|
| 680 | |
---|
| 681 | @property |
---|
| 682 | def label(self): |
---|
[7714] | 683 | return _('${a}: Online Payment Ticket ${b}', mapping = { |
---|
[8170] | 684 | 'a':self.context.__parent__.display_fullname, |
---|
| 685 | 'b':self.context.p_id}) |
---|
[7250] | 686 | |
---|
[8420] | 687 | class OnlinePaymentApprovePage(UtilityView, grok.View): |
---|
| 688 | """ Approval view |
---|
[7250] | 689 | """ |
---|
| 690 | grok.context(IApplicantOnlinePayment) |
---|
[8420] | 691 | grok.name('approve') |
---|
| 692 | grok.require('waeup.managePortal') |
---|
[7250] | 693 | |
---|
| 694 | def update(self): |
---|
[11580] | 695 | flashtype, msg, log = self.context.approveApplicantPayment() |
---|
[8428] | 696 | if log is not None: |
---|
[9771] | 697 | applicant = self.context.__parent__ |
---|
| 698 | # Add log message to applicants.log |
---|
| 699 | applicant.writeLogMessage(self, log) |
---|
| 700 | # Add log message to payments.log |
---|
| 701 | self.context.logger.info( |
---|
[9795] | 702 | '%s,%s,%s,%s,%s,,,,,,' % ( |
---|
[9771] | 703 | applicant.applicant_id, |
---|
| 704 | self.context.p_id, self.context.p_category, |
---|
| 705 | self.context.amount_auth, self.context.r_code)) |
---|
[11580] | 706 | self.flash(msg, type=flashtype) |
---|
[7250] | 707 | return |
---|
| 708 | |
---|
| 709 | def render(self): |
---|
| 710 | self.redirect(self.url(self.context, '@@index')) |
---|
| 711 | return |
---|
| 712 | |
---|
[7459] | 713 | class ExportPDFPaymentSlipPage(UtilityView, grok.View): |
---|
[7250] | 714 | """Deliver a PDF slip of the context. |
---|
| 715 | """ |
---|
| 716 | grok.context(IApplicantOnlinePayment) |
---|
[8262] | 717 | grok.name('payment_slip.pdf') |
---|
[7250] | 718 | grok.require('waeup.viewApplication') |
---|
[9984] | 719 | form_fields = grok.AutoFields(IApplicantOnlinePayment).omit('p_item') |
---|
[8173] | 720 | form_fields['creation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le') |
---|
| 721 | form_fields['payment_date'].custom_widget = FriendlyDatetimeDisplayWidget('le') |
---|
[7250] | 722 | prefix = 'form' |
---|
[8258] | 723 | note = None |
---|
[7250] | 724 | |
---|
| 725 | @property |
---|
[7714] | 726 | def title(self): |
---|
[7819] | 727 | portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE |
---|
[7811] | 728 | return translate(_('Payment Data'), 'waeup.kofa', |
---|
[7714] | 729 | target_language=portal_language) |
---|
| 730 | |
---|
| 731 | @property |
---|
[7250] | 732 | def label(self): |
---|
[7819] | 733 | portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE |
---|
[8262] | 734 | return translate(_('Online Payment Slip'), |
---|
[7811] | 735 | 'waeup.kofa', target_language=portal_language) \ |
---|
[7714] | 736 | + ' %s' % self.context.p_id |
---|
[7250] | 737 | |
---|
[11754] | 738 | @property |
---|
| 739 | def payment_slip_download_warning(self): |
---|
| 740 | if self.context.__parent__.state != SUBMITTED: |
---|
| 741 | return _('Please submit the application form before ' |
---|
| 742 | 'trying to download payment slips.') |
---|
| 743 | return '' |
---|
| 744 | |
---|
[7250] | 745 | def render(self): |
---|
[11754] | 746 | if self.payment_slip_download_warning: |
---|
| 747 | self.flash(self.payment_slip_download_warning, type='danger') |
---|
[11599] | 748 | self.redirect(self.url(self.context)) |
---|
| 749 | return |
---|
[7259] | 750 | applicantview = ApplicantBaseDisplayFormPage(self.context.__parent__, |
---|
[7250] | 751 | self.request) |
---|
| 752 | students_utils = getUtility(IStudentsUtils) |
---|
[8262] | 753 | return students_utils.renderPDF(self,'payment_slip.pdf', |
---|
[8258] | 754 | self.context.__parent__, applicantview, note=self.note) |
---|
[7250] | 755 | |
---|
[10571] | 756 | class ExportPDFPageApplicationSlip(UtilityView, grok.View): |
---|
[6358] | 757 | """Deliver a PDF slip of the context. |
---|
| 758 | """ |
---|
| 759 | grok.context(IApplicant) |
---|
| 760 | grok.name('application_slip.pdf') |
---|
[7136] | 761 | grok.require('waeup.viewApplication') |
---|
[6358] | 762 | prefix = 'form' |
---|
| 763 | |
---|
[8666] | 764 | def update(self): |
---|
[9051] | 765 | if self.context.state in ('initialized', 'started', 'paid'): |
---|
[8666] | 766 | self.flash( |
---|
[11254] | 767 | _('Please pay and submit before trying to download ' |
---|
| 768 | 'the application slip.'), type='warning') |
---|
[8666] | 769 | return self.redirect(self.url(self.context)) |
---|
| 770 | return |
---|
| 771 | |
---|
[6358] | 772 | def render(self): |
---|
[12395] | 773 | try: |
---|
| 774 | pdfstream = getAdapter(self.context, IPDF, name='application_slip')( |
---|
| 775 | view=self) |
---|
| 776 | except IOError: |
---|
| 777 | self.flash( |
---|
| 778 | _('Your image file is corrupted. ' |
---|
| 779 | 'Please replace.'), type='danger') |
---|
| 780 | return self.redirect(self.url(self.context)) |
---|
[6358] | 781 | self.response.setHeader( |
---|
| 782 | 'Content-Type', 'application/pdf') |
---|
[7392] | 783 | return pdfstream |
---|
[6358] | 784 | |
---|
[7081] | 785 | def handle_img_upload(upload, context, view): |
---|
[7063] | 786 | """Handle upload of applicant image. |
---|
[7081] | 787 | |
---|
| 788 | Returns `True` in case of success or `False`. |
---|
| 789 | |
---|
| 790 | Please note that file pointer passed in (`upload`) most probably |
---|
| 791 | points to end of file when leaving this function. |
---|
[7063] | 792 | """ |
---|
[7081] | 793 | size = file_size(upload) |
---|
| 794 | if size > MAX_UPLOAD_SIZE: |
---|
[11254] | 795 | view.flash(_('Uploaded image is too big!'), type='danger') |
---|
[7081] | 796 | return False |
---|
[7247] | 797 | dummy, ext = os.path.splitext(upload.filename) |
---|
| 798 | ext.lower() |
---|
| 799 | if ext != '.jpg': |
---|
[11254] | 800 | view.flash(_('jpg file extension expected.'), type='danger') |
---|
[7247] | 801 | return False |
---|
[7081] | 802 | upload.seek(0) # file pointer moved when determining size |
---|
[7063] | 803 | store = getUtility(IExtFileStore) |
---|
| 804 | file_id = IFileStoreNameChooser(context).chooseName() |
---|
| 805 | store.createFile(file_id, upload) |
---|
[7081] | 806 | return True |
---|
[7063] | 807 | |
---|
[7819] | 808 | class ApplicantManageFormPage(KofaEditFormPage): |
---|
[6196] | 809 | """A full edit view for applicant data. |
---|
| 810 | """ |
---|
| 811 | grok.context(IApplicant) |
---|
[7200] | 812 | grok.name('manage') |
---|
[7136] | 813 | grok.require('waeup.manageApplication') |
---|
[7200] | 814 | grok.template('applicanteditpage') |
---|
[6322] | 815 | manage_applications = True |
---|
[6196] | 816 | pnav = 3 |
---|
[12664] | 817 | display_actions = [[_('Save'), _('Finally Submit')], |
---|
[7714] | 818 | [_('Add online payment ticket'),_('Remove selected tickets')]] |
---|
[6196] | 819 | |
---|
[8046] | 820 | @property |
---|
[10831] | 821 | def form_fields(self): |
---|
| 822 | if self.context.special: |
---|
[10845] | 823 | form_fields = grok.AutoFields(ISpecialApplicant) |
---|
| 824 | form_fields['applicant_id'].for_display = True |
---|
[10831] | 825 | else: |
---|
| 826 | form_fields = grok.AutoFields(IApplicant) |
---|
| 827 | form_fields['student_id'].for_display = True |
---|
| 828 | form_fields['applicant_id'].for_display = True |
---|
| 829 | return form_fields |
---|
| 830 | |
---|
| 831 | @property |
---|
[10534] | 832 | def target(self): |
---|
| 833 | return getattr(self.context.__parent__, 'prefix', None) |
---|
| 834 | |
---|
| 835 | @property |
---|
[8046] | 836 | def separators(self): |
---|
| 837 | return getUtility(IApplicantsUtils).SEPARATORS_DICT |
---|
| 838 | |
---|
[11733] | 839 | @property |
---|
| 840 | def custom_upload_requirements(self): |
---|
| 841 | return '' |
---|
| 842 | |
---|
[6196] | 843 | def update(self): |
---|
[7200] | 844 | super(ApplicantManageFormPage, self).update() |
---|
[6353] | 845 | self.wf_info = IWorkflowInfo(self.context) |
---|
[7081] | 846 | self.max_upload_size = string_from_bytes(MAX_UPLOAD_SIZE) |
---|
[10090] | 847 | self.upload_success = None |
---|
[6598] | 848 | upload = self.request.form.get('form.passport', None) |
---|
| 849 | if upload: |
---|
[11733] | 850 | if self.custom_upload_requirements: |
---|
| 851 | self.flash( |
---|
| 852 | self.custom_upload_requirements, |
---|
| 853 | type='danger') |
---|
| 854 | self.redirect(self.url(self.context)) |
---|
| 855 | return |
---|
[10090] | 856 | # We got a fresh upload, upload_success is |
---|
| 857 | # either True or False |
---|
| 858 | self.upload_success = handle_img_upload( |
---|
[7084] | 859 | upload, self.context, self) |
---|
[10090] | 860 | if self.upload_success: |
---|
[10095] | 861 | self.context.writeLogMessage(self, 'saved: passport') |
---|
[6196] | 862 | return |
---|
| 863 | |
---|
| 864 | @property |
---|
| 865 | def label(self): |
---|
| 866 | container_title = self.context.__parent__.title |
---|
[8096] | 867 | return _('${a} <br /> Application Form ${b}', mapping = { |
---|
[7714] | 868 | 'a':container_title, 'b':self.context.application_number}) |
---|
[6196] | 869 | |
---|
[6303] | 870 | def getTransitions(self): |
---|
[6351] | 871 | """Return a list of dicts of allowed transition ids and titles. |
---|
[6353] | 872 | |
---|
| 873 | Each list entry provides keys ``name`` and ``title`` for |
---|
| 874 | internal name and (human readable) title of a single |
---|
| 875 | transition. |
---|
[6349] | 876 | """ |
---|
[8434] | 877 | allowed_transitions = [t for t in self.wf_info.getManualTransitions() |
---|
[11482] | 878 | if not t[0] in ('pay', 'create')] |
---|
[7687] | 879 | return [dict(name='', title=_('No transition'))] +[ |
---|
[6355] | 880 | dict(name=x, title=y) for x, y in allowed_transitions] |
---|
[6303] | 881 | |
---|
[7714] | 882 | @action(_('Save'), style='primary') |
---|
[6196] | 883 | def save(self, **data): |
---|
[7240] | 884 | form = self.request.form |
---|
| 885 | password = form.get('password', None) |
---|
| 886 | password_ctl = form.get('control_password', None) |
---|
| 887 | if password: |
---|
| 888 | validator = getUtility(IPasswordValidator) |
---|
| 889 | errors = validator.validate_password(password, password_ctl) |
---|
| 890 | if errors: |
---|
[11254] | 891 | self.flash( ' '.join(errors), type='danger') |
---|
[7240] | 892 | return |
---|
[10090] | 893 | if self.upload_success is False: # False is not None! |
---|
| 894 | # Error during image upload. Ignore other values. |
---|
| 895 | return |
---|
[6475] | 896 | changed_fields = self.applyData(self.context, **data) |
---|
[7199] | 897 | # Turn list of lists into single list |
---|
| 898 | if changed_fields: |
---|
| 899 | changed_fields = reduce(lambda x,y: x+y, changed_fields.values()) |
---|
[7240] | 900 | else: |
---|
| 901 | changed_fields = [] |
---|
| 902 | if password: |
---|
| 903 | # Now we know that the form has no errors and can set password ... |
---|
| 904 | IUserAccount(self.context).setPassword(password) |
---|
| 905 | changed_fields.append('password') |
---|
[7199] | 906 | fields_string = ' + '.join(changed_fields) |
---|
[7085] | 907 | trans_id = form.get('transition', None) |
---|
| 908 | if trans_id: |
---|
| 909 | self.wf_info.fireTransition(trans_id) |
---|
[7714] | 910 | self.flash(_('Form has been saved.')) |
---|
[6644] | 911 | if fields_string: |
---|
[12892] | 912 | self.context.writeLogMessage(self, 'saved: %s' % fields_string) |
---|
[6196] | 913 | return |
---|
| 914 | |
---|
[7250] | 915 | def unremovable(self, ticket): |
---|
[7330] | 916 | return False |
---|
[7250] | 917 | |
---|
| 918 | # This method is also used by the ApplicantEditFormPage |
---|
| 919 | def delPaymentTickets(self, **data): |
---|
| 920 | form = self.request.form |
---|
[9701] | 921 | if 'val_id' in form: |
---|
[7250] | 922 | child_id = form['val_id'] |
---|
| 923 | else: |
---|
[11254] | 924 | self.flash(_('No payment selected.'), type='warning') |
---|
[7250] | 925 | self.redirect(self.url(self.context)) |
---|
| 926 | return |
---|
| 927 | if not isinstance(child_id, list): |
---|
| 928 | child_id = [child_id] |
---|
| 929 | deleted = [] |
---|
| 930 | for id in child_id: |
---|
| 931 | # Applicants are not allowed to remove used payment tickets |
---|
| 932 | if not self.unremovable(self.context[id]): |
---|
| 933 | try: |
---|
| 934 | del self.context[id] |
---|
| 935 | deleted.append(id) |
---|
| 936 | except: |
---|
[7714] | 937 | self.flash(_('Could not delete:') + ' %s: %s: %s' % ( |
---|
[11254] | 938 | id, sys.exc_info()[0], sys.exc_info()[1]), type='danger') |
---|
[7250] | 939 | if len(deleted): |
---|
[7741] | 940 | self.flash(_('Successfully removed: ${a}', |
---|
[7738] | 941 | mapping = {'a':', '.join(deleted)})) |
---|
[8742] | 942 | self.context.writeLogMessage( |
---|
| 943 | self, 'removed: % s' % ', '.join(deleted)) |
---|
[7250] | 944 | return |
---|
| 945 | |
---|
[7252] | 946 | # We explicitely want the forms to be validated before payment tickets |
---|
| 947 | # can be created. If no validation is requested, use |
---|
[7459] | 948 | # 'validator=NullValidator' in the action directive |
---|
[11578] | 949 | @action(_('Add online payment ticket'), style='primary') |
---|
[7250] | 950 | def addPaymentTicket(self, **data): |
---|
| 951 | self.redirect(self.url(self.context, '@@addafp')) |
---|
[7252] | 952 | return |
---|
[7250] | 953 | |
---|
[7714] | 954 | @jsaction(_('Remove selected tickets')) |
---|
[7250] | 955 | def removePaymentTickets(self, **data): |
---|
| 956 | self.delPaymentTickets(**data) |
---|
| 957 | self.redirect(self.url(self.context) + '/@@manage') |
---|
| 958 | return |
---|
| 959 | |
---|
[10094] | 960 | # Not used in base package |
---|
| 961 | def file_exists(self, attr): |
---|
| 962 | file = getUtility(IExtFileStore).getFileByContext( |
---|
| 963 | self.context, attr=attr) |
---|
| 964 | if file: |
---|
| 965 | return True |
---|
| 966 | else: |
---|
| 967 | return False |
---|
| 968 | |
---|
[7200] | 969 | class ApplicantEditFormPage(ApplicantManageFormPage): |
---|
[5982] | 970 | """An applicant-centered edit view for applicant data. |
---|
| 971 | """ |
---|
[6196] | 972 | grok.context(IApplicantEdit) |
---|
[5273] | 973 | grok.name('edit') |
---|
[6198] | 974 | grok.require('waeup.handleApplication') |
---|
[7200] | 975 | grok.template('applicanteditpage') |
---|
[6322] | 976 | manage_applications = False |
---|
[10358] | 977 | submit_state = PAID |
---|
[5484] | 978 | |
---|
[7250] | 979 | @property |
---|
[10831] | 980 | def form_fields(self): |
---|
| 981 | if self.context.special: |
---|
[11657] | 982 | form_fields = grok.AutoFields(ISpecialApplicant).omit( |
---|
| 983 | 'locked', 'suspended') |
---|
[10845] | 984 | form_fields['applicant_id'].for_display = True |
---|
[10831] | 985 | else: |
---|
| 986 | form_fields = grok.AutoFields(IApplicantEdit).omit( |
---|
| 987 | 'locked', 'course_admitted', 'student_id', |
---|
[10845] | 988 | 'suspended' |
---|
[10831] | 989 | ) |
---|
| 990 | form_fields['applicant_id'].for_display = True |
---|
| 991 | form_fields['reg_number'].for_display = True |
---|
| 992 | return form_fields |
---|
| 993 | |
---|
| 994 | @property |
---|
[7250] | 995 | def display_actions(self): |
---|
[8286] | 996 | state = IWorkflowState(self.context).getState() |
---|
[10358] | 997 | actions = [[],[]] |
---|
| 998 | if state == STARTED: |
---|
[7714] | 999 | actions = [[_('Save')], |
---|
| 1000 | [_('Add online payment ticket'),_('Remove selected tickets')]] |
---|
[11599] | 1001 | elif self.context.special and state == PAID: |
---|
[12664] | 1002 | actions = [[_('Save'), _('Finally Submit')], |
---|
[11599] | 1003 | [_('Add online payment ticket'),_('Remove selected tickets')]] |
---|
[8286] | 1004 | elif state == PAID: |
---|
[12664] | 1005 | actions = [[_('Save'), _('Finally Submit')], |
---|
[7714] | 1006 | [_('Remove selected tickets')]] |
---|
[7250] | 1007 | return actions |
---|
| 1008 | |
---|
[7330] | 1009 | def unremovable(self, ticket): |
---|
[8286] | 1010 | state = IWorkflowState(self.context).getState() |
---|
| 1011 | return ticket.r_code or state in (INITIALIZED, SUBMITTED) |
---|
[7330] | 1012 | |
---|
[7145] | 1013 | def emit_lock_message(self): |
---|
[11254] | 1014 | self.flash(_('The requested form is locked (read-only).'), |
---|
| 1015 | type='warning') |
---|
[5941] | 1016 | self.redirect(self.url(self.context)) |
---|
| 1017 | return |
---|
[6078] | 1018 | |
---|
[5686] | 1019 | def update(self): |
---|
[8665] | 1020 | if self.context.locked or ( |
---|
| 1021 | self.context.__parent__.expired and |
---|
| 1022 | self.context.__parent__.strict_deadline): |
---|
[7145] | 1023 | self.emit_lock_message() |
---|
[5941] | 1024 | return |
---|
[7200] | 1025 | super(ApplicantEditFormPage, self).update() |
---|
[5686] | 1026 | return |
---|
[5952] | 1027 | |
---|
[6196] | 1028 | def dataNotComplete(self): |
---|
[7252] | 1029 | store = getUtility(IExtFileStore) |
---|
| 1030 | if not store.getFileByContext(self.context, attr=u'passport.jpg'): |
---|
[7714] | 1031 | return _('No passport picture uploaded.') |
---|
[6322] | 1032 | if not self.request.form.get('confirm_passport', False): |
---|
[7714] | 1033 | return _('Passport picture confirmation box not ticked.') |
---|
[6196] | 1034 | return False |
---|
[5952] | 1035 | |
---|
[7252] | 1036 | # We explicitely want the forms to be validated before payment tickets |
---|
| 1037 | # can be created. If no validation is requested, use |
---|
[7459] | 1038 | # 'validator=NullValidator' in the action directive |
---|
[11578] | 1039 | @action(_('Add online payment ticket'), style='primary') |
---|
[7250] | 1040 | def addPaymentTicket(self, **data): |
---|
| 1041 | self.redirect(self.url(self.context, '@@addafp')) |
---|
[7252] | 1042 | return |
---|
[7250] | 1043 | |
---|
[7714] | 1044 | @jsaction(_('Remove selected tickets')) |
---|
[7250] | 1045 | def removePaymentTickets(self, **data): |
---|
| 1046 | self.delPaymentTickets(**data) |
---|
| 1047 | self.redirect(self.url(self.context) + '/@@edit') |
---|
| 1048 | return |
---|
| 1049 | |
---|
[7996] | 1050 | @action(_('Save'), style='primary') |
---|
[5273] | 1051 | def save(self, **data): |
---|
[10090] | 1052 | if self.upload_success is False: # False is not None! |
---|
| 1053 | # Error during image upload. Ignore other values. |
---|
| 1054 | return |
---|
[10219] | 1055 | if data.get('course1', 1) == data.get('course2', 2): |
---|
[11254] | 1056 | self.flash(_('1st and 2nd choice must be different.'), |
---|
| 1057 | type='warning') |
---|
[10210] | 1058 | return |
---|
[5273] | 1059 | self.applyData(self.context, **data) |
---|
[10210] | 1060 | self.flash(_('Form has been saved.')) |
---|
[5273] | 1061 | return |
---|
| 1062 | |
---|
[12664] | 1063 | @action(_('Finally Submit'), warning=WARNING) |
---|
[5484] | 1064 | def finalsubmit(self, **data): |
---|
[10090] | 1065 | if self.upload_success is False: # False is not None! |
---|
[7084] | 1066 | return # error during image upload. Ignore other values |
---|
[6196] | 1067 | if self.dataNotComplete(): |
---|
[11254] | 1068 | self.flash(self.dataNotComplete(), type='danger') |
---|
[5941] | 1069 | return |
---|
[7252] | 1070 | self.applyData(self.context, **data) |
---|
[8286] | 1071 | state = IWorkflowState(self.context).getState() |
---|
[6322] | 1072 | # This shouldn't happen, but the application officer |
---|
| 1073 | # might have forgotten to lock the form after changing the state |
---|
[10358] | 1074 | if state != self.submit_state: |
---|
[11254] | 1075 | self.flash(_('The form cannot be submitted. Wrong state!'), |
---|
| 1076 | type='danger') |
---|
[6303] | 1077 | return |
---|
| 1078 | IWorkflowInfo(self.context).fireTransition('submit') |
---|
[8589] | 1079 | # application_date is used in export files for sorting. |
---|
| 1080 | # We can thus store utc. |
---|
[8194] | 1081 | self.context.application_date = datetime.utcnow() |
---|
[7714] | 1082 | self.flash(_('Form has been submitted.')) |
---|
[6196] | 1083 | self.redirect(self.url(self.context)) |
---|
[5273] | 1084 | return |
---|
[5941] | 1085 | |
---|
[7063] | 1086 | class PassportImage(grok.View): |
---|
| 1087 | """Renders the passport image for applicants. |
---|
| 1088 | """ |
---|
| 1089 | grok.name('passport.jpg') |
---|
| 1090 | grok.context(IApplicant) |
---|
[7113] | 1091 | grok.require('waeup.viewApplication') |
---|
[7063] | 1092 | |
---|
| 1093 | def render(self): |
---|
| 1094 | # A filename chooser turns a context into a filename suitable |
---|
| 1095 | # for file storage. |
---|
| 1096 | image = getUtility(IExtFileStore).getFileByContext(self.context) |
---|
| 1097 | self.response.setHeader( |
---|
| 1098 | 'Content-Type', 'image/jpeg') |
---|
| 1099 | if image is None: |
---|
| 1100 | # show placeholder image |
---|
[7089] | 1101 | return open(DEFAULT_PASSPORT_IMAGE_PATH, 'rb').read() |
---|
[7063] | 1102 | return image |
---|
[7363] | 1103 | |
---|
[7819] | 1104 | class ApplicantRegistrationPage(KofaAddFormPage): |
---|
[7363] | 1105 | """Captcha'd registration page for applicants. |
---|
| 1106 | """ |
---|
| 1107 | grok.context(IApplicantsContainer) |
---|
| 1108 | grok.name('register') |
---|
[7373] | 1109 | grok.require('waeup.Anonymous') |
---|
[7363] | 1110 | grok.template('applicantregister') |
---|
| 1111 | |
---|
[7368] | 1112 | @property |
---|
[8033] | 1113 | def form_fields(self): |
---|
| 1114 | form_fields = None |
---|
[8128] | 1115 | if self.context.mode == 'update': |
---|
| 1116 | form_fields = grok.AutoFields(IApplicantRegisterUpdate).select( |
---|
[11738] | 1117 | 'lastname','reg_number','email') |
---|
[8128] | 1118 | else: #if self.context.mode == 'create': |
---|
[8033] | 1119 | form_fields = grok.AutoFields(IApplicantEdit).select( |
---|
| 1120 | 'firstname', 'middlename', 'lastname', 'email', 'phone') |
---|
| 1121 | return form_fields |
---|
| 1122 | |
---|
| 1123 | @property |
---|
[7368] | 1124 | def label(self): |
---|
[8078] | 1125 | return _('Apply for ${a}', |
---|
[7714] | 1126 | mapping = {'a':self.context.title}) |
---|
[7368] | 1127 | |
---|
[7363] | 1128 | def update(self): |
---|
[8665] | 1129 | if self.context.expired: |
---|
[11254] | 1130 | self.flash(_('Outside application period.'), type='warning') |
---|
[7368] | 1131 | self.redirect(self.url(self.context)) |
---|
| 1132 | return |
---|
| 1133 | # Handle captcha |
---|
[7363] | 1134 | self.captcha = getUtility(ICaptchaManager).getCaptcha() |
---|
| 1135 | self.captcha_result = self.captcha.verify(self.request) |
---|
| 1136 | self.captcha_code = self.captcha.display(self.captcha_result.error_code) |
---|
| 1137 | return |
---|
| 1138 | |
---|
[8629] | 1139 | def _redirect(self, email, password, applicant_id): |
---|
| 1140 | # Forward only email to landing page in base package. |
---|
| 1141 | self.redirect(self.url(self.context, 'registration_complete', |
---|
| 1142 | data = dict(email=email))) |
---|
| 1143 | return |
---|
| 1144 | |
---|
[9178] | 1145 | @action(_('Send login credentials to email address'), style='primary') |
---|
[7363] | 1146 | def register(self, **data): |
---|
| 1147 | if not self.captcha_result.is_valid: |
---|
[8037] | 1148 | # Captcha will display error messages automatically. |
---|
[7363] | 1149 | # No need to flash something. |
---|
| 1150 | return |
---|
[8033] | 1151 | if self.context.mode == 'create': |
---|
| 1152 | # Add applicant |
---|
| 1153 | applicant = createObject(u'waeup.Applicant') |
---|
| 1154 | self.applyData(applicant, **data) |
---|
| 1155 | self.context.addApplicant(applicant) |
---|
[8042] | 1156 | applicant.reg_number = applicant.applicant_id |
---|
| 1157 | notify(grok.ObjectModifiedEvent(applicant)) |
---|
[8033] | 1158 | elif self.context.mode == 'update': |
---|
| 1159 | # Update applicant |
---|
[8037] | 1160 | reg_number = data.get('reg_number','') |
---|
[11738] | 1161 | lastname = data.get('lastname','') |
---|
[8033] | 1162 | cat = getUtility(ICatalog, name='applicants_catalog') |
---|
| 1163 | results = list( |
---|
| 1164 | cat.searchResults(reg_number=(reg_number, reg_number))) |
---|
| 1165 | if results: |
---|
| 1166 | applicant = results[0] |
---|
[11738] | 1167 | if getattr(applicant,'lastname',None) is None: |
---|
[11254] | 1168 | self.flash(_('An error occurred.'), type='danger') |
---|
[8037] | 1169 | return |
---|
[11738] | 1170 | elif applicant.lastname.lower() != lastname.lower(): |
---|
[8042] | 1171 | # Don't tell the truth here. Anonymous must not |
---|
[11738] | 1172 | # know that a record was found and only the lastname |
---|
[8042] | 1173 | # verification failed. |
---|
[11254] | 1174 | self.flash(_('No application record found.'), type='warning') |
---|
[8037] | 1175 | return |
---|
[8627] | 1176 | elif applicant.password is not None and \ |
---|
| 1177 | applicant.state != INITIALIZED: |
---|
| 1178 | self.flash(_('Your password has already been set and used. ' |
---|
[11254] | 1179 | 'Please proceed to the login page.'), |
---|
| 1180 | type='warning') |
---|
[8042] | 1181 | return |
---|
| 1182 | # Store email address but nothing else. |
---|
[8033] | 1183 | applicant.email = data['email'] |
---|
[8042] | 1184 | notify(grok.ObjectModifiedEvent(applicant)) |
---|
[8033] | 1185 | else: |
---|
[8042] | 1186 | # No record found, this is the truth. |
---|
[11254] | 1187 | self.flash(_('No application record found.'), type='warning') |
---|
[8033] | 1188 | return |
---|
| 1189 | else: |
---|
[8042] | 1190 | # Does not happen but anyway ... |
---|
[8033] | 1191 | return |
---|
[7819] | 1192 | kofa_utils = getUtility(IKofaUtils) |
---|
[7811] | 1193 | password = kofa_utils.genPassword() |
---|
[7380] | 1194 | IUserAccount(applicant).setPassword(password) |
---|
[7365] | 1195 | # Send email with credentials |
---|
[7399] | 1196 | login_url = self.url(grok.getSite(), 'login') |
---|
[8853] | 1197 | url_info = u'Login: %s' % login_url |
---|
[7714] | 1198 | msg = _('You have successfully been registered for the') |
---|
[7811] | 1199 | if kofa_utils.sendCredentials(IUserAccount(applicant), |
---|
[8853] | 1200 | password, url_info, msg): |
---|
[8629] | 1201 | email_sent = applicant.email |
---|
[7380] | 1202 | else: |
---|
[8629] | 1203 | email_sent = None |
---|
| 1204 | self._redirect(email=email_sent, password=password, |
---|
| 1205 | applicant_id=applicant.applicant_id) |
---|
[7380] | 1206 | return |
---|
| 1207 | |
---|
[7819] | 1208 | class ApplicantRegistrationEmailSent(KofaPage): |
---|
[7380] | 1209 | """Landing page after successful registration. |
---|
[8629] | 1210 | |
---|
[7380] | 1211 | """ |
---|
| 1212 | grok.name('registration_complete') |
---|
| 1213 | grok.require('waeup.Public') |
---|
| 1214 | grok.template('applicantregemailsent') |
---|
[7714] | 1215 | label = _('Your registration was successful.') |
---|
[7380] | 1216 | |
---|
[8629] | 1217 | def update(self, email=None, applicant_id=None, password=None): |
---|
[7380] | 1218 | self.email = email |
---|
[8629] | 1219 | self.password = password |
---|
| 1220 | self.applicant_id = applicant_id |
---|
[7380] | 1221 | return |
---|
[10655] | 1222 | |
---|
| 1223 | class ExportJobContainerOverview(KofaPage): |
---|
| 1224 | """Page that lists active applicant data export jobs and provides links |
---|
| 1225 | to discard or download CSV files. |
---|
| 1226 | |
---|
| 1227 | """ |
---|
| 1228 | grok.context(VirtualApplicantsExportJobContainer) |
---|
| 1229 | grok.require('waeup.manageApplication') |
---|
| 1230 | grok.name('index.html') |
---|
| 1231 | grok.template('exportjobsindex') |
---|
[11254] | 1232 | label = _('Data Exports') |
---|
[10655] | 1233 | pnav = 3 |
---|
| 1234 | |
---|
| 1235 | def update(self, CREATE=None, DISCARD=None, job_id=None): |
---|
| 1236 | if CREATE: |
---|
| 1237 | self.redirect(self.url('@@start_export')) |
---|
| 1238 | return |
---|
| 1239 | if DISCARD and job_id: |
---|
| 1240 | entry = self.context.entry_from_job_id(job_id) |
---|
| 1241 | self.context.delete_export_entry(entry) |
---|
| 1242 | ob_class = self.__implemented__.__name__.replace('waeup.kofa.','') |
---|
| 1243 | self.context.logger.info( |
---|
| 1244 | '%s - discarded: job_id=%s' % (ob_class, job_id)) |
---|
| 1245 | self.flash(_('Discarded export') + ' %s' % job_id) |
---|
| 1246 | self.entries = doll_up(self, user=self.request.principal.id) |
---|
| 1247 | return |
---|
| 1248 | |
---|
| 1249 | class ExportJobContainerJobStart(KofaPage): |
---|
| 1250 | """Page that starts an applicants export job. |
---|
| 1251 | |
---|
| 1252 | """ |
---|
| 1253 | grok.context(VirtualApplicantsExportJobContainer) |
---|
| 1254 | grok.require('waeup.manageApplication') |
---|
| 1255 | grok.name('start_export') |
---|
| 1256 | |
---|
| 1257 | def update(self): |
---|
| 1258 | exporter = 'applicants' |
---|
| 1259 | container_code = self.context.__parent__.code |
---|
| 1260 | job_id = self.context.start_export_job(exporter, |
---|
| 1261 | self.request.principal.id, |
---|
| 1262 | container=container_code) |
---|
| 1263 | |
---|
| 1264 | ob_class = self.__implemented__.__name__.replace('waeup.kofa.','') |
---|
| 1265 | self.context.logger.info( |
---|
| 1266 | '%s - exported: %s (%s), job_id=%s' |
---|
| 1267 | % (ob_class, exporter, container_code, job_id)) |
---|
| 1268 | self.flash(_('Export started.')) |
---|
| 1269 | self.redirect(self.url(self.context)) |
---|
| 1270 | return |
---|
| 1271 | |
---|
| 1272 | def render(self): |
---|
| 1273 | return |
---|
| 1274 | |
---|
| 1275 | class ExportJobContainerDownload(ExportCSVView): |
---|
| 1276 | """Page that downloads a students export csv file. |
---|
| 1277 | |
---|
| 1278 | """ |
---|
| 1279 | grok.context(VirtualApplicantsExportJobContainer) |
---|
[11253] | 1280 | grok.require('waeup.manageApplication') |
---|