Replace yes/no widgets with single checkboxes.

svn path=/plone.app.discussion/trunk/; revision=31923
This commit is contained in:
Timo Stollenwerk 2009-11-19 21:40:08 +00:00
parent ae2767daec
commit 6999e6f8d0
2 changed files with 17 additions and 16 deletions

View File

@ -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

View File

@ -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.