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 |
---|
23 | from zope.formlib.textwidgets import BytesDisplayWidget |
---|
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, ExportPDFCourseRegistrationSlip, |
---|
31 | CourseTicketDisplayFormPage, StudentTriggerTransitionFormPage, |
---|
32 | msave, emit_lock_message, StudyCourseDisplayFormPage, |
---|
33 | StudyCourseManageFormPage, |
---|
34 | ExportPDFPaymentSlip, |
---|
35 | StudentTransferFormPage, |
---|
36 | ) |
---|
37 | from waeup.kofa.students.interfaces import ( |
---|
38 | IStudentsUtils, ICourseTicket, IStudentStudyCourseTransfer) |
---|
39 | from waeup.kofa.students.workflow import FORBIDDEN_POSTGRAD_TRANS |
---|
40 | from kofacustom.nigeria.students.browser import ( |
---|
41 | NigeriaOnlinePaymentDisplayFormPage, |
---|
42 | NigeriaStudentBaseDisplayFormPage, |
---|
43 | NigeriaStudentBaseManageFormPage, |
---|
44 | NigeriaStudentBaseEditFormPage, |
---|
45 | NigeriaStudentClearanceEditFormPage, |
---|
46 | NigeriaOnlinePaymentAddFormPage, |
---|
47 | NigeriaExportPDFPaymentSlip, |
---|
48 | NigeriaExportPDFClearanceSlip, |
---|
49 | ) |
---|
50 | |
---|
51 | from kofacustom.ekodisco.students.interfaces import ( |
---|
52 | ICustomStudentOnlinePayment, ICustomStudentStudyCourse, |
---|
53 | ICustomStudentStudyLevel, ICustomStudentStudyCourse, |
---|
54 | ICustomStudentStudyCourse, ICustomStudentBase) |
---|
55 | from kofacustom.ekodisco.interfaces import MessageFactory as _ |
---|
56 | |
---|
57 | class CustomStudentBaseDisplayFormPage(NigeriaStudentBaseDisplayFormPage): |
---|
58 | """ Page to display student base data |
---|
59 | """ |
---|
60 | form_fields = grok.AutoFields(ICustomStudentBase).omit( |
---|
61 | 'password', 'suspended', 'suspended_comment', 'matric_number', 'sex') |
---|
62 | form_fields['perm_address'].custom_widget = BytesDisplayWidget |
---|
63 | |
---|
64 | class CustomStudentBaseManageFormPage(NigeriaStudentBaseManageFormPage): |
---|
65 | """ View to manage student base data |
---|
66 | """ |
---|
67 | form_fields = grok.AutoFields(ICustomStudentBase).omit( |
---|
68 | 'student_id', 'adm_code', 'suspended', 'matric_number', 'sex') |
---|
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 | |
---|
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( |
---|
84 | 'certificate', 'entry_session', 'current_session', |
---|
85 | 'service_address') |
---|
86 | form_fields['service_address'].custom_widget = BytesDisplayWidget |
---|
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( |
---|
95 | 'certificate', 'entry_session', 'current_session', |
---|
96 | 'service_address') |
---|
97 | |
---|
98 | class CustomExportPDFPaymentSlip(ExportPDFPaymentSlip): |
---|
99 | """Deliver a PDF slip of the context. |
---|
100 | """ |
---|
101 | omit_fields = ( |
---|
102 | 'password', 'suspended', 'phone', 'date_of_birth', |
---|
103 | 'adm_code', 'sex', 'suspended_comment', |
---|
104 | 'current_mode', 'matric_number') |
---|
105 | |
---|
106 | class StudentTransferFormPage(StudentTransferFormPage): |
---|
107 | """Page to transfer the student. |
---|
108 | """ |
---|
109 | form_fields = grok.AutoFields(IStudentStudyCourseTransfer).select( |
---|
110 | 'certificate', 'current_session') |
---|