From: Michael J. Rubinsky Date: Fri, 6 Nov 2009 22:31:32 +0000 (-0500) Subject: Correctly fix listTimeObjects handling in the ajax interface. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=2f91b86615afbf53897abd9e62c640335262952d;p=horde.git Correctly fix listTimeObjects handling in the ajax interface. Not a very elegant fix, since it assumes that listTimeObjectCategories will have a maximum nesting of three (contacts/birthdays/addressbook_id for example) but we were already assuming that the maximum nesting would be two, so... --- diff --git a/kronolith/js/kronolith.js b/kronolith/js/kronolith.js index 05f9618ac..21fe23191 100644 --- a/kronolith/js/kronolith.js +++ b/kronolith/js/kronolith.js @@ -762,9 +762,12 @@ KronolithCore = { ext[api[0]] = {}; } if (typeof ext[api[0]][api[1]] == 'undefined') { - ext[api[0]][api[1]] = []; + ext[api[0]][api[1]] = {}; } - ext[api[0]][api[1]].push(cal.value); + if (typeof api[2] == 'undefined') { + api[2] = 0; + } + ext[api[0]][api[1]][api[2]] = cal.value; extNames[api[0]] = cal.value.api; }); $H(ext).each(function(api) { @@ -775,15 +778,14 @@ KronolithCore = { .insert({ bottom: extNames[api.key].escapeHTML() })) .insert(new Element('DIV', { 'id': 'kronolithExternalCalendar' + api.key, 'class': 'kronolithCalendars' })); $H(api.value).each(function(cals) { - for (var i = 0; i < cals.value.length; i++) { - var cal = cals.value[i]; + $H(cals.value).each(function(cal) { $('kronolithExternalCalendar' + api.key) - .insert(new Element('DIV', { 'class': cal.show ? 'kronolithCalOn' : 'kronolithCalOff' }) - .store('calendar', api.key + '/' + cals.key) + .insert(new Element('DIV', { 'class': cal.value.show ? 'kronolithCalOn' : 'kronolithCalOff' }) + .store('calendar', api.key + '/' + cals.key + ((cal.key != 0) ? '/' + cal.key : '')) .store('calendarclass', 'external') - .setStyle({ backgroundColor: cal.bg, color: cal.fg }) - .update(cal.name.escapeHTML())); - } + .setStyle({ backgroundColor: cal.value.bg, color: cal.value.fg }) + .update(cal.value.name.escapeHTML())); + }); }); }); @@ -2245,7 +2247,6 @@ KronolithCore = { calClass = elt.retrieve('calendarclass'); if (calClass) { var calendar = elt.retrieve('calendar'); - console.log(calendar); Kronolith.conf.calendars[calClass][calendar].show = !Kronolith.conf.calendars[calClass][calendar].show; if (this.view == 'year' || typeof this.ecache.get(calClass) == 'undefined' ||