Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[webui] move the recording "Download" button to the toolbar
  • Loading branch information
Jalle19 authored and perexg committed Aug 7, 2014
1 parent 9dd2224 commit 848602d
Showing 1 changed file with 24 additions and 8 deletions.
32 changes: 24 additions & 8 deletions src/webui/static/app/dvr.js
Expand Up @@ -88,13 +88,6 @@ tvheadend.dvrDetails = function(entry) {
content += '<hr>';
content += '<div class="x-epg-meta">Status: ' + entry.status + '</div>';

if (entry.url != null && entry.filesize > 0) {
content += '<div class="x-epg-meta">' + '<a href="' + entry.url
+ '" target="_blank">Download</a> '
+ parseInt(entry.filesize / 1000000) + ' MB</div>';

}

var win = new Ext.Window({
title: entry.title,
layout: 'fit',
Expand Down Expand Up @@ -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',
Expand All @@ -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',
Expand All @@ -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();
}
Expand All @@ -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);
}

Expand Down

0 comments on commit 848602d

Please sign in to comment.