зеркало из https://github.com/mozilla/gecko-dev.git
Bug 327832 'To' date and time no longer linked to 'From' date/time, in new event dialog. r=mvl
This commit is contained in:
Родитель
8adfd50f67
Коммит
c5be355a08
|
@ -42,6 +42,8 @@ var gReadOnlyMode = false;
|
|||
// load/check the stuff in this area, because it hasn't changed.
|
||||
var gDetailsShown = false;
|
||||
|
||||
var gItemDuration;
|
||||
|
||||
/* dialog stuff */
|
||||
function onLoad()
|
||||
{
|
||||
|
@ -131,6 +133,7 @@ function loadDialog(item)
|
|||
if (isEvent(item)) {
|
||||
var startDate = item.startDate.getInTimezone(kDefaultTimezone);
|
||||
var endDate = item.endDate.getInTimezone(kDefaultTimezone);
|
||||
gItemDuration = endDate.subtractDate(startDate);
|
||||
|
||||
// Check if an all-day event has been passed in (to adapt endDate).
|
||||
if (startDate.isDate) {
|
||||
|
@ -162,6 +165,9 @@ function loadDialog(item)
|
|||
setElementValue("todo-has-duedate", hasDueDate, "checked");
|
||||
if (hasDueDate)
|
||||
setElementValue("todo-duedate", item.dueDate.jsDate);
|
||||
if (hasEntryDate && hasDueDate) {
|
||||
gItemDuration = item.dueDate.subtractDate(item.entryDate);
|
||||
}
|
||||
document.getElementById("component-type").selectedIndex = 1;
|
||||
}
|
||||
|
||||
|
@ -420,6 +426,51 @@ function updateStyle()
|
|||
}
|
||||
}
|
||||
|
||||
function onStartTimeChange()
|
||||
{
|
||||
if (!gItemDuration) {
|
||||
return;
|
||||
}
|
||||
var startWidgetId;
|
||||
var endWidgetId;
|
||||
if (isEvent(window.calendarItem)) {
|
||||
startWidgetId = "event-starttime";
|
||||
endWidgetId = "event-endtime";
|
||||
} else {
|
||||
if (!getElementValue("todo-has-entrydate", "checked") || !getElementValue("todo-has-duedate", "checked")) {
|
||||
gItemDuration = null;
|
||||
return;
|
||||
}
|
||||
startWidgetId = "todo-entrydate";
|
||||
endWidgetId = "todo-duedate";
|
||||
}
|
||||
var start = jsDateToDateTime(getElementValue(startWidgetId));
|
||||
start.addDuration(gItemDuration);
|
||||
setElementValue(endWidgetId, start.getInTimezone(calendarDefaultTimezone()).jsDate);
|
||||
updateAccept();
|
||||
}
|
||||
|
||||
function onEndTimeChange()
|
||||
{
|
||||
var startWidgetId;
|
||||
var endWidgetId;
|
||||
if (isEvent(window.calendarItem)) {
|
||||
startWidgetId = "event-starttime";
|
||||
endWidgetId = "event-endtime";
|
||||
} else {
|
||||
if (!getElementValue("todo-has-entrydate", "checked") ||
|
||||
!getElementValue("todo-has-duedate", "checked")) {
|
||||
gItemDuration = null;
|
||||
return;
|
||||
}
|
||||
startWidgetId = "todo-entrydate";
|
||||
endWidgetId = "todo-duedate";
|
||||
}
|
||||
var start = jsDateToDateTime(getElementValue(startWidgetId));
|
||||
var end = jsDateToDateTime(getElementValue(endWidgetId));
|
||||
gItemDuration = end.subtractDate(start);
|
||||
updateAccept();
|
||||
}
|
||||
function updateAccept()
|
||||
{
|
||||
var kDefaultTimezone = calendarDefaultTimezone();
|
||||
|
@ -495,6 +546,13 @@ function updateDueDate()
|
|||
setElementValue("todo-duedate", getElementValue("todo-duedate"));
|
||||
|
||||
setElementValue("todo-duedate", !getElementValue("todo-has-duedate", "checked"), "disabled");
|
||||
if (getElementValue("todo-has-entrydate", "checked") && getElementValue("todo-has-duedate", "checked")) {
|
||||
var start = jsDateToDateTime(getElementValue("todo-entrydate"));
|
||||
var end = jsDateToDateTime(getElementValue("todo-duedate"));
|
||||
gItemDuration = end.subtractDate(start);
|
||||
} else {
|
||||
gItemDuration = null;
|
||||
}
|
||||
|
||||
updateAccept();
|
||||
}
|
||||
|
@ -509,6 +567,14 @@ function updateEntryDate()
|
|||
|
||||
setElementValue("todo-entrydate", !getElementValue("todo-has-entrydate", "checked"), "disabled");
|
||||
|
||||
if (getElementValue("todo-has-entrydate", "checked") && getElementValue("todo-has-duedate", "checked")) {
|
||||
var start = jsDateToDateTime(getElementValue("todo-entrydate"));
|
||||
var end = jsDateToDateTime(getElementValue("todo-duedate"));
|
||||
gItemDuration = end.subtractDate(start);
|
||||
} else {
|
||||
gItemDuration = null;
|
||||
}
|
||||
|
||||
updateAccept();
|
||||
}
|
||||
|
||||
|
|
|
@ -108,13 +108,13 @@
|
|||
<label value="&newevent.date.label;" class="todo-only"/>
|
||||
</hbox>
|
||||
<hbox>
|
||||
<datetimepicker id="event-starttime" onchange="updateAccept();"
|
||||
<datetimepicker id="event-starttime" onchange="onStartTimeChange();"
|
||||
class="event-only"/>
|
||||
<checkbox id="event-all-day" oncommand="updateAllDay();"
|
||||
class="event-only" label="&newevent.alldayevent.label;"/>
|
||||
<checkbox id="todo-has-entrydate" oncommand="updateEntryDate();"
|
||||
class="todo-only"/>
|
||||
<datetimepicker id="todo-entrydate" onchange="updateAccept();"
|
||||
<datetimepicker id="todo-entrydate" onchange="onStartTimeChange();"
|
||||
class="todo-only"/>
|
||||
<spacer flex="1"/>
|
||||
</hbox>
|
||||
|
@ -127,9 +127,9 @@
|
|||
</hbox>
|
||||
<vbox>
|
||||
<hbox align="center">
|
||||
<datetimepicker id="event-endtime" onchange="updateAccept();" class="event-only"/>
|
||||
<datetimepicker id="event-endtime" onchange="onEndTimeChange();" class="event-only"/>
|
||||
<checkbox id="todo-has-duedate" oncommand="updateDueDate();" class="todo-only"/>
|
||||
<datetimepicker id="todo-duedate" onchange="updateAccept();" class="todo-only"/>
|
||||
<datetimepicker id="todo-duedate" onchange="onEndTimeChange();" class="todo-only"/>
|
||||
<checkbox id="item-recurrence" oncommand="updateRecurrence();"
|
||||
label="&newevent.repeat.label2;"/>
|
||||
<button id="set-recurrence" label="&newevent.set.label;" oncommand="editRecurrence();"/>
|
||||
|
|
Загрузка…
Ссылка в новой задаче