From 419d719ab8e52caf72975b24ea35beddf566cbf8 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Thu, 18 Mar 2010 20:04:03 +0000 Subject: [PATCH] Added back file prioritizing in Web UI --- src/webui/prop-files.html | 86 ++++++++++++++++++++++++++++++++------- 1 file changed, 71 insertions(+), 15 deletions(-) diff --git a/src/webui/prop-files.html b/src/webui/prop-files.html index 7d7cded88..2efdcd7c1 100644 --- a/src/webui/prop-files.html +++ b/src/webui/prop-files.html @@ -2,10 +2,11 @@ + - + @@ -32,10 +33,50 @@ var createDownloadedCB = function(id, downloaded) { if($defined($('cbPrio'+id).get('checked')) && $('cbPrio'+id).get('checked')) checked = 1; setFilePriority(id, checked); + // Display or add combobox + if(checked) { + $('comboPrio'+id).set("value", 1); + $('comboPrio'+id).removeClass("invisible"); + } else { + $('comboPrio'+id).addClass("invisible"); + } }); return CB; } +var createPriorityCombo = function(id, selected_prio) { + var select = new Element('select'); + select.set('id', 'comboPrio'+id); + select.addEvent('change', function(e){ + var new_prio = $('comboPrio'+id).get('value'); + setFilePriority(id, new_prio); + }); + var opt = new Element("option"); + opt.set('value', '1') + opt.set('html', "_(Normal)"); + if(selected_prio <= 1) + opt.setAttribute('selected', ''); + opt.injectInside(select); + opt = new Element("option"); + opt.set('value', '2') + opt.set('html', "_(High)"); + if(selected_prio == 2) + opt.setAttribute('selected', ''); + opt.injectInside(select); + opt = new Element("option"); + opt.set('value', '7') + opt.set('html', "_(Maximum)"); + if(selected_prio == 7) + opt.setAttribute('selected', ''); + opt.injectInside(select); + if(selected_prio < 1) { + select.addClass("invisible"); + } else { + select.removeClass("invisible"); + } + return select; +} + var filesDynTable = new Class ({ initialize: function(){ @@ -65,16 +106,26 @@ var createDownloadedCB = function(id, downloaded) { updateRow: function(tr, row, id){ var tds = tr.getElements('td'); for(var i=0; i 0) tds[i].getChildren('input')[0].set('checked', 'checked'); else tds[i].removeProperty('checked') } else { - tds[i].set('html', row[i]); + if(i == 4) { + if(row[i] > 0) { + tds[i].getChildren('select').set('value', row[i]); + $('comboPrio'+id).removeClass("invisible"); + } else { + if(!$('comboPrio'+id).hasClass("invisible")) + $('comboPrio'+id).addClass("invisible"); + } + } else { + tds[i].set('html', row[i]); + } } } } @@ -93,13 +144,17 @@ var createDownloadedCB = function(id, downloaded) { for(var i=0; i \ No newline at end of file +
_(Downloaded) _(Name) _(Size) _(Progress)_(Downloaded)_(Priority)