Improved JavaScript of UIxContactsUserFolders to avoid useless AJAX requests.

Monotone-Parent: 23831e953238f691f5c6c210b4ddec5d7aee5aec
Monotone-Revision: a62454d2734ee40074efa8872c2a7dfef7bf59fc

Monotone-Author: flachapelle@inverse.ca
Monotone-Date: 2009-09-04T21:32:53
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Francis Lachapelle 2009-09-04 21:32:53 +00:00
parent 1bd01c2ce0
commit d8be5f7ddb
3 changed files with 29 additions and 21 deletions

View file

@ -1,11 +1,11 @@
DIV#filterPanel DIV#filterPanel
{ position: absolute; { position: absolute; n0border: 1px dotted blue;
text-align: center; text-align: center;
width: auto; width: auto;
line-height: 3em; n0line-height: 3em;
top: 0; top: 0;
left: 1em; left: 0;
right: 1em; } padding: 3px 1em 0; }
SPAN.searchBox SPAN.searchBox
{ float: none !important; } { float: none !important; }

View file

@ -24,14 +24,14 @@ function onSearchFormSubmit() {
} }
function usersSearchCallback(http) { function usersSearchCallback(http) {
document.userFoldersRequest = null; document.userFoldersRequest = null;
var div = $("folders"); var div = $("folders");
if (http.status == 200) { if (http.status == 200) {
var response = http.responseText; var response = http.responseText;
buildUsersTree(div, http.responseText) buildUsersTree(div, http.responseText);
} }
else if (http.status == 404) else if (http.status == 404)
div.update(); div.update();
} }
function addUserLineToTree(tree, parent, line) { function addUserLineToTree(tree, parent, line) {
@ -223,20 +223,25 @@ function onConfirmFolderSelection(event) {
} }
function onFolderSearchKeyDown(event) { function onFolderSearchKeyDown(event) {
if (event.ctrlKey
|| event.metaKey
|| event.keyCode == Event.KEY_TAB)
return;
var div = $("folders"); var div = $("folders");
if (!div.clean) { if (!div.clean) {
var oldD = $("d"); var oldD = $("d"); // the folders tree
if (oldD) { if (oldD) {
oldD.remove(); oldD.remove();
delete d; delete d;
} }
div.clean = true; div.clean = true;
$("addButton").disabled = true; $("addButton").disabled = true;
} }
if (this.timer) if (this.timer)
startAnimation($("pageContent"), $("filterPanel")); startAnimation($("pageContent"), $("filterPanel"));
} }
function initUserFoldersWindow() { function initUserFoldersWindow() {

View file

@ -939,6 +939,9 @@ function onSearchBlur(event) {
} }
function onSearchKeyDown(event) { function onSearchKeyDown(event) {
if (event.keyCode == Event.KEY_TAB)
return false;
if (this.timer) if (this.timer)
clearTimeout(this.timer); clearTimeout(this.timer);