[9526] | 1 | ## $Id: viewlets.py 10705 2013-11-06 08:59:15Z 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 | |
---|
[10691] | 19 | import grok |
---|
[9873] | 20 | from waeup.kofa.students.viewlets import ( |
---|
[10691] | 21 | AddPreviousPaymentActionButton, AddBalancePaymentActionButton, |
---|
| 22 | ManageActionButton) |
---|
| 23 | from waeup.kofa.students.interfaces import IStudent |
---|
| 24 | from waeup.kofa.students.browser import StudentBaseDisplayFormPage |
---|
| 25 | from waeup.kofa.students.workflow import ( |
---|
| 26 | ADMITTED, PAID, REQUESTED, RETURNING, CLEARED, REGISTERED, |
---|
| 27 | VALIDATED, GRADUATED, TRANSCRIPT, CREATED, CLEARANCE) |
---|
| 28 | from waeup.kwarapoly.interfaces import MessageFactory as _ |
---|
[9526] | 29 | |
---|
| 30 | class AddPreviousPaymentActionButton(AddPreviousPaymentActionButton): |
---|
| 31 | |
---|
| 32 | @property |
---|
| 33 | def target_url(self): |
---|
| 34 | return '' |
---|
[9873] | 35 | |
---|
| 36 | class AddBalancePaymentActionButton(AddBalancePaymentActionButton): |
---|
| 37 | |
---|
| 38 | @property |
---|
| 39 | def target_url(self): |
---|
| 40 | return '' |
---|
[10691] | 41 | |
---|
| 42 | class AdmissionNotificationActionButton(ManageActionButton): |
---|
| 43 | grok.order(4) |
---|
| 44 | grok.context(IStudent) |
---|
| 45 | grok.view(StudentBaseDisplayFormPage) |
---|
| 46 | grok.require('waeup.viewStudent') |
---|
| 47 | icon = 'actionicon_pdf.png' |
---|
| 48 | text = _('Download admission notification') |
---|
| 49 | target = 'admission_notification.pdf' |
---|
| 50 | |
---|
| 51 | @property |
---|
| 52 | def target_url(self): |
---|
| 53 | if self.context.state not in (ADMITTED, CLEARANCE, REQUESTED, CLEARED): |
---|
| 54 | return '' |
---|
| 55 | return self.view.url(self.view.context, self.target) |
---|
| 56 | |
---|
| 57 | class AdmissionSlipActionButton(ManageActionButton): |
---|
| 58 | grok.order(4) |
---|
| 59 | grok.context(IStudent) |
---|
| 60 | grok.view(StudentBaseDisplayFormPage) |
---|
| 61 | grok.require('waeup.viewStudent') |
---|
| 62 | icon = 'actionicon_pdf.png' |
---|
| 63 | text = _('Download admission letter') |
---|
| 64 | target = 'admission_slip.pdf' |
---|
| 65 | |
---|
| 66 | @property |
---|
| 67 | def target_url(self): |
---|
| 68 | if self.context.state in (CREATED, ADMITTED, |
---|
| 69 | CLEARANCE, REQUESTED, CLEARED): |
---|
| 70 | return '' |
---|
[10695] | 71 | return self.view.url(self.view.context, self.target) |
---|
| 72 | |
---|
[10705] | 73 | class RegistrationSlipActionButton(ManageActionButton): |
---|
[10695] | 74 | grok.order(4) |
---|
| 75 | grok.context(IStudent) |
---|
| 76 | grok.view(StudentBaseDisplayFormPage) |
---|
| 77 | grok.require('waeup.viewStudent') |
---|
| 78 | icon = 'actionicon_pdf.png' |
---|
| 79 | text = _('Download registration form') |
---|
[10705] | 80 | target = 'registration_slip.pdf' |
---|
[10695] | 81 | |
---|
| 82 | @property |
---|
| 83 | def target_url(self): |
---|
| 84 | if self.context.state in (CREATED,): |
---|
| 85 | return '' |
---|
[10691] | 86 | return self.view.url(self.view.context, self.target) |
---|