1 | ## $Id: viewlets.py 11613 2014-04-30 14:38:41Z 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 ( |
---|
23 | ICustomStudentStudyCourse, ICustomStudentStudyLevel) |
---|
24 | from waeup.kofa.students.viewlets import ( |
---|
25 | FileDisplay, FileUpload, Image) |
---|
26 | from waeup.kofa.students.browser import ( |
---|
27 | ExportPDFClearanceSlipPage, StudyCourseDisplayFormPage, |
---|
28 | StudyLevelDisplayFormPage) |
---|
29 | |
---|
30 | from kofacustom.nigeria.interfaces import MessageFactory as _ |
---|
31 | |
---|
32 | class StudyCourseEditActionButton(ManageActionButton): |
---|
33 | grok.order(1) |
---|
34 | grok.context(ICustomStudentStudyCourse) |
---|
35 | grok.view(StudyCourseDisplayFormPage) |
---|
36 | grok.require('waeup.clearStudent') |
---|
37 | text = _('Edit level') |
---|
38 | target = 'edit_level' |
---|
39 | |
---|
40 | @property |
---|
41 | def target_url(self): |
---|
42 | if self.context.is_current and self.context.student.state == REQUESTED: |
---|
43 | return self.view.url(self.view.context, self.target) |
---|
44 | return False |
---|
45 | |
---|
46 | class CourseResultSlipActionButton(ManageActionButton): |
---|
47 | grok.order(6) |
---|
48 | grok.context(ICustomStudentStudyLevel) |
---|
49 | grok.view(StudyLevelDisplayFormPage) |
---|
50 | grok.require('waeup.viewStudent') |
---|
51 | icon = 'actionicon_pdf.png' |
---|
52 | text = _('Download course result slip') |
---|
53 | target = 'course_result_slip.pdf' |
---|
54 | |
---|
55 | @property |
---|
56 | def target_url(self): |
---|
57 | return self.view.url(self.view.context, self.target) |
---|
58 | |
---|
59 | # JAMB Letter |
---|
60 | |
---|
61 | class JAMBLetterDisplay(FileDisplay): |
---|
62 | """JAMB Letter display viewlet. |
---|
63 | """ |
---|
64 | grok.order(19) |
---|
65 | label = _(u'JAMB Letter') |
---|
66 | title = _(u'JAMB Letter') |
---|
67 | download_name = u'jamb_letter' |
---|
68 | |
---|
69 | class JAMBLetterSlip(JAMBLetterDisplay): |
---|
70 | grok.view(ExportPDFClearanceSlipPage) |
---|
71 | |
---|
72 | class JAMBLetterUpload(FileUpload): |
---|
73 | """JAMB Letter upload viewlet. |
---|
74 | """ |
---|
75 | grok.order(19) |
---|
76 | label = _(u'JAMB Letter') |
---|
77 | title = _(u'JAMB Letter Scan') |
---|
78 | mus = 1024 * 150 |
---|
79 | download_name = u'jamb_letter' |
---|
80 | |
---|
81 | class JAMBLetterImage(Image): |
---|
82 | """Renders JAMB Letter scan. |
---|
83 | """ |
---|
84 | grok.name('jamb_letter') |
---|
85 | download_name = u'jamb_letter' |
---|
86 | |
---|
87 | # Affidavit of Non-Membership of Secret Cults |
---|
88 | |
---|
89 | class SecrCultsStatementDisplay(FileDisplay): |
---|
90 | """Affidavit of Non-Membership of Secret Cults display viewlet. |
---|
91 | """ |
---|
92 | grok.order(20) |
---|
93 | label = _(u'Affidavit of Non-Membership of Secret Cults') |
---|
94 | title = _(u'Affidavit of Non-Membership of Secret Cults') |
---|
95 | download_name = u'secr_cults' |
---|
96 | |
---|
97 | class SecrCultsStatementSlip(SecrCultsStatementDisplay): |
---|
98 | grok.view(ExportPDFClearanceSlipPage) |
---|
99 | |
---|
100 | class SecrCultsStatementUpload(FileUpload): |
---|
101 | """Affidavit of Non-Membership of Secret Cults upload viewlet. |
---|
102 | """ |
---|
103 | grok.order(20) |
---|
104 | label = _(u'Affidavit of Non-Membership of Secret Cults') |
---|
105 | title = _(u'Affidavit of Non-Membership of Secret Cults Scan') |
---|
106 | mus = 1024 * 150 |
---|
107 | download_name = u'secr_cults' |
---|
108 | |
---|
109 | class SecrCultsStatementImage(Image): |
---|
110 | """Renders Affidavit of Non-Membership of Secret Cults scan. |
---|
111 | """ |
---|
112 | grok.name('secr_cults') |
---|
113 | download_name = u'secr_cults' |
---|
114 | |
---|
115 | # Fingerprints |
---|
116 | |
---|
117 | class LeftThumbPrintDisplay(FileDisplay): |
---|
118 | """Left thumb fingerprint display viewlet. |
---|
119 | """ |
---|
120 | grok.order(21) |
---|
121 | label = _(u'Left Thumb Fingerprint') |
---|
122 | title = _(u'Left Thumb Fingerprint Minutiae') |
---|
123 | download_name = u'finger1.fpm' |
---|
124 | |
---|
125 | class LeftThumbPrintSlip(LeftThumbPrintDisplay): |
---|
126 | """Mentions scanned fingerprint on slip. |
---|
127 | |
---|
128 | Fingerprint minutiae is not printet. |
---|
129 | """ |
---|
130 | grok.view(ExportPDFClearanceSlipPage) |
---|
131 | |
---|
132 | class LeftThumbPrintUpload(FileUpload): |
---|
133 | """Left thumb fingerprint upload viewlet. |
---|
134 | """ |
---|
135 | grok.order(21) |
---|
136 | grok.require('waeup.manageStudent') |
---|
137 | label = _(u'Left Thumb Fingerprint') |
---|
138 | title = _(u'Left Thumb Fingerprint Minutiae') |
---|
139 | mus = 1024 * 5 |
---|
140 | download_name = u'finger1.fpm' |
---|
141 | |
---|
142 | class LeftThumbPrintImage(Image): |
---|
143 | """Renders left thumb fingerprint minutiae for download. |
---|
144 | """ |
---|
145 | grok.name('finger1.fpm') |
---|
146 | download_name = u'finger1.fpm' |
---|