Allow custom address in email selection #38844

This commit is contained in:
Nicolas Demonte 2020-01-17 17:35:34 +01:00
parent fb769655c1
commit 3987ec9e82
6 changed files with 37 additions and 28 deletions

View File

@ -51,6 +51,7 @@ setup(
'collective.edm.listing',
'collective.externaleditor',
'collective.onlogin',
'collective.select2',
'collective.solr',
'collective.task',
'collective.taskqueue',

View File

@ -1,41 +1,35 @@
# -*- encoding: utf-8 -*-
import random
import logging
from datetime import datetime
from DateTime import DateTime
from email import encoders
from email.mime.base import MIMEBase
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
from z3c.form import form, button
from z3c.form.field import Fields
from z3c.form.interfaces import HIDDEN_MODE
from zope.annotation.interfaces import IAnnotations
from Acquisition import aq_inner, aq_parent
from plone.z3cform.layout import FormWrapper
from Acquisition import aq_parent
from DateTime import DateTime
from Products.Five.browser import BrowserView
from Products.CMFCore.utils import getToolByName
from collective.select2.field import Select2MultiField
from pfwbged.policy import _
from plone import api
from .. import _
from plone.z3cform.layout import FormWrapper
from z3c.form import button
from z3c.form import form
from z3c.form.field import Fields
from zope import schema
from zope.annotation.interfaces import IAnnotations
from zope.interface import Interface
class IMail(Interface):
recipients = schema.List(
recipients = Select2MultiField(
title=_(u"Recipients"),
description=_(u"Email addresses of the recipients"),
search_view=lambda x: '{}/select2-ldap-emails-search'.format(x),
placeholder=_(u"Select a value here"),
required=True,
value_type=schema.Choice(
vocabulary=u'collective.dms.basecontent.ldap_emails',
value_type=schema.TextLine(
title=_(u"Recipients"),
),
)
@ -48,7 +42,6 @@ class IMail(Interface):
class MailForm(form.AddForm):
fields = Fields(IMail)
fields['recipients'].widgetFactory = AjaxChosenMultiFieldWidget
next_url = None
def updateActions(self):

View File

@ -7,7 +7,13 @@ $(document).ready(function(){
noform: function(el) {return jQuery.plonepopups.noformerrorshow(el, 'reload');},
config: {
closeOnClick: false,
closeOnEsc: false
closeOnEsc: false,
onLoad : function (e) {
$('.pb-ajax .select2-multi-widget').select2Widget({
multiple: true
});
return true;
}
}
});
$(document).find('.overlay-form-redirect').prepOverlay({

View File

@ -28,6 +28,7 @@
<include package="collective.task" />
<include package="collective.onlogin" />
<include package="collective.solr" />
<include package="collective.select2" />
<include package="pfwbged.basecontent" />
<include package="pfwbged.collection" />
<include package="pfwbged.folder" />

View File

@ -54,7 +54,7 @@ msgstr "Actions"
#: ../browser/add_multi_information.py:25
#: ../browser/multi_attribute_task.py:41
msgid "Add"
msgstr ""
msgstr "Ajouter"
#: ../menu.py:332
msgid "Add ${title}"
@ -253,7 +253,11 @@ msgstr "Enregistrer"
msgid "Save As..."
msgstr "Enregistrer sous…"
#: ../browser/send_by_email.py:52
#: ../browser/send_by_email.py:29
msgid "Select a value here"
msgstr "Sélectionner une valeur ici"
#: ../browser/send_by_email.py:55
msgid "Send"
msgstr "Envoyer"

View File

@ -255,7 +255,11 @@ msgstr ""
msgid "Save As..."
msgstr ""
#: ../browser/send_by_email.py:52
#: ../browser/send_by_email.py:29
msgid "Select a value here"
msgstr ""
#: ../browser/send_by_email.py:55
msgid "Send"
msgstr ""