source: main/waeup.uniben/trunk/src/waeup/uniben/hostels/browser.py @ 14662

Last change on this file since 14662 was 13324, checked in by Henrik Bettermann, 9 years ago

Restructure text in alert box.

  • Property svn:keywords set to Id
File size: 2.0 KB
Line 
1## $Id: browser.py 13324 2015-10-14 20:02:20Z henrik $
2##
3## Copyright (C) 2015 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##
18import grok
19from waeup.kofa.hostels.interfaces import IHostelsContainer
20from waeup.kofa.hostels.browser import ReleaseExpiredAllocationsPage, HostelsContainerPage
21from waeup.kofa.browser.viewlets import ManageActionButton
22
23
24class ReleaseExpiredAllocationsActionButton(ManageActionButton):
25    grok.order(2)
26    grok.context(IHostelsContainer)
27    grok.view(HostelsContainerPage)
28    grok.require('waeup.manageHostels')
29    icon = 'actionicon_sweep.png'
30    target = 'releaseexpired'
31    text = 'Release all expired bed space allocations'
32
33    @property
34    def target_url(self):
35        if self.target and self.request.principal.id == 'admin':
36            return self.view.url(self.view.context, self.target)
37        return
38
39    @property
40    def onclick(self):
41        msg = "'All expired bed space allocations will be annulled. " + \
42              "Are you sure? \\n\\n" + \
43              "Bed space allocation expires four (4) days after accommodation " + \
44              "booking if maintenance fee is not paid.'"
45        return "return window.confirm(%s);" % msg
46
47
48class CustomReleaseExpiredAllocationsPage(ReleaseExpiredAllocationsPage):
49    """Release all expired allocated beds.
50    """
51
52    def update(self):
53        super(CustomReleaseExpiredAllocationsPage, self).update(4)
54        return
Note: See TracBrowser for help on using the repository browser.