## $Id: browser.py 10378 2013-06-25 04:03:45Z henrik $
##
## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##
"""UI components for basic applicants and related components.
"""
import grok
from waeup.kofa.applicants.browser import ApplicantRegistrationPage
from kofacustom.nigeria.applicants.browser import (
NigeriaApplicantDisplayFormPage,
NigeriaPDFApplicationSlip)
from waeup.uniben.interfaces import MessageFactory as _
PASTQ_ALL = ['ADT','EPCS','ESM','HEK','VTE']
PASTQ_AL = ['ENL','FAA','FOL','HIS','LAL',
'PHL','THR','BUL','JIL','LAW','PPL','PUL'] + PASTQ_ALL
PASTQ_BS = ['ANT','ANY','CHH','COH','HAE','MED','MEH','PHS','SUR',
'PCG','PCH','PCO', 'PCT','PHA','PHM','PMB','ANA','MBC',
'MLS','NSC','PSY','DPV','ODR','OSP','PER', 'RES','AEB',
'BCH','BOT','CED','EVL','MCB','OPT','PBB','SLT','ZOO',
'AEE','ANS', 'CRS','FIS','FOW','SOS'] + PASTQ_ALL
PASTQ_EPS = ['CHE','CVE','DMIC','EEE','MCH','PEE','PRE','CHM',
'CSC','GLY','MTH','PHY'] + PASTQ_ALL
PASTQ_MSS = ['ACC','BNK','BUS','ECO','GEO','POL','SAA','SWK'] + PASTQ_ALL
class CustomApplicantRegistrationPage(ApplicantRegistrationPage):
"""Captcha'd registration page for applicants.
"""
def _redirect(self, email, password, applicant_id):
# Forward email and credentials to landing page.
self.redirect(self.url(self.context, 'registration_complete',
data = dict(email=email, password=password,
applicant_id=applicant_id)))
return
class CustomApplicantDisplayFormPage(NigeriaApplicantDisplayFormPage):
"""A display view for applicant data.
"""
grok.template('applicantdisplaypage')
def _show_pastq(self):
return self.target.startswith('putme') \
and self.context.state in ('paid', 'submitted') \
and getattr(self.context, 'course1') is not None
@property
def show_pastq_al(self):
return self._show_pastq() \
and self.context.course1.__parent__.__parent__.code in PASTQ_AL
@property
def show_pastq_bs(self):
return self._show_pastq() \
and self.context.course1.__parent__.__parent__.code in PASTQ_BS
@property
def show_pastq_eps(self):
return self._show_pastq() \
and self.context.course1.__parent__.__parent__.code in PASTQ_EPS
@property
def show_pastq_mss(self):
return self._show_pastq() \
and self.context.course1.__parent__.__parent__.code in PASTQ_MSS
class CustomNigeriaPDFApplicationSlip(NigeriaPDFApplicationSlip):
@property
def note(self):
if self.target is not None and not self.target.startswith('pg') \
and not self._reduced_slip():
return _(u'
'
'Comfirm your exam venue 72 hours to the exam.')
return