From 93b295e8c49efdcec4e813c320b46688826a0d09 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Thu, 6 Jan 2011 09:16:02 +0000 Subject: [PATCH] Fix delete button in Web UI --- src/webui/html/confirmdeletion.html | 12 ++++++++---- src/webui/httpconnection.cpp | 10 ++++++++-- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/webui/html/confirmdeletion.html b/src/webui/html/confirmdeletion.html index 1a4821736..e44da102c 100644 --- a/src/webui/html/confirmdeletion.html +++ b/src/webui/html/confirmdeletion.html @@ -48,10 +48,14 @@ window.addEvent('domready', function(){ var cmd = '/command/delete'; if($('deleteFromDiskCB').get('checked')) cmd = '/command/deletePerm'; - hashes.each(function(item, index){ - new Request({url: cmd, method: 'post', data: {hash: item}}).send(); - }); - window.parent.document.getElementById('confirmDeletionPage').parentNode.removeChild(window.parent.document.getElementById('confirmDeletionPage')); + new Request({url: cmd, + method: 'post', + data: {hashes: hashes.join('|')}, + onComplete: function() { + window.parent.document.getElementById('confirmDeletionPage').parentNode.removeChild(window.parent.document.getElementById('confirmDeletionPage')); + } + }).send(); + }); }); diff --git a/src/webui/httpconnection.cpp b/src/webui/httpconnection.cpp index b7bd0142a..3d972b969 100644 --- a/src/webui/httpconnection.cpp +++ b/src/webui/httpconnection.cpp @@ -506,11 +506,17 @@ void HttpConnection::respondCommand(QString command) return; } if(command == "delete") { - emit deleteTorrent(parser.post("hash"), false); + QStringList hashes = parser.post("hashes").split("|"); + foreach(const QString &hash, hashes) { + emit deleteTorrent(hash, false); + } return; } if(command == "deletePerm") { - emit deleteTorrent(parser.post("hash"), true); + QStringList hashes = parser.post("hashes").split("|"); + foreach(const QString &hash, hashes) { + emit deleteTorrent(hash, true); + } return; } if(command == "increasePrio") {