[8911] | 1 | ## $Id: browser.py 9496 2012-11-01 08:35:49Z 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 | ## |
---|
| 18 | import grok |
---|
| 19 | from zope.i18n import translate |
---|
| 20 | from waeup.kofa.widgets.datewidget import FriendlyDatetimeDisplayWidget |
---|
[9496] | 21 | from waeup.kofa.students.browser import CourseTicketAddFormPage |
---|
[8911] | 22 | from kofacustom.nigeria.students.browser import ( |
---|
| 23 | NigeriaOnlinePaymentDisplayFormPage, |
---|
| 24 | NigeriaOnlinePaymentAddFormPage, |
---|
| 25 | NigeriaExportPDFPaymentSlipPage) |
---|
| 26 | |
---|
[9496] | 27 | from waeup.aaue.students.interfaces import ( |
---|
| 28 | ICustomStudentOnlinePayment, ICustomCourseTicketAdd) |
---|
[8911] | 29 | |
---|
| 30 | class CustomOnlinePaymentDisplayFormPage(NigeriaOnlinePaymentDisplayFormPage): |
---|
| 31 | """ Page to view an online payment ticket |
---|
| 32 | """ |
---|
| 33 | grok.context(ICustomStudentOnlinePayment) |
---|
| 34 | form_fields = grok.AutoFields(ICustomStudentOnlinePayment) |
---|
| 35 | form_fields[ |
---|
| 36 | 'creation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le') |
---|
| 37 | form_fields[ |
---|
| 38 | 'payment_date'].custom_widget = FriendlyDatetimeDisplayWidget('le') |
---|
| 39 | |
---|
| 40 | class CustomOnlinePaymentAddFormPage(NigeriaOnlinePaymentAddFormPage): |
---|
| 41 | """ Page to add an online payment ticket |
---|
| 42 | """ |
---|
| 43 | form_fields = grok.AutoFields(ICustomStudentOnlinePayment).select( |
---|
| 44 | 'p_category') |
---|
| 45 | |
---|
| 46 | class CustomExportPDFPaymentSlipPage(NigeriaExportPDFPaymentSlipPage): |
---|
| 47 | """Deliver a PDF slip of the context. |
---|
| 48 | """ |
---|
| 49 | grok.context(ICustomStudentOnlinePayment) |
---|
| 50 | form_fields = grok.AutoFields(ICustomStudentOnlinePayment) |
---|
| 51 | form_fields['creation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le') |
---|
[9496] | 52 | form_fields['payment_date'].custom_widget = FriendlyDatetimeDisplayWidget('le') |
---|
| 53 | |
---|
| 54 | class CourseTicketAddFormPage2(CourseTicketAddFormPage): |
---|
| 55 | """Add a course ticket by student. |
---|
| 56 | """ |
---|
| 57 | grok.name('ctadd') |
---|
| 58 | grok.require('waeup.handleStudent') |
---|
| 59 | form_fields = grok.AutoFields(ICustomCourseTicketAdd) |
---|