[10765] | 1 | ## $Id: viewlets.py 17368 2023-03-28 06:18:07Z 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 |
---|
[15177] | 20 | from zope.component import getUtility |
---|
[10765] | 21 | from waeup.kofa.interfaces import REQUESTED |
---|
| 22 | from waeup.kofa.browser.viewlets import ManageActionButton |
---|
[12430] | 23 | from waeup.kofa.students.fileviewlets import ( |
---|
[12450] | 24 | StudentFileDisplay, StudentFileUpload, StudentImage) |
---|
[10765] | 25 | from waeup.kofa.students.browser import ( |
---|
[13062] | 26 | ExportPDFClearanceSlip, StudyCourseDisplayFormPage, |
---|
[15176] | 27 | StudyLevelDisplayFormPage, StudentBaseDisplayFormPage) |
---|
[15177] | 28 | from waeup.kofa.students.interfaces import IStudent, IStudentsUtils |
---|
| 29 | from waeup.kofa.students.workflow import PAID |
---|
[10765] | 30 | |
---|
[15176] | 31 | from kofacustom.edopoly.students.interfaces import ( |
---|
| 32 | ICustomStudentStudyCourse, ICustomStudentStudyLevel) |
---|
[17360] | 33 | from waeup.kofa.students.viewlets import ( |
---|
| 34 | RequestTranscriptActionButton, StudentPassportActionButton, |
---|
| 35 | TranscriptSlipActionButton, |
---|
| 36 | StudyCourseTranscriptActionButton) |
---|
[15176] | 37 | |
---|
[10765] | 38 | from kofacustom.nigeria.interfaces import MessageFactory as _ |
---|
[15176] | 39 | |
---|
| 40 | class GetMatricNumberActionButton(ManageActionButton): |
---|
| 41 | grok.order(10) |
---|
| 42 | grok.context(IStudent) |
---|
| 43 | grok.view(StudentBaseDisplayFormPage) |
---|
| 44 | grok.require('waeup.viewStudent') |
---|
| 45 | #grok.require('waeup.manageStudent') |
---|
| 46 | icon = 'actionicon_count.png' |
---|
| 47 | text = _('Get Matriculation Number') |
---|
| 48 | |
---|
| 49 | @property |
---|
| 50 | def target_url(self): |
---|
| 51 | students_utils = getUtility(IStudentsUtils) |
---|
| 52 | if self.context.matric_number: |
---|
| 53 | return '' |
---|
| 54 | error, matric_number = students_utils.constructMatricNumber( |
---|
| 55 | self.context) |
---|
| 56 | if error: |
---|
| 57 | return '' |
---|
| 58 | return self.view.url(self.view.context, 'get_matric_number') |
---|
| 59 | |
---|
| 60 | class MatricNumberSlipActionButton(ManageActionButton): |
---|
| 61 | grok.order(10) |
---|
| 62 | grok.context(IStudent) |
---|
| 63 | grok.view(StudentBaseDisplayFormPage) |
---|
| 64 | grok.require('waeup.viewStudent') |
---|
| 65 | icon = 'actionicon_pdf.png' |
---|
| 66 | text = _('Download matriculation number slip') |
---|
| 67 | target = 'matric_number_slip.pdf' |
---|
| 68 | |
---|
| 69 | @property |
---|
| 70 | def target_url(self): |
---|
| 71 | if self.context.state not in (PAID,) or not self.context.is_fresh \ |
---|
| 72 | or not self.context.matric_number: |
---|
| 73 | return '' |
---|
[15185] | 74 | return self.view.url(self.view.context, self.target) |
---|
| 75 | |
---|
| 76 | class MedicalLaboratoryRequestFormActionButton(ManageActionButton): |
---|
| 77 | grok.order(11) |
---|
| 78 | grok.context(IStudent) |
---|
| 79 | grok.view(StudentBaseDisplayFormPage) |
---|
| 80 | grok.require('waeup.viewStudent') |
---|
| 81 | icon = 'actionicon_pdf.png' |
---|
| 82 | text = _('Download medical laboratory request form') |
---|
| 83 | target = 'medical_laboratory_form.pdf' |
---|
| 84 | |
---|
| 85 | @property |
---|
| 86 | def target_url(self): |
---|
| 87 | if not self.context.medical_fee_paid: |
---|
| 88 | return '' |
---|
| 89 | return self.view.url(self.view.context, self.target) |
---|
[17360] | 90 | |
---|