Bug 1692480 - get rid of setElementValue(). r=darktrojan
This commit is contained in:
Родитель
db6240eab5
Коммит
9dae3c5143
|
@ -208,10 +208,10 @@ var calendarWindowPrefs = {
|
|||
if (aTopic == "nsPref:changed") {
|
||||
switch (aData) {
|
||||
case "calendar.view.useSystemColors": {
|
||||
let attributeValue =
|
||||
let useSystemColors =
|
||||
Services.prefs.getBoolPref("calendar.view.useSystemColors", false) && "true";
|
||||
for (let win of Services.ww.getWindowEnumerator()) {
|
||||
setElementValue(win.document.documentElement, attributeValue, "systemcolors");
|
||||
win.document.documentElement.toggleAttribute("systemcolors", useSystemColors);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -219,9 +219,9 @@ var calendarWindowPrefs = {
|
|||
} else if (aTopic == "domwindowopened") {
|
||||
let win = aSubject;
|
||||
win.addEventListener("load", () => {
|
||||
let attributeValue =
|
||||
let useSystemColors =
|
||||
Services.prefs.getBoolPref("calendar.view.useSystemColors", false) && "true";
|
||||
setElementValue(win.document.documentElement, attributeValue, "systemcolors");
|
||||
win.document.documentElement.toggleAttribute("systemcolors", useSystemColors);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/* global MozElements, MozXULElement, setBooleanAttribute, onMouseOverItem
|
||||
invokeEventDragSession, setElementValue */
|
||||
invokeEventDragSession */
|
||||
|
||||
"use strict";
|
||||
|
||||
|
@ -311,11 +311,7 @@
|
|||
cal.alarms.addReminderImages(iconsBox, alarms);
|
||||
|
||||
// Set suppressed status on the icons box.
|
||||
setElementValue(
|
||||
iconsBox,
|
||||
item.calendar.getProperty("suppressAlarms") || false,
|
||||
"suppressed"
|
||||
);
|
||||
iconsBox.toggleAttribute("suppressed", item.calendar.getProperty("suppressAlarms"));
|
||||
}
|
||||
|
||||
// Item classification / privacy.
|
||||
|
|
|
@ -9,8 +9,6 @@ var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
|||
* tearDownInvitationsManager
|
||||
*/
|
||||
|
||||
/* globals setElementValue */
|
||||
|
||||
/**
|
||||
* This object contains functions to take care of manipulating requests.
|
||||
*/
|
||||
|
@ -75,7 +73,7 @@ var gInvitationsOperationListener = {
|
|||
if (Components.isSuccessCode(aStatus)) {
|
||||
let value = cal.l10n.getLtnString("invitationsLink.label", [this.mCount]);
|
||||
document.getElementById("calendar-invitations-label").value = value;
|
||||
setElementValue(invitationsBox, this.mCount < 1 && "true", "hidden");
|
||||
invitationsBox.hidden = this.mCount < 1;
|
||||
} else {
|
||||
invitationsBox.setAttribute("hidden", "true");
|
||||
}
|
||||
|
|
|
@ -546,7 +546,7 @@ function calendarListTooltipShowing(event) {
|
|||
tooltipText = cal.l10n.getCalString("tooltipCalendarReadOnly", [calendarName]);
|
||||
}
|
||||
|
||||
setElementValue("calendar-list-tooltip", tooltipText, "label");
|
||||
document.getElementById("calendar-list-tooltip").label = tooltipText;
|
||||
return !!tooltipText;
|
||||
}
|
||||
|
||||
|
@ -574,20 +574,16 @@ function calendarListSetupContextMenu(event) {
|
|||
|
||||
if (calendar) {
|
||||
let stringName = composite.getCalendarById(calendar.id) ? "hideCalendar" : "showCalendar";
|
||||
setElementValue(
|
||||
"list-calendars-context-togglevisible",
|
||||
cal.l10n.getCalString(stringName, [calendar.name]),
|
||||
"label"
|
||||
);
|
||||
document.getElementById(
|
||||
"list-calendars-context-togglevisible"
|
||||
).label = cal.l10n.getCalString(stringName, [calendar.name]);
|
||||
let accessKey = document
|
||||
.getElementById("list-calendars-context-togglevisible")
|
||||
.getAttribute(composite.getCalendarById(calendar.id) ? "accesskeyhide" : "accesskeyshow");
|
||||
setElementValue("list-calendars-context-togglevisible", accessKey, "accesskey");
|
||||
setElementValue(
|
||||
"list-calendars-context-showonly",
|
||||
cal.l10n.getCalString("showOnlyCalendar", [calendar.name]),
|
||||
"label"
|
||||
);
|
||||
document.getElementById("list-calendars-context-togglevisible").accessKey = accessKey;
|
||||
document.getElementById(
|
||||
"list-calendars-context-showonly"
|
||||
).label = cal.l10n.getCalString("showOnlyCalendar", [calendar.name]);
|
||||
setupDeleteMenuitem("list-calendars-context-delete", calendar);
|
||||
for (let elem of event.target.querySelectorAll(".needs-calendar")) {
|
||||
elem.removeAttribute("collapsed");
|
||||
|
@ -620,8 +616,10 @@ function setupDeleteMenuitem(aDeleteId, aCalendar) {
|
|||
}
|
||||
|
||||
let deleteItem = document.getElementById(aDeleteId);
|
||||
setElementValue(deleteItem, deleteItem.getAttribute("label" + type), "label");
|
||||
setElementValue(deleteItem, deleteItem.getAttribute("accesskey" + type), "accesskey");
|
||||
// Dynamically set labelremove, labeldelete, labelunsubscribe
|
||||
deleteItem.setAttribute("label", deleteItem.getAttribute("label" + type, "label"));
|
||||
// Dynamically set accesskeyremove, accesskeydelete, accesskeyunsubscribe
|
||||
deleteItem.setAttribute("label", deleteItem.getAttribute("accesskey" + type, "accesskey"));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -57,8 +57,8 @@ var taskEdit = {
|
|||
*/
|
||||
setupTaskField(aTarget, aDisable, aValue) {
|
||||
aTarget.value = aValue;
|
||||
setElementValue(aTarget, aDisable && "true", "readonly");
|
||||
setElementValue(aTarget, aDisable && "true", "aria-disabled");
|
||||
aTarget.readonly = aDisable;
|
||||
aTarget.ariaDisabled = aDisable;
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -19,65 +19,6 @@ var { PluralForm } = ChromeUtils.import("resource://gre/modules/PluralForm.jsm")
|
|||
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
var { XPCOMUtils } = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
/**
|
||||
* Helper function for filling the form,
|
||||
* Set the value of a property of a XUL element
|
||||
*
|
||||
* @param aElement ID of XUL element to set, or the element node itself
|
||||
* @param aNewValue value to set property to ( if undefined no change is made )
|
||||
* @param aPropertyName OPTIONAL name of property to set, default is "value",
|
||||
* use "checked" for radios & checkboxes, "data" for
|
||||
* drop-downs
|
||||
*/
|
||||
function setElementValue(aElement, aNewValue, aPropertyName) {
|
||||
cal.ASSERT(aElement, "aElement");
|
||||
|
||||
if (aNewValue !== undefined) {
|
||||
if (typeof aElement == "string") {
|
||||
aElement = document.getElementById(aElement);
|
||||
cal.ASSERT(aElement, "aElement");
|
||||
}
|
||||
|
||||
if (!aElement) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (aNewValue === false) {
|
||||
try {
|
||||
aElement.removeAttribute(aPropertyName);
|
||||
} catch (e) {
|
||||
cal.ERROR(
|
||||
"setElementValue: aElement.removeAttribute couldn't remove " +
|
||||
aPropertyName +
|
||||
" from " +
|
||||
(aElement && aElement.localName) +
|
||||
" e: " +
|
||||
e +
|
||||
"\n"
|
||||
);
|
||||
}
|
||||
} else if (aPropertyName) {
|
||||
try {
|
||||
aElement.setAttribute(aPropertyName, aNewValue);
|
||||
} catch (e) {
|
||||
cal.ERROR(
|
||||
"setElementValue: aElement.setAttribute couldn't set " +
|
||||
aPropertyName +
|
||||
" from " +
|
||||
(aElement && aElement.localName) +
|
||||
" to " +
|
||||
aNewValue +
|
||||
" e: " +
|
||||
e +
|
||||
"\n"
|
||||
);
|
||||
}
|
||||
} else {
|
||||
aElement.value = aNewValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function for getting data from the form,
|
||||
* Get the value of a property of a XUL element
|
||||
|
@ -106,7 +47,14 @@ function getElementValue(aElement, aPropertyName) {
|
|||
* @return Returns aValue (for chaining)
|
||||
*/
|
||||
function setBooleanAttribute(aXulElement, aAttribute, aValue) {
|
||||
setElementValue(aXulElement, aValue ? "true" : false, aAttribute);
|
||||
if (typeof aXulElement == "string") {
|
||||
aXulElement = document.getElementById(aXulElement);
|
||||
}
|
||||
if (aValue === false) {
|
||||
aXulElement.removeAttribute(aAttribute);
|
||||
} else {
|
||||
aXulElement.setAttribute(aAttribute, !!aValue);
|
||||
}
|
||||
return aValue;
|
||||
}
|
||||
|
||||
|
@ -314,11 +262,11 @@ function setAttributeToChildren(aParent, aAttribute, aValue, aFilterAttribute, a
|
|||
for (let i = 0; i < aParent.children.length; i++) {
|
||||
let element = aParent.children[i];
|
||||
if (aFilterAttribute == null) {
|
||||
setElementValue(element, aValue, aAttribute);
|
||||
element[aAttribute] = aValue;
|
||||
} else if (element.hasAttribute(aFilterAttribute)) {
|
||||
let compValue = element.getAttribute(aFilterAttribute);
|
||||
if (compValue === aFilterValue) {
|
||||
setElementValue(element, aValue, aAttribute);
|
||||
element[aAttribute] = aValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -210,14 +210,14 @@ function updateReminderDetails(reminderDetails, reminderList, calendar) {
|
|||
if (reminderList.value == "custom") {
|
||||
// Depending on how many alarms we have, show either the "Multiple Alarms"
|
||||
// label or the single reminder label.
|
||||
setElementValue(reminderMultipleLabel, reminders.length < 2 && "true", "hidden");
|
||||
setElementValue(reminderSingleLabel, reminders.length > 1 && "true", "hidden");
|
||||
reminderMultipleLabel.hidden = reminders.length < 2;
|
||||
reminderSingleLabel.hidden = reminders.length > 1;
|
||||
|
||||
cal.alarms.addReminderImages(iconBox, reminders);
|
||||
|
||||
// If there is only one reminder, display the reminder string
|
||||
if (reminders.length == 1) {
|
||||
setElementValue(reminderSingleLabel, reminders[0].toString(window.calendarItem));
|
||||
reminderSingleLabel.value = reminders[0].toString(window.calendarItem);
|
||||
}
|
||||
} else {
|
||||
reminderMultipleLabel.setAttribute("hidden", "true");
|
||||
|
@ -491,7 +491,7 @@ function commonUpdateReminder(
|
|||
if (reminders.some(x => x.related == Ci.calIAlarm.ALARM_RELATED_START)) {
|
||||
// ...automatically check 'has entrydate'.
|
||||
if (!getElementValue("todo-has-entrydate", "checked")) {
|
||||
setElementValue("todo-has-entrydate", "true", "checked");
|
||||
document.getElementById("todo-has-entrydate").checked = true;
|
||||
|
||||
// Make sure gStartTime is properly initialized
|
||||
updateEntryDate();
|
||||
|
@ -505,7 +505,7 @@ function commonUpdateReminder(
|
|||
if (reminders.some(x => x.related == Ci.calIAlarm.ALARM_RELATED_END)) {
|
||||
// ...automatically check 'has duedate'.
|
||||
if (!getElementValue("todo-has-duedate", "checked")) {
|
||||
setElementValue("todo-has-duedate", "true", "checked");
|
||||
document.getElementById("todo-has-duedate").checked = true;
|
||||
|
||||
// Make sure gStartTime is properly initialized
|
||||
updateDueDate();
|
||||
|
@ -561,8 +561,8 @@ function updateLink(itemUrlString, linkRow, urlLink) {
|
|||
|
||||
setTimeout(() => {
|
||||
// HACK the url link doesn't crop when setting the value in onLoad
|
||||
setElementValue(urlLink, itemUrlString);
|
||||
setElementValue(urlLink, itemUrlString, "href");
|
||||
urlLink.value = itemUrlString;
|
||||
urlLink.href = itemUrlString;
|
||||
}, 0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -247,8 +247,8 @@ var dateTimePickerUI = {
|
|||
|
||||
changeAllDay() {
|
||||
let allDay = this.allDay.checked;
|
||||
setElementValue("event-starttime", allDay, "timepickerdisabled");
|
||||
setElementValue("event-endtime", allDay, "timepickerdisabled");
|
||||
document.getElementById("event-starttime").toggleAttribute("timepickerdisabled", allDay);
|
||||
document.getElementById("event-endtime").toggleAttribute("timepickerdisabled", allDay);
|
||||
|
||||
if (allDay) {
|
||||
// Store date-times and related timezones so we can restore
|
||||
|
|
|
@ -378,7 +378,7 @@ function onLoad() {
|
|||
|
||||
// Set starting value for 'repeat until' rule and highlight the start date.
|
||||
let repeatDate = cal.dtz.dateTimeToJsDate(gStartTime.getInTimezone(cal.dtz.floating));
|
||||
setElementValue("repeat-until-date", repeatDate);
|
||||
document.getElementById("repeat-until-date").value = repeatDate;
|
||||
document.getElementById("repeat-until-date").extraDate = repeatDate;
|
||||
|
||||
if (item.parentItem != item) {
|
||||
|
@ -431,8 +431,8 @@ function initializeControls(rule) {
|
|||
if (aByMonthDay == -1) {
|
||||
// The last day of the month.
|
||||
document.getElementById("yearly-group").selectedIndex = 1;
|
||||
setElementValue("yearly-ordinal", -1);
|
||||
setElementValue("yearly-weekday", -1);
|
||||
document.getElementById("yearly-ordinal").value = -1;
|
||||
document.getElementById("yearly-weekday").value = -1;
|
||||
} else {
|
||||
if (aByMonthDay < -1) {
|
||||
// The UI doesn't manage negative days apart from -1 but we can
|
||||
|
@ -440,7 +440,7 @@ function initializeControls(rule) {
|
|||
aByMonthDay += aDate.endOfMonth.day + 1;
|
||||
}
|
||||
document.getElementById("yearly-group").selectedIndex = 0;
|
||||
setElementValue("yearly-days", aByMonthDay);
|
||||
document.getElementById("yearly-days").value = aByMonthDay;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -453,18 +453,18 @@ function initializeControls(rule) {
|
|||
switch (rule.type) {
|
||||
case "DAILY":
|
||||
document.getElementById("period-list").selectedIndex = 0;
|
||||
setElementValue("daily-days", rule.interval);
|
||||
document.getElementById("daily-days").value = rule.interval;
|
||||
break;
|
||||
case "WEEKLY":
|
||||
setElementValue("weekly-weeks", rule.interval);
|
||||
document.getElementById("weekly-weeks").value = rule.interval;
|
||||
document.getElementById("period-list").selectedIndex = 1;
|
||||
break;
|
||||
case "MONTHLY":
|
||||
setElementValue("monthly-interval", rule.interval);
|
||||
document.getElementById("monthly-interval").value = rule.interval;
|
||||
document.getElementById("period-list").selectedIndex = 2;
|
||||
break;
|
||||
case "YEARLY":
|
||||
setElementValue("yearly-interval", rule.interval);
|
||||
document.getElementById("yearly-interval").value = rule.interval;
|
||||
document.getElementById("period-list").selectedIndex = 3;
|
||||
break;
|
||||
default:
|
||||
|
@ -502,24 +502,24 @@ function initializeControls(rule) {
|
|||
document.getElementById("monthly-group").selectedIndex = 1;
|
||||
DaypickerMonthday.days = [startDate.day];
|
||||
let day = Math.floor((startDate.day - 1) / 7) + 1;
|
||||
setElementValue("monthly-ordinal", day);
|
||||
setElementValue("monthly-weekday", startDate.weekday + 1);
|
||||
document.getElementById("monthly-ordinal").value = day;
|
||||
document.getElementById("monthly-weekday").value = startDate.weekday + 1;
|
||||
} else if (everyWeekDay(byDayRuleComponent)) {
|
||||
// Every day of the month.
|
||||
document.getElementById("monthly-group").selectedIndex = 0;
|
||||
setElementValue("monthly-ordinal", 0);
|
||||
setElementValue("monthly-weekday", -1);
|
||||
document.getElementById("monthly-ordinal").value = 0;
|
||||
document.getElementById("monthly-weekday").value = -1;
|
||||
} else if (byDayRuleComponent.length > 0) {
|
||||
// One of the first five days or weekdays of the month.
|
||||
document.getElementById("monthly-group").selectedIndex = 0;
|
||||
let ruleInfo = getOrdinalAndWeekdayOfRule(byDayRuleComponent[0]);
|
||||
setElementValue("monthly-ordinal", ruleInfo.ordinal);
|
||||
setElementValue("monthly-weekday", ruleInfo.weekday);
|
||||
document.getElementById("monthly-ordinal").value = ruleInfo.ordinal;
|
||||
document.getElementById("monthly-weekday").value = ruleInfo.weekday;
|
||||
} else if (byMonthDayRuleComponent.length == 1 && byMonthDayRuleComponent[0] == -1) {
|
||||
// The last day of the month.
|
||||
document.getElementById("monthly-group").selectedIndex = 0;
|
||||
setElementValue("monthly-ordinal", byMonthDayRuleComponent[0]);
|
||||
setElementValue("monthly-weekday", byMonthDayRuleComponent[0]);
|
||||
document.getElementById("monthly-ordinal").value = byMonthDayRuleComponent[0];
|
||||
document.getElementById("monthly-weekday").value = byMonthDayRuleComponent[0];
|
||||
} else if (byMonthDayRuleComponent.length > 0) {
|
||||
document.getElementById("monthly-group").selectedIndex = 1;
|
||||
DaypickerMonthday.days = byMonthDayRuleComponent;
|
||||
|
@ -527,19 +527,19 @@ function initializeControls(rule) {
|
|||
|
||||
// "YEARLY" ruletype
|
||||
if (byMonthRuleComponent.length == 0 || rule.type != "YEARLY") {
|
||||
setElementValue("yearly-month-rule", startDate.month + 1);
|
||||
setElementValue("yearly-month-ordinal", startDate.month + 1);
|
||||
document.getElementById("yearly-month-rule").value = startDate.month + 1;
|
||||
document.getElementById("yearly-month-ordinal").value = startDate.month + 1;
|
||||
if (byMonthDayRuleComponent.length > 0) {
|
||||
setControlsForByMonthDay_YearlyRule(startDate, byMonthDayRuleComponent[0]);
|
||||
} else {
|
||||
setElementValue("yearly-days", startDate.day);
|
||||
document.getElementById("yearly-days").value = startDate.day;
|
||||
let ordinalDay = Math.floor((startDate.day - 1) / 7) + 1;
|
||||
setElementValue("yearly-ordinal", ordinalDay);
|
||||
setElementValue("yearly-weekday", startDate.weekday + 1);
|
||||
document.getElementById("yearly-ordinal").value = ordinalDay;
|
||||
document.getElementById("yearly-weekday").value = startDate.weekday + 1;
|
||||
}
|
||||
} else {
|
||||
setElementValue("yearly-month-rule", byMonthRuleComponent[0]);
|
||||
setElementValue("yearly-month-ordinal", byMonthRuleComponent[0]);
|
||||
document.getElementById("yearly-month-rule").value = byMonthRuleComponent[0];
|
||||
document.getElementById("yearly-month-ordinal").value = byMonthRuleComponent[0];
|
||||
if (byMonthDayRuleComponent.length > 0) {
|
||||
let date = startDate.clone();
|
||||
date.month = byMonthRuleComponent[0] - 1;
|
||||
|
@ -548,26 +548,26 @@ function initializeControls(rule) {
|
|||
document.getElementById("yearly-group").selectedIndex = 1;
|
||||
if (everyWeekDay(byDayRuleComponent)) {
|
||||
// Every day of the month.
|
||||
setElementValue("yearly-ordinal", 0);
|
||||
setElementValue("yearly-weekday", -1);
|
||||
document.getElementById("yearly-ordinal").value = 0;
|
||||
document.getElementById("yearly-weekday").value = -1;
|
||||
} else {
|
||||
let yearlyRuleInfo = getOrdinalAndWeekdayOfRule(byDayRuleComponent[0]);
|
||||
setElementValue("yearly-ordinal", yearlyRuleInfo.ordinal);
|
||||
setElementValue("yearly-weekday", yearlyRuleInfo.weekday);
|
||||
document.getElementById("yearly-ordinal").value = yearlyRuleInfo.ordinal;
|
||||
document.getElementById("yearly-weekday").value = yearlyRuleInfo.weekday;
|
||||
}
|
||||
} else if (byMonthRuleComponent.length > 0) {
|
||||
document.getElementById("yearly-group").selectedIndex = 0;
|
||||
setElementValue("yearly-days", startDate.day);
|
||||
document.getElementById("yearly-days").value = startDate.day;
|
||||
}
|
||||
}
|
||||
|
||||
/* load up the duration of the event radiogroup */
|
||||
if (rule.isByCount) {
|
||||
if (rule.count == -1) {
|
||||
setElementValue("recurrence-duration", "forever");
|
||||
document.getElementById("recurrence-duration").value = "forever";
|
||||
} else {
|
||||
setElementValue("recurrence-duration", "ntimes");
|
||||
setElementValue("repeat-ntimes-count", rule.count);
|
||||
document.getElementById("recurrence-duration").value = "ntimes";
|
||||
document.getElementById("repeat-ntimes-count").value = rule.count;
|
||||
}
|
||||
} else {
|
||||
let untilDate = rule.untilDate;
|
||||
|
@ -579,10 +579,10 @@ function initializeControls(rule) {
|
|||
gUntilDate = gStartTime.clone();
|
||||
}
|
||||
let repeatDate = cal.dtz.dateTimeToJsDate(gUntilDate.getInTimezone(cal.dtz.floating));
|
||||
setElementValue("recurrence-duration", "until");
|
||||
setElementValue("repeat-until-date", repeatDate);
|
||||
document.getElementById("recurrence-duration").value = "until";
|
||||
document.getElementById("repeat-until-date").value = repeatDate;
|
||||
} else {
|
||||
setElementValue("recurrence-duration", "forever");
|
||||
document.getElementById("recurrence-duration").value = "forever";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -963,7 +963,7 @@ function checkUntilDate() {
|
|||
let repeatDate = cal.dtz.dateTimeToJsDate(
|
||||
(gUntilDate || gStartTime).getInTimezone(cal.dtz.floating)
|
||||
);
|
||||
setElementValue("repeat-until-date", repeatDate);
|
||||
document.getElementById("repeat-until-date").value = repeatDate;
|
||||
checkUntilDate.warning = true;
|
||||
let callback = function() {
|
||||
// No warning when the dialog is being closed with the Cancel button.
|
||||
|
|
|
@ -38,17 +38,21 @@ function onLoad() {
|
|||
return cal.l10n.getString("calendar-alarms", getItemBundleStringName(x));
|
||||
}
|
||||
|
||||
setElementValue(
|
||||
"reminder-before-start-menuitem",
|
||||
_sn("reminderCustomOriginBeginBefore"),
|
||||
"label"
|
||||
document.getElementById("reminder-before-start-menuitem").label = _sn(
|
||||
"reminderCustomOriginBeginBefore"
|
||||
);
|
||||
|
||||
setElementValue("reminder-after-start-menuitem", _sn("reminderCustomOriginBeginAfter"), "label");
|
||||
document.getElementById("reminder-after-start-menuitem").label = _sn(
|
||||
"reminderCustomOriginBeginAfter"
|
||||
);
|
||||
|
||||
setElementValue("reminder-before-end-menuitem", _sn("reminderCustomOriginEndBefore"), "label");
|
||||
document.getElementById("reminder-before-end-menuitem").label = _sn(
|
||||
"reminderCustomOriginEndBefore"
|
||||
);
|
||||
|
||||
setElementValue("reminder-after-end-menuitem", _sn("reminderCustomOriginEndAfter"), "label");
|
||||
document.getElementById("reminder-after-end-menuitem").label = _sn(
|
||||
"reminderCustomOriginEndAfter"
|
||||
);
|
||||
|
||||
// Set up the action map
|
||||
let supportedActions = calendar.getProperty("capabilities.alarms.actionValues") || ["DISPLAY"]; // TODO email support, "EMAIL"
|
||||
|
@ -63,7 +67,7 @@ function onLoad() {
|
|||
let shouldHide =
|
||||
!(actionNode.value in allowedActionsMap) ||
|
||||
(actionNode.hasAttribute("provider") && actionNode.getAttribute("provider") != calendar.type);
|
||||
setElementValue(actionNode, shouldHide && "true", "hidden");
|
||||
actionNode.hidden = shouldHide;
|
||||
if (!firstAvailableItem && !shouldHide) {
|
||||
firstAvailableItem = actionNode;
|
||||
}
|
||||
|
@ -132,33 +136,28 @@ function setupRadioEnabledState(aDisableAll) {
|
|||
let relationItem = document.getElementById("reminder-relation-radiogroup").selectedItem;
|
||||
let relativeDisabled, absoluteDisabled;
|
||||
|
||||
// Note that the mix of string/boolean here is not a mistake.
|
||||
// setElementValue removes the attribute from the node if the second
|
||||
// parameter is === false, otherwise sets the attribute value to the given
|
||||
// string (i.e "true").
|
||||
if (aDisableAll) {
|
||||
relativeDisabled = "true";
|
||||
absoluteDisabled = "true";
|
||||
relativeDisabled = true;
|
||||
absoluteDisabled = true;
|
||||
} else if (relationItem) {
|
||||
// This is not a mistake, when this function is called from onselect,
|
||||
// the value has not been set.
|
||||
relativeDisabled = relationItem.value == "absolute" && "true";
|
||||
absoluteDisabled = relationItem.value == "relative" && "true";
|
||||
relativeDisabled = relationItem.value == "absolute";
|
||||
absoluteDisabled = relationItem.value == "relative";
|
||||
} else {
|
||||
relativeDisabled = false;
|
||||
absoluteDisabled = false;
|
||||
}
|
||||
|
||||
setElementValue("reminder-length", relativeDisabled, "disabled");
|
||||
setElementValue("reminder-unit", relativeDisabled, "disabled");
|
||||
setElementValue("reminder-relation-origin", relativeDisabled, "disabled");
|
||||
document.getElementById("reminder-length").disabled = relativeDisabled;
|
||||
document.getElementById("reminder-unit").disabled = relativeDisabled;
|
||||
document.getElementById("reminder-relation-origin").disabled = relativeDisabled;
|
||||
|
||||
setElementValue("reminder-absolute-date", absoluteDisabled, "disabled");
|
||||
document.getElementById("reminder-absolute-date").setAttribute("disabled", !!absoluteDisabled);
|
||||
|
||||
let disableAll = aDisableAll ? "true" : false;
|
||||
setElementValue("reminder-relative-radio", disableAll, "disabled");
|
||||
setElementValue("reminder-absolute-radio", disableAll, "disabled");
|
||||
setElementValue("reminder-actions-menulist", disableAll, "disabled");
|
||||
document.getElementById("reminder-relative-radio").disabled = aDisableAll;
|
||||
document.getElementById("reminder-absolute-radio").disabled = aDisableAll;
|
||||
document.getElementById("reminder-actions-menulist").disabled = aDisableAll;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -170,13 +169,11 @@ function setupMaxReminders() {
|
|||
let listbox = document.getElementById("reminder-listbox");
|
||||
let maxReminders = args.calendar.getProperty("capabilities.alarms.maxCount");
|
||||
|
||||
// != null is needed here to ensure cond to be true/false, instead of
|
||||
// true/null. The former is needed for setElementValue.
|
||||
let cond = maxReminders != null && listbox.children.length >= maxReminders;
|
||||
let hitMaxReminders = maxReminders && listbox.children.length >= maxReminders;
|
||||
|
||||
// If we hit the maximum number of reminders, show the error box and
|
||||
// disable the new button.
|
||||
setElementValue("reminder-new-button", cond && "true", "disabled");
|
||||
document.getElementById("reminder-new-button").disabled = hitMaxReminders;
|
||||
|
||||
let localeErrorString = cal.l10n.getString(
|
||||
"calendar-alarms",
|
||||
|
@ -188,7 +185,7 @@ function setupMaxReminders() {
|
|||
maxReminders
|
||||
);
|
||||
|
||||
if (cond) {
|
||||
if (hitMaxReminders) {
|
||||
let notification = gReminderNotification.appendNotification(
|
||||
pluralErrorLabel,
|
||||
"reminderNotification",
|
||||
|
@ -455,7 +452,7 @@ function onRemoveReminder() {
|
|||
listitem.remove();
|
||||
listbox.selectItem(newSelection);
|
||||
|
||||
setElementValue("reminder-remove-button", listbox.children.length < 1 && "true", "disabled");
|
||||
document.getElementById("reminder-remove-button").disabled = listbox.children.length < 1;
|
||||
setupMaxReminders();
|
||||
}
|
||||
|
||||
|
|
|
@ -312,7 +312,7 @@ function eventsAndTasksOptions(targetId) {
|
|||
checkbox.setAttribute("checked", checked ? "true" : "false");
|
||||
|
||||
if (targetId == "tasks") {
|
||||
setElementValue("tasks-with-no-due-date", !checked, "disabled");
|
||||
setElementValue("completed-tasks", !checked, "disabled");
|
||||
document.getElementById("tasks-with-no-due-date").disabled = !checked;
|
||||
document.getElementById("completed-tasks").disabled = !checked;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -529,13 +529,10 @@ var TodayPane = {
|
|||
* Checks if the todayPaneStatusLabel should be hidden.
|
||||
*/
|
||||
showTodayPaneStatusLabel() {
|
||||
let attributeValue =
|
||||
Services.prefs.getBoolPref("calendar.view.showTodayPaneStatusLabel", true) && "false";
|
||||
setElementValue(
|
||||
document.getElementById("calendar-status-todaypane-button"),
|
||||
!attributeValue,
|
||||
"hideLabel"
|
||||
);
|
||||
let hideLabel = !Services.prefs.getBoolPref("calendar.view.showTodayPaneStatusLabel", true);
|
||||
document
|
||||
.getElementById("calendar-status-todaypane-button")
|
||||
.toggleAttribute("hideLabel", hideLabel);
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
list-style-image: url(chrome://calendar/skin/shared/icons/alarm.svg);
|
||||
}
|
||||
|
||||
.alarm-icons-box[suppressed="true"] > .reminder-icon[value="DISPLAY"] {
|
||||
.alarm-icons-box[suppressed] > .reminder-icon[value="DISPLAY"] {
|
||||
list-style-image: url(chrome://calendar/skin/shared/icons/alarm-no.svg);
|
||||
}
|
||||
|
||||
|
|
|
@ -262,7 +262,7 @@ function receiveMessage(aEvent) {
|
|||
}
|
||||
case "editToDoStatus": {
|
||||
let textbox = document.getElementById("percent-complete-textbox");
|
||||
setElementValue(textbox, aEvent.data.value);
|
||||
textbox.value = aEvent.data.value;
|
||||
updateToDoStatus("percent-changed");
|
||||
break;
|
||||
}
|
||||
|
@ -417,9 +417,9 @@ function onLoad() {
|
|||
if (item.isTodo()) {
|
||||
let initialDatesValue = cal.dtz.dateTimeToJsDate(args.initialStartDateValue);
|
||||
if (!gNewItemUI) {
|
||||
setElementValue("completed-date-picker", initialDatesValue);
|
||||
setElementValue("todo-entrydate", initialDatesValue);
|
||||
setElementValue("todo-duedate", initialDatesValue);
|
||||
document.getElementById("completed-date-picker").value = initialDatesValue;
|
||||
document.getElementById("todo-entrydate").value = initialDatesValue;
|
||||
document.getElementById("todo-duedate").value = initialDatesValue;
|
||||
}
|
||||
}
|
||||
loadDialog(window.calendarItem);
|
||||
|
@ -626,8 +626,8 @@ function loadDialog(aItem) {
|
|||
initialEndTime: gEndTime,
|
||||
};
|
||||
} else {
|
||||
setElementValue("item-title", aItem.title);
|
||||
setElementValue("item-location", aItem.getProperty("LOCATION"));
|
||||
document.getElementById("item-title").value = aItem.title;
|
||||
document.getElementById("item-location").value = aItem.getProperty("LOCATION");
|
||||
}
|
||||
|
||||
// add calendars to the calendar menulist
|
||||
|
@ -733,7 +733,7 @@ function loadDialog(aItem) {
|
|||
if (gNewItemUI) {
|
||||
itemProps.initialDescription = aItem.getProperty("DESCRIPTION");
|
||||
} else {
|
||||
setElementValue("item-description", aItem.getProperty("DESCRIPTION"));
|
||||
document.getElementById("item-description").value = aItem.getProperty("DESCRIPTION");
|
||||
}
|
||||
|
||||
if (aItem.isTodo()) {
|
||||
|
@ -761,7 +761,7 @@ function loadDialog(aItem) {
|
|||
if (gNewItemUI) {
|
||||
itemProps.initialPercentComplete = percentCompleteInteger;
|
||||
} else {
|
||||
setElementValue("percent-complete-textbox", percentCompleteInteger);
|
||||
document.getElementById("percent-complete-textbox").value = percentCompleteInteger;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -857,11 +857,11 @@ function loadDialog(aItem) {
|
|||
// itemProps.initialTodoStatus = itemStatus;
|
||||
} else {
|
||||
let todoStatus = document.getElementById("todo-status");
|
||||
setElementValue(todoStatus, itemStatus);
|
||||
todoStatus.value = itemStatus;
|
||||
if (!todoStatus.selectedItem) {
|
||||
// No selected item means there was no <menuitem> that matches the
|
||||
// value given. Select the "NONE" item by default.
|
||||
setElementValue(todoStatus, "NONE");
|
||||
todoStatus.value = "NONE";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1159,7 +1159,7 @@ function loadDateTime(item) {
|
|||
duration = endTime.subtractDate(startTime);
|
||||
}
|
||||
if (!gNewItemUI) {
|
||||
setElementValue("cmd_attendees", true, "disabled");
|
||||
document.getElementById("cmd_attendees").setAttribute("disabled", true);
|
||||
setBooleanAttribute("keepduration-button", "disabled", !(hasEntryDate && hasDueDate));
|
||||
}
|
||||
sendMessage({
|
||||
|
@ -1320,9 +1320,8 @@ function dateTimeControls2State(aStartDatepicker) {
|
|||
!document.getElementById("repeat-untilDate").hidden &&
|
||||
document.getElementById("repeat-details").hidden
|
||||
) {
|
||||
setElementValue(
|
||||
"repeat-until-datepicker",
|
||||
cal.dtz.dateTimeToJsDate(gUntilDate.getInTimezone(cal.dtz.floating))
|
||||
document.getElementById("repeat-until-datepicker").value = cal.dtz.dateTimeToJsDate(
|
||||
gUntilDate.getInTimezone(cal.dtz.floating)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -1397,11 +1396,11 @@ function updateDateCheckboxes(aDatePickerId, aCheckboxId, aDateTime) {
|
|||
}
|
||||
|
||||
// force something to get set if there was nothing there before
|
||||
setElementValue(aDatePickerId, getElementValue(aDatePickerId));
|
||||
aDatePickerId.value = getElementValue(aDatePickerId);
|
||||
|
||||
// first of all disable the datetime picker if we don't have a date
|
||||
let hasDate = getElementValue(aCheckboxId, "checked");
|
||||
setElementValue(aDatePickerId, !hasDate, "disabled");
|
||||
aDatePickerId.disabled = !hasDate;
|
||||
|
||||
// create a new datetime object if date is now checked for the first time
|
||||
if (hasDate && !aDateTime.isValid()) {
|
||||
|
@ -1587,7 +1586,7 @@ function getRepeatTypeAndUntilDate(aItem) {
|
|||
* @param {Object} aItem The calendar item
|
||||
*/
|
||||
function loadRepeat(aRepeatType, aUntilDate, aItem) {
|
||||
setElementValue("item-repeat", aRepeatType);
|
||||
document.getElementById("item-repeat").value = aRepeatType;
|
||||
let repeatMenu = document.getElementById("item-repeat");
|
||||
gLastRepeatSelection = repeatMenu.selectedIndex;
|
||||
|
||||
|
@ -1598,7 +1597,7 @@ function loadRepeat(aRepeatType, aUntilDate, aItem) {
|
|||
// Show the repeat-until-datepicker and set its date
|
||||
document.getElementById("repeat-untilDate").hidden = false;
|
||||
document.getElementById("repeat-details").hidden = true;
|
||||
setElementValue("repeat-until-datepicker", aUntilDate);
|
||||
document.getElementById("repeat-until-datepicker").value = aUntilDate;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1959,8 +1958,8 @@ function updateAllDay() {
|
|||
}
|
||||
|
||||
let allDay = getElementValue("event-all-day", "checked");
|
||||
setElementValue("event-starttime", allDay, "timepickerdisabled");
|
||||
setElementValue("event-endtime", allDay, "timepickerdisabled");
|
||||
document.getElementById("event-starttime").toggleAttribute("timepickerdisabled", allDay);
|
||||
document.getElementById("event-endtime").toggleAttribute("timepickerdisabled", allDay);
|
||||
|
||||
gStartTime.isDate = allDay;
|
||||
gEndTime.isDate = allDay;
|
||||
|
@ -2826,7 +2825,7 @@ function updateRepeat(aSuppressDialogs, aItemRepeatCall) {
|
|||
if (item.isTodo()) {
|
||||
// automatically check 'has entrydate' if needed.
|
||||
if (!getElementValue("todo-has-entrydate", "checked")) {
|
||||
setElementValue("todo-has-entrydate", "true", "checked");
|
||||
document.getElementById("todo-has-entrydate").checked = true;
|
||||
|
||||
// make sure gStartTime is properly initialized
|
||||
updateEntryDate();
|
||||
|
@ -2952,7 +2951,7 @@ function updateRepeat(aSuppressDialogs, aItemRepeatCall) {
|
|||
repeatDate = (lastOccurrenceDate || proposedUntilDate).getInTimezone(cal.dtz.floating);
|
||||
repeatDate = cal.dtz.dateTimeToJsDate(repeatDate);
|
||||
}
|
||||
setElementValue("repeat-until-datepicker", repeatDate);
|
||||
document.getElementById("repeat-until-datepicker").value = repeatDate;
|
||||
}
|
||||
if (rrules[0].length > 0) {
|
||||
recurrenceInfo.deleteRecurrenceItem(rule);
|
||||
|
@ -2960,7 +2959,7 @@ function updateRepeat(aSuppressDialogs, aItemRepeatCall) {
|
|||
} else {
|
||||
// New event proposes "forever" as default until date.
|
||||
recurrenceInfo = new CalRecurrenceInfo(item);
|
||||
setElementValue("repeat-until-datepicker", "forever");
|
||||
document.getElementById("repeat-until-datepicker").value = "forever";
|
||||
}
|
||||
|
||||
repeatUntilDate.hidden = false;
|
||||
|
@ -2999,7 +2998,7 @@ function updateRepeat(aSuppressDialogs, aItemRepeatCall) {
|
|||
|
||||
if (item.isTodo()) {
|
||||
if (!getElementValue("todo-has-entrydate", "checked")) {
|
||||
setElementValue("todo-has-entrydate", "true", "checked");
|
||||
document.getElementById("todo-has-entrydate").checked = true;
|
||||
}
|
||||
disableElementWithLock("todo-has-entrydate", "repeat-lock");
|
||||
}
|
||||
|
@ -3136,20 +3135,20 @@ function updateToDoStatus(aStatus, aCompletedDate = null) {
|
|||
let newPercentComplete;
|
||||
if ((aStatus == "IN-PROCESS" || aStatus == "NEEDS-ACTION") && oldPercentComplete == 100) {
|
||||
newPercentComplete = 0;
|
||||
setElementValue("completed-date-picker", oldCompletedDate);
|
||||
document.getElementById("completed-date-picker").value = oldCompletedDate;
|
||||
document.getElementById("completed-date-picker").setAttribute("disabled", "true");
|
||||
} else if (aStatus == "COMPLETED") {
|
||||
newPercentComplete = 100;
|
||||
setElementValue("completed-date-picker", aCompletedDate);
|
||||
document.getElementById("completed-date-picker").value = aCompletedDate;
|
||||
document.getElementById("completed-date-picker").removeAttribute("disabled");
|
||||
} else {
|
||||
newPercentComplete = oldPercentComplete;
|
||||
setElementValue("completed-date-picker", oldCompletedDate);
|
||||
document.getElementById("completed-date-picker").value = oldCompletedDate;
|
||||
document.getElementById("completed-date-picker").setAttribute("disabled", "true");
|
||||
}
|
||||
|
||||
gConfig.percentComplete = newPercentComplete;
|
||||
setElementValue("percent-complete-textbox", newPercentComplete);
|
||||
document.getElementById("percent-complete-textbox").value = newPercentComplete;
|
||||
if (gInTab) {
|
||||
sendMessage({
|
||||
command: "updateConfigState",
|
||||
|
@ -3577,7 +3576,7 @@ function updateDateTime() {
|
|||
let startTime = gStartTime.getInTimezone(gStartTimezone);
|
||||
let endTime = gEndTime.getInTimezone(gEndTimezone);
|
||||
|
||||
setElementValue("event-all-day", startTime.isDate, "checked");
|
||||
document.getElementById("event-all-day").checked = startTime.isDate;
|
||||
|
||||
// In the case where the timezones are different but
|
||||
// the timezone of the endtime is "UTC", we convert
|
||||
|
@ -3596,8 +3595,8 @@ function updateDateTime() {
|
|||
startTime.timezone = cal.dtz.floating;
|
||||
endTime.timezone = cal.dtz.floating;
|
||||
|
||||
setElementValue("event-starttime", cal.dtz.dateTimeToJsDate(startTime));
|
||||
setElementValue("event-endtime", cal.dtz.dateTimeToJsDate(endTime));
|
||||
document.getElementById("event-starttime").value = cal.dtz.dateTimeToJsDate(startTime);
|
||||
document.getElementById("event-endtime").value = cal.dtz.dateTimeToJsDate(endTime);
|
||||
}
|
||||
|
||||
if (item.isTodo()) {
|
||||
|
@ -3607,34 +3606,34 @@ function updateDateTime() {
|
|||
let hasDueDate = endTime != null;
|
||||
|
||||
if (hasEntryDate && hasDueDate) {
|
||||
setElementValue("todo-has-entrydate", hasEntryDate, "checked");
|
||||
document.getElementById("todo-has-entrydate").checked = hasEntryDate;
|
||||
startTime.timezone = cal.dtz.floating;
|
||||
setElementValue("todo-entrydate", cal.dtz.dateTimeToJsDate(startTime));
|
||||
document.getElementById("todo-entrydate").value = cal.dtz.dateTimeToJsDate(startTime);
|
||||
|
||||
setElementValue("todo-has-duedate", hasDueDate, "checked");
|
||||
document.getElementById("todo-has-duedate").checked = hasDueDate;
|
||||
endTime.timezone = cal.dtz.floating;
|
||||
setElementValue("todo-duedate", cal.dtz.dateTimeToJsDate(endTime));
|
||||
document.getElementById("todo-duedate").value = cal.dtz.dateTimeToJsDate(endTime);
|
||||
} else if (hasEntryDate) {
|
||||
setElementValue("todo-has-entrydate", hasEntryDate, "checked");
|
||||
document.getElementById("todo-has-entrydate").checked = hasEntryDate;
|
||||
startTime.timezone = cal.dtz.floating;
|
||||
setElementValue("todo-entrydate", cal.dtz.dateTimeToJsDate(startTime));
|
||||
document.getElementById("todo-entrydate").value = cal.dtz.dateTimeToJsDate(startTime);
|
||||
|
||||
startTime.timezone = cal.dtz.floating;
|
||||
setElementValue("todo-duedate", cal.dtz.dateTimeToJsDate(startTime));
|
||||
document.getElementById("todo-duedate").value = cal.dtz.dateTimeToJsDate(startTime);
|
||||
} else if (hasDueDate) {
|
||||
endTime.timezone = cal.dtz.floating;
|
||||
setElementValue("todo-entrydate", cal.dtz.dateTimeToJsDate(endTime));
|
||||
document.getElementById("todo-entrydate").value = cal.dtz.dateTimeToJsDate(endTime);
|
||||
|
||||
setElementValue("todo-has-duedate", hasDueDate, "checked");
|
||||
document.getElementById("todo-has-duedate").checked = hasDueDate;
|
||||
endTime.timezone = cal.dtz.floating;
|
||||
setElementValue("todo-duedate", cal.dtz.dateTimeToJsDate(endTime));
|
||||
document.getElementById("todo-duedate").value = cal.dtz.dateTimeToJsDate(endTime);
|
||||
} else {
|
||||
startTime = window.initialStartDateValue;
|
||||
startTime.timezone = cal.dtz.floating;
|
||||
endTime = startTime.clone();
|
||||
|
||||
setElementValue("todo-entrydate", cal.dtz.dateTimeToJsDate(startTime));
|
||||
setElementValue("todo-duedate", cal.dtz.dateTimeToJsDate(endTime));
|
||||
document.getElementById("todo-entrydate").value = cal.dtz.dateTimeToJsDate(startTime);
|
||||
document.getElementById("todo-duedate").value = cal.dtz.dateTimeToJsDate(endTime);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -3643,15 +3642,15 @@ function updateDateTime() {
|
|||
if (item.isEvent()) {
|
||||
let startTime = gStartTime.getInTimezone(kDefaultTimezone);
|
||||
let endTime = gEndTime.getInTimezone(kDefaultTimezone);
|
||||
setElementValue("event-all-day", startTime.isDate, "checked");
|
||||
document.getElementById("event-all-day").checked = startTime.isDate;
|
||||
|
||||
// before feeding the date/time value into the control we need
|
||||
// to set the timezone to 'floating' in order to avoid the
|
||||
// automatic conversion back into the OS timezone.
|
||||
startTime.timezone = cal.dtz.floating;
|
||||
endTime.timezone = cal.dtz.floating;
|
||||
setElementValue("event-starttime", cal.dtz.dateTimeToJsDate(startTime));
|
||||
setElementValue("event-endtime", cal.dtz.dateTimeToJsDate(endTime));
|
||||
document.getElementById("event-starttime").value = cal.dtz.dateTimeToJsDate(startTime);
|
||||
document.getElementById("event-endtime").value = cal.dtz.dateTimeToJsDate(endTime);
|
||||
}
|
||||
|
||||
if (item.isTodo()) {
|
||||
|
@ -3661,34 +3660,34 @@ function updateDateTime() {
|
|||
let hasDueDate = endTime != null;
|
||||
|
||||
if (hasEntryDate && hasDueDate) {
|
||||
setElementValue("todo-has-entrydate", hasEntryDate, "checked");
|
||||
document.getElementById("todo-has-entrydate").checked = hasEntryDate;
|
||||
startTime.timezone = cal.dtz.floating;
|
||||
setElementValue("todo-entrydate", cal.dtz.dateTimeToJsDate(startTime));
|
||||
document.getElementById("todo-entrydate").value = cal.dtz.dateTimeToJsDate(startTime);
|
||||
|
||||
setElementValue("todo-has-duedate", hasDueDate, "checked");
|
||||
document.getElementById("todo-has-duedate").checked = hasDueDate;
|
||||
endTime.timezone = cal.dtz.floating;
|
||||
setElementValue("todo-duedate", cal.dtz.dateTimeToJsDate(endTime));
|
||||
document.getElementById("todo-duedate").value = cal.dtz.dateTimeToJsDate(endTime);
|
||||
} else if (hasEntryDate) {
|
||||
setElementValue("todo-has-entrydate", hasEntryDate, "checked");
|
||||
document.getElementById("todo-has-entrydate").checked = hasEntryDate;
|
||||
startTime.timezone = cal.dtz.floating;
|
||||
setElementValue("todo-entrydate", cal.dtz.dateTimeToJsDate(startTime));
|
||||
document.getElementById("todo-entrydate").value = cal.dtz.dateTimeToJsDate(startTime);
|
||||
|
||||
startTime.timezone = cal.dtz.floating;
|
||||
setElementValue("todo-duedate", cal.dtz.dateTimeToJsDate(startTime));
|
||||
document.getElementById("todo-duedate").value = cal.dtz.dateTimeToJsDate(startTime);
|
||||
} else if (hasDueDate) {
|
||||
endTime.timezone = cal.dtz.floating;
|
||||
setElementValue("todo-entrydate", cal.dtz.dateTimeToJsDate(endTime));
|
||||
document.getElementById("todo-entrydate").value = cal.dtz.dateTimeToJsDate(endTime);
|
||||
|
||||
setElementValue("todo-has-duedate", hasDueDate, "checked");
|
||||
document.getElementById("todo-has-duedate").checked = hasDueDate;
|
||||
endTime.timezone = cal.dtz.floating;
|
||||
setElementValue("todo-duedate", cal.dtz.dateTimeToJsDate(endTime));
|
||||
document.getElementById("todo-duedate").value = cal.dtz.dateTimeToJsDate(endTime);
|
||||
} else {
|
||||
startTime = window.initialStartDateValue;
|
||||
startTime.timezone = cal.dtz.floating;
|
||||
endTime = startTime.clone();
|
||||
|
||||
setElementValue("todo-entrydate", cal.dtz.dateTimeToJsDate(startTime));
|
||||
setElementValue("todo-duedate", cal.dtz.dateTimeToJsDate(endTime));
|
||||
document.getElementById("todo-entrydate").value = cal.dtz.dateTimeToJsDate(startTime);
|
||||
document.getElementById("todo-duedate").value = cal.dtz.dateTimeToJsDate(endTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3762,7 +3761,7 @@ function updateTimezone() {
|
|||
function updateAttachment() {
|
||||
let hasAttachments = capSupported("attachments");
|
||||
if (!gNewItemUI) {
|
||||
setElementValue("cmd_attach_url", !hasAttachments && "true", "disabled");
|
||||
document.getElementById("cmd_attach_url").setAttribute("disabled", !hasAttachments);
|
||||
}
|
||||
|
||||
// update the attachment tab label to make the number of (uri) attachments visible
|
||||
|
@ -3828,8 +3827,8 @@ function updateItemURL(aShow, aUrl) {
|
|||
if (aShow && aUrl.length) {
|
||||
setTimeout(() => {
|
||||
// HACK the url-link doesn't crop when setting the value in onLoad
|
||||
setElementValue("url-link", aUrl);
|
||||
setElementValue("url-link", aUrl, "href");
|
||||
document.getElementById("url-link").value = aUrl;
|
||||
document.getElementById("url-link").href = aUrl;
|
||||
}, 0);
|
||||
}
|
||||
}
|
||||
|
@ -4134,9 +4133,9 @@ function isItemChanged() {
|
|||
// we need to guide the description text through the text-field since
|
||||
// newlines are getting converted which would indicate changes to the
|
||||
// text.
|
||||
setElementValue("item-description", oldItem.getProperty("DESCRIPTION"));
|
||||
document.getElementById("item-description").value = oldItem.getProperty("DESCRIPTION");
|
||||
cal.item.setItemProperty(oldItem, "DESCRIPTION", getElementValue("item-description"));
|
||||
setElementValue("item-description", newItem.getProperty("DESCRIPTION"));
|
||||
document.getElementById("item-description").value = newItem.getProperty("DESCRIPTION");
|
||||
|
||||
if (newItem.calendar.id == oldItem.calendar.id && cal.item.compareContent(newItem, oldItem)) {
|
||||
return false;
|
||||
|
@ -4187,10 +4186,9 @@ function checkUntilDate() {
|
|||
if (untilDate.compare(startDate) < 0) {
|
||||
// Invalid date: restore the previous date. Since we are checking an
|
||||
// until date, a null value for gUntilDate means repeat "forever".
|
||||
setElementValue(
|
||||
"repeat-until-datepicker",
|
||||
gUntilDate ? cal.dtz.dateTimeToJsDate(gUntilDate.getInTimezone(cal.dtz.floating)) : "forever"
|
||||
);
|
||||
document.getElementById("repeat-until-datepicker").value = gUntilDate
|
||||
? cal.dtz.dateTimeToJsDate(gUntilDate.getInTimezone(cal.dtz.floating))
|
||||
: "forever";
|
||||
gWarning = true;
|
||||
let callback = function() {
|
||||
// Disable the "Save" and "Save and Close" commands as long as the
|
||||
|
|
|
@ -105,7 +105,7 @@ function receiveMessage(aEvent) {
|
|||
case "disableLinkCommand": {
|
||||
let linkCommand = document.getElementById("cmd_toggle_link");
|
||||
if (linkCommand) {
|
||||
setElementValue(linkCommand, "true", "disabled");
|
||||
linkCommand.setAttribute("disabled", true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -136,7 +136,7 @@ function receiveMessage(aEvent) {
|
|||
break;
|
||||
case "setElementAttribute": {
|
||||
let arg = aEvent.data.argument;
|
||||
setElementValue(arg.id, arg.value, arg.attribute);
|
||||
document.getElementById(arg.id)[arg.attribute] = arg.value;
|
||||
break;
|
||||
}
|
||||
case "loadCloudProviders": {
|
||||
|
@ -659,12 +659,12 @@ function updatePrivacy(aArg) {
|
|||
}
|
||||
} else {
|
||||
// aArg.hasPrivacy is false
|
||||
setElementValue("button-privacy", "true", "disabled");
|
||||
setElementValue("status-privacy", "true", "collapsed");
|
||||
document.getElementById("button-privacy").disabled = true;
|
||||
document.getElementById("status-privacy").collapsed = true;
|
||||
// in the tab case the menu item does not exist
|
||||
let privacyMenuItem = document.getElementById("options-privacy-menu");
|
||||
if (privacyMenuItem) {
|
||||
setElementValue("options-privacy-menu", "true", "disabled");
|
||||
document.getElementById("options-privacy-menu").disabled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -689,12 +689,12 @@ function editPriority(aTarget) {
|
|||
function updatePriority(aArg) {
|
||||
// Set up capabilities
|
||||
if (document.getElementById("button-priority")) {
|
||||
setElementValue("button-priority", !aArg.hasPriority && "true", "disabled");
|
||||
document.getElementById("button-priority").disabled = !aArg.hasPriority;
|
||||
}
|
||||
if (!gTabmail && document.getElementById("options-priority-menu")) {
|
||||
setElementValue("options-priority-menu", !aArg.hasPriority && "true", "disabled");
|
||||
document.getElementById("options-priority-menu").disabled = !aArg.hasPriority;
|
||||
}
|
||||
setElementValue("status-priority", !aArg.hasPriority && "true", "collapsed");
|
||||
document.getElementById("status-priority").collapsed = !aArg.hasPriority;
|
||||
|
||||
if (aArg.hasPriority) {
|
||||
let priorityLevel = "none";
|
||||
|
@ -917,7 +917,7 @@ function attachURL() {
|
|||
* @param {boolean} aArg.attachUrlCommand Enable the attach url command?
|
||||
*/
|
||||
function updateAttachment(aArg) {
|
||||
setElementValue("cmd_attach_url", !aArg.attachUrlCommand && "true", "disabled");
|
||||
document.getElementById("cmd_attach_url").setAttribute("disabled", !aArg.attachUrlCommand);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -927,7 +927,7 @@ function updateAttachment(aArg) {
|
|||
* @param {boolean} aArg.attendeesCommand Enable the attendees command?
|
||||
*/
|
||||
function updateAttendeesCommand(aArg) {
|
||||
setElementValue("cmd_attendees", !aArg.attendeesCommand, "disabled");
|
||||
document.getElementById("cmd_attendees").setAttribute("disabled", !aArg.attendeesCommand);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -937,8 +937,8 @@ function updateAttendeesCommand(aArg) {
|
|||
* @param {boolean} aEnable Enable the commands?
|
||||
*/
|
||||
function enableAcceptCommand(aEnable) {
|
||||
setElementValue("cmd_accept", !aEnable, "disabled");
|
||||
setElementValue("cmd_save", !aEnable, "disabled");
|
||||
document.getElementById("cmd_accept").setAttribute("disabled", !aEnable);
|
||||
document.getElementById("cmd_save").setAttribute("disabled", !aEnable);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Загрузка…
Ссылка в новой задаче