Multi-select emails from LDAP in Send by email view #32825
This commit is contained in:
parent
7720ab11bd
commit
ec6af89840
|
@ -9,6 +9,7 @@ from email.mime.multipart import MIMEMultipart
|
|||
from email.mime.text import MIMEText
|
||||
from email import encoders
|
||||
|
||||
from collective.dms.basecontent.widget import AjaxChosenMultiFieldWidget
|
||||
from zope.interface import Interface
|
||||
from zope import schema
|
||||
from zope.component import createObject, queryUtility
|
||||
|
@ -27,9 +28,17 @@ from plone import api
|
|||
|
||||
from .. import _
|
||||
|
||||
|
||||
class IMail(Interface):
|
||||
recipients = schema.Text(title=_(u"Recipients"), required=True,
|
||||
description=_(u"Email addresses of the recipients, one per line"))
|
||||
recipients = schema.List(
|
||||
title=_(u"Recipients"),
|
||||
description=_(u"Email addresses of the recipients"),
|
||||
required=True,
|
||||
value_type=schema.Choice(
|
||||
vocabulary=u'collective.dms.basecontent.ldap_emails',
|
||||
),
|
||||
)
|
||||
|
||||
subject = schema.TextLine(title=_(u"Subject"), required=True)
|
||||
comment = schema.Text(
|
||||
title=_(u"Comment"),
|
||||
|
@ -39,6 +48,7 @@ class IMail(Interface):
|
|||
|
||||
class MailForm(form.AddForm):
|
||||
fields = Fields(IMail)
|
||||
fields['recipients'].widgetFactory = AjaxChosenMultiFieldWidget
|
||||
next_url = None
|
||||
|
||||
def updateActions(self):
|
||||
|
@ -58,7 +68,7 @@ class MailForm(form.AddForm):
|
|||
self._finishedAdd = True
|
||||
|
||||
subject = data['subject']
|
||||
recipients = data['recipients'].splitlines()
|
||||
recipients = data['recipients']
|
||||
comment = data.get('comment')
|
||||
|
||||
msg = MIMEMultipart()
|
||||
|
|
|
@ -152,9 +152,9 @@ msgstr "Adresse du document : %s"
|
|||
msgid "Document: %s"
|
||||
msgstr "Document : %s"
|
||||
|
||||
#: ../browser/send_by_email.py:32
|
||||
msgid "Email addresses of the recipients, one per line"
|
||||
msgstr "Adresses électroniques des destinataires, une par ligne"
|
||||
#: ../browser/send_by_email.py:35
|
||||
msgid "Email addresses of the recipients"
|
||||
msgstr "Adresses électroniques des destinataires"
|
||||
|
||||
#: ../browser/send_by_email.py:97
|
||||
msgid "Error sending email"
|
||||
|
|
|
@ -154,8 +154,8 @@ msgstr ""
|
|||
msgid "Document: %s"
|
||||
msgstr ""
|
||||
|
||||
#: ../browser/send_by_email.py:32
|
||||
msgid "Email addresses of the recipients, one per line"
|
||||
#: ../browser/send_by_email.py:35
|
||||
msgid "Email addresses of the recipients"
|
||||
msgstr ""
|
||||
|
||||
#: ../browser/send_by_email.py:97
|
||||
|
|
Reference in New Issue