diff --git a/CHANGES.txt b/CHANGES.txt index 4ea57bd..c1f8ebf 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -4,6 +4,9 @@ Changelog 1.0RC1 (unreleased) ------------------- +- Make the mail-setting warning message show up in the discussion control panel. + [timo] + - Link directly to the "Discussion Item" types control panel in the moderation view. [timo] diff --git a/plone/app/discussion/browser/controlpanel.pt b/plone/app/discussion/browser/controlpanel.pt index 31c3bd3..00c5df2 100644 --- a/plone/app/discussion/browser/controlpanel.pt +++ b/plone/app/discussion/browser/controlpanel.pt @@ -25,6 +25,24 @@ tal:attributes="src string:${context/portal_url}/++resource++plone.app.discussion.javascripts/controlpanel.js"> +
+
+ Warning +
+
+ You have not configured a mail host or a site 'From' + address, various features including contact forms, email + notification and password reset will not work. Go to the + + Mail control panel + + to fix this. +
+
Portal status message
diff --git a/plone/app/discussion/browser/controlpanel.py b/plone/app/discussion/browser/controlpanel.py index 8819475..f8f9dfb 100644 --- a/plone/app/discussion/browser/controlpanel.py +++ b/plone/app/discussion/browser/controlpanel.py @@ -1,5 +1,7 @@ # -*- coding: utf-8 -*- +from Acquisition import aq_base, aq_inner + from Products.CMFCore.utils import getToolByName from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile @@ -19,7 +21,8 @@ from plone.app.discussion.interfaces import IDiscussionSettings, _ class DiscussionSettingsEditForm(controlpanel.RegistryEditForm): - + """Discussion settings form. + """ schema = IDiscussionSettings label = _(u"Discussion settings") description = _(u"help_discussion_settings_editform", @@ -76,6 +79,8 @@ class DiscussionSettingsEditForm(controlpanel.RegistryEditForm): class DiscussionSettingsControlPanel(controlpanel.ControlPanelFormWrapper): + """Discussion settings control panel. + """ form = DiscussionSettingsEditForm index = ViewPageTemplateFile('controlpanel.pt') @@ -110,3 +115,16 @@ class DiscussionSettingsControlPanel(controlpanel.ControlPanelFormWrapper): # Merge all settings into one string return ' '.join(output) + + def mailhost_warning(self): + """Returns true if mailhost is not configured properly. + """ + # Copied from plone.app.controlpanel/plone/app/controlpanel/overview.py + mailhost = getToolByName(aq_inner(self.context), 'MailHost', None) + if mailhost is None: + return True + mailhost = getattr(aq_base(mailhost), 'smtp_host', None) + email = getattr(aq_inner(self.context), 'email_from_address', None) + if mailhost and email: + return False + return True \ No newline at end of file