From: Michael J. Rubinsky Date: Fri, 6 Nov 2009 20:00:32 +0000 (-0500) Subject: Avoid key collisions when a listTimeObjects provider can export the same timeObject... X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=202eb693c2a77b366c59528044707adefde92564;p=horde.git 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). --- 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())); + } }); });