1 | ## $Id: browser.py 10809 2013-11-29 06:45:29Z 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 | from waeup.kofa.students.interfaces import ( |
---|
35 | IStudentsUtils, ICourseTicket) |
---|
36 | from waeup.kofa.students.workflow import FORBIDDEN_POSTGRAD_TRANS |
---|
37 | from kofacustom.nigeria.students.browser import ( |
---|
38 | NigeriaOnlinePaymentDisplayFormPage, |
---|
39 | NigeriaStudentBaseDisplayFormPage, |
---|
40 | NigeriaStudentBaseManageFormPage, |
---|
41 | NigeriaStudentBaseEditFormPage, |
---|
42 | NigeriaStudentClearanceEditFormPage, |
---|
43 | NigeriaOnlinePaymentAddFormPage, |
---|
44 | NigeriaExportPDFPaymentSlipPage, |
---|
45 | NigeriaExportPDFClearanceSlipPage, |
---|
46 | ) |
---|
47 | |
---|
48 | from kofacustom.ekodisco.students.interfaces import ( |
---|
49 | ICustomStudentOnlinePayment, ICustomStudentStudyCourse, |
---|
50 | ICustomStudentStudyLevel, ICustomStudentStudyCourse, |
---|
51 | ICustomStudentStudyCourse, ICustomStudentBase) |
---|
52 | from kofacustom.ekodisco.interfaces import MessageFactory as _ |
---|
53 | |
---|
54 | class CustomStudentBaseDisplayFormPage(NigeriaStudentBaseDisplayFormPage): |
---|
55 | """ Page to display student base data |
---|
56 | """ |
---|
57 | form_fields = grok.AutoFields(ICustomStudentBase).omit( |
---|
58 | 'password', 'suspended', 'suspended_comment') |
---|
59 | form_fields['perm_address'].custom_widget = BytesDisplayWidget |
---|
60 | |
---|
61 | class CustomStudentBaseManageFormPage(NigeriaStudentBaseManageFormPage): |
---|
62 | """ View to manage student base data |
---|
63 | """ |
---|
64 | form_fields = grok.AutoFields(ICustomStudentBase).omit( |
---|
65 | 'student_id', 'adm_code', 'suspended') |
---|
66 | |
---|
67 | #class CustomStudentBaseEditFormPage(NigeriaStudentBaseEditFormPage): |
---|
68 | # """ View to edit student base data |
---|
69 | # """ |
---|
70 | # form_fields = grok.AutoFields(ICustomStudentBase).select( |
---|
71 | # 'email', 'phone') |
---|
72 | |
---|
73 | |
---|
74 | |
---|
75 | |
---|
76 | |
---|
77 | |
---|
78 | class CustomStudyCourseDisplayFormPage(StudyCourseDisplayFormPage): |
---|
79 | """ Page to display the student study course data |
---|
80 | """ |
---|
81 | grok.context(ICustomStudentStudyCourse) |
---|
82 | grok.template('studycoursepage') |
---|
83 | |
---|
84 | form_fields = grok.AutoFields(ICustomStudentStudyCourse).select( |
---|
85 | 'certificate', 'entry_session', 'current_session', |
---|
86 | 'service_address') |
---|
87 | form_fields['service_address'].custom_widget = BytesDisplayWidget |
---|
88 | |
---|
89 | class CustomStudyCourseManageFormPage(StudyCourseManageFormPage): |
---|
90 | """ Page to edit the student study course data |
---|
91 | """ |
---|
92 | grok.context(ICustomStudentStudyCourse) |
---|
93 | grok.template('studycoursemanagepage') |
---|
94 | |
---|
95 | form_fields = grok.AutoFields(ICustomStudentStudyCourse).select( |
---|
96 | 'certificate', 'entry_session', 'current_session', |
---|
97 | 'service_address') |
---|