1 | ## $Id: browser.py 10338 2013-06-22 07:43:52Z 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 | """ |
---|
20 | import grok |
---|
21 | from waeup.kofa.applicants.browser import ApplicantRegistrationPage |
---|
22 | from kofacustom.nigeria.applicants.browser import NigeriaApplicantEditFormPage |
---|
23 | |
---|
24 | PASTQ_ALL = ['ADT','EPCS','ESM','HEK','VTE'] |
---|
25 | |
---|
26 | PASTQ_AL = ['ENL','FAA','FOL','HIS','LAL', |
---|
27 | 'PHL','THR','BUL','JIL','LAW','PPL','PUL'] + PASTQ_ALL |
---|
28 | |
---|
29 | PASTQ_BS = ['ANT','ANY','CHH','COH','HAE','MED','MEH','PHS','SUR', |
---|
30 | 'PCG','PCH','PCO', 'PCT','PHA','PHM','PMB','ANA','MBC', |
---|
31 | 'MLS','NSC','PSY','DPV','ODR','OSP','PER', 'RES','AEB', |
---|
32 | 'BCH','BOT','CED','EVL','MCB','OPT','PBB','SLT','ZOO', |
---|
33 | 'AEE','ANS', 'CRS','FIS','FOW','SOS'] + PASTQ_ALL |
---|
34 | |
---|
35 | PASTQ_EPS = ['CHE','CVE','DMIC','EEE','MCH','PEE','PRE','CHM', |
---|
36 | 'CSC','GLY','MTH','PHY'] + PASTQ_ALL |
---|
37 | |
---|
38 | PASTQ_MSS = ['ACC','BNK','BUS','ECO','GEO','POL','SAA','SWK'] + PASTQ_ALL |
---|
39 | |
---|
40 | class CustomApplicantRegistrationPage(ApplicantRegistrationPage): |
---|
41 | """Captcha'd registration page for applicants. |
---|
42 | """ |
---|
43 | |
---|
44 | def _redirect(self, email, password, applicant_id): |
---|
45 | # Forward email and credentials to landing page. |
---|
46 | self.redirect(self.url(self.context, 'registration_complete', |
---|
47 | data = dict(email=email, password=password, |
---|
48 | applicant_id=applicant_id))) |
---|
49 | return |
---|
50 | |
---|
51 | class CustomApplicantEditFormPage(NigeriaApplicantEditFormPage): |
---|
52 | """A full edit view for applicant data. |
---|
53 | """ |
---|
54 | grok.template('applicanteditpage') |
---|
55 | |
---|
56 | def _show_pastq(self): |
---|
57 | return self.target.startswith('putme') \ |
---|
58 | and self.context.state == 'paid' \ |
---|
59 | and getattr(self.context, 'course1') is not None |
---|
60 | |
---|
61 | @property |
---|
62 | def show_pastq_al(self): |
---|
63 | return self._show_pastq() \ |
---|
64 | and self.context.course1.__parent__.__parent__.code in PASTQ_AL |
---|
65 | |
---|
66 | @property |
---|
67 | def show_pastq_bs(self): |
---|
68 | return self._show_pastq() \ |
---|
69 | and self.context.course1.__parent__.__parent__.code in PASTQ_BS |
---|
70 | |
---|
71 | @property |
---|
72 | def show_pastq_eps(self): |
---|
73 | return self._show_pastq() \ |
---|
74 | and self.context.course1.__parent__.__parent__.code in PASTQ_EPS |
---|
75 | |
---|
76 | @property |
---|
77 | def show_pastq_mss(self): |
---|
78 | return self._show_pastq() \ |
---|
79 | and self.context.course1.__parent__.__parent__.code in PASTQ_MSS |
---|
80 | |
---|
81 | |
---|