This commit is contained in:
Timo Stollenwerk 2013-04-18 15:57:01 +02:00
parent b151244138
commit 607719fd42
2 changed files with 104 additions and 75 deletions

View File

@ -47,8 +47,10 @@ class IConversation(IIterableMapping):
) )
public_commentators = schema.Set( public_commentators = schema.Set(
title=_(u"The set of unique commentators (usernames) of" title=_(
" published_comments"), u"The set of unique commentators (usernames) of"
u" published_comments"
),
readonly=True, readonly=True,
) )
@ -130,7 +132,7 @@ class IComment(Interface):
portal_type = schema.ASCIILine( portal_type = schema.ASCIILine(
title=_(u"Portal type"), title=_(u"Portal type"),
default="Discussion Item", default="Discussion Item",
) )
__parent__ = schema.Object( __parent__ = schema.Object(
title=_(u"Conversation"), schema=Interface) title=_(u"Conversation"), schema=Interface)
@ -143,7 +145,7 @@ class IComment(Interface):
in_reply_to = schema.Int( in_reply_to = schema.Int(
title=_(u"Id of comment this comment is in reply to"), title=_(u"Id of comment this comment is in reply to"),
required=False, required=False,
) )
# for logged in comments - set to None for anonymous # for logged in comments - set to None for anonymous
author_username = schema.TextLine(title=_(u"Name"), required=False) author_username = schema.TextLine(title=_(u"Name"), required=False)
@ -156,12 +158,19 @@ class IComment(Interface):
default=u"Subject")) default=u"Subject"))
mime_type = schema.ASCIILine(title=_(u"MIME type"), default="text/plain") mime_type = schema.ASCIILine(title=_(u"MIME type"), default="text/plain")
text = schema.Text(title=_(u"label_comment", text = schema.Text(
default=u"Comment")) title=_(
u"label_comment",
default=u"Comment"
)
)
user_notification = schema.Bool(title=_(u"Notify me of new comments via " user_notification = schema.Bool(
"email."), title=_(
required=False) u"Notify me of new comments via email."
),
required=False
)
creator = schema.TextLine(title=_(u"Username of the commenter")) creator = schema.TextLine(title=_(u"Username of the commenter"))
creation_date = schema.Date(title=_(u"Creation date")) creation_date = schema.Date(title=_(u"Creation date"))
@ -221,119 +230,139 @@ class IDiscussionSettings(Interface):
globally_enabled = schema.Bool( globally_enabled = schema.Bool(
title=_(u"label_globally_enabled", title=_(u"label_globally_enabled",
default=u"Globally enable comments"), default=u"Globally enable comments"),
description=_(u"help_globally_enabled", description=_(
default=u"If selected, users are able to post comments on the " u"help_globally_enabled",
"site. Though, you have to enable comments for " default=u"If selected, users are able to post comments on the "
"specific content types, folders or content objects " u"site. Though, you have to enable comments for "
"before users will be able to post comments."), u"specific content types, folders or content objects "
u"before users will be able to post comments."
),
required=False, required=False,
default=False, default=False,
) )
anonymous_comments = schema.Bool( anonymous_comments = schema.Bool(
title=_(u"label_anonymous_comments", title=_(u"label_anonymous_comments",
default="Enable anonymous comments"), default="Enable anonymous comments"),
description=_(u"help_anonymous_comments", description=_(
default=u"If selected, anonymous users are able to post " u"help_anonymous_comments",
"comments without loggin in. It is highly " default=u"If selected, anonymous users are able to post "
"recommended to use a captcha solution to prevent " u"comments without loggin in. It is highly "
"spam if this setting is enabled."), u"recommended to use a captcha solution to prevent "
u"spam if this setting is enabled."
),
required=False, required=False,
default=False, default=False,
) )
moderation_enabled = schema.Bool( moderation_enabled = schema.Bool(
title=_(u"label_moderation_enabled", title=_(
default="Enable comment moderation"), u"label_moderation_enabled",
description=_(u"help_moderation_enabled", default="Enable comment moderation"
default=u"If selected, comments will enter a 'Pending' state " ),
"in which they are invisible to the public. A user " description=_(
"with the 'Review comments' permission ('Reviewer' " u"help_moderation_enabled",
"or 'Manager') can approve comments to make them " default=u"If selected, comments will enter a 'Pending' state "
"visible to the public. If you want to enable a " u"in which they are invisible to the public. A user "
"custom comment workflow, you have to go to the " u"with the 'Review comments' permission ('Reviewer' "
"types control panel."), u"or 'Manager') can approve comments to make them "
u"visible to the public. If you want to enable a "
u"custom comment workflow, you have to go to the "
u"types control panel."
),
required=False, required=False,
default=False, default=False,
) )
text_transform = schema.Choice( text_transform = schema.Choice(
title=_(u"label_text_transform", title=_(u"label_text_transform",
default="Comment text transform"), default="Comment text transform"),
description=_(u"help_text_transform", description=_(
default=u"Use this setting to choose if the comment text " + u"help_text_transform",
"should be transformed in any way. You can choose " default=u"Use this setting to choose if the comment text " +
"between 'Plain text' and 'Intelligent text'. " + u"should be transformed in any way. You can choose "
"'Intelligent text' converts plain text into HTML " + u"between 'Plain text' and 'Intelligent text'. " +
"where line breaks and indentation is preserved, " + u"'Intelligent text' converts plain text into HTML " +
"and web and email addresses are made into " + u"where line breaks and indentation is preserved, " +
"clickable links."), u"and web and email addresses are made into " +
u"clickable links."),
required=True, required=True,
default='text/plain', default='text/plain',
vocabulary='plone.app.discussion.vocabularies.TextTransformVocabulary', vocabulary='plone.app.discussion.vocabularies.TextTransformVocabulary',
) )
captcha = schema.Choice( captcha = schema.Choice(
title=_(u"label_captcha", title=_(u"label_captcha",
default="Captcha"), default="Captcha"),
description=_(u"help_captcha", description=_(
default=u"Use this setting to enable or disable Captcha " u"help_captcha",
"validation for comments. Install " default=u"Use this setting to enable or disable Captcha "
"plone.formwidget.captcha, " u"validation for comments. Install "
"plone.formwidget.recaptcha, collective.akismet, or " u"plone.formwidget.captcha, "
"collective.z3cform.norobots if there are no options " u"plone.formwidget.recaptcha, collective.akismet, or "
"available."), u"collective.z3cform.norobots if there are no options "
u"available."),
required=True, required=True,
default='disabled', default='disabled',
vocabulary='plone.app.discussion.vocabularies.CaptchaVocabulary', vocabulary='plone.app.discussion.vocabularies.CaptchaVocabulary',
) )
show_commenter_image = schema.Bool( show_commenter_image = schema.Bool(
title=_(u"label_show_commenter_image", title=_(u"label_show_commenter_image",
default=u"Show commenter image"), default=u"Show commenter image"),
description=_(u"help_show_commenter_image", description=_(
default=u"If selected, an image of the user is shown next to " u"help_show_commenter_image",
"the comment."), default=u"If selected, an image of the user is shown next to "
u"the comment."),
required=False, required=False,
default=True, default=True,
) )
moderator_notification_enabled = schema.Bool( moderator_notification_enabled = schema.Bool(
title=_(u"label_moderator_notification_enabled", title=_(u"label_moderator_notification_enabled",
default=u"Enable moderator email notification"), default=u"Enable moderator email notification"),
description=_(u"help_moderator_notification_enabled", description=_(
default=u"If selected, the moderator is notified if a comment " u"help_moderator_notification_enabled",
"needs attention. The moderator email address can " + default=u"If selected, the moderator is notified if a comment "
"be found in the 'Mail settings' control panel " u"needs attention. The moderator email address can " +
"(Site 'From' address)"), u"be found in the 'Mail settings' control panel "
u"(Site 'From' address)"),
required=False, required=False,
default=False, default=False,
) )
moderator_email = schema.ASCIILine( moderator_email = schema.ASCIILine(
title=_(u'label_moderator_email', title=_(
default=u'Moderator Email Address'), u'label_moderator_email',
description=_(u'help_moderator_email', default=u'Moderator Email Address'
default=u"Address to which moderator notifications " ),
u"will be sent."), description=_(
u'help_moderator_email',
default=u"Address to which moderator notifications "
u"will be sent."),
required=False, required=False,
) )
user_notification_enabled = schema.Bool( user_notification_enabled = schema.Bool(
title=_(u"label_user_notification_enabled", title=_(
default=u"Enable user email notification"), u"label_user_notification_enabled",
description=_(u"help_user_notification_enabled", default=u"Enable user email notification"
default=u"If selected, users can choose to be notified " ),
"of new comments by email."), description=_(
u"help_user_notification_enabled",
default=u"If selected, users can choose to be notified "
u"of new comments by email."),
required=False, required=False,
default=False) default=False
)
anonymous_email_enabled = schema.Bool( anonymous_email_enabled = schema.Bool(
title=_(u"label_anonymous_email_enabled", title=_(u"label_anonymous_email_enabled",
default=u"Enable anonymous email field"), default=u"Enable anonymous email field"),
description=_(u"help_anonymous_email_enabled", description=_(
default=u"If selected, anonymous user will have to " u"help_anonymous_email_enabled",
"give their email."), default=u"If selected, anonymous user will have to "
u"give their email."),
required=False, required=False,
default=False) default=False)

View File

@ -20,7 +20,7 @@ def patchedClearFindAndRebuild(self):
def indexObject(obj, path): def indexObject(obj, path):
if (base_hasattr(obj, 'indexObject') and if (base_hasattr(obj, 'indexObject') and
safe_callable(obj.indexObject)): safe_callable(obj.indexObject)):
try: try:
obj.indexObject() obj.indexObject()