[9382] | 1 | ## $Id: viewlets.py 12452 2015-01-12 11:17:16Z 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, ) |
---|
[12423] | 25 | from waeup.kofa.students.fileviewlets import ( |
---|
[12452] | 26 | StudentFileDisplay, StudentFileUpload, StudentImage) |
---|
[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 | |
---|
[12122] | 70 | @property |
---|
| 71 | def target_url(self): |
---|
| 72 | if self.context.student.state == REQUESTED \ |
---|
| 73 | and self.context.student.physical_clearance_date: |
---|
| 74 | return self.view.url(self.view.context, self.target) |
---|
| 75 | return False |
---|
[12121] | 76 | |
---|
[12122] | 77 | |
---|
[9382] | 78 | # JAMB Letter |
---|
| 79 | |
---|
[12452] | 80 | class JAMBLetterDisplay(StudentFileDisplay): |
---|
[9382] | 81 | """JAMB Letter display viewlet. |
---|
| 82 | """ |
---|
| 83 | grok.order(19) |
---|
| 84 | label = _(u'JAMB Letter') |
---|
| 85 | title = _(u'JAMB Letter') |
---|
[11556] | 86 | download_name = u'jamb_letter' |
---|
[9382] | 87 | |
---|
| 88 | class JAMBLetterSlip(JAMBLetterDisplay): |
---|
| 89 | grok.view(ExportPDFClearanceSlipPage) |
---|
| 90 | |
---|
[12452] | 91 | class JAMBLetterUpload(StudentFileUpload): |
---|
[9382] | 92 | """JAMB Letter upload viewlet. |
---|
| 93 | """ |
---|
| 94 | grok.order(19) |
---|
| 95 | label = _(u'JAMB Letter') |
---|
| 96 | title = _(u'JAMB Letter Scan') |
---|
| 97 | mus = 1024 * 150 |
---|
[11556] | 98 | download_name = u'jamb_letter' |
---|
[9382] | 99 | |
---|
[12452] | 100 | class JAMBLetterImage(StudentImage): |
---|
[9382] | 101 | """Renders JAMB Letter scan. |
---|
| 102 | """ |
---|
[11556] | 103 | grok.name('jamb_letter') |
---|
| 104 | download_name = u'jamb_letter' |
---|
[9382] | 105 | |
---|
| 106 | # Affidavit of Non-Membership of Secret Cults |
---|
| 107 | |
---|
[12452] | 108 | class SecrCultsStatementDisplay(StudentFileDisplay): |
---|
[9382] | 109 | """Affidavit of Non-Membership of Secret Cults display viewlet. |
---|
| 110 | """ |
---|
| 111 | grok.order(20) |
---|
| 112 | label = _(u'Affidavit of Non-Membership of Secret Cults') |
---|
| 113 | title = _(u'Affidavit of Non-Membership of Secret Cults') |
---|
| 114 | download_name = u'secr_cults' |
---|
| 115 | |
---|
| 116 | class SecrCultsStatementSlip(SecrCultsStatementDisplay): |
---|
| 117 | grok.view(ExportPDFClearanceSlipPage) |
---|
| 118 | |
---|
[12452] | 119 | class SecrCultsStatementUpload(StudentFileUpload): |
---|
[9382] | 120 | """Affidavit of Non-Membership of Secret Cults upload viewlet. |
---|
| 121 | """ |
---|
| 122 | grok.order(20) |
---|
| 123 | label = _(u'Affidavit of Non-Membership of Secret Cults') |
---|
| 124 | title = _(u'Affidavit of Non-Membership of Secret Cults Scan') |
---|
| 125 | mus = 1024 * 150 |
---|
| 126 | download_name = u'secr_cults' |
---|
| 127 | |
---|
[12452] | 128 | class SecrCultsStatementImage(StudentImage): |
---|
[9382] | 129 | """Renders Affidavit of Non-Membership of Secret Cults scan. |
---|
| 130 | """ |
---|
| 131 | grok.name('secr_cults') |
---|
[11611] | 132 | download_name = u'secr_cults' |
---|
| 133 | |
---|
| 134 | # Fingerprints |
---|
| 135 | |
---|
[12452] | 136 | class LeftThumbPrintDisplay(StudentFileDisplay): |
---|
[11611] | 137 | """Left thumb fingerprint display viewlet. |
---|
| 138 | """ |
---|
| 139 | grok.order(21) |
---|
| 140 | label = _(u'Left Thumb Fingerprint') |
---|
| 141 | title = _(u'Left Thumb Fingerprint Minutiae') |
---|
| 142 | download_name = u'finger1.fpm' |
---|
| 143 | |
---|
| 144 | class LeftThumbPrintSlip(LeftThumbPrintDisplay): |
---|
| 145 | """Mentions scanned fingerprint on slip. |
---|
| 146 | |
---|
| 147 | Fingerprint minutiae is not printet. |
---|
| 148 | """ |
---|
| 149 | grok.view(ExportPDFClearanceSlipPage) |
---|
| 150 | |
---|
[12452] | 151 | class LeftThumbPrintUpload(StudentFileUpload): |
---|
[11611] | 152 | """Left thumb fingerprint upload viewlet. |
---|
| 153 | """ |
---|
| 154 | grok.order(21) |
---|
[11613] | 155 | grok.require('waeup.manageStudent') |
---|
[11611] | 156 | label = _(u'Left Thumb Fingerprint') |
---|
| 157 | title = _(u'Left Thumb Fingerprint Minutiae') |
---|
| 158 | mus = 1024 * 5 |
---|
| 159 | download_name = u'finger1.fpm' |
---|
| 160 | |
---|
[12452] | 161 | class LeftThumbPrintImage(StudentImage): |
---|
[11611] | 162 | """Renders left thumb fingerprint minutiae for download. |
---|
| 163 | """ |
---|
| 164 | grok.name('finger1.fpm') |
---|
| 165 | download_name = u'finger1.fpm' |
---|