[Svn] r4190 - in trunk/roundcubemail: . config program/js program/localization/en_US program/localization/pl_PL program/steps/mail

trac at roundcube.net trac at roundcube.net
Sun Nov 7 09:36:53 CET 2010


Author: alec
Date: 2010-11-07 02:36:52 -0600 (Sun, 07 Nov 2010)
New Revision: 4190

Modified:
   trunk/roundcubemail/CHANGELOG
   trunk/roundcubemail/config/main.inc.php.dist
   trunk/roundcubemail/program/js/app.js
   trunk/roundcubemail/program/localization/en_US/messages.inc
   trunk/roundcubemail/program/localization/pl_PL/messages.inc
   trunk/roundcubemail/program/steps/mail/compose.inc
Log:
- Add option for minimum length of autocomplete's string (#1486428)


Modified: trunk/roundcubemail/CHANGELOG
===================================================================
--- trunk/roundcubemail/CHANGELOG	2010-11-07 07:50:16 UTC (rev 4189)
+++ trunk/roundcubemail/CHANGELOG	2010-11-07 08:36:52 UTC (rev 4190)
@@ -63,6 +63,7 @@
 - Add missing confirmation/error messages on contact/group/message actions (#1486845)
 - Add 'loading' message on message move/copy/delete/mark actions
 - Improve responsiveness of messages displaying (#1486986)
+- Add option for minimum length of autocomplete's string (#1486428)
 
 RELEASE 0.4.2
 -------------

Modified: trunk/roundcubemail/config/main.inc.php.dist
===================================================================
--- trunk/roundcubemail/config/main.inc.php.dist	2010-11-07 07:50:16 UTC (rev 4189)
+++ trunk/roundcubemail/config/main.inc.php.dist	2010-11-07 08:36:52 UTC (rev 4190)
@@ -462,6 +462,11 @@
 // when populating address autocomplete fields server-side. ex: array('sql','Verisign');
 $rcmail_config['autocomplete_addressbooks'] = array('sql');
 
+// The minimum number of characters required to be typed in an autocomplete field
+// before address books will be searched. Most useful for LDAP directories that
+// may need to do lengthy results building given overly-broad searches
+$rcmail_config['autocomplete_min_length'] = 1;
+
 // ----------------------------------
 // USER PREFERENCES
 // ----------------------------------

Modified: trunk/roundcubemail/program/js/app.js
===================================================================
--- trunk/roundcubemail/program/js/app.js	2010-11-07 07:50:16 UTC (rev 4189)
+++ trunk/roundcubemail/program/js/app.js	2010-11-07 08:36:52 UTC (rev 4190)
@@ -3426,14 +3426,14 @@
       return;
 
     // get cursor pos
-    var inp_value = this.ksearch_input.value;
-    var cpos = this.get_caret_pos(this.ksearch_input);
-    var p = inp_value.lastIndexOf(this.ksearch_value, cpos);
+    var inp_value = this.ksearch_input.value,
+      cpos = this.get_caret_pos(this.ksearch_input),
+      p = inp_value.lastIndexOf(this.ksearch_value, cpos),
+      insert = '',
 
-    // replace search string with full address
-    var pre = this.ksearch_input.value.substring(0, p);
-    var end = this.ksearch_input.value.substring(p+this.ksearch_value.length, this.ksearch_input.value.length);
-    var insert = '';
+      // replace search string with full address
+      pre = inp_value.substring(0, p),
+      end = inp_value.substring(p+this.ksearch_value.length, inp_value.length);
 
     // insert all members of a group
     if (typeof this.env.contacts[id] == 'object' && this.env.contacts[id].id) {
@@ -3465,6 +3465,7 @@
   this.ksearch_get_results = function()
   {
     var inp_value = this.ksearch_input ? this.ksearch_input.value : null;
+
     if (inp_value === null)
       return;
 
@@ -3472,9 +3473,10 @@
       this.ksearch_pane.hide();
 
     // get string from current cursor pos to last comma
-    var cpos = this.get_caret_pos(this.ksearch_input);
-    var p = inp_value.lastIndexOf(',', cpos-1);
-    var q = inp_value.substring(p+1, cpos);
+    var cpos = this.get_caret_pos(this.ksearch_input),
+      p = inp_value.lastIndexOf(',', cpos-1),
+      q = inp_value.substring(p+1, cpos),
+      min = this.env.autocomplete_min_length;
 
     // trim query string
     q = q.replace(/(^\s+|\s+$)/g, '');
@@ -3483,6 +3485,18 @@
     if (q == this.ksearch_value)
       return;
 
+    if (q.length < min) {
+      if (!this.env.acinfo) {
+        var label = this.get_label('autocompletechars');
+        label = label.replace('$min', min);
+        this.env.acinfo = this.display_message(label);
+      }
+      return;
+    }
+    else if (this.env.acinfo && q.length == min) {
+      this.hide_message(this.env.acinfo);
+    }
+
     var old_value = this.ksearch_value;
     this.ksearch_value = q;
 

Modified: trunk/roundcubemail/program/localization/en_US/messages.inc
===================================================================
--- trunk/roundcubemail/program/localization/en_US/messages.inc	2010-11-07 07:50:16 UTC (rev 4189)
+++ trunk/roundcubemail/program/localization/en_US/messages.inc	2010-11-07 08:36:52 UTC (rev 4190)
@@ -127,5 +127,6 @@
 $messages['messagemoved'] = 'Message(s) moved successfully';
 $messages['messagecopied'] = 'Message(s) copied successfully';
 $messages['messagemarked'] = 'Message(s) marked successfully';
+$messages['autocompletechars'] = 'Enter at least $min characters for autocompletion';
 
 ?>

Modified: trunk/roundcubemail/program/localization/pl_PL/messages.inc
===================================================================
--- trunk/roundcubemail/program/localization/pl_PL/messages.inc	2010-11-07 07:50:16 UTC (rev 4189)
+++ trunk/roundcubemail/program/localization/pl_PL/messages.inc	2010-11-07 08:36:52 UTC (rev 4190)
@@ -132,5 +132,6 @@
 $messages['messagemoved'] = 'Wiadomości zostały przeniesione';
 $messages['messagecopied'] = 'Wiadomości zostały skopiowane';
 $messages['messagemarked'] = 'Wiadomości zostały oznaczone';
+$messages['autocompletechars'] = 'Wprowadź co najmniej $min znak(ów) aby skorzystać z autouzupełniania';
 
 ?>

Modified: trunk/roundcubemail/program/steps/mail/compose.inc
===================================================================
--- trunk/roundcubemail/program/steps/mail/compose.inc	2010-11-07 07:50:16 UTC (rev 4189)
+++ trunk/roundcubemail/program/steps/mail/compose.inc	2010-11-07 08:36:52 UTC (rev 4190)
@@ -112,7 +112,8 @@
 // add some labels to client
 $OUTPUT->add_label('nosubject', 'nosenderwarning', 'norecipientwarning', 'nosubjectwarning', 'cancel',
     'nobodywarning', 'notsentwarning', 'notuploadedwarning', 'savingmessage', 'sendingmessage', 
-    'messagesaved', 'converting', 'editorwarning', 'searching', 'uploading', 'fileuploaderror');
+    'messagesaved', 'converting', 'editorwarning', 'searching', 'uploading', 'fileuploaderror',
+    'autocompletechars');
 
 // add config parameters to client script
 if (!empty($CONFIG['drafts_mbox'])) {
@@ -123,6 +124,7 @@
 $OUTPUT->set_env('mailbox', $IMAP->get_mailbox_name());
 $OUTPUT->set_env('sig_above', $CONFIG['sig_above']);
 $OUTPUT->set_env('top_posting', $CONFIG['top_posting']);
+$OUTPUT->set_env('autocomplete_min_length', $CONFIG['autocomplete_min_length']);
 
 // get reference message and set compose mode
 if ($msg_uid = $_SESSION['compose']['param']['reply_uid'])

_______________________________________________
http://lists.roundcube.net/mailman/listinfo/svn


More information about the Svn mailing list