[imp] compose windows does not close and subject misses spaces
Ryan Gallagher
ryan@studiesabroad.com
Thu Oct 24 21:21:37 2002
Quoting Amith Varghese <amith@xalan.com>:
> > We just added JS regex to the compose.inc template to filter on these
> problem
> > characters.
>
> Is this something that could be submitted back as a patch? One of my users
> experienced this problem on IE and it would be nice to solve it.
>
> Thanks
> Amith
The only reason I didn't submit it as a patch is because the JS probably
should have gone in the actual JS library file, and I was waiting to see if
any more chararacters cropped up with the same problem.
Yes it was an IE specific problem that arose from external Text being pasted
into imp, the part that baffles us is that it only causes issues when an
attachment is involved. Otherwise the messages send fine in IE without the
attachment.
Here's the function (although they aren't illegal so "buggy" prob would have
been a better name). Also I pre-empted a couple of char types that I hadn't
witnessed yet but figured better safe than sorry.
function ReplaceIllegal() {
// the following are for the attachments bugfix
var str = document.compose.message.value;
// LEFT ANGLED DQUOTE
str = str.replace( /\u201D/g, '\"');
// RIGHT ANGLED DQUOTE
str = str.replace( /\u201C/g, '\"');
// LEFT ANGLED SINGLE QUOTE
str = str.replace( /\u2018/g, '\'');
// RIGHT ANGLED SINGLE QUOTE
str = str.replace( /\u2019/g, '\'');
// ELIPSES
str = str.replace( /\u2026/g, '...');
// MED DASH
str = str.replace( /\u2013/g, '--');
// LONG DASH
str = str.replace( /\u2014/g, '---');
document.compose.message.value = str;
}
Here you can see where I inserted it into the uniqSubmit inside
templates/compose.inc. It's really only necessary for IE and for the case
when attachments are present. But this worked so i haven't touched it since.
function uniqSubmit()
{
var now = new Date();
document.compose.action = document.compose.action + now.getTime();
replaceIllegal();
document.compose.submit();
}
ASIDE: I have another potiental patch that facilitates pasteing of newline
delimited email addresses into TO/CC/BCC (say from an excel column) via
changing those input fields to textareas and using regex to dynamic make them
comma delimited instead of \n(\r\n) (added \:, \; and \| as acceptable too).
Made it look like it did before with style="height:XX" attribute. Users
barely notice difference unless they have long lists of addresses, in which
case it wraps instead of extending to the right.
This was a big issue for some of our users migrating from Outlook as imp would
drop any pasted emails beyond the first \n
--
Ryan T. Gallagher
ryan@studiesabroad.com
International Studies Abroad
http://www.studiesabroad.com
(512)480-8522