Registered Member
|
I want the red "X" in the web interface to delete the torrent files when I delete the torrent.
Also, I want it to be a one-click procedure -- no "Are you absolutely sure..." prompt. So, I coded up a patch to make the web interface behave as I want. I thought I'd share it here for anyone else who is interested. This is all my notes. If you want to make the changes: 1. download the source 2. edit the two files so that your diffs look like my diffs below. 3. ./configure , make, make install. If you don't have all the libraries that ./configure needs, you will get nasty, useless and misleading error messages. If you look inside config.log , you will usually find the name of a file you are missing. You will need, at least: kdelibs4-dev libgmp3-dev libzzip-0-12 libqt3-mt-dev the version numbers are just what I was using today. They will certainly change over time. This patch is for version 2.1.4: /usr/share/apps/ktorrent/www/default/interface.php builds the prompt message "Are you absolutely sure that you want to remove this torrent?" --commented out msg call: diff interface.php.ORIG interface.php 26c26 < msg = "Are you absolutely sure that you want remove this torrent?"; --- > <!-- msg = "Are you absolutely sure that you want remove this torrent?"; --> plugins/webinterface/php_interface.cpp calls: core->remove((*i), false); the "false" is a 0 (zero) this eventually triggers the remove call described in coreinterface.h: /** * Remove a download.This will delete all temp * data from this TorrentControl And delete the * TorrentControl itself. It can also potentially * start a new download (when one is waiting to be downloaded). * @param tc The torrent * @param data_to Wether or not to delete the file data to */ virtual void remove(TorrentInterface* tc,bool data_to) = 0; --If we change "false" to "true", the torrent data files are removed: diff php_interface.cpp.ORIG php_interface.cpp 286c286 < core->remove((*i), false); --- > core->remove((*i), true); /* delete data */ |
Moderator
|
|
Registered Member
|
Perhaps.
But, it is a risk/reward balance. The other side of the risk is that I forget to delete old stuff, and I run out of disk space. Also, I think it is very instructive for the community to know how to make changes like this. I meant this posting in its technical spirit. I'd rather not get into a deep discussion of UI's. People can use this, or not, as is their inclination. Thanks, Bob |
Registered Member
|
I think that the delete confirmation can be removed from php code.
A simple onclick="if(!confirm('confirm text here')) return false;" should be enough on delete link. That way it avoid a full refresh of php page (especialy problematic when banwith is completely used by torrent upload). The pros are : - easy - quick The cons : - will not work on javascript not enabled navigator |
Registered Member
|
Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]