From b4b1da73a34c4c13409aed186c9b5da3bdfaf633 Mon Sep 17 00:00:00 2001 From: "mvl%exedo.nl" Date: Sun, 31 Jul 2005 12:27:21 +0000 Subject: [PATCH] Make sure not to enable two radioitems when editing an item with recurrence set. bug 287393, patch by jt@nerant.org, r=mvl --- calendar/resources/content/applicationUtil.js | 21 +++++++++++++++++++ calendar/resources/content/eventDialog.js | 6 +++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/calendar/resources/content/applicationUtil.js b/calendar/resources/content/applicationUtil.js index 744e5cba3f17..945b0fced7b0 100644 --- a/calendar/resources/content/applicationUtil.js +++ b/calendar/resources/content/applicationUtil.js @@ -366,6 +366,27 @@ function menuListIndexOf(menuList, value) return -1; // not found } +function radioGroupSelectItem(radioGroupId, id) +{ + var radioGroup = document.getElementById(radioGroupId); + var index = radioGroupIndexOf(radioGroup, id); + if (index != -1) { + radioGroup.selectedIndex = index; + } else { + throw "radioGroupSelectItem: No such Element: "+id; + } +} + +function radioGroupIndexOf(radioGroup, id) +{ + var items = radioGroup.getElementsByTagName("radio"); + for each (item in items) { + if (item.getAttribute("id") == id) + return i; + } + return -1; // not found +} + function debug(text) { diff --git a/calendar/resources/content/eventDialog.js b/calendar/resources/content/eventDialog.js index 0361447ab548..4c90fc214341 100644 --- a/calendar/resources/content/eventDialog.js +++ b/calendar/resources/content/eventDialog.js @@ -328,13 +328,13 @@ function loadCalendarEventDialog() } if (!theRule.isFinite) { - setElementValue("repeat-forever-radio", true, "selected"); + radioGroupSelectItem("repeat-until-group", "repeat-forever-radio"); } else { if (theRule.isByCount) { - setElementValue("repeat-numberoftimes-radio", true, "selected"); + radioGroupSelectItem("repeat-until-group", "repeat-numberoftimes-radio"); setElementValue("repeat-numberoftimes-textbox", theRule.count ); } else { - setElementValue("repeat-until-radio", true, "selected"); + radioGroupSelectItem("repeat-until-group", "repeat-until-radio"); setElementValue("repeat-end-date-picker", theRule.endDate.jsDate); } }