From ad7bf7f5d36aca87c72cdfbc99b4e0c70fa0e54d Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Mon, 11 Oct 2010 21:22:14 +0000 Subject: [PATCH] Monotone-Parent: f308101c72372244428eb66d3f81a23140676912 Monotone-Revision: 795b040ab9bbddf7db971b30e8398290dcbd4ae8 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2010-10-11T21:22:14 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 3 +++ UI/WebServerResources/UIxAttendeesEditor.js | 19 ++++++++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index fd3e40a0c..2ceba8289 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2010-10-11 Wolfgang Sourdeau + * UI/WebServerResources/UIxAttendeesEditor.js: + (performSearchCallback): same as below. + * UI/WebServerResources/SOGoAutoCompletion.js: (SOGoAutoCompletionInterface.performSearchCallback): when the match string is not found in "completeEmail" (due to a match with a diff --git a/UI/WebServerResources/UIxAttendeesEditor.js b/UI/WebServerResources/UIxAttendeesEditor.js index 4acc1b23d..290d7cd8f 100644 --- a/UI/WebServerResources/UIxAttendeesEditor.js +++ b/UI/WebServerResources/UIxAttendeesEditor.js @@ -237,12 +237,17 @@ function performSearchCallback(http) { node.container = contact["container"]; } 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); - node.appendChild(document.createTextNode(matchBefore)); - node.appendChild(new Element('strong').update(matchText)); - node.appendChild(document.createTextNode(matchAfter)); + 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)); + } if (contact["contactInfo"]) node.appendChild(document.createTextNode(" (" + contact["contactInfo"] + ")")); @@ -533,7 +538,7 @@ function onInputBlur(event) { // selecting a menu item var visible = $(document.currentPopupMenu).getStyle('visibility') != 'hidden'; if (visible) { - log("XXX we return"); + // log("XXX we return"); return; } }