source: main/waeup.kwarapoly/trunk/src/waeup/kwarapoly/students/browser.py @ 9388

Last change on this file since 9388 was 9347, checked in by Henrik Bettermann, 12 years ago

Base configuration

  • Property svn:keywords set to Id
File size: 3.7 KB
RevLine 
[8911]1## $Id: browser.py 9347 2012-10-18 05:42:30Z henrik $
2##
3## Copyright (C) 2012 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 zope.i18n import translate
[9156]20from hurry.workflow.interfaces import IWorkflowInfo
21from waeup.kofa.interfaces import ADMITTED
22from waeup.kofa.interfaces import MessageFactory as _
[8911]23from waeup.kofa.widgets.datewidget import FriendlyDatetimeDisplayWidget
[9190]24from waeup.kofa.students.browser import StartClearancePage, BedTicketAddPage
[8911]25from kofacustom.nigeria.students.browser import (
26    NigeriaOnlinePaymentDisplayFormPage,
27    NigeriaOnlinePaymentAddFormPage,
[9181]28    NigeriaExportPDFPaymentSlipPage,
[9190]29    NigeriaStudentClearanceEditFormPage,
30    )
[8911]31
[9347]32from waeup.kwarapoly.students.interfaces import ICustomStudentOnlinePayment
[8911]33
34class CustomOnlinePaymentDisplayFormPage(NigeriaOnlinePaymentDisplayFormPage):
35    """ Page to view an online payment ticket
36    """
37    grok.context(ICustomStudentOnlinePayment)
38    form_fields = grok.AutoFields(ICustomStudentOnlinePayment)
39    form_fields[
40        'creation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
41    form_fields[
42        'payment_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
43
44class CustomOnlinePaymentAddFormPage(NigeriaOnlinePaymentAddFormPage):
45    """ Page to add an online payment ticket
46    """
47    form_fields = grok.AutoFields(ICustomStudentOnlinePayment).select(
48        'p_category')
49
50class CustomExportPDFPaymentSlipPage(NigeriaExportPDFPaymentSlipPage):
51    """Deliver a PDF slip of the context.
52    """
53    grok.context(ICustomStudentOnlinePayment)
54    form_fields = grok.AutoFields(ICustomStudentOnlinePayment)
55    form_fields['creation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
[9156]56    form_fields['payment_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
57
58class CustomStartClearancePage(StartClearancePage):
59
60    grok.template('startclearance')
61
62    def update(self, SUBMIT=None):
63        if not self.context.state == ADMITTED:
64            self.flash(_("Wrong state"))
65            self.redirect(self.url(self.context))
66            return
67        if not self.portrait_uploaded:
68            self.flash(_("No portrait uploaded."))
69            self.redirect(self.url(self.context, 'change_portrait'))
70            return
71        if not self.all_required_fields_filled:
72            self.flash(_("Not all required fields filled."))
73            self.redirect(self.url(self.context, 'edit_base'))
74            return
75        if SUBMIT is None:
76            return
77        IWorkflowInfo(self.context).fireTransition('start_clearance')
78        self.flash(_('Clearance process has been started.'))
79        self.redirect(self.url(self.context,'cedit'))
[9181]80        return
81
82class CustomStudentClearanceEditFormPage(NigeriaStudentClearanceEditFormPage):
83    """ View to edit student clearance data by student
84    """
85
86    def dataNotComplete(self):
[9190]87        return False
88
89class BedTicketAddPage(BedTicketAddPage):
90    """ Page to add an online payment ticket
91    """
92    grok.template('bookbed')
93    buttonname = _('Create bed ticket')
94    notice = ''
95    with_ac = False
Note: See TracBrowser for help on using the repository browser.