[16717] | 1 | ## $Id: viewlets.py 17612 2023-10-13 08:25:57Z henrik $ |
---|
[15614] | 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 |
---|
[17554] | 22 | from kofacustom.unidel.students.interfaces import (ICustomStudent, |
---|
[15614] | 23 | ICustomStudentStudyCourse, ICustomStudentStudyLevel) |
---|
| 24 | from waeup.kofa.students.fileviewlets import ( |
---|
| 25 | StudentFileDisplay, StudentFileUpload, StudentImage) |
---|
[17554] | 26 | from waeup.kofa.students.browser import (StudentBaseDisplayFormPage, |
---|
[15614] | 27 | ExportPDFClearanceSlip, StudyCourseDisplayFormPage, |
---|
| 28 | StudyLevelDisplayFormPage) |
---|
[17587] | 29 | from waeup.kofa.students.viewlets import AdmissionSlipActionButton |
---|
[15614] | 30 | |
---|
| 31 | from kofacustom.nigeria.interfaces import MessageFactory as _ |
---|
[17554] | 32 | |
---|
| 33 | class ExamClearanceSlipActionButton(ManageActionButton): |
---|
| 34 | grok.order(10) |
---|
| 35 | grok.context(ICustomStudent) |
---|
| 36 | grok.view(StudentBaseDisplayFormPage) |
---|
[17561] | 37 | grok.require('waeup.manageStudent') |
---|
[17554] | 38 | text = _('Download examination clearance slip') |
---|
| 39 | target = 'examclearance_slip.pdf' |
---|
| 40 | icon = 'actionicon_pdf.png' |
---|
| 41 | |
---|
| 42 | @property |
---|
| 43 | def target_url(self): |
---|
| 44 | #if not self.context.state in : |
---|
| 45 | # return '' |
---|
[17587] | 46 | return self.view.url(self.view.context, self.target) |
---|
| 47 | |
---|
| 48 | class AdmissionSlipActionButton(AdmissionSlipActionButton): |
---|
[17594] | 49 | grok.require('waeup.managePortal') |
---|
[17612] | 50 | |
---|
| 51 | # UTME (JAMB) Result |
---|
| 52 | |
---|
| 53 | class JAMBResultDisplay(StudentFileDisplay): |
---|
| 54 | """ UTME (JAMB) Result display viewlet. |
---|
| 55 | """ |
---|
| 56 | grok.order(19) |
---|
| 57 | label = _(u' UTME (JAMB) Result') |
---|
| 58 | title = _(u' UTME (JAMB) Result') |
---|
| 59 | download_name = u'jamb_result' |
---|
| 60 | |
---|
| 61 | class JAMBResultSlip(JAMBResultDisplay): |
---|
| 62 | grok.view(ExportPDFClearanceSlip) |
---|
| 63 | |
---|
| 64 | class JAMBResultUpload(StudentFileUpload): |
---|
| 65 | """UTME (JAMB) Result upload viewlet. |
---|
| 66 | """ |
---|
| 67 | grok.order(19) |
---|
| 68 | label = _(u' UTME (JAMB) Result') |
---|
| 69 | title = _(u' UTME (JAMB) Result Scan') |
---|
| 70 | mus = 1024 * 250 |
---|
| 71 | download_name = u'jamb_result' |
---|
| 72 | |
---|
| 73 | class JAMBResultImage(StudentImage): |
---|
| 74 | """Renders UTME (JAMB) Result scan. |
---|
| 75 | """ |
---|
| 76 | grok.name('jamb_result') |
---|
| 77 | download_name = u'jamb_result' |
---|