1 | ## $Id: browser.py 7822 2012-03-09 07:26:31Z 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.custom.students.interfaces import ( |
---|
24 | IStudent, IStudentPersonal, IStudentClearance, IStudentClearanceEdit |
---|
25 | ) |
---|
26 | from waeup.kofa.students.browser import ( |
---|
27 | StudentPersonalDisplayFormPage, StudentPersonalManageFormPage, |
---|
28 | StudentClearanceManageFormPage, StudentClearanceEditFormPage, |
---|
29 | StudentClearanceDisplayFormPage |
---|
30 | ) |
---|
31 | |
---|
32 | class StudentPersonalDisplayFormPage(StudentPersonalDisplayFormPage): |
---|
33 | """ Page to display student personal data |
---|
34 | """ |
---|
35 | grok.context(IStudent) |
---|
36 | form_fields = grok.AutoFields(IStudentPersonal) |
---|
37 | form_fields['perm_address'].custom_widget = BytesDisplayWidget |
---|
38 | |
---|
39 | class StudentPersonalManageFormPage(StudentPersonalManageFormPage): |
---|
40 | """ Page to edit student clearance data |
---|
41 | """ |
---|
42 | grok.context(IStudent) |
---|
43 | form_fields = grok.AutoFields(IStudentPersonal) |
---|
44 | |
---|
45 | class StudentClearanceDisplayFormPage(StudentClearanceDisplayFormPage): |
---|
46 | """ Page to display student clearance data |
---|
47 | """ |
---|
48 | grok.context(IStudent) |
---|
49 | form_fields = grok.AutoFields(IStudentClearance).omit('clearance_locked') |
---|
50 | form_fields['date_of_birth'].custom_widget = FriendlyDateDisplayWidget('le') |
---|
51 | |
---|
52 | class StudentClearanceManageFormPage(StudentClearanceManageFormPage): |
---|
53 | """ Page to edit student clearance data |
---|
54 | """ |
---|
55 | grok.context(IStudent) |
---|
56 | form_fields = grok.AutoFields(IStudentClearance) |
---|
57 | form_fields['date_of_birth'].custom_widget = FriendlyDateWidget('le-year') |
---|
58 | |
---|
59 | class StudentClearanceEditFormPage(StudentClearanceEditFormPage): |
---|
60 | """ View to edit student clearance data by student |
---|
61 | """ |
---|
62 | grok.context(IStudent) |
---|
63 | form_fields = grok.AutoFields( |
---|
64 | IStudentClearanceEdit).omit('clearance_locked') |
---|
65 | form_fields['date_of_birth'].custom_widget = FriendlyDateWidget('le-year') |
---|
66 | |
---|
67 | |
---|