From 66799d2d31e8ceb0aee0d60d65c7837e5f4f7447 Mon Sep 17 00:00:00 2001 From: Timo Stollenwerk Date: Tue, 9 Aug 2011 16:03:52 +0000 Subject: [PATCH] Two new how-tos added (only rough outlines yet). svn path=/plone.app.discussion/trunk/; revision=51575 --- .../howto_override_enable_conversation.txt | 60 ++++++++++++ ...discussion_settings_with_generic_setup.txt | 94 +++++++++++++++++++ 2 files changed, 154 insertions(+) create mode 100644 docs/source/howtos/howto_override_enable_conversation.txt create mode 100644 docs/source/howtos/howto_set_discussion_settings_with_generic_setup.txt diff --git a/docs/source/howtos/howto_override_enable_conversation.txt b/docs/source/howtos/howto_override_enable_conversation.txt new file mode 100644 index 0000000..f93ae87 --- /dev/null +++ b/docs/source/howtos/howto_override_enable_conversation.txt @@ -0,0 +1,60 @@ + +configure.zcml:: + + + + + + + + +conversation.py + + from zope.component import queryUtility + + from plone.registry.interfaces import IRegistry + + from Acquisition import aq_base + from Acquisition import aq_chain + from Acquisition import aq_inner + + from Products.CMFCore.utils import getToolByName + from Products.CMFCore.interfaces import IFolderish + + from Products.CMFPlone.interfaces import IPloneSiteRoot + from Products.CMFPlone.interfaces import INonStructuralFolder + + from plone.app.discussion.interfaces import IDiscussionSettings + + + class ConversationView(object): + + def enabled(self): + context = aq_inner(self.context) + + # Fetch discussion registry + registry = queryUtility(IRegistry) + settings = registry.forInterface(IDiscussionSettings, check=False) + + # Check if discussion is allowed globally + if not settings.globally_enabled: + return False + + # Check if discussion is allowed on the content object + if context.allow_discussion is not None: + return context.allow_discussion + + # Check if discussion is allowed on the content type + portal_types = getToolByName(self, 'portal_types') + document_fti = getattr(portal_types, context.portal_type) + return document_fti.getProperty('allow_discussion') diff --git a/docs/source/howtos/howto_set_discussion_settings_with_generic_setup.txt b/docs/source/howtos/howto_set_discussion_settings_with_generic_setup.txt new file mode 100644 index 0000000..dc317cc --- /dev/null +++ b/docs/source/howtos/howto_set_discussion_settings_with_generic_setup.txt @@ -0,0 +1,94 @@ +================================================= +How to set discussion settings with generic setup +================================================= + +This document explains how to set plone.app.discussion's settings with a +generic setup profile. + +plone.app.discussion uses plone.app.registry ... + +registry.xml:: + + + + + False + help_anonymous_comments + False + label_anonymous_comments + + False + + + + disabled + help_captcha + label_captcha + plone.app.discussion.vocabularies.CaptchaVocabulary + + disabled + + + + False + help_globally_enabled + False + label_globally_enabled + + False + + + + False + help_moderation_enabled + False + label_moderation_enabled + + False + + + + help_moderator_email + False + label_moderator_email + + + + + + False + help_moderator_notification_enabled + False + label_moderator_notification_enabled + + False + + + + True + help_show_commenter_image + False + label_show_commenter_image + + True + + + + text/plain + help_text_transform + label_text_transform + plone.app.discussion.vocabularies.TextTransformVocabulary + + text/plain + + + + False + help_user_notification_enabled + False + label_user_notification_enabled + + False + + +