webui: minor improvement to service mapping button

This commit is contained in:
Adam Sutton 2013-09-22 13:28:49 +01:00
parent af07b24df2
commit ba4c233daa
2 changed files with 22 additions and 12 deletions

View file

@ -640,6 +640,8 @@ tvheadend.idnode_grid = function(panel, conf)
if (delBtn)
delBtn.setDisabled(s.getCount() == 0);
editBtn.setDisabled(s.getCount() != 1);
if (conf.selected)
conf.selected(s);
});
/* Top bar */
@ -700,7 +702,7 @@ tvheadend.idnode_grid = function(panel, conf)
disabled : true,
handler : function() {
var r = select.getSelections();
if (r) {
if (r && r.length > 0) {
var uuids = []
for ( var i = 0; i < r.length; i++ )
uuids.push(r[i].id)

View file

@ -89,21 +89,29 @@ tvheadend.services = function(panel)
{
var mapButton = new Ext.Toolbar.Button({
tooltip : 'Map services to channels',
iconCls : '',
text : 'Map Services',
iconCls : 'clone',
text : 'Map All',
callback: tvheadend.mapServices,
disabled : false,
});
var selected = function (s)
{
if (s.getCount() > 0)
mapButton.setText('Map Selected')
else
mapButton.setText('Map All')
}
tvheadend.idnode_grid(panel, {
url : 'api/mpegts/service',
comet : 'service',
titleS : 'Service',
titleP : 'Services',
tabIndex: 3,
add : false,
del : false,
tbar : [ mapButton ],
lcol : [
url : 'api/mpegts/service',
comet : 'service',
titleS : 'Service',
titleP : 'Services',
tabIndex : 3,
add : false,
del : false,
selected : selected,
tbar : [ mapButton ],
lcol : [
{
header : 'Play',
renderer : function(v, o, r) {