[9382] | 1 | ## $Id: viewlets.py 9858 2013-01-10 07:05:59Z 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 ( |
---|
| 23 | ICustomStudentStudyCourse, ICustomStudentStudyLevel) |
---|
[9382] | 24 | from waeup.kofa.students.viewlets import ( |
---|
| 25 | FileDisplay, FileUpload, Image) |
---|
[9439] | 26 | from waeup.kofa.students.browser import ( |
---|
[9848] | 27 | ExportPDFClearanceSlipPage, StudyCourseDisplayFormPage, |
---|
| 28 | StudyLevelDisplayFormPage) |
---|
[9382] | 29 | |
---|
| 30 | from kofacustom.nigeria.interfaces import MessageFactory as _ |
---|
| 31 | |
---|
[9439] | 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' |
---|
[9382] | 39 | |
---|
[9439] | 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 | |
---|
[9848] | 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 | |
---|
[9382] | 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'cert' |
---|
| 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'cert' |
---|
| 80 | |
---|
| 81 | class JAMBLetterImage(Image): |
---|
| 82 | """Renders JAMB Letter scan. |
---|
| 83 | """ |
---|
| 84 | grok.name('cert') |
---|
| 85 | download_name = u'cert' |
---|
| 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 ResultStatementImage(Image): |
---|
| 110 | """Renders Affidavit of Non-Membership of Secret Cults scan. |
---|
| 111 | """ |
---|
| 112 | grok.name('secr_cults') |
---|
| 113 | download_name = u'secr_cults' |
---|