From 3bae2387d4e0efcfe88fd56fa743c70deb638ee8 Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Thu, 6 Mar 2014 22:13:17 -0500 Subject: [PATCH] Fix contact autocompletion when UID is a digit --- NEWS | 1 + UI/WebServerResources/SOGoAutoCompletion.js | 13 +++++++++---- UI/WebServerResources/generic.css | 2 ++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 8e355fc77..5eead7800 100644 --- a/NEWS +++ b/NEWS @@ -17,6 +17,7 @@ Bug fixes - fixed missing 'name part' in address for email messages in Active Sync - fixed race condition when syncing huge amount of deleted messages over Active Sync - fixed encoding of string as CSS identifier when the string starts with a digit + - fixed auto-completion popupmenu when UID is a digit 2.2.0 (2014-02-24) ------------------ diff --git a/UI/WebServerResources/SOGoAutoCompletion.js b/UI/WebServerResources/SOGoAutoCompletion.js index 290b371b5..45cf10424 100644 --- a/UI/WebServerResources/SOGoAutoCompletion.js +++ b/UI/WebServerResources/SOGoAutoCompletion.js @@ -167,10 +167,12 @@ var SOGoAutoCompletionInterface = { for (var i = 0; i < data.contacts.length; i++) { var contact = data.contacts[i]; var completeEmail = contact["c_cn"]; + var uid = "" + contact[this.uidField]; + var c_name = "" + contact['c_name']; if (contact["c_mail"]) completeEmail += " <" + contact["c_mail"] + ">"; var node = new Element('li', { 'address': completeEmail, - 'uid': contact[this.uidField] }); + 'uid': uid }); var matchPosition = completeEmail.toLowerCase().indexOf(data.searchText.toLowerCase()); if (matchPosition > -1) { var matchBefore = completeEmail.substring(0, matchPosition); @@ -184,7 +186,7 @@ var SOGoAutoCompletionInterface = { node.appendChild(document.createTextNode(completeEmail)); } list.appendChild(node); - if (contact['c_name'].endsWith (".vlf")) { + if (c_name.endsWith(".vlf")) { // Keep track of list containers node.writeAttribute("container", contact['container']); } @@ -211,6 +213,7 @@ var SOGoAutoCompletionInterface = { this.menu.setStyle({ top: top + "px", left: offset[0] + "px", height: height, + maxWidth: (window.width() - offset[0] - 12) + "px", visibility: "visible" }); this.menu.scrollTop = 0; @@ -225,8 +228,10 @@ var SOGoAutoCompletionInterface = { if (data.contacts.length == 1) { // Single result var contact = data.contacts[0]; - input.writeAttribute("uid", contact[this.uidField]); - if (contact['c_name'].endsWith(".vlf")) { + var uid = "" + contact[this.uidField]; + var c_name = "" + contact['c_name']; + input.writeAttribute("uid", uid); + if (c_name.endsWith(".vlf")) { this.writeAttribute("container", contact['container']); } var completeEmail = contact["c_cn"]; diff --git a/UI/WebServerResources/generic.css b/UI/WebServerResources/generic.css index c1e5169b8..1754d73f2 100644 --- a/UI/WebServerResources/generic.css +++ b/UI/WebServerResources/generic.css @@ -251,6 +251,8 @@ DIV.contactSelector DIV.contactList padding-bottom: .15em; margin: 0px; width: auto; + overflow: hidden; + text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }