diff --git a/CHANGES.rst b/CHANGES.rst index e34658f223..dea397b5ea 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -8,6 +8,9 @@ Changelog 5.0b3 (unreleased) ------------------ +- updates to contact forms to make them more user friendly on submission + [vangheem] + - include code plugin by default for TinyMCE [vangheem] diff --git a/Products/CMFPlone/browser/author.py b/Products/CMFPlone/browser/author.py index d4a8401192..0f71927477 100644 --- a/Products/CMFPlone/browser/author.py +++ b/Products/CMFPlone/browser/author.py @@ -7,7 +7,6 @@ from Products.CMFPlone.utils import getToolByName from Products.CMFPlone.utils import pretty_title_or_id from Products.Five.browser import BrowserView -from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile from Products.MailHost.interfaces import IMailHost from Products.statusmessages.interfaces import IStatusMessage @@ -98,20 +97,20 @@ def handle_send(self, action): ) mail_host = getUtility(IMailHost) - encoding = mail_settings.email_charset + email_charset = self.portal.getProperty('email_charset') try: message = self.feedback_template( self, send_from_address=send_from_address, sender_id=sender_id, url=referer, subject=subject, - message=message, encoding=encoding + message=message, encoding=email_charset ) - message = message.encode(encoding) + message = message.encode(email_charset) mail_host.send( message, send_to_address, envelope_from, - subject=subject, charset=encoding + subject=subject, charset=email_charset ) except ConflictError: raise @@ -129,6 +128,9 @@ def handle_send(self, action): _(u'Mail sent.'), type=u'info' ) + self.request.response.redirect('%s/author/%s' % ( + self.portal.absolute_url(), + author or '')) return @@ -251,6 +253,9 @@ def __call__(self): ISecuritySchema, prefix='plone') allow_anonymous_view_about = security_settings.allow_anon_views_about + mail_settings = registry.forInterface(IMailSchema, prefix='plone') + self.email_from_address = mail_settings.email_from_address + if self.is_anonymous and not allow_anonymous_view_about: raise Unauthorized() diff --git a/Products/CMFPlone/browser/contact_info.py b/Products/CMFPlone/browser/contact_info.py index 565b6e25a6..3e5a50d310 100644 --- a/Products/CMFPlone/browser/contact_info.py +++ b/Products/CMFPlone/browser/contact_info.py @@ -23,6 +23,7 @@ class ContactForm(form.Form): fields = field.Fields(IContactForm) ignoreContext = True + success = False def mailhost_is_configured(self): registry = getUtility(IRegistry) @@ -44,6 +45,7 @@ def handle_send(self, action): self.send_message(data) self.send_feedback() + self.success = True def generate_mail(self, variables, encoding='utf-8'): template = self.context.restrictedTraverse(self.template_mailview) diff --git a/Products/CMFPlone/browser/templates/author.pt b/Products/CMFPlone/browser/templates/author.pt index d7c4678639..c4d6c4c040 100644 --- a/Products/CMFPlone/browser/templates/author.pt +++ b/Products/CMFPlone/browser/templates/author.pt @@ -27,7 +27,7 @@ tal:define="portal_url context/@@plone_portal_state/navigation_root_url; here_url context/@@plone_context_state/object_url; portal context/@@plone_portal_state/portal; - email_from_address portal/email_from_address; + email_from_address view/email_from_address; author view/author; username view/username"> @@ -59,6 +59,11 @@
+ + User portrait picture

@@ -80,11 +85,6 @@ i18n:translate="label_edit">Edit - User portrait picture -
Author description. @@ -132,7 +132,7 @@

- +

This site doesn't have a valid email setup, so you cannot use diff --git a/Products/CMFPlone/browser/templates/contact-info.pt b/Products/CMFPlone/browser/templates/contact-info.pt index 400b217dd4..a43024debb 100644 --- a/Products/CMFPlone/browser/templates/contact-info.pt +++ b/Products/CMFPlone/browser/templates/contact-info.pt @@ -31,7 +31,7 @@

-
+
Fill in this form to contact the site owners. @@ -42,6 +42,11 @@
+
+

+ Thank you for your feedback +

+