source: main/waeup.fceokene/trunk/src/waeup/fceokene/students/viewlets.py @ 16924

Last change on this file since 16924 was 15990, checked in by Henrik Bettermann, 5 years ago

Change button order.

  • Property svn:keywords set to Id
File size: 2.7 KB
Line 
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
19import grok
20from waeup.kofa.browser.viewlets import ManageActionButton
21from waeup.kofa.students.viewlets import (
22    AdmissionSlipActionButton,
23    AddPreviousPaymentActionButton, AddBalancePaymentActionButton,
24    ApprovePaymentActionButton)
25from waeup.kofa.students.interfaces import IStudentStudyLevel
26from waeup.kofa.students.browser import StudyLevelDisplayFormPage
27from waeup.kofa.students.workflow import ADMITTED, VALIDATED
28
29class 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
37class AddPreviousPaymentActionButton(AddPreviousPaymentActionButton):
38
39    @property
40    def target_url(self):
41        return ''
42
43#class AddBalancePaymentActionButton(AddBalancePaymentActionButton):
44
45#    @property
46#    def target_url(self):
47#        return ''
48
49class ApprovePaymentActionButton(ApprovePaymentActionButton):
50
51    grok.require('waeup.manageStudent')
52
53class ExaminationClearanceSlipActionButton1(ManageActionButton):
54    grok.order(7)
55    grok.context(IStudentStudyLevel)
56    grok.view(StudyLevelDisplayFormPage)
57    grok.require('waeup.viewStudent')
58    icon = 'actionicon_pdf.png'
59    text = 'Download 1st semester examination clearance slip'
60    target = 'examination_clearance_slip_1.pdf'
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)
71
72class ExaminationClearanceSlipActionButton2(ExaminationClearanceSlipActionButton1):
73    grok.order(8)
74    text = 'Download 2nd semester examination clearance slip'
75    target = 'examination_clearance_slip_2.pdf'
Note: See TracBrowser for help on using the repository browser.