From: Michael M Slusarz Date: Fri, 19 Dec 2008 08:02:20 +0000 (-0700) Subject: Complete Request #7322 X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=6a839412944d9486aceb6da1022209b4576e3a0b;p=horde.git Complete Request #7322 Make autocompletion threshold parameters configurable --- diff --git a/imp/config/conf.xml b/imp/config/conf.xml index 9158a4e47..09c486c6f 100644 --- a/imp/config/conf.xml +++ b/imp/config/conf.xml @@ -317,6 +317,14 @@ 200000 + 100 + 3 diff --git a/imp/docs/CHANGES b/imp/docs/CHANGES index 9f03425a3..20766c748 100644 --- a/imp/docs/CHANGES +++ b/imp/docs/CHANGES @@ -2,6 +2,7 @@ v5.0-cvs -------- +[mms] Make autocompletion threshold parameters configurable (Request #7322). [mms] Add compose attachment preview to DIMP. [mms] Add 'unit' parameter for quota display (Carlos Pires , Request #7044). diff --git a/imp/lib/Imple/ContactAutoCompleter.php b/imp/lib/Imple/ContactAutoCompleter.php index c04f76284..44465dd95 100644 --- a/imp/lib/Imple/ContactAutoCompleter.php +++ b/imp/lib/Imple/ContactAutoCompleter.php @@ -58,8 +58,9 @@ class IMP_Imple_ContactAutoCompleter extends IMP_Imple 'indicator: "' . $this->_params['triggerId'] . '_loading_img"', 'afterUpdateElement: function(f, t) { if (!f.value.endsWith(";")) { f.value += ","; } f.value += " "; }' ); + $ac_browser = empty($GLOBALS['conf']['compose']['ac_browser']) ? 0 : $GLOBALS['conf']['compose']['ac_browser']; - if (!isset($_SESSION['imp']['cache']['ac_ajax'])) { + if ($ac_browser && !isset($_SESSION['imp']['cache']['ac_ajax'])) { $success = $use_ajax = true; $sparams = IMP_Compose::getAddressSearchParams(); foreach ($sparams['fields'] as $val) { @@ -72,17 +73,19 @@ class IMP_Imple_ContactAutoCompleter extends IMP_Imple } if ($success) { $addrlist = IMP_Compose::getAddressList(); - $use_ajax = count($addrlist) > 200; + $use_ajax = count($addrlist) > $ac_browser; } $_SESSION['imp']['cache']['ac_ajax'] = $use_ajax; } - if ($_SESSION['imp']['cache']['ac_ajax']) { + if (!$ac_browser || $_SESSION['imp']['cache']['ac_ajax']) { $func = 'Ajax.Autocompleter'; if (empty($this->_url)) { $this->_url = Horde::url($GLOBALS['registry']->get('webroot', 'imp') . '/imple.php?imple=ContactAutoCompleter/input=' . rawurlencode($this->_params['triggerId']), true); } $params[] = '"' . $this->_url . '"'; + + $js_params[] = 'minChars: ' . intval($GLOBALS['conf']['compose']['ac_threshold'] ? $GLOBALS['conf']['compose']['ac_threshold'] : 1); } else { if (!$list_output) { if (!isset($addrlist)) {