[9525] | 1 | ## $Id: viewlets.py 15990 2020-02-05 22:35:58Z 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 | |
---|
[15940] | 19 | import grok |
---|
[15977] | 20 | from waeup.kofa.browser.viewlets import ManageActionButton |
---|
[9871] | 21 | from waeup.kofa.students.viewlets import ( |
---|
[10828] | 22 | AdmissionSlipActionButton, |
---|
[15940] | 23 | AddPreviousPaymentActionButton, AddBalancePaymentActionButton, |
---|
| 24 | ApprovePaymentActionButton) |
---|
[15977] | 25 | from waeup.kofa.students.interfaces import IStudentStudyLevel |
---|
| 26 | from waeup.kofa.students.browser import StudyLevelDisplayFormPage |
---|
| 27 | from waeup.kofa.students.workflow import ADMITTED, VALIDATED |
---|
[9525] | 28 | |
---|
[10828] | 29 | class AdmissionSlipActionButton(AdmissionSlipActionButton): |
---|
| 30 | |
---|
| 31 | @property |
---|
| 32 | def target_url(self): |
---|
| 33 | if self.context.state in (ADMITTED,): |
---|
| 34 | return '' |
---|
| 35 | return self.view.url(self.view.context, self.target) |
---|
| 36 | |
---|
[9525] | 37 | class AddPreviousPaymentActionButton(AddPreviousPaymentActionButton): |
---|
| 38 | |
---|
| 39 | @property |
---|
| 40 | def target_url(self): |
---|
| 41 | return '' |
---|
[9871] | 42 | |
---|
[15939] | 43 | #class AddBalancePaymentActionButton(AddBalancePaymentActionButton): |
---|
[9871] | 44 | |
---|
[15939] | 45 | # @property |
---|
| 46 | # def target_url(self): |
---|
[15940] | 47 | # return '' |
---|
| 48 | |
---|
| 49 | class ApprovePaymentActionButton(ApprovePaymentActionButton): |
---|
| 50 | |
---|
| 51 | grok.require('waeup.manageStudent') |
---|
[15977] | 52 | |
---|
[15989] | 53 | class ExaminationClearanceSlipActionButton1(ManageActionButton): |
---|
[15990] | 54 | grok.order(7) |
---|
[15977] | 55 | grok.context(IStudentStudyLevel) |
---|
| 56 | grok.view(StudyLevelDisplayFormPage) |
---|
| 57 | grok.require('waeup.viewStudent') |
---|
| 58 | icon = 'actionicon_pdf.png' |
---|
[15989] | 59 | text = 'Download 1st semester examination clearance slip' |
---|
| 60 | target = 'examination_clearance_slip_1.pdf' |
---|
[15977] | 61 | |
---|
| 62 | @property |
---|
| 63 | def target_url(self): |
---|
| 64 | is_current = self.context.__parent__.is_current |
---|
| 65 | if not is_current: |
---|
| 66 | return '' |
---|
| 67 | if self.context.student.state != VALIDATED \ |
---|
| 68 | or self.context.student.current_level != self.context.level: |
---|
| 69 | return '' |
---|
| 70 | return self.view.url(self.view.context, self.target) |
---|
[15989] | 71 | |
---|
| 72 | class ExaminationClearanceSlipActionButton2(ExaminationClearanceSlipActionButton1): |
---|
[15990] | 73 | grok.order(8) |
---|
[15989] | 74 | text = 'Download 2nd semester examination clearance slip' |
---|
| 75 | target = 'examination_clearance_slip_2.pdf' |
---|