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, _ from plone.app.discussion.interfaces import IDiscussionSettings, _
try: from z3c.form.browser.checkbox import SingleCheckBoxFieldWidget
# 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
class DiscussionSettingsEditForm(controlpanel.RegistryEditForm): class DiscussionSettingsEditForm(controlpanel.RegistryEditForm):
@ -33,10 +28,16 @@ class DiscussionSettingsEditForm(controlpanel.RegistryEditForm):
def updateFields(self): def updateFields(self):
super(DiscussionSettingsEditForm, self).updateFields() 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): def updateWidgets(self):
super(DiscussionSettingsEditForm, self).updateWidgets() 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): class DiscussionSettingsControlPanel(controlpanel.ControlPanelFormWrapper):
form = DiscussionSettingsEditForm form = DiscussionSettingsEditForm

View File

@ -17,13 +17,13 @@ class IDiscussionSettings(Interface):
# - Types control panel: Allow comments on content types # - Types control panel: Allow comments on content types
# - Search control panel: Show comments in search results # - Search control panel: Show comments in search results
globally_enabled = schema.Bool(title=_(u"Globally enabled"), globally_enabled = schema.Bool(title=_(u"Globally enable comments"),
description=_(u"Use this setting to enable or disable comments globally."), default=True,
default=True) required=False)
anonymous_comments = schema.Bool(title=_(u"Anonymous comments"), anonymous_comments = schema.Bool(title=_(u"Enable anonymous comments"),
description=_(u"Use this setting to enable or disable posting comments as anonymous visitor."), default=False,
default=False) required=False)
captcha = schema.Choice(title=_(u"Captcha"), captcha = schema.Choice(title=_(u"Captcha"),
description=_(u"""Use this setting to enable or disable captcha validation for comments. 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',) vocabulary='plone.app.discussion.vocabularies.CaptchaVocabulary',)
show_commenter_image = schema.Bool(title=_(u"Show commenter image"), 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): class IConversation(IIterableMapping):
"""A conversation about a content object. """A conversation about a content object.