}
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();
}
} 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();
$('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));
}.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;
},
/**
/**
* 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()
{
$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'];
</div>
<?php
-$ctac = Horde_Ajax_Imple::factory(array('kronolith', 'TagAutoCompleter'),
- array('triggerId' => '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();