From: Jan Schneider Date: Tue, 9 Mar 2010 23:03:08 +0000 (+0100) Subject: No need to pass the class name around in the ajax communication. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=52c7dc5029a7409645c4775a01186ccc219eb0c5;p=horde.git No need to pass the class name around in the ajax communication. --- diff --git a/kronolith/js/kronolith.js b/kronolith/js/kronolith.js index b0f724583..bed4af817 100644 --- a/kronolith/js/kronolith.js +++ b/kronolith/js/kronolith.js @@ -2238,7 +2238,7 @@ KronolithCore = { } if (newCalendar || info.owner) { - this.doAction('listTopTags', {tagclass: 'kronolithCalendarTag'}, this.topTagsCallback); + this.doAction('listTopTags', null, this.topTagsCallback.curry('kronolithCalendarinternalTopTags', 'kronolithCalendarTag')); form.down('.kronolithColorPicker').show(); if (type == 'internal') { form.down('.kronolithCalendarSubscribe').hide(); @@ -2259,7 +2259,7 @@ KronolithCore = { } } else { form.disable(); - this.doAction('listTopTags', {tagclass: 'kronolithTagDisable'}, this.topTagsCallback); + this.doAction('listTopTags', null, this.topTagsCallback.curry('kronolithCalendarTag', 'kronolithTagDisable')); form.down('.kronolithColorPicker').hide(); form.down('.kronolithCalendarDelete').hide(); form.down('.kronolithCalendarSave').hide(); @@ -3814,7 +3814,7 @@ KronolithCore = { $('kronolithEventSave').show(); $('kronolithEventDelete').show(); $('kronolithEventForm').down('.kronolithFormActions .kronolithSeparator').show(); - this.doAction('listTopTags', {tagclass: 'kronolithEventTag'}, this.topTagsCallback); + this.doAction('listTopTags', null, this.topTagsCallback.curry('kronolithEventTopTags', 'kronolithEventTag')); if (id) { RedBox.loading(); this.doAction('getEvent', { cal: calendar, id: id, date: date }, this.editEventCallback.bind(this)); @@ -3903,19 +3903,18 @@ KronolithCore = { }.bind(this)); }, - topTagsCallback: function(r) + topTagsCallback: function(update, tagclass, r) { - var update = (r.response.tagclass == 'kronolithEventTag') ? 'kronolithEventTopTags' : 'kronolithCalendarinternalTopTags'; if (!r.response.tags) { $(update).update(); return; } - t = new Element('div'); + + var t = new Element('div'); r.response.tags.each(function(tag) { - t.insert(new Element('span', { className: r.response.tagclass }).update(tag.escapeHTML())); + t.insert(new Element('span', { className: tagclass }).update(tag.escapeHTML())); }); $(update).update(t); - return; }, /** diff --git a/kronolith/lib/Ajax/Application.php b/kronolith/lib/Ajax/Application.php index 072d75989..987030a7f 100644 --- a/kronolith/lib/Ajax/Application.php +++ b/kronolith/lib/Ajax/Application.php @@ -412,8 +412,6 @@ class Kronolith_Ajax_Application extends Horde_Ajax_Application_Base /** * Generate a list of most frequently used tags for the current user. - * Takes a 'tagclass' parameter that gets passed back to indicate what element - * to update. */ public function listTopTags() { @@ -421,7 +419,6 @@ class Kronolith_Ajax_Application extends Horde_Ajax_Application_Base $tagger = new Kronolith_Tagger(); $result = new stdClass; $result->tags = array(); - $result->tagclass = $this->_vars->tagclass; $tags = $tagger->getCloud(Horde_Auth::getAuth(), 10); foreach ($tags as $tag) { $result->tags[] = $tag['tag_name']; diff --git a/kronolith/templates/chunks/calendar.php b/kronolith/templates/chunks/calendar.php index 1fe96247d..6151df721 100644 --- a/kronolith/templates/chunks/calendar.php +++ b/kronolith/templates/chunks/calendar.php @@ -439,10 +439,11 @@ tbd 'kronolithCalendarinternalTags', - 'triggerContainer' => 'kronolithACCalendarTriggerContainer', - 'box' => 'kronolithCalendarinternalACBox', - 'pretty' => true, - 'no_onload' => true)); -$ctac->attach(); +Horde_Ajax_Imple::factory( + array('kronolith', 'TagAutoCompleter'), + array('triggerId' => 'kronolithCalendarinternalTags', + 'triggerContainer' => 'kronolithACCalendarTriggerContainer', + 'box' => 'kronolithCalendarinternalACBox', + 'pretty' => true, + 'no_onload' => true)) + ->attach();