From 848602d82e93b73f37e6c15fd4a9a06d91473c54 Mon Sep 17 00:00:00 2001 From: Sam Stenvall Date: Thu, 7 Aug 2014 10:11:52 +0300 Subject: [PATCH] [webui] move the recording "Download" button to the toolbar --- src/webui/static/app/dvr.js | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/src/webui/static/app/dvr.js b/src/webui/static/app/dvr.js index 2f5a5a58..701594fe 100644 --- a/src/webui/static/app/dvr.js +++ b/src/webui/static/app/dvr.js @@ -88,13 +88,6 @@ tvheadend.dvrDetails = function(entry) { content += '
'; content += '
Status: ' + entry.status + '
'; - if (entry.url != null && entry.filesize > 0) { - content += '
' + 'Download ' - + parseInt(entry.filesize / 1000000) + ' MB
'; - - } - var win = new Ext.Window({ title: entry.title, layout: 'fit', @@ -473,6 +466,13 @@ tvheadend.dvrschedule = function(title, iconCls, dvrStore) { }); } }; + + function downloadSelected() { + var selectedKey = panel.selModel.selections.keys[0]; + var entry = dvrStore.getById(selectedKey); + + window.location = entry.data.url; + } function abortSelected() { Ext.MessageBox.confirm('Message', @@ -491,6 +491,14 @@ tvheadend.dvrschedule = function(title, iconCls, dvrStore) { handler: abortSelected, disabled: true }); + + var downloadButton = new Ext.Toolbar.Button({ + tooltip: 'Download the selected recording', + iconCls: 'save', + text: 'Download', + handler: downloadSelected, + disabled: true + }); var deleteButton = new Ext.Toolbar.Button({ tooltip: 'Delete one or more selected rows', @@ -510,8 +518,15 @@ tvheadend.dvrschedule = function(title, iconCls, dvrStore) { if (self.getCount() > 0) { deleteButton.enable(); abortButton.enable(); + + // It only makes sense to download one item at a time + if (self.getCount() === 1) + downloadButton.enable(); + else + downloadButton.disable(); } else { + downloadButton.disable(); deleteButton.disable(); abortButton.disable(); } @@ -532,8 +547,9 @@ tvheadend.dvrschedule = function(title, iconCls, dvrStore) { abortButton ]); } - // Add the "Delete recordings" button to the others + // Add the "Download" and "Delete" button to the others else { + panelButtons.push(downloadButton); panelButtons.push(deleteButton); }