source: main/waeup.aaue/trunk/src/waeup/aaue/students/viewlets.py @ 11606

Last change on this file since 11606 was 11603, checked in by Henrik Bettermann, 11 years ago

Activate GetMatricNumberActionButton?.

  • Property svn:keywords set to Id
File size: 2.0 KB
Line 
1## $Id: viewlets.py 11603 2014-04-28 04:58:19Z 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 zope.component import getUtility
21from waeup.kofa.students.interfaces import IStudent, IStudentsUtils
22from waeup.kofa.students.viewlets import (
23    AddPreviousPaymentActionButton, AddBalancePaymentActionButton,
24    ManageActionButton, StudentBaseDisplayFormPage)
25
26from waeup.aaue.interfaces import MessageFactory as _
27
28class AddPreviousPaymentActionButton(AddPreviousPaymentActionButton):
29
30    @property
31    def target_url(self):
32        return ''
33
34class AddBalancePaymentActionButton(AddBalancePaymentActionButton):
35
36    @property
37    def target_url(self):
38        return ''
39
40class 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        matric_number = students_utils.constructMatricNumber(self.context)
55        if not matric_number:
56            return ''
57        return self.view.url(self.view.context, 'get_matric_number')
Note: See TracBrowser for help on using the repository browser.