From 6999e6f8d0d116d6807e9745dd8e21a0601e13f6 Mon Sep 17 00:00:00 2001 From: Timo Stollenwerk Date: Thu, 19 Nov 2009 21:40:08 +0000 Subject: [PATCH] Replace yes/no widgets with single checkboxes. svn path=/plone.app.discussion/trunk/; revision=31923 --- plone/app/discussion/browser/controlpanel.py | 17 +++++++++-------- plone/app/discussion/interfaces.py | 16 ++++++++-------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/plone/app/discussion/browser/controlpanel.py b/plone/app/discussion/browser/controlpanel.py index e71619e..708f30d 100644 --- a/plone/app/discussion/browser/controlpanel.py +++ b/plone/app/discussion/browser/controlpanel.py @@ -7,13 +7,8 @@ from plone.app.registry.browser import controlpanel from plone.app.discussion.interfaces import IDiscussionSettings, _ -try: - # only in z3c.form 2.0 - from z3c.form.browser.textlines import TextLinesFieldWidget - from z3c.form.browser.widget import SingleCheckBoxWidget -except ImportError: - from plone.z3cform.textlines import TextLinesFieldWidget - from plone.z3cform.widget import SingleCheckBoxWidget +from z3c.form.browser.checkbox import SingleCheckBoxFieldWidget + class DiscussionSettingsEditForm(controlpanel.RegistryEditForm): @@ -33,10 +28,16 @@ class DiscussionSettingsEditForm(controlpanel.RegistryEditForm): def updateFields(self): super(DiscussionSettingsEditForm, self).updateFields() - #self.fields['globally_enabled'].widgetFactory = SingleCheckBoxWidget + self.fields['globally_enabled'].widgetFactory = SingleCheckBoxFieldWidget + self.fields['anonymous_comments'].widgetFactory = SingleCheckBoxFieldWidget + self.fields['show_commenter_image'].widgetFactory = SingleCheckBoxFieldWidget def updateWidgets(self): super(DiscussionSettingsEditForm, self).updateWidgets() + self.widgets['globally_enabled'].label = u"" + self.widgets['anonymous_comments'].label = u"" + self.widgets['show_commenter_image'].label = u"" + class DiscussionSettingsControlPanel(controlpanel.ControlPanelFormWrapper): form = DiscussionSettingsEditForm diff --git a/plone/app/discussion/interfaces.py b/plone/app/discussion/interfaces.py index 0c90fcb..772ad6c 100644 --- a/plone/app/discussion/interfaces.py +++ b/plone/app/discussion/interfaces.py @@ -17,13 +17,13 @@ class IDiscussionSettings(Interface): # - Types control panel: Allow comments on content types # - Search control panel: Show comments in search results - globally_enabled = schema.Bool(title=_(u"Globally enabled"), - description=_(u"Use this setting to enable or disable comments globally."), - default=True) + globally_enabled = schema.Bool(title=_(u"Globally enable comments"), + default=True, + required=False) - anonymous_comments = schema.Bool(title=_(u"Anonymous comments"), - description=_(u"Use this setting to enable or disable posting comments as anonymous visitor."), - default=False) + anonymous_comments = schema.Bool(title=_(u"Enable anonymous comments"), + default=False, + required=False) captcha = schema.Choice(title=_(u"Captcha"), description=_(u"""Use this setting to enable or disable captcha validation for comments. @@ -34,8 +34,8 @@ class IDiscussionSettings(Interface): vocabulary='plone.app.discussion.vocabularies.CaptchaVocabulary',) show_commenter_image = schema.Bool(title=_(u"Show commenter image"), - description=_(u"Use this setting to enable or disable showing the commenter's image next to his/her comments."), - default=True) + default=True, + required=False) class IConversation(IIterableMapping): """A conversation about a content object.