WebUI: Implement 'Force Start' feature.

This commit is contained in:
Gabriele
2015-04-15 19:13:18 +02:00
parent 2c5edf8652
commit b5b40abb56
7 changed files with 43 additions and 0 deletions

View File

@@ -137,6 +137,7 @@ var ContextMenu = new Class({
all_are_paused = true;
there_are_paused = false;
all_are_super_seeding = true;
all_are_force_start = true;
var h = myTable.selectedIds();
h.each(function(item, index){
@@ -152,6 +153,9 @@ var ContextMenu = new Class({
else
there_are_f_l_piece_prio = true;
if (data['force_start'] != true)
all_are_force_start = false;
if (data['progress'] != 1.0) // not downloaded
all_are_downloaded = false;
else if (data['super_seeding'] != true)
@@ -174,6 +178,8 @@ var ContextMenu = new Class({
if (!all_are_f_l_piece_prio && there_are_f_l_piece_prio)
show_f_l_piece_prio = false;
this.setItemChecked('ForceStart', all_are_force_start);
if (all_are_downloaded) {
this.hideItem('SequentialDownload');
this.hideItem('FirstLastPiecePrio');

View File

@@ -181,6 +181,21 @@ initializeWindows = function() {
}
};
setForceStartFN = function(val) {
var h = myTable.selectedIds();
if (h.length) {
new Request({
url: 'command/setForceStart',
method: 'post',
data: {
value: val,
hashes: h.join("|")
}
}).send();
updateMainData();
}
};
globalDownloadLimitFN = function() {
new MochaUI.Window({
id: 'downloadLimitPage',

View File

@@ -54,6 +54,9 @@
},
SuperSeeding : function (element, ref) {
setSuperSeedingFN(!ref.getItemChecked('SuperSeeding'));
},
ForceStart : function (element, ref) {
setForceStartFN(!ref.getItemChecked('ForceStart'));
}
},
offsets : {