From 202eb693c2a77b366c59528044707adefde92564 Mon Sep 17 00:00:00 2001 From: "Michael J. Rubinsky" Date: Fri, 6 Nov 2009 15:00:32 -0500 Subject: [PATCH] Avoid key collisions when a listTimeObjects provider can export the same timeObject category for multiple resources (Like Turba exporting Birthdays for more then one address book). --- kronolith/js/kronolith.js | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/kronolith/js/kronolith.js b/kronolith/js/kronolith.js index d3e093e64..d9a988f15 100644 --- a/kronolith/js/kronolith.js +++ b/kronolith/js/kronolith.js @@ -761,7 +761,10 @@ KronolithCore = { if (typeof ext[api[0]] == 'undefined') { ext[api[0]] = {}; } - ext[api[0]][api[1]] = cal.value; + if (typeof ext[api[0]][api[1]] == 'undefined') { + ext[api[0]][api[1]] = []; + } + ext[api[0]][api[1]].push(cal.value); extNames[api[0]] = cal.value.api; }); $H(ext).each(function(api) { @@ -771,13 +774,16 @@ KronolithCore = { .update('+')) .insert({ bottom: extNames[api.key].escapeHTML() })) .insert(new Element('DIV', { 'id': 'kronolithExternalCalendar' + api.key, 'class': 'kronolithCalendars' })); - $H(api.value).each(function(cal) { - $('kronolithExternalCalendar' + api.key) - .insert(new Element('DIV', { 'class': cal.value.show ? 'kronolithCalOn' : 'kronolithCalOff' }) - .store('calendar', api.key + '/' + cal.key) - .store('calendarclass', 'external') - .setStyle({ backgroundColor: cal.value.bg, color: cal.value.fg }) - .update(cal.value.name.escapeHTML())); + $H(api.value).each(function(cals) { + for (var i = 0; i < cals.value.length; i++) { + var cal = cals.value[i]; + $('kronolithExternalCalendar' + api.key) + .insert(new Element('DIV', { 'class': cal.show ? 'kronolithCalOn' : 'kronolithCalOff' }) + .store('calendar', api.key + '/' + cal.key) + .store('calendarclass', 'external') + .setStyle({ backgroundColor: cal.bg, color: cal.fg }) + .update(cal.name.escapeHTML())); + } }); }); -- 2.11.0