source: main/waeup.uniben/trunk/src/waeup/uniben/applicants/browser.py @ 10378

Last change on this file since 10378 was 10378, checked in by Henrik Bettermann, 11 years ago

Put note on slip.

  • Property svn:keywords set to Id
File size: 3.5 KB
RevLine 
[8012]1## $Id: browser.py 10378 2013-06-25 04:03:45Z 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]20import grok
[9057]21from waeup.kofa.applicants.browser import ApplicantRegistrationPage
[10378]22from kofacustom.nigeria.applicants.browser import (
23    NigeriaApplicantDisplayFormPage,
24    NigeriaPDFApplicationSlip)
[8012]25
[10378]26from waeup.uniben.interfaces import MessageFactory as _
27
[10338]28PASTQ_ALL = ['ADT','EPCS','ESM','HEK','VTE']
[8012]29
[10338]30PASTQ_AL = ['ENL','FAA','FOL','HIS','LAL',
31            'PHL','THR','BUL','JIL','LAW','PPL','PUL'] + PASTQ_ALL
32
33PASTQ_BS = ['ANT','ANY','CHH','COH','HAE','MED','MEH','PHS','SUR',
34            'PCG','PCH','PCO', 'PCT','PHA','PHM','PMB','ANA','MBC',
35            'MLS','NSC','PSY','DPV','ODR','OSP','PER', 'RES','AEB',
36            'BCH','BOT','CED','EVL','MCB','OPT','PBB','SLT','ZOO',
37            'AEE','ANS', 'CRS','FIS','FOW','SOS'] + PASTQ_ALL
38
39PASTQ_EPS = ['CHE','CVE','DMIC','EEE','MCH','PEE','PRE','CHM',
40             'CSC','GLY','MTH','PHY'] + PASTQ_ALL
41
42PASTQ_MSS = ['ACC','BNK','BUS','ECO','GEO','POL','SAA','SWK'] + PASTQ_ALL
43
[8630]44class CustomApplicantRegistrationPage(ApplicantRegistrationPage):
45    """Captcha'd registration page for applicants.
46    """
47
[10337]48    def _redirect(self, email, password, applicant_id):
49        # Forward email and credentials to landing page.
50        self.redirect(self.url(self.context, 'registration_complete',
51            data = dict(email=email, password=password,
52            applicant_id=applicant_id)))
53        return
[10287]54
[10375]55class CustomApplicantDisplayFormPage(NigeriaApplicantDisplayFormPage):
56    """A display view for applicant data.
[10287]57    """
[10375]58    grok.template('applicantdisplaypage')
[10338]59
60    def _show_pastq(self):
61        return self.target.startswith('putme') \
[10375]62               and self.context.state in ('paid', 'submitted') \
[10338]63               and getattr(self.context, 'course1') is not None
64
65    @property
66    def show_pastq_al(self):
67        return self._show_pastq() \
68               and self.context.course1.__parent__.__parent__.code in PASTQ_AL
69
70    @property
71    def show_pastq_bs(self):
72        return self._show_pastq() \
73               and self.context.course1.__parent__.__parent__.code in PASTQ_BS
74
75    @property
76    def show_pastq_eps(self):
77        return self._show_pastq() \
78               and self.context.course1.__parent__.__parent__.code in PASTQ_EPS
79
80    @property
81    def show_pastq_mss(self):
82        return self._show_pastq() \
83               and self.context.course1.__parent__.__parent__.code in PASTQ_MSS
84
[10378]85class CustomNigeriaPDFApplicationSlip(NigeriaPDFApplicationSlip):
[10338]86
[10378]87
88    @property
89    def note(self):
90        if self.target is not None and not self.target.startswith('pg') \
91            and not self._reduced_slip():
92            return _(u'<br /><br /><br />'
93                      'Comfirm your exam venue 72 hours to the exam.')
94        return
95
96
Note: See TracBrowser for help on using the repository browser.