[10770] | 1 | ## $Id: browser.py 13064 2015-06-16 14:11:20Z 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, |
---|
[13064] | 30 | StudentBasePDFFormPage, ExportPDFCourseRegistrationSlip, |
---|
[10770] | 31 | CourseTicketDisplayFormPage, StudentTriggerTransitionFormPage, |
---|
[10804] | 32 | msave, emit_lock_message, StudyCourseDisplayFormPage, |
---|
[10812] | 33 | StudyCourseManageFormPage, |
---|
[13064] | 34 | ExportPDFPaymentSlip, |
---|
[10822] | 35 | StudentTransferFormPage, |
---|
[10812] | 36 | ) |
---|
[10804] | 37 | from waeup.kofa.students.interfaces import ( |
---|
[10822] | 38 | IStudentsUtils, ICourseTicket, IStudentStudyCourseTransfer) |
---|
[10770] | 39 | from waeup.kofa.students.workflow import FORBIDDEN_POSTGRAD_TRANS |
---|
| 40 | from kofacustom.nigeria.students.browser import ( |
---|
| 41 | NigeriaOnlinePaymentDisplayFormPage, |
---|
[10809] | 42 | NigeriaStudentBaseDisplayFormPage, |
---|
[10770] | 43 | NigeriaStudentBaseManageFormPage, |
---|
[10809] | 44 | NigeriaStudentBaseEditFormPage, |
---|
[10770] | 45 | NigeriaStudentClearanceEditFormPage, |
---|
| 46 | NigeriaOnlinePaymentAddFormPage, |
---|
[13064] | 47 | NigeriaExportPDFPaymentSlip, |
---|
| 48 | NigeriaExportPDFClearanceSlip, |
---|
[10770] | 49 | ) |
---|
| 50 | |
---|
| 51 | from kofacustom.ekodisco.students.interfaces import ( |
---|
| 52 | ICustomStudentOnlinePayment, ICustomStudentStudyCourse, |
---|
[10804] | 53 | ICustomStudentStudyLevel, ICustomStudentStudyCourse, |
---|
[10809] | 54 | ICustomStudentStudyCourse, ICustomStudentBase) |
---|
[10770] | 55 | from kofacustom.ekodisco.interfaces import MessageFactory as _ |
---|
| 56 | |
---|
[10809] | 57 | class CustomStudentBaseDisplayFormPage(NigeriaStudentBaseDisplayFormPage): |
---|
| 58 | """ Page to display student base data |
---|
| 59 | """ |
---|
| 60 | form_fields = grok.AutoFields(ICustomStudentBase).omit( |
---|
[10817] | 61 | 'password', 'suspended', 'suspended_comment', 'matric_number', 'sex') |
---|
[10809] | 62 | form_fields['perm_address'].custom_widget = BytesDisplayWidget |
---|
[10804] | 63 | |
---|
[10809] | 64 | class CustomStudentBaseManageFormPage(NigeriaStudentBaseManageFormPage): |
---|
| 65 | """ View to manage student base data |
---|
| 66 | """ |
---|
| 67 | form_fields = grok.AutoFields(ICustomStudentBase).omit( |
---|
[10817] | 68 | 'student_id', 'adm_code', 'suspended', 'matric_number', 'sex') |
---|
[10809] | 69 | |
---|
| 70 | #class CustomStudentBaseEditFormPage(NigeriaStudentBaseEditFormPage): |
---|
| 71 | # """ View to edit student base data |
---|
| 72 | # """ |
---|
| 73 | # form_fields = grok.AutoFields(ICustomStudentBase).select( |
---|
| 74 | # 'email', 'phone') |
---|
| 75 | |
---|
| 76 | |
---|
[10804] | 77 | class CustomStudyCourseDisplayFormPage(StudyCourseDisplayFormPage): |
---|
| 78 | """ Page to display the student study course data |
---|
| 79 | """ |
---|
| 80 | grok.context(ICustomStudentStudyCourse) |
---|
| 81 | grok.template('studycoursepage') |
---|
| 82 | |
---|
| 83 | form_fields = grok.AutoFields(ICustomStudentStudyCourse).select( |
---|
[10809] | 84 | 'certificate', 'entry_session', 'current_session', |
---|
| 85 | 'service_address') |
---|
| 86 | form_fields['service_address'].custom_widget = BytesDisplayWidget |
---|
[10804] | 87 | |
---|
| 88 | class CustomStudyCourseManageFormPage(StudyCourseManageFormPage): |
---|
| 89 | """ Page to edit the student study course data |
---|
| 90 | """ |
---|
| 91 | grok.context(ICustomStudentStudyCourse) |
---|
| 92 | grok.template('studycoursemanagepage') |
---|
| 93 | |
---|
| 94 | form_fields = grok.AutoFields(ICustomStudentStudyCourse).select( |
---|
[10809] | 95 | 'certificate', 'entry_session', 'current_session', |
---|
[10812] | 96 | 'service_address') |
---|
| 97 | |
---|
[13064] | 98 | class CustomExportPDFPaymentSlip(ExportPDFPaymentSlip): |
---|
[10812] | 99 | """Deliver a PDF slip of the context. |
---|
| 100 | """ |
---|
| 101 | omit_fields = ( |
---|
| 102 | 'password', 'suspended', 'phone', 'date_of_birth', |
---|
[10813] | 103 | 'adm_code', 'sex', 'suspended_comment', |
---|
| 104 | 'current_mode', 'matric_number') |
---|
[10822] | 105 | |
---|
| 106 | class StudentTransferFormPage(StudentTransferFormPage): |
---|
| 107 | """Page to transfer the student. |
---|
| 108 | """ |
---|
| 109 | form_fields = grok.AutoFields(IStudentStudyCourseTransfer).select( |
---|
| 110 | 'certificate', 'current_session') |
---|