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