From 1553b3c7019285a4b333531dcce2013f79c963c1 Mon Sep 17 00:00:00 2001 From: thomascube Date: Thu, 18 Dec 2008 17:56:50 +0000 Subject: Bugfix and improve auto-completion --- program/js/app.js | 4 ++-- program/steps/mail/autocomplete.inc | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'program') diff --git a/program/js/app.js b/program/js/app.js index 7e9509ec2..a09a11c77 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -2535,7 +2535,7 @@ function rcube_webmail() this.ksearch_display_results = function (a_results, a_result_ids, c) { // display search results - if (c && a_results.length) { + if (c && a_results.length && this.ksearch_input) { var p, ul, li; // create results pane if not present @@ -2554,7 +2554,7 @@ function rcube_webmail() // add each result line to list for (i=0; i/, '>').replace(new RegExp('('+this.ksearch_value+')', 'ig'), '$1'); + li.innerHTML = a_results[i].replace(new RegExp('('+this.ksearch_value+')', 'ig'), '##$1%%').replace(//g, '>').replace(/##([^%]+)%%/g, '$1'); li.onmouseover = function(){ ref.ksearch_select(this); }; li.onmouseup = function(){ ref.ksearch_click(this) }; li._rcm_id = a_result_ids[i]; diff --git a/program/steps/mail/autocomplete.inc b/program/steps/mail/autocomplete.inc index 4bc5dc263..fe011de0a 100644 --- a/program/steps/mail/autocomplete.inc +++ b/program/steps/mail/autocomplete.inc @@ -19,13 +19,14 @@ */ +$MAXNUM = 15; // same limit as in app.js $contacts = array(); if ($search = get_input_value('_search', RCUBE_INPUT_POST)) { foreach ($RCMAIL->config->get('autocomplete_addressbooks', array('sql')) as $id) { $abook = $RCMAIL->get_address_book($id); - $abook->set_pagesize(20); + $abook->set_pagesize($MAXNUM); if ($result = $abook->search(array('email','name'), $search)) { while ($sql_arr = $result->iterate()) { @@ -34,6 +35,9 @@ if ($search = get_input_value('_search', RCUBE_INPUT_POST)) { } } } + + if (count($contacts) >= $MAXNUM) + break; } sort($contacts); -- cgit v1.2.3