webui: make it possible to map selected services

I probably need to improve the text on the button.
This commit is contained in:
Adam Sutton 2013-09-20 22:39:27 +01:00
parent ac83c6f408
commit a3e036ca9f
3 changed files with 29 additions and 4 deletions

View file

@ -21,7 +21,7 @@ tvheadend.comet.on('channeltags', function(m) {
/*
* Service mapping
*/
tvheadend.mapServices = function()
tvheadend.mapServices = function(t, e, store, select)
{
var panel = null;
var win = null;
@ -63,11 +63,22 @@ tvheadend.mapServices = function()
text : 'Map',
tooltip : 'Begin mapping',
handler : function () {
p = null;
if (select) {
var r = select.getSelections();
if (r.length > 0) {
var uuids = [];
for (var i = 0; i < r.length; i++)
uuids.push(r[i].id);
p = { uuids: Ext.encode(uuids) };
}
}
panel.getForm().submit({
url : 'api/service/mapper/start',
waitMessage : 'Mapping services...'
waitMessage : 'Mapping services...',
params : p
});
}
}
});
panel = new Ext.FormPanel({

View file

@ -748,8 +748,14 @@ tvheadend.idnode_grid = function(panel, conf)
/* Extra buttons */
if (conf.tbar) {
buttons.push('-')
for (i = 0; i < conf.tbar.length; i++)
for (i = 0; i < conf.tbar.length; i++) {
if (conf.tbar[i].callback) {
conf.tbar[i].handler = function (b, e) {
this.callback(this, e, store, select);
}
}
buttons.push(conf.tbar[i])
}
}
/* Help */

View file

@ -85,6 +85,13 @@ tvheadend.muxes = function(panel)
tvheadend.services = function(panel)
{
var mapButton = new Ext.Toolbar.Button({
tooltip : 'Map services to channels',
iconCls : '',
text : 'Map Services',
callback: tvheadend.mapServices,
disabled : false,
});
tvheadend.idnode_grid(panel, {
url : 'api/mpegts/service',
comet : 'service',
@ -92,6 +99,7 @@ tvheadend.services = function(panel)
titleP : 'Services',
add : false,
del : false,
tbar : [ mapButton ],
lcol : [
{
header : 'Play',