From e3b23016dc31900512035861479550873b7f41fe Mon Sep 17 00:00:00 2001 From: C Robert Date: Mon, 29 Jun 2009 19:31:59 +0000 Subject: [PATCH] Monotone-Parent: 71124a5805a6acd533a352015d2c6fe9c134f725 Monotone-Revision: 3d05f2005e93e45bcafb0ec4aff59c61d8e08631 Monotone-Author: crobert@inverse.ca Monotone-Date: 2009-06-29T19:31:59 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 1 + UI/WebServerResources/ContactsUI.js | 38 ++++++++++++++++++++--------- 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 635f861a6..7d0addfb6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,7 @@ 2009-06-29 Cyril Robert * UI/WebServerResources/ContactsUI.js: Added drag & drop support! + * UI/WebServerResources/ContactsUI.js: Disabled drag & drop for lists 2009-06-26 Francis Lachapelle diff --git a/UI/WebServerResources/ContactsUI.js b/UI/WebServerResources/ContactsUI.js index 3d31c5f4c..d77e97097 100644 --- a/UI/WebServerResources/ContactsUI.js +++ b/UI/WebServerResources/ContactsUI.js @@ -1102,13 +1102,27 @@ function currentFolderIsRemote () { return rc; } +function containsVLF (ids) { + var rc = false; + + for (var i=0; i < ids.length; i++) + if (ids[i].match ("\.vlf$") == ".vlf") + rc = true; + + return rc; +} + function startDragging (itm, e) { var handle = $("dragDropVisual"); - var count = $('contactsList').getSelectedRowsId().length; - handle.style.display = "block"; - handle.update (count); - if (e.shiftKey || currentFolderIsRemote ()) - handle.addClassName ("copy"); + var contacts = $('contactsList').getSelectedRowsId(); + var count = contacts.length; + + if (!containsVLF (contacts)) { + handle.style.display = "block"; + handle.update (count); + if (e.shiftKey || currentFolderIsRemote ()) + handle.addClassName ("copy"); + } } function whileDragging (itm, e) { @@ -1137,13 +1151,15 @@ function dropSelectedContacts (action, toId) { var selectedFolders = $("contactFolders").getSelectedNodes(); if (selectedFolders.length > 0) { var contactIds = $('contactsList').getSelectedRowsId(); - var fromId = $(selectedFolders[0]).id; - if (!currentFolderIsRemote () || action != "move") { - var url = ApplicationBaseURL + fromId + "/" + action - + "?folder=" + toId + "&uid=" - + contactIds.join("&uid="); + if (!containsVLF (contactIds)) { + var fromId = $(selectedFolders[0]).id; + if (!currentFolderIsRemote () || action != "move") { + var url = ApplicationBaseURL + fromId + "/" + action + + "?folder=" + toId + "&uid=" + + contactIds.join("&uid="); - triggerAjaxRequest(url, actionContactCallback, fromId); + triggerAjaxRequest(url, actionContactCallback, fromId); + } } } }