Bug 329415 Trying to remove exceptions in recurrencedialog with no exceptions selected throws JS-errors. patch by robin.edrenius@gmail.com, r=jminta

This commit is contained in:
jminta%gmail.com 2006-03-18 15:13:54 +00:00
Родитель 584dad6358
Коммит 4ff6aad78a
2 изменённых файлов: 18 добавлений и 2 удалений

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

@ -57,6 +57,8 @@ function onLoad()
opener.setCursor("auto");
checkSelectedException();
self.focus();
}
@ -357,6 +359,7 @@ function removeSelectedException()
window.removedExceptions.push(item.date);
}
exceptionList.removeItemAt(exceptionList.getIndexOfItem(item));
checkSelectedException();
}
function splitRecurrenceRules(recurrenceInfo)
@ -375,3 +378,13 @@ function splitRecurrenceRules(recurrenceInfo)
return [rules, exceptions];
}
function checkSelectedException()
{
var exceptionList = document.getElementById("recurrence-exceptions-listbox");
var item = exceptionList.selectedItem;
if (!item) {
document.getElementById("remove-exceptions-button").setAttribute("disabled", "true");
} else {
document.getElementById("remove-exceptions-button").removeAttribute("disabled");
}
}

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

@ -202,11 +202,14 @@
<label value="&newevent.recurrence.exceptions.label;"/>
<hbox align="center">
<listbox id="recurrence-exceptions-listbox" rows="8" flex="1"/>
<listbox id="recurrence-exceptions-listbox" rows="8" flex="1"
onselect="checkSelectedException()"/>
<vbox align="top">
<datepicker id="exdate-picker"/>
<button label="&newevent.addexceptions.label;" oncommand="addException()"/>
<button label="&newevent.recurrence.remove.label;" oncommand="removeSelectedException();"/>
<button label="&newevent.recurrence.remove.label;"
id="remove-exceptions-button"
oncommand="removeSelectedException();"/>
</vbox>
</hbox>