source: main/waeup.custom/trunk/src/waeup/custom/students/browser.py @ 7890

Last change on this file since 7890 was 7890, checked in by Henrik Bettermann, 13 years ago

Setup module for Interswitch components.

Do not display the base package callback button in custom pages.

  • Property svn:keywords set to Id
File size: 2.9 KB
Line 
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##
18import grok
19from zope.formlib.textwidgets import BytesDisplayWidget
20from waeup.kofa.widgets.datewidget import (
21    FriendlyDateWidget, FriendlyDateDisplayWidget
22    )
23from waeup.kofa.students.browser import (
24    StudentPersonalDisplayFormPage, StudentPersonalManageFormPage,
25    StudentClearanceManageFormPage, StudentClearanceEditFormPage,
26    StudentClearanceDisplayFormPage)
27from waeup.kofa.students.viewlets import RequestCallbackActionButton
28from waeup.custom.students.interfaces import (
29    IStudent, IStudentPersonal, IStudentClearance, IStudentClearanceEdit,
30    )
31from waeup.custom.interfaces import MessageFactory as _
32
33class 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
40class StudentPersonalManageFormPage(StudentPersonalManageFormPage):
41    """ Page to edit student clearance data
42    """
43    grok.context(IStudent)
44    form_fields = grok.AutoFields(IStudentPersonal)
45
46class 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
53class 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
60class 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
68class 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 ''
Note: See TracBrowser for help on using the repository browser.