1 | ## $Id: browser.py 7890 2012-03-16 06:26:17Z 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.formlib.textwidgets import BytesDisplayWidget |
---|
20 | from waeup.kofa.widgets.datewidget import ( |
---|
21 | FriendlyDateWidget, FriendlyDateDisplayWidget |
---|
22 | ) |
---|
23 | from waeup.kofa.students.browser import ( |
---|
24 | StudentPersonalDisplayFormPage, StudentPersonalManageFormPage, |
---|
25 | StudentClearanceManageFormPage, StudentClearanceEditFormPage, |
---|
26 | StudentClearanceDisplayFormPage) |
---|
27 | from waeup.kofa.students.viewlets import RequestCallbackActionButton |
---|
28 | from waeup.custom.students.interfaces import ( |
---|
29 | IStudent, IStudentPersonal, IStudentClearance, IStudentClearanceEdit, |
---|
30 | ) |
---|
31 | from waeup.custom.interfaces import MessageFactory as _ |
---|
32 | |
---|
33 | class StudentPersonalDisplayFormPage(StudentPersonalDisplayFormPage): |
---|
34 | """ Page to display student personal data |
---|
35 | """ |
---|
36 | grok.context(IStudent) |
---|
37 | form_fields = grok.AutoFields(IStudentPersonal) |
---|
38 | form_fields['perm_address'].custom_widget = BytesDisplayWidget |
---|
39 | |
---|
40 | class StudentPersonalManageFormPage(StudentPersonalManageFormPage): |
---|
41 | """ Page to edit student clearance data |
---|
42 | """ |
---|
43 | grok.context(IStudent) |
---|
44 | form_fields = grok.AutoFields(IStudentPersonal) |
---|
45 | |
---|
46 | class StudentClearanceDisplayFormPage(StudentClearanceDisplayFormPage): |
---|
47 | """ Page to display student clearance data |
---|
48 | """ |
---|
49 | grok.context(IStudent) |
---|
50 | form_fields = grok.AutoFields(IStudentClearance).omit('clearance_locked') |
---|
51 | form_fields['date_of_birth'].custom_widget = FriendlyDateDisplayWidget('le') |
---|
52 | |
---|
53 | class StudentClearanceManageFormPage(StudentClearanceManageFormPage): |
---|
54 | """ Page to edit student clearance data |
---|
55 | """ |
---|
56 | grok.context(IStudent) |
---|
57 | form_fields = grok.AutoFields(IStudentClearance) |
---|
58 | form_fields['date_of_birth'].custom_widget = FriendlyDateWidget('le-year') |
---|
59 | |
---|
60 | class StudentClearanceEditFormPage(StudentClearanceEditFormPage): |
---|
61 | """ View to edit student clearance data by student |
---|
62 | """ |
---|
63 | grok.context(IStudent) |
---|
64 | form_fields = grok.AutoFields( |
---|
65 | IStudentClearanceEdit).omit('clearance_locked') |
---|
66 | form_fields['date_of_birth'].custom_widget = FriendlyDateWidget('le-year') |
---|
67 | |
---|
68 | class RequestCallbackActionButton(RequestCallbackActionButton): |
---|
69 | """ Do not display the base package callback button in custom pages. |
---|
70 | """ |
---|
71 | |
---|
72 | @property |
---|
73 | def target_url(self): |
---|
74 | return '' |
---|