## $Id: browser.py 10822 2013-11-30 12:20:04Z henrik $ ## ## Copyright (C) 2012 Uli Fouquet & Henrik Bettermann ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2 of the License, or ## (at your option) any later version. ## ## This program is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with this program; if not, write to the Free Software ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## import grok from zope.i18n import translate from zope.schema.interfaces import ConstraintNotSatisfied from zope.component import getUtility from hurry.workflow.interfaces import IWorkflowInfo from zope.formlib.textwidgets import BytesDisplayWidget from waeup.kofa.interfaces import REQUESTED, IExtFileStore, IKofaUtils from waeup.kofa.widgets.datewidget import FriendlyDatetimeDisplayWidget from waeup.kofa.browser.layout import KofaEditFormPage from waeup.kofa.browser.layout import action, jsaction from waeup.kofa.students.browser import ( StudyLevelEditFormPage, StudyLevelDisplayFormPage, StudentBasePDFFormPage, ExportPDFCourseRegistrationSlipPage, CourseTicketDisplayFormPage, StudentTriggerTransitionFormPage, msave, emit_lock_message, StudyCourseDisplayFormPage, StudyCourseManageFormPage, ExportPDFPaymentSlipPage, StudentTransferFormPage, ) from waeup.kofa.students.interfaces import ( IStudentsUtils, ICourseTicket, IStudentStudyCourseTransfer) from waeup.kofa.students.workflow import FORBIDDEN_POSTGRAD_TRANS from kofacustom.nigeria.students.browser import ( NigeriaOnlinePaymentDisplayFormPage, NigeriaStudentBaseDisplayFormPage, NigeriaStudentBaseManageFormPage, NigeriaStudentBaseEditFormPage, NigeriaStudentClearanceEditFormPage, NigeriaOnlinePaymentAddFormPage, NigeriaExportPDFPaymentSlipPage, NigeriaExportPDFClearanceSlipPage, ) from kofacustom.ekodisco.students.interfaces import ( ICustomStudentOnlinePayment, ICustomStudentStudyCourse, ICustomStudentStudyLevel, ICustomStudentStudyCourse, ICustomStudentStudyCourse, ICustomStudentBase) from kofacustom.ekodisco.interfaces import MessageFactory as _ class CustomStudentBaseDisplayFormPage(NigeriaStudentBaseDisplayFormPage): """ Page to display student base data """ form_fields = grok.AutoFields(ICustomStudentBase).omit( 'password', 'suspended', 'suspended_comment', 'matric_number', 'sex') form_fields['perm_address'].custom_widget = BytesDisplayWidget class CustomStudentBaseManageFormPage(NigeriaStudentBaseManageFormPage): """ View to manage student base data """ form_fields = grok.AutoFields(ICustomStudentBase).omit( 'student_id', 'adm_code', 'suspended', 'matric_number', 'sex') #class CustomStudentBaseEditFormPage(NigeriaStudentBaseEditFormPage): # """ View to edit student base data # """ # form_fields = grok.AutoFields(ICustomStudentBase).select( # 'email', 'phone') class CustomStudyCourseDisplayFormPage(StudyCourseDisplayFormPage): """ Page to display the student study course data """ grok.context(ICustomStudentStudyCourse) grok.template('studycoursepage') form_fields = grok.AutoFields(ICustomStudentStudyCourse).select( 'certificate', 'entry_session', 'current_session', 'service_address') form_fields['service_address'].custom_widget = BytesDisplayWidget class CustomStudyCourseManageFormPage(StudyCourseManageFormPage): """ Page to edit the student study course data """ grok.context(ICustomStudentStudyCourse) grok.template('studycoursemanagepage') form_fields = grok.AutoFields(ICustomStudentStudyCourse).select( 'certificate', 'entry_session', 'current_session', 'service_address') class CustomExportPDFPaymentSlipPage(ExportPDFPaymentSlipPage): """Deliver a PDF slip of the context. """ omit_fields = ( 'password', 'suspended', 'phone', 'date_of_birth', 'adm_code', 'sex', 'suspended_comment', 'current_mode', 'matric_number') class StudentTransferFormPage(StudentTransferFormPage): """Page to transfer the student. """ form_fields = grok.AutoFields(IStudentStudyCourseTransfer).select( 'certificate', 'current_session')