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); + } } } }