mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-08 23:19:04 +01:00
* Mail: show which email address has a wrong format when pasting multiple ones
This commit is contained in:
parent
ad059b81e7
commit
3372e1b1c2
@ -1121,33 +1121,41 @@ var et2_taglist_email = (function(){ "use strict"; return et2_taglist.extend(
|
|||||||
if (!valid)
|
if (!valid)
|
||||||
{
|
{
|
||||||
var parts = item.id.split(/, */);
|
var parts = item.id.split(/, */);
|
||||||
|
var items = [], errors = [];
|
||||||
if (parts.length > 1)
|
if (parts.length > 1)
|
||||||
{
|
{
|
||||||
valid = true;
|
|
||||||
for(var i=0; i < parts.length; ++i)
|
for(var i=0; i < parts.length; ++i)
|
||||||
{
|
{
|
||||||
parts[i] = parts[i].trim();
|
parts[i] = parts[i].trim();
|
||||||
if (!et2_url.prototype.EMAIL_PREG.test(parts[i]))
|
if (!et2_url.prototype.EMAIL_PREG.test(parts[i]))
|
||||||
{
|
{
|
||||||
valid = false;
|
errors.push(parts[i]);
|
||||||
break;
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
items.push({id: parts[i], label: parts[i]});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (valid)
|
item.id = item.label = errors.length ? errors.join(', ') : items.shift().id;
|
||||||
|
valid = !errors.length;
|
||||||
|
// insert further parts into taglist, after validation first one
|
||||||
|
if (items.length)
|
||||||
{
|
{
|
||||||
item.id = item.label = parts.shift();
|
// a bit ugly but unavoidable
|
||||||
// insert further parts into taglist, after validation first one
|
if (valid)
|
||||||
var taglist = this.taglist;
|
|
||||||
window.setTimeout(function()
|
|
||||||
{
|
{
|
||||||
var items = [];
|
// if no error, we need to delay insert, as taglist gets into wired state and shows first item twice
|
||||||
for(var i=0; i < parts.length; ++i)
|
var taglist = this.taglist;
|
||||||
|
window.setTimeout(function()
|
||||||
{
|
{
|
||||||
items.push({id: parts[i], label: parts[i]});
|
taglist.addToSelection(items);
|
||||||
|
}, 10);
|
||||||
}
|
}
|
||||||
taglist.addToSelection(items);
|
else
|
||||||
}, 10);
|
{
|
||||||
|
// if we have an error, we need to insert items now, to not overwrite the error
|
||||||
|
this.taglist.addToSelection(items);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user