source: main/waeup.fceokene/trunk/src/waeup/fceokene/students/browser.py @ 10010

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

Adjust to changes made in base package.

  • Property svn:keywords set to Id
File size: 4.1 KB
Line 
1## $Id: browser.py 9986 2013-02-24 10:40:32Z 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
20from zope.component import getUtility
21from hurry.workflow.interfaces import IWorkflowInfo
22from waeup.kofa.interfaces import ADMITTED, IKofaUtils
23from waeup.kofa.interfaces import MessageFactory as _
24from waeup.kofa.widgets.datewidget import FriendlyDatetimeDisplayWidget
25from waeup.kofa.students.browser import (
26    StartClearancePage, BedTicketAddPage, ExportPDFAdmissionSlipPage)
27from kofacustom.nigeria.students.browser import (
28    NigeriaOnlinePaymentDisplayFormPage,
29    NigeriaOnlinePaymentAddFormPage,
30    NigeriaExportPDFPaymentSlipPage,
31    NigeriaStudentClearanceEditFormPage,
32    )
33
34from waeup.fceokene.students.interfaces import ICustomStudentOnlinePayment
35
36class CustomExportPDFAdmissionSlipPage(ExportPDFAdmissionSlipPage):
37    """Deliver a PDF Admission slip.
38    """
39
40    @property
41    def label(self):
42        portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE
43        return translate(_('Admission Letter of'),
44            'waeup.kofa', target_language=portal_language) \
45            + ' %s' % self.context.display_fullname
46
47    @property
48    def label(self):
49        portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE
50        lang = self.request.cookies.get('kofa.language', portal_language)
51        line0 = ''
52        if self.context.student.current_mode.startswith('ug'):
53            line0 = 'IN AFFILIATION WITH UNIVERSITY OF IBADAN\n'
54        line1 = translate(_('Admission Letter of'),
55            'waeup.kofa', target_language=portal_language) \
56            + ' %s' % self.context.display_fullname
57        return '%s%s' % (line0, line1)
58
59class CustomOnlinePaymentDisplayFormPage(NigeriaOnlinePaymentDisplayFormPage):
60    """ Page to view an online payment ticket
61    """
62    grok.context(ICustomStudentOnlinePayment)
63    form_fields = grok.AutoFields(ICustomStudentOnlinePayment).omit(
64        'provider_amt', 'gateway_amt', 'thirdparty_amt', 'p_item')
65    form_fields[
66        'creation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
67    form_fields[
68        'payment_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
69
70class CustomOnlinePaymentAddFormPage(NigeriaOnlinePaymentAddFormPage):
71    """ Page to add an online payment ticket
72    """
73    form_fields = grok.AutoFields(ICustomStudentOnlinePayment).select(
74        'p_category')
75
76class CustomExportPDFPaymentSlipPage(NigeriaExportPDFPaymentSlipPage):
77    """Deliver a PDF slip of the context.
78    """
79    grok.context(ICustomStudentOnlinePayment)
80    form_fields = grok.AutoFields(ICustomStudentOnlinePayment).omit(
81        'provider_amt', 'gateway_amt', 'thirdparty_amt', 'p_item')
82    form_fields['creation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
83    form_fields['payment_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
84
85class CustomStartClearancePage(StartClearancePage):
86
87    @property
88    def with_ac(self):
89        mode = getattr(self.context, 'current_mode', None)
90        if mode and mode.startswith('ug'):
91            return True
92        return False
93
94class CustomStudentClearanceEditFormPage(NigeriaStudentClearanceEditFormPage):
95    """ View to edit student clearance data by student
96    """
97
98    def dataNotComplete(self):
99        return False
100
101class CustomBedTicketAddPage(BedTicketAddPage):
102    """ Page to add an online payment ticket
103    """
104    buttonname = _('Create bed ticket')
105    notice = ''
106    with_ac = False
Note: See TracBrowser for help on using the repository browser.