Obey the 80 chars limit.

svn path=/plone.app.discussion/trunk/; revision=39272
This commit is contained in:
Timo Stollenwerk 2010-08-28 16:11:58 +00:00
parent 5f5b831904
commit 0f9c98ec97

View File

@ -1,3 +1,7 @@
# -*- coding: utf-8 -*-
"""Interfaces for plone.app.discussion
"""
from zope.interface import Interface from zope.interface import Interface
from zope.interface.common.mapping import IIterableMapping from zope.interface.common.mapping import IIterableMapping
from zope import schema from zope import schema
@ -17,78 +21,73 @@ class IDiscussionSettings(Interface):
# - Search control panel: Show comments in search results # - Search control panel: Show comments in search results
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=_(u"help_globally_enabled",
default=u"If selected, users are able " default=u"If selected, users are able to post comments on the "
"to post comments on the site" "site. Though, you have to enable comments for "
". Though, you have to " "specific content types, folders or content objects"
"enable comments for " "before users will be able to post comments."),
"specific content types, " required=False,
"folders or content objects" default=True,
"before users will be able " )
"to post comments."),
required=False,
default=True)
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=_(u"help_anonymous_comments",
default=u"If selected, anonymous " default=u"If selected, anonymous users are able to post "
"users are able to post " "comments without loggin in. It is highly "
"comments without loggin " "recommended to use a captcha solution to prevent "
"in. It is highly " "spam if this setting is enabled."),
"recommended to use a " required=False,
"captcha solution to " default=False,
"prevent spam if this " )
"setting is enabled."),
required=False,
default=False)
text_transform = schema.Choice( text_transform = schema.Choice(
title=_(u"label_text_transform", default="Comment text transform"), title=_(u"label_text_transform",
description=_(u"help_text_transform", default="Comment text transform"),
default=u""), description=_(u"help_text_transform",
required=True, default=u""),
default='text/plain', required=True,
vocabulary='plone.app.discussion.vocabularies.TextTransformVocabulary',) default='text/plain',
vocabulary='plone.app.discussion.vocabularies.TextTransformVocabulary',
)
captcha = schema.Choice( captcha = schema.Choice(
title=_(u"label_captcha", default="Captcha"), title=_(u"label_captcha",
description=_(u"help_captcha", default="Captcha"),
default=u"Use this setting to enable or " description=_(u"help_captcha",
"disable Captcha validation for " default=u"Use this setting to enable or disable Captcha "
"comments. Install " "validation for comments. Install "
"plone.formwidget.captcha or " "plone.formwidget.captcha or "
"plone.formwidget.recaptcha if there " "plone.formwidget.recaptcha if there are no options "
"are no options available."), "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=_(u"help_show_commenter_image",
default=u"If selected, an image " default=u"If selected, an image "
"of the user is shown " "of the user is shown "
"next to the comment."), "next to 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=_(u"help_moderator_notification_enabled",
default=u"If selected, " default=u"If selected, the moderator is notified if a comment "
"the moderator " "needs attention."),
"is notified " required=False,
"if a comment " default=False,
"needs " )
"attention."),
required=False,
default=False)
#user_notification_enabled = schema.Bool( #user_notification_enabled = schema.Bool(
# title=_(u"label_user_notification_enabled", # title=_(u"label_user_notification_enabled",
@ -123,9 +122,21 @@ class IConversation(IIterableMapping):
(and acquisition parent) for all comments, regardless of threading. (and acquisition parent) for all comments, regardless of threading.
""" """
total_comments = schema.Int(title=_(u"Total number of comments on this item"), min=0, readonly=True) total_comments = schema.Int(
last_comment_date = schema.Date(title=_(u"Date of the most recent comment"), readonly=True) title=_(u"Total number of comments on this item"),
commentators = schema.Set(title=_(u"The set of unique commentators (usernames)"), readonly=True) min=0,
readonly=True,
)
last_comment_date = schema.Date(
title=_(u"Date of the most recent comment"),
readonly=True,
)
commentators = schema.Set(
title=_(u"The set of unique commentators (usernames)"),
readonly=True,
)
def enabled(): def enabled():
""" Returns True if discussion is enabled for this conversation. """ Returns True if discussion is enabled for this conversation.
@ -227,14 +238,23 @@ class IComment(Interface):
Comments are indexed in the catalog and subject to workflow and security. Comments are indexed in the catalog and subject to workflow and security.
""" """
portal_type = schema.ASCIILine(title=_(u"Portal type"), portal_type = schema.ASCIILine(
default="Discussion Item") title=_(u"Portal type"),
default="Discussion Item",
)
__parent__ = schema.Object(
title=_(u"Conversation"), schema=Interface)
__parent__ = schema.Object(title=_(u"Conversation"), schema=Interface)
__name__ = schema.TextLine(title=_(u"Name")) __name__ = schema.TextLine(title=_(u"Name"))
comment_id = schema.Int(title=_(u"A comment id unique to this conversation")) comment_id = schema.Int(
in_reply_to = schema.Int(title=_(u"Id of comment this comment is in reply to"), required=False) title=_(u"A comment id unique to this conversation"))
in_reply_to = schema.Int(
title=_(u"Id of comment this comment is in reply to"),
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)