[10770] | 1 | ## $Id: browser.py 10817 2013-11-29 11:35:08Z 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 zope.schema.interfaces import ConstraintNotSatisfied |
---|
| 21 | from zope.component import getUtility |
---|
| 22 | from hurry.workflow.interfaces import IWorkflowInfo |
---|
[10809] | 23 | from zope.formlib.textwidgets import BytesDisplayWidget |
---|
[10770] | 24 | from waeup.kofa.interfaces import REQUESTED, IExtFileStore, IKofaUtils |
---|
| 25 | from waeup.kofa.widgets.datewidget import FriendlyDatetimeDisplayWidget |
---|
| 26 | from waeup.kofa.browser.layout import KofaEditFormPage |
---|
| 27 | from waeup.kofa.browser.layout import action, jsaction |
---|
| 28 | from waeup.kofa.students.browser import ( |
---|
| 29 | StudyLevelEditFormPage, StudyLevelDisplayFormPage, |
---|
| 30 | StudentBasePDFFormPage, ExportPDFCourseRegistrationSlipPage, |
---|
| 31 | CourseTicketDisplayFormPage, StudentTriggerTransitionFormPage, |
---|
[10804] | 32 | msave, emit_lock_message, StudyCourseDisplayFormPage, |
---|
[10812] | 33 | StudyCourseManageFormPage, |
---|
| 34 | ExportPDFPaymentSlipPage, |
---|
| 35 | ) |
---|
[10804] | 36 | from waeup.kofa.students.interfaces import ( |
---|
| 37 | IStudentsUtils, ICourseTicket) |
---|
[10770] | 38 | from waeup.kofa.students.workflow import FORBIDDEN_POSTGRAD_TRANS |
---|
| 39 | from kofacustom.nigeria.students.browser import ( |
---|
| 40 | NigeriaOnlinePaymentDisplayFormPage, |
---|
[10809] | 41 | NigeriaStudentBaseDisplayFormPage, |
---|
[10770] | 42 | NigeriaStudentBaseManageFormPage, |
---|
[10809] | 43 | NigeriaStudentBaseEditFormPage, |
---|
[10770] | 44 | NigeriaStudentClearanceEditFormPage, |
---|
| 45 | NigeriaOnlinePaymentAddFormPage, |
---|
| 46 | NigeriaExportPDFPaymentSlipPage, |
---|
| 47 | NigeriaExportPDFClearanceSlipPage, |
---|
| 48 | ) |
---|
| 49 | |
---|
| 50 | from kofacustom.ekodisco.students.interfaces import ( |
---|
| 51 | ICustomStudentOnlinePayment, ICustomStudentStudyCourse, |
---|
[10804] | 52 | ICustomStudentStudyLevel, ICustomStudentStudyCourse, |
---|
[10809] | 53 | ICustomStudentStudyCourse, ICustomStudentBase) |
---|
[10770] | 54 | from kofacustom.ekodisco.interfaces import MessageFactory as _ |
---|
| 55 | |
---|
[10809] | 56 | class CustomStudentBaseDisplayFormPage(NigeriaStudentBaseDisplayFormPage): |
---|
| 57 | """ Page to display student base data |
---|
| 58 | """ |
---|
| 59 | form_fields = grok.AutoFields(ICustomStudentBase).omit( |
---|
[10817] | 60 | 'password', 'suspended', 'suspended_comment', 'matric_number', 'sex') |
---|
[10809] | 61 | form_fields['perm_address'].custom_widget = BytesDisplayWidget |
---|
[10804] | 62 | |
---|
[10809] | 63 | class CustomStudentBaseManageFormPage(NigeriaStudentBaseManageFormPage): |
---|
| 64 | """ View to manage student base data |
---|
| 65 | """ |
---|
| 66 | form_fields = grok.AutoFields(ICustomStudentBase).omit( |
---|
[10817] | 67 | 'student_id', 'adm_code', 'suspended', 'matric_number', 'sex') |
---|
[10809] | 68 | |
---|
| 69 | #class CustomStudentBaseEditFormPage(NigeriaStudentBaseEditFormPage): |
---|
| 70 | # """ View to edit student base data |
---|
| 71 | # """ |
---|
| 72 | # form_fields = grok.AutoFields(ICustomStudentBase).select( |
---|
| 73 | # 'email', 'phone') |
---|
| 74 | |
---|
| 75 | |
---|
[10804] | 76 | class CustomStudyCourseDisplayFormPage(StudyCourseDisplayFormPage): |
---|
| 77 | """ Page to display the student study course data |
---|
| 78 | """ |
---|
| 79 | grok.context(ICustomStudentStudyCourse) |
---|
| 80 | grok.template('studycoursepage') |
---|
| 81 | |
---|
| 82 | form_fields = grok.AutoFields(ICustomStudentStudyCourse).select( |
---|
[10809] | 83 | 'certificate', 'entry_session', 'current_session', |
---|
| 84 | 'service_address') |
---|
| 85 | form_fields['service_address'].custom_widget = BytesDisplayWidget |
---|
[10804] | 86 | |
---|
| 87 | class CustomStudyCourseManageFormPage(StudyCourseManageFormPage): |
---|
| 88 | """ Page to edit the student study course data |
---|
| 89 | """ |
---|
| 90 | grok.context(ICustomStudentStudyCourse) |
---|
| 91 | grok.template('studycoursemanagepage') |
---|
| 92 | |
---|
| 93 | form_fields = grok.AutoFields(ICustomStudentStudyCourse).select( |
---|
[10809] | 94 | 'certificate', 'entry_session', 'current_session', |
---|
[10812] | 95 | 'service_address') |
---|
| 96 | |
---|
| 97 | class CustomExportPDFPaymentSlipPage(ExportPDFPaymentSlipPage): |
---|
| 98 | """Deliver a PDF slip of the context. |
---|
| 99 | """ |
---|
| 100 | omit_fields = ( |
---|
| 101 | 'password', 'suspended', 'phone', 'date_of_birth', |
---|
[10813] | 102 | 'adm_code', 'sex', 'suspended_comment', |
---|
| 103 | 'current_mode', 'matric_number') |
---|