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 |
---|
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, ExportPDFCourseRegistrationSlipPage, |
---|
31 | CourseTicketDisplayFormPage, StudentTriggerTransitionFormPage, |
---|
32 | msave, emit_lock_message, StudyCourseDisplayFormPage, |
---|
33 | StudyCourseManageFormPage, |
---|
34 | ExportPDFPaymentSlipPage, |
---|
35 | ) |
---|
36 | from waeup.kofa.students.interfaces import ( |
---|
37 | IStudentsUtils, ICourseTicket) |
---|
38 | from waeup.kofa.students.workflow import FORBIDDEN_POSTGRAD_TRANS |
---|
39 | from kofacustom.nigeria.students.browser import ( |
---|
40 | NigeriaOnlinePaymentDisplayFormPage, |
---|
41 | NigeriaStudentBaseDisplayFormPage, |
---|
42 | NigeriaStudentBaseManageFormPage, |
---|
43 | NigeriaStudentBaseEditFormPage, |
---|
44 | NigeriaStudentClearanceEditFormPage, |
---|
45 | NigeriaOnlinePaymentAddFormPage, |
---|
46 | NigeriaExportPDFPaymentSlipPage, |
---|
47 | NigeriaExportPDFClearanceSlipPage, |
---|
48 | ) |
---|
49 | |
---|
50 | from kofacustom.ekodisco.students.interfaces import ( |
---|
51 | ICustomStudentOnlinePayment, ICustomStudentStudyCourse, |
---|
52 | ICustomStudentStudyLevel, ICustomStudentStudyCourse, |
---|
53 | ICustomStudentStudyCourse, ICustomStudentBase) |
---|
54 | from kofacustom.ekodisco.interfaces import MessageFactory as _ |
---|
55 | |
---|
56 | class CustomStudentBaseDisplayFormPage(NigeriaStudentBaseDisplayFormPage): |
---|
57 | """ Page to display student base data |
---|
58 | """ |
---|
59 | form_fields = grok.AutoFields(ICustomStudentBase).omit( |
---|
60 | 'password', 'suspended', 'suspended_comment', 'matric_number', 'sex') |
---|
61 | form_fields['perm_address'].custom_widget = BytesDisplayWidget |
---|
62 | |
---|
63 | class CustomStudentBaseManageFormPage(NigeriaStudentBaseManageFormPage): |
---|
64 | """ View to manage student base data |
---|
65 | """ |
---|
66 | form_fields = grok.AutoFields(ICustomStudentBase).omit( |
---|
67 | 'student_id', 'adm_code', 'suspended', 'matric_number', 'sex') |
---|
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 | |
---|
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( |
---|
83 | 'certificate', 'entry_session', 'current_session', |
---|
84 | 'service_address') |
---|
85 | form_fields['service_address'].custom_widget = BytesDisplayWidget |
---|
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( |
---|
94 | 'certificate', 'entry_session', 'current_session', |
---|
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', |
---|
102 | 'adm_code', 'sex', 'suspended_comment', |
---|
103 | 'current_mode', 'matric_number') |
---|