|
|
|
<span id="torrentFiles">
|
|
|
|
<table class="torrentTable" cellpadding="0" cellspacing="0">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>_(Name)</th>
|
|
|
|
<th>_(Size)</th>
|
|
|
|
<th style="width: 90px;">_(Progress)</th>
|
* Replace priority combo boxes by check boxes in Web UI as in Regular UI
* Prepare http server and preferences classes to add new settings to Web UI
* Tabified Program preferences in Web UI since there will be a lot of settings soon
* Started to add new settings to Web UI (PeX, LSD, Encryption, save path, temp path, scan dir, preallocateall, queueing, listen_port, upnp, nat-pmp, language, ip filter) -> Proxy is missing
* Added a command line parameter to change the web ui port
* Fix PeerGuardian .p2b binary filter support
15 years ago
|
|
|
<th>_(Downloaded)</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody id="filesTable"></tbody>
|
|
|
|
</table>
|
|
|
|
</span>
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
var waitingTorrentFiles=false;
|
|
|
|
var current_hash = "";
|
|
|
|
|
|
|
|
var setFilePriority = function(id, priority) {
|
|
|
|
if(current_hash == "") return;
|
|
|
|
new Request({url: '/command/setFilePrio', method: 'post', data: {'hash': current_hash, 'id': id, 'priority': priority}}).send();
|
|
|
|
}
|
|
|
|
|
* Replace priority combo boxes by check boxes in Web UI as in Regular UI
* Prepare http server and preferences classes to add new settings to Web UI
* Tabified Program preferences in Web UI since there will be a lot of settings soon
* Started to add new settings to Web UI (PeX, LSD, Encryption, save path, temp path, scan dir, preallocateall, queueing, listen_port, upnp, nat-pmp, language, ip filter) -> Proxy is missing
* Added a command line parameter to change the web ui port
* Fix PeerGuardian .p2b binary filter support
15 years ago
|
|
|
var createDownloadedCB = function(id, downloaded) {
|
|
|
|
var CB = new Element('input');
|
|
|
|
CB.set('type', 'checkbox');
|
|
|
|
if(downloaded)
|
|
|
|
CB.set('checked', 'checked');
|
|
|
|
CB.set('id', 'cbPrio'+id);
|
|
|
|
CB.addEvent('change', function(e){
|
* Replace priority combo boxes by check boxes in Web UI as in Regular UI
* Prepare http server and preferences classes to add new settings to Web UI
* Tabified Program preferences in Web UI since there will be a lot of settings soon
* Started to add new settings to Web UI (PeX, LSD, Encryption, save path, temp path, scan dir, preallocateall, queueing, listen_port, upnp, nat-pmp, language, ip filter) -> Proxy is missing
* Added a command line parameter to change the web ui port
* Fix PeerGuardian .p2b binary filter support
15 years ago
|
|
|
var checked = 0;
|
|
|
|
if($defined($('cbPrio'+id).get('checked')) && $('cbPrio'+id).get('checked'))
|
|
|
|
checked = 1;
|
|
|
|
setFilePriority(id, checked);
|
|
|
|
});
|
* Replace priority combo boxes by check boxes in Web UI as in Regular UI
* Prepare http server and preferences classes to add new settings to Web UI
* Tabified Program preferences in Web UI since there will be a lot of settings soon
* Started to add new settings to Web UI (PeX, LSD, Encryption, save path, temp path, scan dir, preallocateall, queueing, listen_port, upnp, nat-pmp, language, ip filter) -> Proxy is missing
* Added a command line parameter to change the web ui port
* Fix PeerGuardian .p2b binary filter support
15 years ago
|
|
|
return CB;
|
|
|
|
}
|
|
|
|
|
|
|
|
var filesDynTable = new Class ({
|
|
|
|
|
|
|
|
initialize: function(){
|
|
|
|
},
|
|
|
|
|
|
|
|
setup: function(table){
|
|
|
|
this.table = $(table);
|
|
|
|
this.rows = new Hash();
|
|
|
|
},
|
|
|
|
|
|
|
|
removeRow: function(id){
|
|
|
|
if(this.rows.has(id)) {
|
|
|
|
var tr = this.rows.get(id);
|
|
|
|
tr.dispose();
|
|
|
|
this.rows.erase(id);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
},
|
|
|
|
|
|
|
|
removeAllRows: function() {
|
|
|
|
this.rows.each(function(tr, id) {
|
|
|
|
this.removeRow(id);
|
|
|
|
}.bind(this));
|
|
|
|
},
|
|
|
|
|
* Replace priority combo boxes by check boxes in Web UI as in Regular UI
* Prepare http server and preferences classes to add new settings to Web UI
* Tabified Program preferences in Web UI since there will be a lot of settings soon
* Started to add new settings to Web UI (PeX, LSD, Encryption, save path, temp path, scan dir, preallocateall, queueing, listen_port, upnp, nat-pmp, language, ip filter) -> Proxy is missing
* Added a command line parameter to change the web ui port
* Fix PeerGuardian .p2b binary filter support
15 years ago
|
|
|
updateRow: function(tr, row, id){
|
|
|
|
var tds = tr.getElements('td');
|
|
|
|
for(var i=0; i<row.length; i++) {
|
|
|
|
if(i==2) {
|
* Replace priority combo boxes by check boxes in Web UI as in Regular UI
* Prepare http server and preferences classes to add new settings to Web UI
* Tabified Program preferences in Web UI since there will be a lot of settings soon
* Started to add new settings to Web UI (PeX, LSD, Encryption, save path, temp path, scan dir, preallocateall, queueing, listen_port, upnp, nat-pmp, language, ip filter) -> Proxy is missing
* Added a command line parameter to change the web ui port
* Fix PeerGuardian .p2b binary filter support
15 years ago
|
|
|
$('pbf_'+id).setValue(row[i].toFloat());
|
|
|
|
} else {
|
|
|
|
if(i==3) {
|
* Replace priority combo boxes by check boxes in Web UI as in Regular UI
* Prepare http server and preferences classes to add new settings to Web UI
* Tabified Program preferences in Web UI since there will be a lot of settings soon
* Started to add new settings to Web UI (PeX, LSD, Encryption, save path, temp path, scan dir, preallocateall, queueing, listen_port, upnp, nat-pmp, language, ip filter) -> Proxy is missing
* Added a command line parameter to change the web ui port
* Fix PeerGuardian .p2b binary filter support
15 years ago
|
|
|
if(row[i] > 0)
|
|
|
|
tds[i].getChildren('input')[0].set('checked', 'checked');
|
|
|
|
else
|
|
|
|
tds[i].removeProperty('checked')
|
|
|
|
} else {
|
|
|
|
tds[i].set('html', row[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
},
|
|
|
|
|
|
|
|
insertRow: function(id, row) {
|
|
|
|
if(this.rows.has(id)) {
|
|
|
|
var tr = this.rows.get(id);
|
* Replace priority combo boxes by check boxes in Web UI as in Regular UI
* Prepare http server and preferences classes to add new settings to Web UI
* Tabified Program preferences in Web UI since there will be a lot of settings soon
* Started to add new settings to Web UI (PeX, LSD, Encryption, save path, temp path, scan dir, preallocateall, queueing, listen_port, upnp, nat-pmp, language, ip filter) -> Proxy is missing
* Added a command line parameter to change the web ui port
* Fix PeerGuardian .p2b binary filter support
15 years ago
|
|
|
this.updateRow(tr, row, id);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
//this.removeRow(id);
|
|
|
|
var tr = new Element('tr');
|
|
|
|
this.rows.set(id, tr);
|
|
|
|
for(var i=0; i<row.length; i++)
|
|
|
|
{
|
|
|
|
var td = new Element('td');
|
|
|
|
if(i==2) {
|
|
|
|
td.adopt(new ProgressBar(row[i].toFloat(), {'id': 'pbf_'+id, 'width':80}));
|
|
|
|
} else {
|
|
|
|
if(i == 3) {
|
* Replace priority combo boxes by check boxes in Web UI as in Regular UI
* Prepare http server and preferences classes to add new settings to Web UI
* Tabified Program preferences in Web UI since there will be a lot of settings soon
* Started to add new settings to Web UI (PeX, LSD, Encryption, save path, temp path, scan dir, preallocateall, queueing, listen_port, upnp, nat-pmp, language, ip filter) -> Proxy is missing
* Added a command line parameter to change the web ui port
* Fix PeerGuardian .p2b binary filter support
15 years ago
|
|
|
td.adopt(createDownloadedCB(id,row[i]));
|
|
|
|
} else {
|
|
|
|
td.set('html', row[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
td.injectInside(tr);
|
|
|
|
}
|
|
|
|
tr.injectInside(this.table);
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
var loadTorrentFilesData = function() {
|
|
|
|
if(!$defined($('filesTable'))) {
|
|
|
|
// Tab changed
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
var new_hash = myTable.getCurrentTorrentHash();
|
|
|
|
if(new_hash == "") {
|
|
|
|
fTable.removeAllRows();
|
|
|
|
loadTorrentFilesData.delay(1500);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if(new_hash != current_hash) {
|
|
|
|
fTable.removeAllRows();
|
|
|
|
current_hash = new_hash;
|
|
|
|
}
|
|
|
|
var url = 'json/propertiesFiles/'+current_hash;
|
|
|
|
if (!waitingTorrentFiles) {
|
|
|
|
waitingTorrentFiles=true;
|
|
|
|
var request = new Request.JSON({
|
|
|
|
url: url,
|
|
|
|
noCache: true,
|
|
|
|
method: 'get',
|
|
|
|
onFailure: function() {
|
|
|
|
$('error_div').set('html', 'qBittorrent client is not reachable');
|
|
|
|
waitingTorrentFiles=false;
|
|
|
|
loadTorrentFilesData.delay(2000);
|
|
|
|
},
|
|
|
|
onSuccess: function(files) {
|
|
|
|
$('error_div').set('html', '');
|
|
|
|
if(files){
|
|
|
|
// Update Trackers data
|
|
|
|
var i=0;
|
|
|
|
files.each(function(file){
|
|
|
|
var row = new Array();
|
|
|
|
row.length = 4;
|
|
|
|
row[0] = file.name;
|
|
|
|
row[1] = file.size;
|
|
|
|
row[2] = (file.progress*100).round(1);
|
|
|
|
row[3] = file.priority;
|
|
|
|
fTable.insertRow(i, row);
|
|
|
|
i++;
|
|
|
|
}.bind(this));
|
|
|
|
} else {
|
|
|
|
fTable.removeAllRows();
|
|
|
|
}
|
|
|
|
waitingTorrentFiles=false;
|
|
|
|
loadTorrentFilesData.delay(1500);
|
|
|
|
}
|
|
|
|
}).send();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
fTable = new filesDynTable();
|
|
|
|
fTable.setup($('filesTable'));
|
|
|
|
// Initial loading
|
|
|
|
loadTorrentFilesData();
|
|
|
|
</script>
|