2010-08-28 18:11:58 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
"""Interfaces for plone.app.discussion
|
|
|
|
"""
|
2015-11-05 00:26:49 +01:00
|
|
|
from plone.app.discussion import _
|
2017-06-21 12:15:32 +02:00
|
|
|
from Products.CMFCore.interfaces import ISiteRoot
|
|
|
|
from Products.CMFCore.utils import getToolByName
|
2015-05-03 08:16:39 +02:00
|
|
|
from zope import schema
|
2017-06-21 12:15:32 +02:00
|
|
|
from zope.component import getUtility
|
|
|
|
from zope.interface import Interface
|
|
|
|
from zope.interface import Invalid
|
2009-05-18 16:16:48 +02:00
|
|
|
from zope.interface.common.mapping import IIterableMapping
|
2019-04-12 11:40:53 +02:00
|
|
|
from zope.interface.interfaces import IObjectEvent
|
2009-05-11 18:52:16 +02:00
|
|
|
|
2017-07-28 17:58:35 +02:00
|
|
|
|
2017-06-20 15:16:19 +02:00
|
|
|
def isEmail(value):
|
2017-06-21 12:15:32 +02:00
|
|
|
portal = getUtility(ISiteRoot)
|
|
|
|
reg_tool = getToolByName(portal, 'portal_registration')
|
2017-06-20 15:16:19 +02:00
|
|
|
if not (value and reg_tool.isValidEmail(value)):
|
2017-07-28 17:58:35 +02:00
|
|
|
raise Invalid(_('Invalid email address.'))
|
2017-06-20 15:16:19 +02:00
|
|
|
return True
|
2010-05-28 17:56:39 +02:00
|
|
|
|
2017-07-28 17:58:35 +02:00
|
|
|
|
2009-05-18 16:16:48 +02:00
|
|
|
class IConversation(IIterableMapping):
|
2009-05-13 16:54:06 +02:00
|
|
|
"""A conversation about a content object.
|
2009-06-02 23:20:53 +02:00
|
|
|
|
2009-05-13 16:54:06 +02:00
|
|
|
This is a persistent object in its own right and manages all comments.
|
2009-06-02 23:20:53 +02:00
|
|
|
|
2009-05-13 16:54:06 +02:00
|
|
|
The dict interface allows access to all comments. They are stored by
|
2009-05-18 16:16:48 +02:00
|
|
|
long integer key, in the order they were added.
|
2009-06-02 23:20:53 +02:00
|
|
|
|
2009-05-18 16:16:48 +02:00
|
|
|
Note that __setitem__() is not supported - use addComment() instead.
|
|
|
|
However, comments can be deleted using __delitem__().
|
2009-06-02 23:20:53 +02:00
|
|
|
|
2009-05-13 16:54:06 +02:00
|
|
|
To get replies at the top level, adapt the conversation to IReplies.
|
2009-06-02 23:20:53 +02:00
|
|
|
|
2009-05-13 16:54:06 +02:00
|
|
|
The conversation can be traversed to via the ++comments++ namespace.
|
|
|
|
For example, path/to/object/++comments++/123 retrieves comment 123.
|
2009-06-02 23:20:53 +02:00
|
|
|
|
2009-05-13 16:54:06 +02:00
|
|
|
The __parent__ of the conversation (and the acquisition parent during
|
|
|
|
traversal) is the content object. The conversation is the __parent__
|
|
|
|
(and acquisition parent) for all comments, regardless of threading.
|
2009-05-11 18:52:16 +02:00
|
|
|
"""
|
2009-06-02 23:20:53 +02:00
|
|
|
|
2010-08-28 18:11:58 +02:00
|
|
|
total_comments = schema.Int(
|
2016-02-05 01:39:53 +01:00
|
|
|
title=_(u'Total number of public comments on this item'),
|
2010-09-10 07:00:47 +02:00
|
|
|
min=0,
|
2010-08-28 18:11:58 +02:00
|
|
|
readonly=True,
|
2013-04-13 22:47:30 +02:00
|
|
|
)
|
2010-09-10 07:00:47 +02:00
|
|
|
|
2010-08-28 18:11:58 +02:00
|
|
|
last_comment_date = schema.Date(
|
2016-02-05 01:39:53 +01:00
|
|
|
title=_(u'Date of the most recent public comment'),
|
2010-08-28 18:11:58 +02:00
|
|
|
readonly=True,
|
2013-04-13 22:47:30 +02:00
|
|
|
)
|
2010-09-10 07:00:47 +02:00
|
|
|
|
2010-08-28 18:11:58 +02:00
|
|
|
commentators = schema.Set(
|
2016-02-05 01:39:53 +01:00
|
|
|
title=_(u'The set of unique commentators (usernames)'),
|
2010-08-28 18:11:58 +02:00
|
|
|
readonly=True,
|
2013-04-13 22:47:30 +02:00
|
|
|
)
|
2009-06-02 23:20:53 +02:00
|
|
|
|
2013-03-28 14:28:22 +01:00
|
|
|
public_commentators = schema.Set(
|
2013-04-18 15:57:01 +02:00
|
|
|
title=_(
|
2018-06-18 17:04:41 +02:00
|
|
|
u'The set of unique commentators (usernames) '
|
|
|
|
u'of published_comments',
|
2013-04-18 15:57:01 +02:00
|
|
|
),
|
2013-03-28 14:28:22 +01:00
|
|
|
readonly=True,
|
2013-04-13 22:47:30 +02:00
|
|
|
)
|
2013-03-28 14:28:22 +01:00
|
|
|
|
2009-05-18 16:16:48 +02:00
|
|
|
def addComment(comment):
|
2009-06-02 23:20:53 +02:00
|
|
|
"""Adds a new comment to the list of comments, and returns the
|
2009-05-18 16:16:48 +02:00
|
|
|
comment id that was assigned. The comment_id property on the comment
|
|
|
|
will be set accordingly.
|
|
|
|
"""
|
2009-06-02 23:20:53 +02:00
|
|
|
|
2009-05-18 17:49:48 +02:00
|
|
|
def __delitem__(key):
|
|
|
|
"""Delete the comment with the given key. The key is a long id.
|
|
|
|
"""
|
2009-06-02 23:20:53 +02:00
|
|
|
|
2009-05-13 16:54:06 +02:00
|
|
|
def getComments(start=0, size=None):
|
2009-05-24 18:04:49 +02:00
|
|
|
"""Return an iterator of comment objects for rendering.
|
2009-06-02 23:20:53 +02:00
|
|
|
|
2009-05-24 18:04:49 +02:00
|
|
|
The 'start' parameter is the id of the comment from which to start the
|
|
|
|
batch. If no such comment exists, the next higher id will be used.
|
|
|
|
This means that you can use max key from a previous batch + 1 safely.
|
2009-06-02 23:20:53 +02:00
|
|
|
|
2009-05-13 16:54:06 +02:00
|
|
|
The 'size' parameter is the number of comments to return in the
|
|
|
|
batch.
|
2009-06-02 23:20:53 +02:00
|
|
|
|
2009-05-24 18:04:49 +02:00
|
|
|
The comments are returned in creation date order, in the exact batch
|
2009-05-13 16:54:06 +02:00
|
|
|
size specified.
|
|
|
|
"""
|
2009-06-02 23:20:53 +02:00
|
|
|
|
2009-05-24 18:04:49 +02:00
|
|
|
def getThreads(start=0, size=None, root=0, depth=None):
|
|
|
|
"""Return a batch of comment objects for rendering.
|
2009-06-02 23:20:53 +02:00
|
|
|
|
2009-05-24 18:04:49 +02:00
|
|
|
The 'start' parameter is the id of the comment from which to start
|
|
|
|
the batch. If no such comment exists, the next higher id will be used.
|
|
|
|
This means that you can use max key from a previous batch + 1 safely.
|
|
|
|
This should be a root level comment.
|
2009-06-02 23:20:53 +02:00
|
|
|
|
2009-05-24 18:04:49 +02:00
|
|
|
The 'size' parameter is the number of threads to return in the
|
|
|
|
batch. Full threads are always returned (although you can stop
|
|
|
|
consuming the iterator if you want to abort).
|
2009-06-02 23:20:53 +02:00
|
|
|
|
2009-05-24 18:04:49 +02:00
|
|
|
'root', if given, is the id of the comment to which reply
|
|
|
|
threads will be found. 'root' itself is not included. If not given,
|
|
|
|
all threads are returned.
|
2009-06-02 23:20:53 +02:00
|
|
|
|
2009-05-13 16:54:06 +02:00
|
|
|
If 'depth' is given, it can be used to limit the depth of threads
|
|
|
|
returned. For example, depth=1 will return only direct replies.
|
2009-06-02 23:20:53 +02:00
|
|
|
|
2009-05-24 18:04:49 +02:00
|
|
|
Comments are returned as an iterator of dicts with keys 'comment',
|
|
|
|
the comment, 'id', the comment id, and 'depth', which is 0 for
|
|
|
|
top-level comments, 1 for their replies, and so on. The list is
|
|
|
|
returned in depth-first order.
|
2009-05-13 16:54:06 +02:00
|
|
|
"""
|
2009-05-11 18:52:16 +02:00
|
|
|
|
2010-05-28 17:56:39 +02:00
|
|
|
|
2009-05-18 16:16:48 +02:00
|
|
|
class IReplies(IIterableMapping):
|
2009-05-13 16:54:06 +02:00
|
|
|
"""A set of related comments in reply to a given content object or
|
|
|
|
another comment.
|
2009-06-02 23:20:53 +02:00
|
|
|
|
2009-05-13 16:54:06 +02:00
|
|
|
Adapt a conversation or another comment to this interface to obtain the
|
|
|
|
direct replies.
|
|
|
|
"""
|
2009-06-02 23:20:53 +02:00
|
|
|
|
2009-05-18 16:16:48 +02:00
|
|
|
def addComment(comment):
|
2009-06-02 23:20:53 +02:00
|
|
|
"""Adds a new comment as a child of this comment, and returns the
|
2009-05-18 16:16:48 +02:00
|
|
|
comment id that was assigned. The comment_id property on the comment
|
|
|
|
will be set accordingly.
|
|
|
|
"""
|
2009-06-02 23:20:53 +02:00
|
|
|
|
2009-05-18 16:16:48 +02:00
|
|
|
def __delitem__(key):
|
|
|
|
"""Delete the comment with the given key. The key is a long id.
|
|
|
|
"""
|
2009-05-11 18:52:16 +02:00
|
|
|
|
2010-05-28 17:56:39 +02:00
|
|
|
|
2009-05-13 16:54:06 +02:00
|
|
|
class IComment(Interface):
|
|
|
|
"""A comment.
|
2009-06-02 23:20:53 +02:00
|
|
|
|
2009-05-13 16:54:06 +02:00
|
|
|
Comments are indexed in the catalog and subject to workflow and security.
|
2009-05-11 18:52:16 +02:00
|
|
|
"""
|
|
|
|
|
2010-08-28 18:11:58 +02:00
|
|
|
portal_type = schema.ASCIILine(
|
2016-02-05 01:39:53 +01:00
|
|
|
title=_(u'Portal type'),
|
|
|
|
default='Discussion Item',
|
2013-04-18 15:57:01 +02:00
|
|
|
)
|
2009-06-02 23:20:53 +02:00
|
|
|
|
2010-08-28 18:11:58 +02:00
|
|
|
__parent__ = schema.Object(
|
2016-02-05 01:39:53 +01:00
|
|
|
title=_(u'Conversation'), schema=Interface)
|
2010-09-10 07:00:47 +02:00
|
|
|
|
2016-02-05 01:39:53 +01:00
|
|
|
__name__ = schema.TextLine(title=_(u'Name'))
|
2009-06-02 23:20:53 +02:00
|
|
|
|
2010-08-28 18:11:58 +02:00
|
|
|
comment_id = schema.Int(
|
2016-02-05 01:39:53 +01:00
|
|
|
title=_(u'A comment id unique to this conversation'))
|
2010-09-10 07:00:47 +02:00
|
|
|
|
2010-08-28 18:11:58 +02:00
|
|
|
in_reply_to = schema.Int(
|
2016-02-05 01:39:53 +01:00
|
|
|
title=_(u'Id of comment this comment is in reply to'),
|
2010-08-28 18:11:58 +02:00
|
|
|
required=False,
|
2013-04-18 15:57:01 +02:00
|
|
|
)
|
2009-06-02 23:20:53 +02:00
|
|
|
|
2009-08-04 22:47:06 +02:00
|
|
|
# for logged in comments - set to None for anonymous
|
2016-02-05 01:39:53 +01:00
|
|
|
author_username = schema.TextLine(title=_(u'Name'), required=False)
|
2009-08-04 22:47:06 +02:00
|
|
|
|
|
|
|
# for anonymous comments only, set to None for logged in comments
|
2016-02-05 01:39:53 +01:00
|
|
|
author_name = schema.TextLine(title=_(u'Name'), required=False)
|
2017-07-28 17:58:35 +02:00
|
|
|
author_email = schema.TextLine(title=_(u'Email'),
|
|
|
|
required=False,
|
|
|
|
constraint=isEmail,
|
|
|
|
)
|
2010-09-10 07:00:47 +02:00
|
|
|
|
2016-02-05 01:39:53 +01:00
|
|
|
title = schema.TextLine(title=_(u'label_subject',
|
|
|
|
default=u'Subject'))
|
2009-06-02 23:20:53 +02:00
|
|
|
|
2016-02-05 01:39:53 +01:00
|
|
|
mime_type = schema.ASCIILine(title=_(u'MIME type'), default='text/plain')
|
2013-04-18 15:57:01 +02:00
|
|
|
text = schema.Text(
|
|
|
|
title=_(
|
2016-02-05 01:39:53 +01:00
|
|
|
u'label_comment',
|
2018-06-18 17:04:41 +02:00
|
|
|
default=u'Comment',
|
|
|
|
),
|
2013-04-18 15:57:01 +02:00
|
|
|
)
|
2009-06-02 23:20:53 +02:00
|
|
|
|
2013-04-18 15:57:01 +02:00
|
|
|
user_notification = schema.Bool(
|
|
|
|
title=_(
|
2018-06-18 17:04:41 +02:00
|
|
|
u'Notify me of new comments via email.',
|
2013-04-18 15:57:01 +02:00
|
|
|
),
|
2018-06-18 17:04:41 +02:00
|
|
|
required=False,
|
2013-04-18 15:57:01 +02:00
|
|
|
)
|
2010-09-10 07:00:47 +02:00
|
|
|
|
2016-02-05 01:39:53 +01:00
|
|
|
creator = schema.TextLine(title=_(u'Username of the commenter'))
|
|
|
|
creation_date = schema.Date(title=_(u'Creation date'))
|
|
|
|
modification_date = schema.Date(title=_(u'Modification date'))
|
2009-06-02 23:20:53 +02:00
|
|
|
|
2010-05-28 17:56:39 +02:00
|
|
|
|
2009-08-12 22:45:47 +02:00
|
|
|
class ICaptcha(Interface):
|
2010-09-10 07:00:47 +02:00
|
|
|
"""Captcha/ReCaptcha text field to extend the existing comment form.
|
2010-05-28 17:56:39 +02:00
|
|
|
"""
|
2016-02-05 01:39:53 +01:00
|
|
|
captcha = schema.TextLine(title=_(u'Captcha'),
|
2009-08-15 12:17:34 +02:00
|
|
|
required=False)
|
2009-08-12 22:45:47 +02:00
|
|
|
|
2010-05-28 17:56:39 +02:00
|
|
|
|
2012-01-25 16:02:00 +01:00
|
|
|
class IDiscussionSettings(Interface):
|
|
|
|
"""Global discussion settings. This describes records stored in the
|
|
|
|
configuration registry and obtainable via plone.registry.
|
|
|
|
"""
|
|
|
|
|
|
|
|
# Todo: Write a short hint, that other discussion related options can
|
|
|
|
# be found elsewhere in the Plone control panel:
|
|
|
|
#
|
|
|
|
# - Types control panel: Allow comments on content types
|
|
|
|
# - Search control panel: Show comments in search results
|
|
|
|
|
|
|
|
globally_enabled = schema.Bool(
|
2016-02-05 01:39:53 +01:00
|
|
|
title=_(u'label_globally_enabled',
|
|
|
|
default=u'Globally enable comments'),
|
2013-04-18 15:57:01 +02:00
|
|
|
description=_(
|
2016-02-05 01:39:53 +01:00
|
|
|
u'help_globally_enabled',
|
|
|
|
default=u'If selected, users are able to post comments on the '
|
2017-01-16 22:13:38 +01:00
|
|
|
u'site. However, you will still need to enable comments '
|
|
|
|
u'for specific content types, folders or content '
|
2018-06-18 17:04:41 +02:00
|
|
|
u'objects before users will be able to post comments.',
|
2013-04-18 15:57:01 +02:00
|
|
|
),
|
2012-01-25 16:02:00 +01:00
|
|
|
required=False,
|
|
|
|
default=False,
|
2013-04-18 15:57:01 +02:00
|
|
|
)
|
2012-01-25 16:02:00 +01:00
|
|
|
|
|
|
|
anonymous_comments = schema.Bool(
|
2016-02-05 01:39:53 +01:00
|
|
|
title=_(u'label_anonymous_comments',
|
|
|
|
default='Enable anonymous comments'),
|
2013-04-18 15:57:01 +02:00
|
|
|
description=_(
|
2016-02-05 01:39:53 +01:00
|
|
|
u'help_anonymous_comments',
|
|
|
|
default=u'If selected, anonymous users are able to post '
|
2017-01-16 22:13:38 +01:00
|
|
|
u'comments without logging in. It is highly '
|
2016-02-05 01:39:53 +01:00
|
|
|
u'recommended to use a captcha solution to prevent '
|
2018-06-18 17:04:41 +02:00
|
|
|
u'spam if this setting is enabled.',
|
2013-04-18 15:57:01 +02:00
|
|
|
),
|
2012-01-25 16:02:00 +01:00
|
|
|
required=False,
|
|
|
|
default=False,
|
2013-04-18 15:57:01 +02:00
|
|
|
)
|
2012-01-25 16:02:00 +01:00
|
|
|
|
2015-09-13 15:38:46 +02:00
|
|
|
anonymous_email_enabled = schema.Bool(
|
2016-02-05 01:39:53 +01:00
|
|
|
title=_(u'label_anonymous_email_enabled',
|
|
|
|
default=u'Enable anonymous email field'),
|
2015-09-13 15:38:46 +02:00
|
|
|
description=_(
|
2016-02-05 01:39:53 +01:00
|
|
|
u'help_anonymous_email_enabled',
|
|
|
|
default=u'If selected, anonymous user will have to '
|
2018-06-18 17:04:41 +02:00
|
|
|
u'give their email.',
|
|
|
|
),
|
2015-09-13 15:38:46 +02:00
|
|
|
required=False,
|
2018-06-18 17:04:41 +02:00
|
|
|
default=False,
|
2015-09-13 15:38:46 +02:00
|
|
|
)
|
|
|
|
|
2012-01-25 16:02:00 +01:00
|
|
|
moderation_enabled = schema.Bool(
|
2013-04-18 15:57:01 +02:00
|
|
|
title=_(
|
2016-02-05 01:39:53 +01:00
|
|
|
u'label_moderation_enabled',
|
2018-06-18 17:04:41 +02:00
|
|
|
default='Enable comment moderation',
|
2013-04-18 15:57:01 +02:00
|
|
|
),
|
|
|
|
description=_(
|
2016-02-05 01:39:53 +01:00
|
|
|
u'help_moderation_enabled',
|
|
|
|
default=u'If selected, comments will enter a "Pending" state '
|
|
|
|
u'in which they are invisible to the public. A user '
|
|
|
|
u'with the "Review comments" permission ("Reviewer" '
|
|
|
|
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 '
|
2018-06-18 17:04:41 +02:00
|
|
|
u'types control panel.',
|
2013-04-18 15:57:01 +02:00
|
|
|
),
|
2012-01-25 16:02:00 +01:00
|
|
|
required=False,
|
|
|
|
default=False,
|
2013-04-18 15:57:01 +02:00
|
|
|
)
|
2012-01-25 16:02:00 +01:00
|
|
|
|
2013-09-17 14:03:46 +02:00
|
|
|
edit_comment_enabled = schema.Bool(
|
2016-02-05 01:39:53 +01:00
|
|
|
title=_(u'label_edit_comment_enabled',
|
|
|
|
default='Enable editing of comments'),
|
|
|
|
description=_(u'help_edit_comment_enabled',
|
|
|
|
default=u'If selected, supports editing '
|
|
|
|
'of comments for users with the "Edit comments" '
|
|
|
|
'permission.'),
|
2013-09-17 14:03:46 +02:00
|
|
|
required=False,
|
|
|
|
default=False,
|
|
|
|
)
|
|
|
|
|
2014-09-20 16:02:48 +02:00
|
|
|
delete_own_comment_enabled = schema.Bool(
|
2016-02-05 01:39:53 +01:00
|
|
|
title=_(u'label_delete_own_comment_enabled',
|
|
|
|
default='Enable deleting own comments'),
|
|
|
|
description=_(u'help_delete_own_comment_enabled',
|
|
|
|
default=u'If selected, supports deleting '
|
|
|
|
'of own comments for users with the '
|
|
|
|
'"Delete own comments" permission.'),
|
2014-09-20 16:02:48 +02:00
|
|
|
required=False,
|
|
|
|
default=False,
|
|
|
|
)
|
|
|
|
|
2012-01-25 16:02:00 +01:00
|
|
|
text_transform = schema.Choice(
|
2016-02-05 01:39:53 +01:00
|
|
|
title=_(u'label_text_transform',
|
|
|
|
default='Comment text transform'),
|
2013-04-18 15:57:01 +02:00
|
|
|
description=_(
|
2016-02-05 01:39:53 +01:00
|
|
|
u'help_text_transform',
|
|
|
|
default=u'Use this setting to choose if the comment text '
|
|
|
|
u'should be transformed in any way. You can choose '
|
|
|
|
u'between "Plain text" and "Intelligent text". '
|
|
|
|
u'"Intelligent text" converts plain text into HTML '
|
|
|
|
u'where line breaks and indentation is preserved, '
|
|
|
|
u'and web and email addresses are made into '
|
|
|
|
u'clickable links.'),
|
2012-01-25 16:02:00 +01:00
|
|
|
required=True,
|
|
|
|
default='text/plain',
|
|
|
|
vocabulary='plone.app.discussion.vocabularies.TextTransformVocabulary',
|
2013-04-18 15:57:01 +02:00
|
|
|
)
|
2012-01-25 16:02:00 +01:00
|
|
|
|
|
|
|
captcha = schema.Choice(
|
2016-02-05 01:39:53 +01:00
|
|
|
title=_(u'label_captcha',
|
|
|
|
default='Captcha'),
|
2013-04-18 15:57:01 +02:00
|
|
|
description=_(
|
2016-02-05 01:39:53 +01:00
|
|
|
u'help_captcha',
|
|
|
|
default=u'Use this setting to enable or disable Captcha '
|
|
|
|
u'validation for comments. Install '
|
|
|
|
u'plone.formwidget.captcha, '
|
|
|
|
u'plone.formwidget.recaptcha, collective.akismet, or '
|
|
|
|
u'collective.z3cform.norobots if there are no options '
|
|
|
|
u'available.'),
|
2012-01-25 16:02:00 +01:00
|
|
|
required=True,
|
|
|
|
default='disabled',
|
|
|
|
vocabulary='plone.app.discussion.vocabularies.CaptchaVocabulary',
|
2013-04-18 15:57:01 +02:00
|
|
|
)
|
2012-01-25 16:02:00 +01:00
|
|
|
|
|
|
|
show_commenter_image = schema.Bool(
|
2016-02-05 01:39:53 +01:00
|
|
|
title=_(u'label_show_commenter_image',
|
|
|
|
default=u'Show commenter image'),
|
2013-04-18 15:57:01 +02:00
|
|
|
description=_(
|
2016-02-05 01:39:53 +01:00
|
|
|
u'help_show_commenter_image',
|
|
|
|
default=u'If selected, an image of the user is shown next to '
|
|
|
|
u'the comment.'),
|
2012-01-25 16:02:00 +01:00
|
|
|
required=False,
|
|
|
|
default=True,
|
2013-04-18 15:57:01 +02:00
|
|
|
)
|
2012-01-25 16:02:00 +01:00
|
|
|
|
|
|
|
moderator_notification_enabled = schema.Bool(
|
2016-02-05 01:39:53 +01:00
|
|
|
title=_(u'label_moderator_notification_enabled',
|
|
|
|
default=u'Enable moderator email notification'),
|
2013-04-18 15:57:01 +02:00
|
|
|
description=_(
|
2016-02-05 01:39:53 +01:00
|
|
|
u'help_moderator_notification_enabled',
|
|
|
|
default=u'If selected, the moderator is notified if a comment '
|
|
|
|
u'needs attention. The moderator email address can '
|
|
|
|
u'be set below.'),
|
2012-01-25 16:02:00 +01:00
|
|
|
required=False,
|
|
|
|
default=False,
|
2013-04-18 15:57:01 +02:00
|
|
|
)
|
2012-01-25 16:02:00 +01:00
|
|
|
|
|
|
|
moderator_email = schema.ASCIILine(
|
2013-04-18 15:57:01 +02:00
|
|
|
title=_(
|
|
|
|
u'label_moderator_email',
|
2018-06-18 17:04:41 +02:00
|
|
|
default=u'Moderator Email Address',
|
2013-04-18 15:57:01 +02:00
|
|
|
),
|
|
|
|
description=_(
|
|
|
|
u'help_moderator_email',
|
2016-02-05 01:39:53 +01:00
|
|
|
default=u'Address to which moderator notifications '
|
|
|
|
u'will be sent.'),
|
2012-01-25 16:02:00 +01:00
|
|
|
required=False,
|
2013-04-18 15:57:01 +02:00
|
|
|
)
|
2012-01-25 16:02:00 +01:00
|
|
|
|
|
|
|
user_notification_enabled = schema.Bool(
|
2013-04-18 15:57:01 +02:00
|
|
|
title=_(
|
2016-02-05 01:39:53 +01:00
|
|
|
u'label_user_notification_enabled',
|
2018-06-18 17:04:41 +02:00
|
|
|
default=u'Enable user email notification',
|
2013-04-18 15:57:01 +02:00
|
|
|
),
|
|
|
|
description=_(
|
2016-02-05 01:39:53 +01:00
|
|
|
u'help_user_notification_enabled',
|
|
|
|
default=u'If selected, users can choose to be notified '
|
|
|
|
u'of new comments by email.'),
|
2012-01-25 16:02:00 +01:00
|
|
|
required=False,
|
2018-06-18 17:04:41 +02:00
|
|
|
default=False,
|
2013-04-18 15:57:01 +02:00
|
|
|
)
|
2012-01-25 16:02:00 +01:00
|
|
|
|
|
|
|
|
2010-06-04 11:33:48 +02:00
|
|
|
class IDiscussionLayer(Interface):
|
2009-05-23 06:55:06 +02:00
|
|
|
"""Request marker installed via browserlayer.xml.
|
2010-01-22 18:54:30 +01:00
|
|
|
"""
|
2013-10-19 06:40:50 +02:00
|
|
|
|
|
|
|
|
|
|
|
class ICommentingTool(Interface):
|
|
|
|
"""For backwards-compatibility.
|
|
|
|
|
|
|
|
This can be removed once we no longer support upgrading from versions
|
|
|
|
of Plone that had a portal_discussion tool.
|
|
|
|
"""
|
2014-04-16 17:54:19 +02:00
|
|
|
|
|
|
|
#
|
|
|
|
# Custom events
|
|
|
|
#
|
|
|
|
|
2015-05-03 08:22:51 +02:00
|
|
|
|
2014-04-16 17:54:19 +02:00
|
|
|
class IDiscussionEvent(IObjectEvent):
|
|
|
|
""" Discussion custom event
|
|
|
|
"""
|
|
|
|
|
2015-05-03 08:22:51 +02:00
|
|
|
|
2014-04-16 17:54:19 +02:00
|
|
|
class ICommentAddedEvent(IDiscussionEvent):
|
|
|
|
""" Comment added
|
|
|
|
"""
|
|
|
|
|
2015-05-03 08:22:51 +02:00
|
|
|
|
2014-04-16 17:54:19 +02:00
|
|
|
class ICommentRemovedEvent(IDiscussionEvent):
|
|
|
|
""" Comment removed
|
|
|
|
"""
|
|
|
|
|
2015-05-03 08:22:51 +02:00
|
|
|
|
2014-04-16 17:54:19 +02:00
|
|
|
class IReplyAddedEvent(IDiscussionEvent):
|
|
|
|
""" Comment reply added
|
|
|
|
"""
|
|
|
|
|
2015-05-03 08:22:51 +02:00
|
|
|
|
2014-04-16 17:54:19 +02:00
|
|
|
class IReplyRemovedEvent(IDiscussionEvent):
|
|
|
|
""" Comment reply removed
|
|
|
|
"""
|
2018-09-27 11:26:41 +02:00
|
|
|
|
|
|
|
|
2018-10-24 16:49:22 +02:00
|
|
|
class ICommentPublishedEvent(IDiscussionEvent):
|
2018-09-27 11:26:41 +02:00
|
|
|
""" Notify user on comment publication
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
2018-10-24 16:49:22 +02:00
|
|
|
class ICommentDeletedEvent(IDiscussionEvent):
|
2018-09-27 11:26:41 +02:00
|
|
|
""" Notify user on comment delete
|
|
|
|
"""
|
2019-12-08 20:01:40 +01:00
|
|
|
|
|
|
|
|
|
|
|
class ICommentTransitionEvent(IDiscussionEvent):
|
|
|
|
"""Notify user on comment transition / change of review_state."""
|