summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2013-01-04 13:43:38 (GMT)
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2013-01-23 17:18:15 (GMT)
commitca44d6f4d33abb27f00a393e49f20d4b94c78b9b (patch)
tree9d386013ab3c2c281e9890aa86b5ccf8f66e32be
parent42969cb286fbfc73e61030095e5003e72df4c3b2 (diff)
downloadkolab-wap-ca44d6f4d33abb27f00a393e49f20d4b94c78b9b.tar.gz
Implement autocompletion minimum length limit (add 'autocomplete_min_length' option) (Bug #1486)
Increase autocompletion request delay - the time from key press to the request (Bug #1486)
-rw-r--r--lib/kolab_client_task.php3
-rw-r--r--public_html/js/kolab_admin.js16
2 files changed, 6 insertions, 13 deletions
diff --git a/lib/kolab_client_task.php b/lib/kolab_client_task.php
index 5fe2473..8583e01 100644
--- a/lib/kolab_client_task.php
+++ b/lib/kolab_client_task.php
@@ -1315,9 +1315,12 @@ class kolab_client_task
));
}
+ $ac_min_len = $this->config_get('autocomplete_min_length', 1, Conf::INT);
+
$this->output->set_env('form_id', $attribs['id']);
$this->output->set_env('assoc_fields', $assoc_fields);
$this->output->set_env('required_fields', $req_fields);
+ $this->output->set_env('autocomplete_min_length', $ac_min_len);
$this->output->add_translation('form.required.empty', 'form.maxcount.exceeded',
$name . '.add.success', $name . '.edit.success', $name . '.delete.success',
'add', 'edit', 'delete');
diff --git a/public_html/js/kolab_admin.js b/public_html/js/kolab_admin.js
index 3290bf1..959f0f1 100644
--- a/public_html/js/kolab_admin.js
+++ b/public_html/js/kolab_admin.js
@@ -514,11 +514,11 @@ function kolab_admin()
case 37: // left
case 39: // right
if (!e.shiftKey)
- return;
+ return;
}
// start timer
- this.ac_timer = window.setTimeout(function() { kadm.ac_start(props); }, 200);
+ this.ac_timer = window.setTimeout(function() { kadm.ac_start(props); }, 500);
this.ac_input = e.target;
return true;
@@ -565,10 +565,7 @@ function kolab_admin()
this.ac_stop();
if (q.length && q.length < min) {
- if (!this.ac_info) {
- this.ac_info = this.display_message(
- this.t('search.acchars').replace('$min', min));
- }
+ this.display_message(this.t('search.acchars').replace('$min', min), 'notice', 2000);
return;
}
@@ -698,15 +695,8 @@ function kolab_admin()
if (this.ac_data)
this.ac_data.abort();
- if (this.ac_info)
- this.hide_message(this.ac_info);
-
- if (this.ac_msg)
- this.hide_message(this.ac_msg);
-
this.ac_data = null;
this.ac_info = null;
- this.ac_msg = null;
};