From: Michael J. Rubinsky Date: Wed, 10 Mar 2010 20:21:02 +0000 (-0500) Subject: First stab at a pretty autocompleter for event attendees. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=71f11f0e5dde536c2663bb5387770ee9cbf55be7;p=horde.git First stab at a pretty autocompleter for event attendees. Mostly working...there seems to be an issue with the fb grid never resetting, even when opening a different event, but that seems to have broken before... --- diff --git a/kronolith/index.php b/kronolith/index.php index c17d27933..32e83aa58 100644 --- a/kronolith/index.php +++ b/kronolith/index.php @@ -96,4 +96,14 @@ Horde_Ajax_Imple::factory( 'pretty' => true, 'var' => 'kronolithCTagAc')) ->attach(); + +Horde_Ajax_Imple::factory( + array('kronolith', 'ContactAutoCompleter'), + array('triggerId' => 'kronolithEventAttendees', + 'triggerContainer' => 'kronolithAttendeesACTriggerContainer', + 'box' => 'kronolithAttendeesACBox', + 'pretty' => true, + 'var' => 'kronolithEAttendeesAc')) + ->attach(); + echo "\n"; diff --git a/kronolith/js/kronolith.js b/kronolith/js/kronolith.js index 33c0f6a15..9bcb701aa 100644 --- a/kronolith/js/kronolith.js +++ b/kronolith/js/kronolith.js @@ -3858,6 +3858,7 @@ KronolithCore = { this.doAction('getEvent', { cal: calendar, id: id, date: date }, this.editEventCallback.bind(this)); $('kronolithEventTopTags').update(); } else { + kronolithEAttendeesAc.reset(); kronolithETagAc.reset(); this.doAction('listTopTags', null, this.topTagsCallback.curry('kronolithEventTopTags', 'kronolithEventTag')); var d; @@ -4071,10 +4072,11 @@ KronolithCore = { } /* Attendees */ + kronolithEAttendeesAc.reset(); this.freeBusy = $H(); $('kronolithEventStartDate').stopObserving('change'); if (!Object.isUndefined(ev.at)) { - $('kronolithEventAttendees').setValue(ev.at.pluck('l').join(', ')); + kronolithEAttendeesAc.reset(ev.at.pluck('l')); var table = $('kronolithEventTabAttendees').down('tbody'); table.select('tr').invoke('remove'); ev.at.each(function(attendee) { diff --git a/kronolith/lib/Ajax/Application.php b/kronolith/lib/Ajax/Application.php index 12f06fefc..457727ab6 100644 --- a/kronolith/lib/Ajax/Application.php +++ b/kronolith/lib/Ajax/Application.php @@ -91,6 +91,7 @@ class Kronolith_Ajax_Application extends Horde_Ajax_Application_Base } $event->readForm(); + $result = $this->_saveEvent($event); if (($result !== true) && $this->_vars->sendupdates) { Kronolith::sendITipNotifications($event, $GLOBALS['notification'], Kronolith::ITIP_REQUEST); diff --git a/kronolith/lib/Ajax/Imple/ContactAutoCompleter.php b/kronolith/lib/Ajax/Imple/ContactAutoCompleter.php index 01da4db96..b0f2f5c52 100644 --- a/kronolith/lib/Ajax/Imple/ContactAutoCompleter.php +++ b/kronolith/lib/Ajax/Imple/ContactAutoCompleter.php @@ -23,14 +23,22 @@ class Kronolith_Ajax_Imple_ContactAutoCompleter extends Horde_Ajax_Imple_AutoCom { $js_params['indicator'] = $this->_params['triggerId'] . '_loading_img'; - return array( - 'ajax' => 'ContactAutoCompleter', - 'params' => $js_params, - 'raw_params' => array( - 'onSelect' => 'function (v) { if (!v.endsWith(";")) { v += ","; } return v + " "; }', - 'onType' => 'function (e) { return e.include("<") ? "" : e; }' - ), - ); + $ret = array('params' => $js_params, + 'raw_params' => array( + 'onSelect' => 'function (v) { if (!v.endsWith(";")) { v += ","; } return v + " "; }', + 'onType' => 'function (e) { return e.include("<") ? "" : e; }' + )); + if (empty($this->_params['pretty'])) { + $ret['ajax'] = 'ContactAutoCompleter'; + } else { + $ret['pretty'] = 'ContactAutoCompleter'; + } + + if (!empty($this->_params['var'])) { + $ret['var'] = $this->_params['var']; + } + + return $ret; } /** diff --git a/kronolith/templates/index/edit.inc b/kronolith/templates/index/edit.inc index a5282ae27..43a877c98 100644 --- a/kronolith/templates/index/edit.inc +++ b/kronolith/templates/index/edit.inc @@ -172,7 +172,8 @@