Don't add KronolithCore callbacks if in the traditional view.
authorJan Schneider <jan@horde.org>
Thu, 24 Jun 2010 15:25:48 +0000 (17:25 +0200)
committerJan Schneider <jan@horde.org>
Thu, 24 Jun 2010 15:25:48 +0000 (17:25 +0200)
kronolith/index.php
kronolith/lib/Ajax/Imple/ContactAutoCompleter.php

index ed5cfe1..bcfd997 100644 (file)
@@ -119,7 +119,9 @@ Horde_Ajax_Imple::factory(
           'triggerContainer' => 'kronolithAttendeesACTriggerContainer',
           'box' => 'kronolithAttendeesACBox',
           'pretty' => true,
-          'var' => 'KronolithCore.attendeesAc'))
+          'var' => 'KronolithCore.attendeesAc',
+          'onAdd' => 'KronolithCore.addAttendee.bind(KronolithCore)',
+          'onRemove' => 'KronolithCore.removeAttendee.bind(KronolithCore)'))
     ->attach();
 
 if ($conf['maps']['driver']) {
index 06582b3..d385fa7 100644 (file)
@@ -27,9 +27,11 @@ class Kronolith_Ajax_Imple_ContactAutoCompleter extends Horde_Ajax_Imple_AutoCom
                      'raw_params' => array(
                          'onSelect' => 'function (v) { if (!v.endsWith(";")) { v += ","; } return v + " "; }',
                          'onType' => 'function (e) { return e.include("<") ? "" : e; }',
-                         'onAdd' => 'KronolithCore.addAttendee.bind(KronolithCore)',
-                         'onRemove' => 'KronolithCore.removeAttendee.bind(KronolithCore)',
                       ));
+        if (isset($this->_params['onAdd'])) {
+            $ret['raw_params']['onAdd'] = $this->_params['onAdd'];
+            $ret['raw_params']['onRemove'] = $this->_params['onRemove'];
+        }
         if (empty($this->_params['pretty'])) {
             $ret['ajax'] = 'ContactAutoCompleter';
         } else {