Redirect back to the discussion control panel when the discussion control panel form is submitted.

svn path=/plone.app.discussion/trunk/; revision=46040
This commit is contained in:
Timo Stollenwerk 2010-11-30 09:06:46 +00:00
parent 65f1ba8230
commit 13772c6e5b
2 changed files with 25 additions and 0 deletions

View File

@ -4,6 +4,10 @@ Changelog
1.0RC1 (unreleased) 1.0RC1 (unreleased)
------------------- -------------------
- Redirect back to the discussion control panel when the discussion control
panel form is submitted.
[timo]
- Fix document_byline bottom margin if commenter images are disabled. - Fix document_byline bottom margin if commenter images are disabled.
[timo] [timo]

View File

@ -1,9 +1,12 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from Products.statusmessages.interfaces import IStatusMessage
from plone.app.registry.browser import controlpanel from plone.app.registry.browser import controlpanel
from plone.app.discussion.interfaces import IDiscussionSettings, _ from plone.app.discussion.interfaces import IDiscussionSettings, _
from z3c.form import button
from z3c.form.browser.checkbox import SingleCheckBoxFieldWidget from z3c.form.browser.checkbox import SingleCheckBoxFieldWidget
@ -45,6 +48,24 @@ class DiscussionSettingsEditForm(controlpanel.RegistryEditForm):
self.widgets['user_notification_enabled'].label = \ self.widgets['user_notification_enabled'].label = \
_(u"User Email Notification") _(u"User Email Notification")
@button.buttonAndHandler(_('Save'), name='save')
def handleSave(self, action):
data, errors = self.extractData()
if errors:
self.status = self.formErrorsMessage
return
changes = self.applyChanges(data)
IStatusMessage(self.request).addStatusMessage(_(u"Changes saved"),
"info")
self.context.REQUEST.RESPONSE.redirect("@@discussion-settings")
@button.buttonAndHandler(_('Cancel'), name='cancel')
def handleCancel(self, action):
IStatusMessage(self.request).addStatusMessage(_(u"Edit cancelled"),
"info")
self.request.response.redirect("%s/%s" % (self.context.absolute_url(),
self.control_panel_view))
class DiscussionSettingsControlPanel(controlpanel.ControlPanelFormWrapper): class DiscussionSettingsControlPanel(controlpanel.ControlPanelFormWrapper):
form = DiscussionSettingsEditForm form = DiscussionSettingsEditForm