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

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

No scans are required in Okene.

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