}
+// Something has been dropped onto a folder.
function mail_folder_drop(event, destination_room) {
event.preventDefault();
- console.log("mail_folder_drop(" + destination_room + ")");
event.target.classList.toggle("ctdl_mail_folder_droppable", false);
+ var msgs = event.dataTransfer.getData("text").split(",");
+ for (var i=0; i<msgs.length; ++i) {
+ mail_move(msgs[i], destination_room);
+ }
+}
+
+
+// mail_folder_drop() calls this function for each message being moved
+function mail_move(msgdiv, destination_room) {
+ console.log("mail_move() " + msgdiv + " to " + destination_room);
}
var i;
var count = 0;
var table = document.getElementById("ctdl-onscreen-mailbox");
+ var messages_being_dragged = [] ;
if (event.target.classList.contains("ctdl-mail-selected")) {
// The row being dragged IS selected. See if any OTHER rows are selected, and they will come along for the ride.
for (i=1; row=table.rows[i]; ++i) {
if (row.classList.contains("ctdl-mail-selected")) {
count = count + 1;
+ messages_being_dragged.push(row.id);
}
}
}
else {
// The row being dragged is NOT selected. It will be dragged on its own, ignoring the selected rows.
count = 1;
+ messages_being_dragged.push(event.target.id);
}
// FIXME tell the clipboard what's being moved.
d = document.getElementById("ctdl_draggo");
d.innerHTML = "<font size='+2'><i class='fa fa-envelope' style='color: red'></i> " + count + "</font>"
event.dataTransfer.setDragImage(d, 0, 0);
- event.dataTransfer.setData("text/html", "blah blah blah");
+ event.dataTransfer.setData("text", messages_being_dragged);
}