diff --git a/ChangeLog b/ChangeLog index 4164f16ae..fd3e40a0c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2010-10-11 Wolfgang Sourdeau + * UI/WebServerResources/SOGoAutoCompletion.js: + (SOGoAutoCompletionInterface.performSearchCallback): when the + match string is not found in "completeEmail" (due to a match with a + non-displayed attribute), don't put emphasize anything + graphically. + * UI/WebServerResources/ContactsUI.js: (onToolbarWriteToSelectedContacts): display an error message when no contact is selected rather than composing a new message. Fixed diff --git a/UI/WebServerResources/SOGoAutoCompletion.js b/UI/WebServerResources/SOGoAutoCompletion.js index 4b17e8b89..5ce0e875e 100644 --- a/UI/WebServerResources/SOGoAutoCompletion.js +++ b/UI/WebServerResources/SOGoAutoCompletion.js @@ -175,17 +175,22 @@ var SOGoAutoCompletionInterface = { var node = new Element('li', { 'address': completeEmail, 'uid': contact[this.uidField] }); var matchPosition = completeEmail.toLowerCase().indexOf(data.searchText.toLowerCase()); - var matchBefore = completeEmail.substring(0, matchPosition); - var matchText = completeEmail.substring(matchPosition, matchPosition + data.searchText.length); - var matchAfter = completeEmail.substring(matchPosition + data.searchText.length); + if (matchPosition > -1) { + var matchBefore = completeEmail.substring(0, matchPosition); + var matchText = completeEmail.substring(matchPosition, matchPosition + data.searchText.length); + var matchAfter = completeEmail.substring(matchPosition + data.searchText.length); + node.appendChild(document.createTextNode(matchBefore)); + node.appendChild(new Element('strong').update(matchText)); + node.appendChild(document.createTextNode(matchAfter)); + } + else { + node.appendChild(document.createTextNode(completeEmail)); + } list.appendChild(node); if (contact['c_name'].endsWith (".vlf")) { // Keep track of list containers node.writeAttribute("container", contact['container']); } - node.appendChild(document.createTextNode(matchBefore)); - node.appendChild(new Element('strong').update(matchText)); - node.appendChild(document.createTextNode(matchAfter)); if (contact["contactInfo"]) node.appendChild(document.createTextNode(" (" + contact["contactInfo"] + ")")); $(node).observe("mousedown", this.onAddressResultClick.bindAsEventListener(this));