diff --git a/calendar/base/content/dialogs/calendar-dialog-utils.js b/calendar/base/content/dialogs/calendar-dialog-utils.js index 30215c1db0..561ddf5e84 100644 --- a/calendar/base/content/dialogs/calendar-dialog-utils.js +++ b/calendar/base/content/dialogs/calendar-dialog-utils.js @@ -4,7 +4,7 @@ /* exported gInTab, gMainWindow, gTabmail, intializeTabOrWindowVariables, * dispose, setDialogId, loadReminders, saveReminder, - * commonUpdateReminder, updateLink, rearrangeAttendees, + * commonUpdateReminder, updateLink, * adaptScheduleAgent, sendMailToOrganizer, * openAttachmentFromItemSummary, */ @@ -572,168 +572,6 @@ function updateLink(itemUrlString, linkRow, urlLink) { } } -/** - * Set up attendees in event and summary dialog. - * - * @param {calIAttendee[]} attendees - The attendees. - * @param {Element} container - Element containing attendees rows, template, etc. - * @param {number} attendeesInRow - The number of attendees that can fit in each row. - * @param {number} maxLabelWidth - Maximum width of the label. - * @return {{attendeesInRow: number, maxLabelWidth: number}} The new values. - */ -function setupAttendees(attendees, container, attendeesInRow, maxLabelWidth) { - let attBox = container.querySelector(".item-attendees-box"); - let attBoxRows = attBox.getElementsByClassName("item-attendees-row"); - let newAttendeesInRow = attendeesInRow; - let newMaxLabelWidth = maxLabelWidth; - - if (attendees && attendees.length > 0) { - // cloning of the template nodes - let row = container.querySelector(".item-attendees-box-template .item-attendees-row"); - - let clonedRow = row.cloneNode(false); - let clonedCell = row.querySelector("box:nth-of-type(1)").cloneNode(true); - let clonedSpacer = row.querySelector("box:nth-of-type(2)").cloneNode(false); - - // determining of attendee box setup - let inRow = attendeesInRow || -1; - if (inRow == -1) { - inRow = determineAttendeesInRow(maxLabelWidth); - newAttendeesInRow = inRow; - } else { - while (attBoxRows.length > 0) { - attBox.removeChild(attBoxRows[0]); - } - } - - // set up of the required nodes - let maxRows = Math.ceil(attendees.length / inRow); - let inLastRow = attendees.length - (maxRows - 1) * inRow; - let attCount = 0; - while (attBox.getElementsByClassName("item-attendees-row").length < maxRows) { - let newRow = clonedRow.cloneNode(false); - let row = attBox.appendChild(newRow); - row.removeAttribute("hidden"); - let rowCount = attBox.getElementsByClassName("item-attendees-row").length; - let reqAtt = rowCount == maxRows ? inLastRow : inRow; - // we add as many attendee cells as required - while (row.children.length < reqAtt) { - let newCell = clonedCell.cloneNode(true); - let cell = row.appendChild(newCell); - let icon = cell.getElementsByTagName("img")[0]; - let text = cell.getElementsByTagName("label")[0]; - let attendee = attendees[attCount]; - - let label = - attendee.commonName && attendee.commonName.length - ? attendee.commonName - : attendee.toString(); - let userType = attendee.userType || "INDIVIDUAL"; - let role = attendee.role || "REQ-PARTICIPANT"; - let partstat = attendee.participationStatus || "NEEDS-ACTION"; - - icon.setAttribute("partstat", partstat); - icon.setAttribute("usertype", userType); - icon.setAttribute("role", role); - cell.setAttribute("attendeeid", attendee.id); - cell.removeAttribute("hidden"); - - let userTypeString = cal.l10n.getCalString("dialog.tooltip.attendeeUserType2." + userType, [ - attendee.toString(), - ]); - let roleString = cal.l10n.getCalString("dialog.tooltip.attendeeRole2." + role, [ - userTypeString, - ]); - let partstatString = cal.l10n.getCalString("dialog.tooltip.attendeePartStat2." + partstat, [ - label, - ]); - let tooltip = cal.l10n.getCalString("dialog.tooltip.attendee.combined", [ - roleString, - partstatString, - ]); - - let del = cal.itip.resolveDelegation(attendee, attendees); - if (del.delegators != "") { - del.delegators = cal.l10n.getCalString("dialog.attendee.append.delegatedFrom", [ - del.delegators, - ]); - label += " " + del.delegators; - tooltip += " " + del.delegators; - } - if (del.delegatees != "") { - del.delegatees = cal.l10n.getCalString("dialog.attendee.append.delegatedTo", [ - del.delegatees, - ]); - tooltip += " " + del.delegatees; - } - - text.setAttribute("value", label); - cell.setAttribute("tooltiptext", tooltip); - attCount++; - } - // we fill the row with placeholders if required - if (attBox.getElementsByClassName("item-attendees-row").length > 1 && inRow > 1) { - while (row.children.length < inRow) { - let newSpacer = clonedSpacer.cloneNode(true); - newSpacer.removeAttribute("hidden"); - row.appendChild(newSpacer); - } - } - } - - // determining of the max width of an attendee label - this needs to - // be done only once and is obsolete in case of resizing - if (!maxLabelWidth) { - let maxWidth = 0; - for (let cell of attBox.getElementsByClassName("item-attendees-cell")) { - cell = cell.cloneNode(true); - cell.removeAttribute("flex"); - cell.getElementsByTagName("label")[0].removeAttribute("flex"); - maxWidth = cell.clientWidth > maxWidth ? cell.clientWidth : maxWidth; - } - newMaxLabelWidth = maxWidth; - } - } else { - while (attBoxRows.length > 0) { - attBox.removeChild(attBoxRows[0]); - } - } - return { attendeesInRow: newAttendeesInRow, maxLabelWidth: newMaxLabelWidth }; -} - -/** - * Re-arranges the attendees on dialog resizing in event and summary dialog - * - * @param {calIAttendee[]} attendees - The attendees. - * @param {Element} parent - Element containing attendees rows, template, etc. - * @param {number} attendeesInRow - The number of attendees that can fit in each row. - * @param {number} maxLabelWidth - Maximum width of the label. - * @return {{attendeesInRow: number, maxLabelWidth: number}} The new values. - */ -function rearrangeAttendees(attendees, parent, attendeesInRow, maxLabelWidth) { - if (attendees && attendees.length > 0 && attendeesInRow) { - let inRow = determineAttendeesInRow(maxLabelWidth); - if (inRow != attendeesInRow) { - return setupAttendees(attendees, parent, inRow, maxLabelWidth); - } - } - return { attendeesInRow, maxLabelWidth }; -} - -/** - * Calculates the number of columns to distribute attendees for event and summary dialog - * - * @param {number} maxLabelWidth - The maximum width for the label. - * @return {number} The number of attendees that can fit in a row. - */ -function determineAttendeesInRow(maxLabelWidth) { - // as default value a reasonable high value is appropriate - // it will be recalculated anyway. - let minWidth = maxLabelWidth || 200; - let inRow = Math.floor(document.documentElement.clientWidth / minWidth); - return inRow > 1 ? inRow : 1; -} - /** * Adapts the scheduling responsibility for caldav servers according to RfC 6638 * based on forceEmailScheduling preference for the respective calendar diff --git a/calendar/base/content/dialogs/calendar-ics-file-dialog.js b/calendar/base/content/dialogs/calendar-ics-file-dialog.js index 66a3aa8450..0f91c1668c 100644 --- a/calendar/base/content/dialogs/calendar-ics-file-dialog.js +++ b/calendar/base/content/dialogs/calendar-ics-file-dialog.js @@ -81,12 +81,6 @@ async function onWindowLoad() { loadingMessage.remove(); document.addEventListener("dialogaccept", importRemainingItems); - - window.addEventListener("resize", () => { - for (let summary of gModel.itemSummaries.values()) { - summary.onWindowResize(); - } - }); }); } window.addEventListener("load", onWindowLoad); diff --git a/calendar/base/content/dialogs/calendar-summary-dialog.js b/calendar/base/content/dialogs/calendar-summary-dialog.js index b1de97542b..9b9c1c89c3 100644 --- a/calendar/base/content/dialogs/calendar-summary-dialog.js +++ b/calendar/base/content/dialogs/calendar-summary-dialog.js @@ -68,10 +68,6 @@ function onLoad() { // Finish setting up the item summary custom element. itemSummary.updateItemDetails(); - window.addEventListener("resize", () => { - itemSummary.onWindowResize(); - }); - updateToolbar(); updateDialogButtons(item); diff --git a/calendar/base/content/widgets/calendar-item-summary.css b/calendar/base/content/widgets/calendar-item-summary.css index b91a8df9d2..b496fab6c0 100644 --- a/calendar/base/content/widgets/calendar-item-summary.css +++ b/calendar/base/content/widgets/calendar-item-summary.css @@ -30,7 +30,10 @@ margin-inline: 0px; } -.calendar-summary-table .organizer-label, .calendar-summary-table .attachments-label { vertical-align: top; } + +.item-attendees .item-attendees-list-container { + min-height: 48px; +} diff --git a/calendar/base/content/widgets/calendar-item-summary.js b/calendar/base/content/widgets/calendar-item-summary.js index 3eb589d048..42d0cb9592 100644 --- a/calendar/base/content/widgets/calendar-item-summary.js +++ b/calendar/base/content/widgets/calendar-item-summary.js @@ -12,6 +12,7 @@ // Wrap in a block to prevent leaking to window scope. { + var { ltn } = ChromeUtils.import("resource:///modules/calendar/ltnInvitationUtils.jsm"); var { cal } = ChromeUtils.import("resource:///modules/calendar/calUtils.jsm"); var { recurrenceStringFromItem } = ChromeUtils.import( "resource:///modules/calendar/calRecurrenceUtils.jsm" @@ -82,17 +83,11 @@ -