1 var contactSelectorAction = 'mailer-contacts';
3 function onContactAdd() {
5 var selectorURL = '?popup=YES&selectorId=mailer-contacts';
7 urlstr = ApplicationBaseURL;
8 if (urlstr[urlstr.length-1] != '/')
10 urlstr += ("../../" + UserLogin + "/Contacts/"
11 + contactSelectorAction + selectorURL);
13 var w = window.open(urlstr, "Addressbook",
14 "width=640,height=400,resizable=1,scrollbars=0");
15 w.selector = selector;
22 function addContact(tag, fullContactName, contactId, contactName, contactEmail) {
23 if (!mailIsRecipient(contactEmail)) {
24 var neededOptionValue = 0;
26 neededOptionValue = 1;
27 else if (tag == "bcc")
28 neededOptionValue = 2;
32 var currentRow = $('row_' + counter);
35 var currentValue = currentRow.childNodesWithTag("span")[1].childNodesWithTag("input")[0].value;
36 if (currentValue == neededOptionValue) {
38 insertContact($("addr_" + counter), contactName, contactEmail);
41 currentRow = $('row_' + counter);
45 fancyAddRow(false, "");
46 $("row_" + counter).childNodesWithTag("span")[0].childNodesWithTag("select")[0].value
48 insertContact($("addr_" + counter), contactName, contactEmail);
53 function mailIsRecipient(mailto) {
54 var isRecipient = false;
57 var currentRow = $('row_' + counter);
59 var email = extractEmailAddress(mailto).toUpperCase();
61 while (currentRow && !isRecipient) {
62 var currentValue = $("addr_"+counter).value.toUpperCase();
63 if (currentValue.indexOf(email) > -1)
68 currentRow = $('row_' + counter);
75 function insertContact(inputNode, contactName, contactEmail) {
76 var value = '' + inputNode.value;
78 var newContact = contactName;
79 if (newContact.length > 0)
80 newContact += ' <' + contactEmail + '>';
82 newContact = contactEmail;
88 inputNode.value = value;
91 function toggleAttachments() {
92 var div = $("attachmentsArea");
93 if (div.style.display)
94 div.style.display = "";
96 div.style.display = "block;";
101 function updateInlineAttachmentList(sender, attachments) {
104 var div = $("attachmentsArea");
106 count = attachments.length;
110 for (var i = 0; i < count; i++) {
111 text = text + attachments[i];
112 text = text + '<br />';
115 var e = $('compose_attachments_list');
117 if (!div.style.display)
118 div.style.display = "block;";
121 div.style.display = "";