1 | ## $Id: viewlets.py 9439 2012-10-27 06:18:08Z 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 | |
---|
19 | import grok |
---|
20 | from waeup.kofa.interfaces import REQUESTED |
---|
21 | from waeup.kofa.browser.viewlets import ManageActionButton |
---|
22 | from waeup.uniben.students.interfaces import ICustomStudentStudyCourse |
---|
23 | from waeup.kofa.students.viewlets import ( |
---|
24 | FileDisplay, FileUpload, Image) |
---|
25 | from waeup.kofa.students.browser import ( |
---|
26 | ExportPDFClearanceSlipPage, StudyCourseDisplayFormPage) |
---|
27 | |
---|
28 | from kofacustom.nigeria.interfaces import MessageFactory as _ |
---|
29 | |
---|
30 | class StudyCourseEditActionButton(ManageActionButton): |
---|
31 | grok.order(1) |
---|
32 | grok.context(ICustomStudentStudyCourse) |
---|
33 | grok.view(StudyCourseDisplayFormPage) |
---|
34 | grok.require('waeup.clearStudent') |
---|
35 | text = _('Edit level') |
---|
36 | target = 'edit_level' |
---|
37 | |
---|
38 | @property |
---|
39 | def target_url(self): |
---|
40 | if self.context.is_current and self.context.student.state == REQUESTED: |
---|
41 | return self.view.url(self.view.context, self.target) |
---|
42 | return False |
---|
43 | |
---|
44 | # JAMB Letter |
---|
45 | |
---|
46 | class JAMBLetterDisplay(FileDisplay): |
---|
47 | """JAMB Letter display viewlet. |
---|
48 | """ |
---|
49 | grok.order(19) |
---|
50 | label = _(u'JAMB Letter') |
---|
51 | title = _(u'JAMB Letter') |
---|
52 | download_name = u'cert' |
---|
53 | |
---|
54 | class JAMBLetterSlip(JAMBLetterDisplay): |
---|
55 | grok.view(ExportPDFClearanceSlipPage) |
---|
56 | |
---|
57 | class JAMBLetterUpload(FileUpload): |
---|
58 | """JAMB Letter upload viewlet. |
---|
59 | """ |
---|
60 | grok.order(19) |
---|
61 | label = _(u'JAMB Letter') |
---|
62 | title = _(u'JAMB Letter Scan') |
---|
63 | mus = 1024 * 150 |
---|
64 | download_name = u'cert' |
---|
65 | |
---|
66 | class JAMBLetterImage(Image): |
---|
67 | """Renders JAMB Letter scan. |
---|
68 | """ |
---|
69 | grok.name('cert') |
---|
70 | download_name = u'cert' |
---|
71 | |
---|
72 | # Affidavit of Non-Membership of Secret Cults |
---|
73 | |
---|
74 | class SecrCultsStatementDisplay(FileDisplay): |
---|
75 | """Affidavit of Non-Membership of Secret Cults display viewlet. |
---|
76 | """ |
---|
77 | grok.order(20) |
---|
78 | label = _(u'Affidavit of Non-Membership of Secret Cults') |
---|
79 | title = _(u'Affidavit of Non-Membership of Secret Cults') |
---|
80 | download_name = u'secr_cults' |
---|
81 | |
---|
82 | class SecrCultsStatementSlip(SecrCultsStatementDisplay): |
---|
83 | grok.view(ExportPDFClearanceSlipPage) |
---|
84 | |
---|
85 | class SecrCultsStatementUpload(FileUpload): |
---|
86 | """Affidavit of Non-Membership of Secret Cults upload viewlet. |
---|
87 | """ |
---|
88 | grok.order(20) |
---|
89 | label = _(u'Affidavit of Non-Membership of Secret Cults') |
---|
90 | title = _(u'Affidavit of Non-Membership of Secret Cults Scan') |
---|
91 | mus = 1024 * 150 |
---|
92 | download_name = u'secr_cults' |
---|
93 | |
---|
94 | class ResultStatementImage(Image): |
---|
95 | """Renders Affidavit of Non-Membership of Secret Cults scan. |
---|
96 | """ |
---|
97 | grok.name('secr_cults') |
---|
98 | download_name = u'secr_cults' |
---|