bug #359712 bad handling of attendees (entry corruption)

This commit is contained in:
michael.buettner%sun.com 2007-03-16 08:47:44 +00:00
Родитель ffe6cb6610
Коммит 28ae23d79e
2 изменённых файлов: 26 добавлений и 18 удалений

Просмотреть файл

@ -326,7 +326,7 @@
if (aDisableIfOrganizer) { if (aDisableIfOrganizer) {
if (aAttendee) { if (aAttendee) {
if (this.mOrganizerID && this.mOrganizerID != "") { if (this.mOrganizerID && this.mOrganizerID != "") {
if (aAttendee.id == this.mOrganizerID) { if (aAttendee.id.toLowerCase() == this.mOrganizerID.toLowerCase()) {
input.setAttribute("disabled","true"); input.setAttribute("disabled","true");
} }
} }
@ -347,21 +347,26 @@
// construct the display string from common name and/or email address. // construct the display string from common name and/or email address.
var inputValue = aAttendee.commonName; var inputValue = aAttendee.commonName;
var regexp = new RegExp("^mailto:(.*)", "i");
if(inputValue) { if(inputValue) {
var email = aAttendee.id; var email = aAttendee.id;
if(email && email.length) { if(email && email.length) {
if (email.indexOf("mailto:") == 0) if (regexp.test(email)) {
email = email.split("mailto:")[1] inputValue += ' <' + RegExp.$1 + '>';
inputValue += ' <'+email+'>'; } else {
inputValue += ' <' + email + '>';
}
} }
} else { } else {
var email = aAttendee.id; var email = aAttendee.id;
if(email && email.length) { if(email && email.length) {
if (email.indexOf("mailto:") == 0) if (regexp.test(email)) {
email = email.split("mailto:")[1] inputValue = RegExp.$1;
} else {
inputValue = email; inputValue = email;
} }
} }
}
// remove leading spaces // remove leading spaces
while (inputValue && inputValue[0] == " " ) while (inputValue && inputValue[0] == " " )
@ -374,7 +379,7 @@
if (aAttendee) { if (aAttendee) {
if (this.mOrganizerID && this.mOrganizerID != "") { if (this.mOrganizerID && this.mOrganizerID != "") {
if (aAttendee.id == this.mOrganizerID) { if (aAttendee.id.toLowerCase() == this.mOrganizerID.toLowerCase()) {
icon.setAttribute("class","status-icon"); icon.setAttribute("class","status-icon");
icon.setAttribute("status",aAttendee.participationStatus); icon.setAttribute("status",aAttendee.participationStatus);
@ -501,9 +506,9 @@
// to look like an email-address, we prepend the prefix. // to look like an email-address, we prepend the prefix.
// this also allows for non-email-addresses. // this also allows for non-email-addresses.
var email = emailAddresses.value[0]; var email = emailAddresses.value[0];
if (email.indexOf("mailto:") != 0) if (email.toLowerCase().indexOf("mailto:") != 0)
if (email.indexOf("@") >= 0) if (email.indexOf("@") >= 0)
email = "mailto:" + email; email = "MAILTO:" + email;
attendee.id = email; attendee.id = email;
} }
if(names.value.length > 0) { if(names.value.length > 0) {
@ -512,7 +517,7 @@
var addAttendee = true; var addAttendee = true;
if (this.mOrganizerID && this.mOrganizerID != "") { if (this.mOrganizerID && this.mOrganizerID != "") {
if (attendee.id == this.mOrganizerID) { if (attendee.id.toLowerCase() == this.mOrganizerID.toLowerCase()) {
if (i == 1) { if (i == 1) {
addAttendee = false; addAttendee = false;
} }
@ -563,9 +568,9 @@
// to look like an email-address, we prepend the prefix. // to look like an email-address, we prepend the prefix.
// this also allows for non-email-addresses. // this also allows for non-email-addresses.
var email = emailAddresses.value[0]; var email = emailAddresses.value[0];
if (email.indexOf("mailto:") != 0) if (email.toLowerCase().indexOf("mailto:") != 0)
if (email.indexOf("@") >= 0) if (email.indexOf("@") >= 0)
email = "mailto:" + email; email = "MAILTO:" + email;
attendee.id = email; attendee.id = email;
} }
if(names.value.length > 0) { if(names.value.length > 0) {
@ -573,7 +578,7 @@
} }
if (this.mOrganizerID && this.mOrganizerID != "") { if (this.mOrganizerID && this.mOrganizerID != "") {
if (attendee.id == this.mOrganizerID) { if (attendee.id.toLowerCase() == this.mOrganizerID.toLowerCase()) {
return attendee; return attendee;
} }
} }
@ -610,9 +615,9 @@
// to look like an email-address, we prepend the prefix. // to look like an email-address, we prepend the prefix.
// this also allows for non-email-addresses. // this also allows for non-email-addresses.
email = emailAddresses.value[0]; email = emailAddresses.value[0];
if (email.indexOf("mailto:") != 0) if (email.toLowerCase().indexOf("mailto:") != 0)
if (email.indexOf("@") >= 0) if (email.indexOf("@") >= 0)
email = "mailto:" + email; email = "MAILTO:" + email;
} }
var isdirty = false; var isdirty = false;

Просмотреть файл

@ -2654,6 +2654,7 @@ function browseDocument()
function updateAttendees() function updateAttendees()
{ {
var regexp = new RegExp("^mailto:(.*)", "i");
var attendeeRow = document.getElementById("attendee-row"); var attendeeRow = document.getElementById("attendee-row");
if(!window.attendees || !window.attendees.length) { if(!window.attendees || !window.attendees.length) {
attendeeRow.setAttribute('collapsed','true'); attendeeRow.setAttribute('collapsed','true');
@ -2667,9 +2668,11 @@ function updateAttendees()
attendeeNames += attendee.commonName; attendeeNames += attendee.commonName;
} else if(attendee.id && attendee.id.length) { } else if(attendee.id && attendee.id.length) {
var email = attendee.id; var email = attendee.id;
if (email.indexOf("mailto:") == 0) if (regexp.test(email)) {
email = email.split("mailto:")[1] attendeeNames += RegExp.$1;
} else {
attendeeNames += email; attendeeNames += email;
}
} else { } else {
continue; continue;
} }