Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
WEBUI JS: Do not allow to create events from EPG if ACL does not allo…
…w that
  • Loading branch information
perexg committed Sep 12, 2014
1 parent 33a516b commit 9a1fc69
Show file tree
Hide file tree
Showing 2 changed files with 95 additions and 71 deletions.
163 changes: 92 additions & 71 deletions src/webui/static/app/epg.js
Expand Up @@ -118,48 +118,64 @@ tvheadend.epgDetails = function(event) {
'?title=' + encodeURIComponent(title) + '">Play</a></div>';
}

var store = new Ext.data.JsonStore({
autoload: true,
root: 'entries',
fields: ['key','val'],
id: 'key',
url: 'api/idnode/load',
baseParams: {
enum: 1,
'class': 'dvrconfig'
},
sortInfo: {
field: 'val',
direction: 'ASC'
}
});
store.load();
var buttons = [];

var confcombo = new Ext.form.ComboBox({
store: store,
triggerAction: 'all',
mode: 'local',
valueField: 'key',
displayField: 'val',
name: 'config_name',
emptyText: '(default)',
value: '',
editable: false
});
if (tvheadend.accessUpdate.dvr) {

var store = new Ext.data.JsonStore({
autoload: true,
root: 'entries',
fields: ['key','val'],
id: 'key',
url: 'api/idnode/load',
baseParams: {
enum: 1,
'class': 'dvrconfig'
},
sortInfo: {
field: 'val',
direction: 'ASC'
}
});
store.load();

var confcombo = new Ext.form.ComboBox({
store: store,
triggerAction: 'all',
mode: 'local',
valueField: 'key',
displayField: 'val',
name: 'config_name',
emptyText: '(default)',
value: '',
editable: false
});

buttons.push(confcombo);
buttons.push(new Ext.Button({
handler: recordEvent,
text: "Record program"
}));
buttons.push(new Ext.Button({
handler: recordSeries,
text: event.serieslink ? "Record series" : "Autorec"
}));

} else {

buttons.push(new Ext.Button({
handler: function() { win.close(); },
text: "Close"
}));
}

var win = new Ext.Window({
title: event.title,
layout: 'fit',
width: 500,
height: 300,
constrainHeader: true,
buttons: [confcombo, new Ext.Button({
handler: recordEvent,
text: "Record program"
}), new Ext.Button({
handler: recordSeries,
text: event.serieslink ? "Record series" : "Autorec"
})],
buttons: buttons,
buttonAlign: 'center',
html: content
});
Expand Down Expand Up @@ -573,6 +589,44 @@ tvheadend.epg = function() {
}
});

tvheadend.autorecButton = new Ext.Button({
text: 'Create AutoRec',
iconCls: 'wand',
tooltip: 'Create an automatic recording entry that will '
+ 'record all future programmes that matches '
+ 'the current query.',
handler: createAutoRec
});

var tbar = [
epgFilterTitle, '-',
epgFilterChannels, '-',
epgFilterChannelTags, '-',
epgFilterContentGroup, '-',
epgFilterDuration, '-',
{
text: 'Reset All',
handler: epgQueryClear
},
'->',
{
text: 'Watch TV',
iconCls: 'eye',
handler: function() {
new tvheadend.VideoPlayer();
}
},
'-',
tvheadend.autorecButton,
'-',
{
text: 'Help',
handler: function() {
new tvheadend.help('Electronic Program Guide', 'epg.html');
}
}
];

var panel = new Ext.ux.grid.livegrid.GridPanel({
stateful: true,
stateId: 'epggrid',
Expand All @@ -584,43 +638,7 @@ tvheadend.epg = function() {
store: epgStore,
selModel: new Ext.ux.grid.livegrid.RowSelectionModel(),
view: epgView,
tbar: [
epgFilterTitle,
'-',
epgFilterChannels,
'-',
epgFilterChannelTags,
'-',
epgFilterContentGroup,
'-',
epgFilterDuration,
'-',
{
text: 'Reset All',
handler: epgQueryClear
},
'->',
{
text: 'Watch TV',
iconCls: 'eye',
handler: function() {
new tvheadend.VideoPlayer();
}
},
'-',
{
text: 'Create AutoRec',
iconCls: 'wand',
tooltip: 'Create an automatic recording entry that will '
+ 'record all future programmes that matches '
+ 'the current query.',
handler: createAutoRec
}, '-', {
text: 'Help',
handler: function() {
new tvheadend.help('Electronic Program Guide', 'epg.html');
}
}],
tbar: tbar,
bbar: new Ext.ux.grid.livegrid.Toolbar({
view: epgView,
displayInfo: true
Expand Down Expand Up @@ -650,6 +668,9 @@ tvheadend.epg = function() {
}

function createAutoRec() {

if (!tvheadend.accessUpdate.dvr)
return;

var title = epgStore.baseParams.title ? epgStore.baseParams.title
: "<i>Don't care</i>";
Expand Down
3 changes: 3 additions & 0 deletions src/webui/static/app/tvheadend.js
Expand Up @@ -313,6 +313,9 @@ function accessUpdate(o) {

tvheadend.rootTabPanel.setLogin(o.username);

if (tvheadend.autorecButton)
tvheadend.autorecButton.setDisabled(o.dvr != true);

if (o.dvr == true && tvheadend.dvrpanel == null) {
tvheadend.dvrpanel = tvheadend.dvr();
tvheadend.rootTabPanel.add(tvheadend.dvrpanel);
Expand Down

0 comments on commit 9a1fc69

Please sign in to comment.