diff --git a/webui/static/app/acleditor.js b/webui/static/app/acleditor.js index 8bec54e5..afe9a98d 100644 --- a/webui/static/app/acleditor.js +++ b/webui/static/app/acleditor.js @@ -3,9 +3,9 @@ tvheadend.acleditor = function() { var fm = Ext.form; var enabledColumn = new Ext.grid.CheckColumn({ - header: "Enabled", - dataIndex: 'enabled', - width: 60 + header: "Enabled", + dataIndex: 'enabled', + width: 60 }); var streamingColumn = new Ext.grid.CheckColumn({ diff --git a/webui/static/app/chconf.js b/webui/static/app/chconf.js index fb6163d7..aabb00f9 100644 --- a/webui/static/app/chconf.js +++ b/webui/static/app/chconf.js @@ -13,15 +13,15 @@ tvheadend.channeldetails = function(chid, chname) { '
Scrambling:{scrambling}
' ) }); - + var enabledColumn = new Ext.grid.CheckColumn({ - header: "Enabled", - dataIndex: 'enabled', - width: 60 + header: "Enabled", + dataIndex: 'enabled', + width: 60 }); var cm = new Ext.grid.ColumnModel([expander, - enabledColumn, + enabledColumn, { width: 125, id:'name', @@ -48,74 +48,74 @@ tvheadend.channeldetails = function(chid, chname) { header: "Source", dataIndex: 'source', } - ]); + ]); var transportRecord = Ext.data.Record.create([ - {name: 'enabled'}, - {name: 'status'}, - {name: 'name'}, - {name: 'provider'}, - {name: 'network'}, - {name: 'source'}, - {name: 'video'}, - {name: 'audio'}, - {name: 'scrambling'}, - {name: 'subtitles'} - ]); + {name: 'enabled'}, + {name: 'status'}, + {name: 'name'}, + {name: 'provider'}, + {name: 'network'}, + {name: 'source'}, + {name: 'video'}, + {name: 'audio'}, + {name: 'scrambling'}, + {name: 'subtitles'} + ]); var transportsstore = - new Ext.data.JsonStore({root: 'entries', - fields: transportRecord, - url: "channel", - autoLoad: true, - id: 'id', - storeid: 'id', - baseParams: {chid: chid, op: "gettransports"} - }); + new Ext.data.JsonStore({root: 'entries', + fields: transportRecord, + url: "channel", + autoLoad: true, + id: 'id', + storeid: 'id', + baseParams: {chid: chid, op: "gettransports"} + }); var transportsgrid = new Ext.grid.EditorGridPanel({ - title:'Transports', - anchor: '100% 50%', - stripeRows:true, - plugins:[enabledColumn, expander], - store: transportsstore, - clicksToEdit: 2, - cm: cm, - selModel: new Ext.grid.RowSelectionModel({singleSelect:false}) - }); + title:'Transports', + anchor: '100% 50%', + stripeRows:true, + plugins:[enabledColumn, expander], + store: transportsstore, + clicksToEdit: 2, + cm: cm, + selModel: new Ext.grid.RowSelectionModel({singleSelect:false}) + }); var confreader = new Ext.data.JsonReader({ - root: 'channels', - }, ['name', 'comdetect']); + root: 'channels', + }, ['name', 'comdetect']); var confpanel = new Ext.FormPanel({ - border:false, - disabled:true, - bodyStyle:'padding:15px', - anchor: '100% 50%', - labelAlign: 'right', - labelWidth: 150, - waitMsgTarget: true, - reader: confreader, - // defaultType: 'textfield', + border:false, + disabled:true, + bodyStyle:'padding:15px', + anchor: '100% 50%', + labelAlign: 'right', + labelWidth: 150, + waitMsgTarget: true, + reader: confreader, + // defaultType: 'textfield', - items: [{ - layout:'column', - border:false, - items:[{ - border:false, - columnWidth:.5, - layout: 'form', - defaultType: 'textfield', - items: [{ - - fieldLabel: 'Channel name', - name: 'name', - } - /* + items: [{ + layout:'column', + border:false, + items:[{ + border:false, + columnWidth:.5, + layout: 'form', + defaultType: 'textfield', + items: [{ + + fieldLabel: 'Channel name', + name: 'name', + } + /* , new Ext.form.ComboBox({ allowBlank: false, @@ -135,9 +135,9 @@ tvheadend.channeldetails = function(chid, chname) { }) }) */ - ] - } - /* + ] + } + /* ,{ columnWidth:.5, layout: 'form', @@ -157,33 +157,33 @@ tvheadend.channeldetails = function(chid, chname) { } ] } */ - ] - }] - }); + ] + }] + }); - confpanel.getForm().load({url:'/channel', - params:{'chid': chid, 'op':'load'}, - success:function(form, action) { - confpanel.enable(); - }}); + confpanel.getForm().load({url:'/channel', + params:{'chid': chid, 'op':'load'}, + success:function(form, action) { + confpanel.enable(); + }}); function saveChanges() { confpanel.getForm().submit({url:'/channel', - params:{'chid': chid, 'op':'save'}, - waitMsg:'Saving Data...', + params:{'chid': chid, 'op':'save'}, + waitMsg:'Saving Data...', - success: function(form, action) { + success: function(form, action) { - if(action.result.reloadchlist) { - tvheadend.chconfliststore.reload(); - } - }, + if(action.result.reloadchlist) { + tvheadend.chconfliststore.reload(); + } + }, - failure: function(form, action) { - Ext.Msg.alert('Save failed', action.result.errormsg); - } - }); + failure: function(form, action) { + Ext.Msg.alert('Save failed', action.result.errormsg); + } + }); } function deleteChannel() { @@ -193,77 +193,77 @@ tvheadend.channeldetails = function(chid, chname) { if(button == 'no') return; Ext.Ajax.request({url: '/channel', - params:{'chid': chid, 'op':'delete'}, - success: function() { - tvheadend.chconfliststore.reload(); - panel.destroy(); - } - }); + params:{'chid': chid, 'op':'delete'}, + success: function() { + tvheadend.chconfliststore.reload(); + panel.destroy(); + } + }); } - ); + ); } var panel = new Ext.Panel({ - title: chname, + title: chname, + border:false, + tbar: [{ + tooltip: 'Delete channel "' + chname + '". All mapped transports will be unmapped', + iconCls:'remove', + text: "Delete channel", + handler: deleteChannel + }, '-', { + tooltip: 'Save changes made to channel configuration below and the mapped transports', + iconCls:'save', + text: "Save configuration", + handler: saveChanges + }], + defaults: { border:false, - tbar: [{ - tooltip: 'Delete channel "' + chname + '". All mapped transports will be unmapped', - iconCls:'remove', - text: "Delete channel", - handler: deleteChannel - }, '-', { - tooltip: 'Save changes made to channel configuration below and the mapped transports', - iconCls:'save', - text: "Save configuration", - handler: saveChanges - }], - defaults: { - border:false, - }, - layout:'anchor', - items: [confpanel,transportsgrid] - }); + }, + layout:'anchor', + items: [confpanel,transportsgrid] + }); panel.on('afterlayout', function(parent, n) { - var DropTargetEl = parent.body.dom; - - var DropTarget = new Ext.dd.DropTarget(DropTargetEl, { - ddGroup : 'chconfddgroup', - notifyEnter : function(ddSource, e, data) { - - //Add some flare to invite drop. - parent.body.stopFx(); - parent.body.highlight(); - }, - notifyDrop : function(ddSource, e, data){ - - // Reference the record (single selection) for readability - var selectedRecord = ddSource.dragData.selections[0]; + var DropTargetEl = parent.body.dom; + + var DropTarget = new Ext.dd.DropTarget(DropTargetEl, { + ddGroup : 'chconfddgroup', + notifyEnter : function(ddSource, e, data) { + + //Add some flare to invite drop. + parent.body.stopFx(); + parent.body.highlight(); + }, + notifyDrop : function(ddSource, e, data){ + + // Reference the record (single selection) for readability + var selectedRecord = ddSource.dragData.selections[0]; - Ext.MessageBox.confirm('Merge channels', - 'Copy transport configuration from "' + selectedRecord.data.name + - '" to "' + chname + '". This will also remove the channel "' + - selectedRecord.data.name + '"', - function(button) { - if(button == 'no') - return; - Ext.Ajax.request({url: '/channel', - params:{chid: chid, - op:'mergefrom', - srcch: selectedRecord.data.chid}, - success: function() { - transportsstore.reload(); - tvheadend.chconfliststore.reload(); - }}); - } - ); - } - }); - }); + Ext.MessageBox.confirm('Merge channels', + 'Copy transport configuration from "' + selectedRecord.data.name + + '" to "' + chname + '". This will also remove the channel "' + + selectedRecord.data.name + '"', + function(button) { + if(button == 'no') + return; + Ext.Ajax.request({url: '/channel', + params:{chid: chid, + op:'mergefrom', + srcch: selectedRecord.data.chid}, + success: function() { + transportsstore.reload(); + tvheadend.chconfliststore.reload(); + }}); + } + ); + } + }); + }); return panel; - } - +} + /** * @@ -271,69 +271,69 @@ tvheadend.channeldetails = function(chid, chname) { tvheadend.chconf = function() { var ChannelRecord = Ext.data.Record.create([ - {name: 'name'}, - {name: 'chid'}]); + {name: 'name'}, + {name: 'chid'}]); var store = new Ext.data.JsonStore({root: 'entries', - fields: ChannelRecord, - url: "chlist", - autoLoad: true, - id: 'id', - storeid: 'id' + fields: ChannelRecord, + url: "chlist", + autoLoad: true, + id: 'id', + storeid: 'id' }); - + var chlist = new Ext.grid.GridPanel({ - ddGroup: 'chconfddgroup', - enableDragDrop: true, - stripeRows:true, - region:'west', - width: 300, - columns: [{id:'name', - header: "Channel name", - width: 260, - dataIndex: 'name'} - ], - selModel: new Ext.grid.RowSelectionModel({singleSelect:true}), - store: store, - }); + ddGroup: 'chconfddgroup', + enableDragDrop: true, + stripeRows:true, + region:'west', + width: 300, + columns: [{id:'name', + header: "Channel name", + width: 260, + dataIndex: 'name'} + ], + selModel: new Ext.grid.RowSelectionModel({singleSelect:true}), + store: store, + }); var details = new Ext.Panel({ - region:'center', layout:'fit', - items:[{border: false}] - }); + region:'center', layout:'fit', + items:[{border: false}] + }); var panel = new Ext.Panel({ - listeners: {activate: handleActivate}, - border: false, - title:'Channels', - layout:'border', - items: [chlist, details] - }); + listeners: {activate: handleActivate}, + border: false, + title:'Channels', + layout:'border', + items: [chlist, details] + }); function handleActivate(tab){ store.reload(); } chlist.on('rowclick', function(grid, n) { - var rec = store.getAt(n); + var rec = store.getAt(n); - details.remove(details.getComponent(0)); - details.doLayout(); + details.remove(details.getComponent(0)); + details.doLayout(); - var newpanel = new tvheadend.channeldetails(rec.data.chid, - rec.data.name); - - details.add(newpanel); - details.doLayout(); - }); + var newpanel = new tvheadend.channeldetails(rec.data.chid, + rec.data.name); + + details.add(newpanel); + details.doLayout(); + }); /** * Setup Drop Targets */ - + // This will make sure we only drop to the view container /* diff --git a/webui/static/app/dvb.js b/webui/static/app/dvb.js index f6fdb6b5..265dc7c1 100644 --- a/webui/static/app/dvb.js +++ b/webui/static/app/dvb.js @@ -6,79 +6,79 @@ tvheadend.dvb_adapterdetails = function(adapterId, adapterName, treenode) { var confreader = new Ext.data.JsonReader({ - root: 'dvbadapters', - }, ['name', 'automux']); + root: 'dvbadapters', + }, ['name', 'automux']); - + function addmux() { var locationbutton = new Ext.Button({ - text: 'Add', - disabled: true, - handler: function() { - var n = locationlist.getSelectionModel().getSelectedNode(); - Ext.Ajax.request({url: '/dvbadapter', - params: {network: n.attributes.id, - adapterId: adapterId, op: 'addnetwork'}}); - win.close(); - } - }); + text: 'Add', + disabled: true, + handler: function() { + var n = locationlist.getSelectionModel().getSelectedNode(); + Ext.Ajax.request({url: '/dvbadapter', + params: {network: n.attributes.id, + adapterId: adapterId, op: 'addnetwork'}}); + win.close(); + } + }); var locationlist = new Ext.tree.TreePanel({ title:'By location', autoScroll:true, rootVisible:false, loader: new Ext.tree.TreeLoader({ - baseParams: {adapter: adapterId}, - dataUrl:'/dvbnetworks', - }), + baseParams: {adapter: adapterId}, + dataUrl:'/dvbnetworks', + }), root: new Ext.tree.AsyncTreeNode({ - id:'root', - }), + id:'root', + }), buttons: [locationbutton], buttonAlign: 'center' - }); + }); locationlist.on('click', function(n) { - if(n.attributes.leaf) { - locationbutton.enable(); - } else { - locationbutton.disable(); - } - }); + if(n.attributes.leaf) { + locationbutton.enable(); + } else { + locationbutton.disable(); + } + }); - + win = new Ext.Window({ - title: 'Add mux(es) on ' + adapterName, - layout: 'fit', - width: 500, - height: 500, - modal: true, - plain: true, - items: new Ext.TabPanel({ - autoTabs: true, - activeTab: 0, - deferredRender: false, - border: false, - items: [locationlist, { - html: 'def', - title: 'Manual configuration' - }] - }) - }); + title: 'Add mux(es) on ' + adapterName, + layout: 'fit', + width: 500, + height: 500, + modal: true, + plain: true, + items: new Ext.TabPanel({ + autoTabs: true, + activeTab: 0, + deferredRender: false, + border: false, + items: [locationlist, { + html: 'def', + title: 'Manual configuration' + }] + }) + }); win.show(); } /** * */ - function probeservices() { + function probeservices() { Ext.MessageBox.confirm('Message', 'Probe all DVB services on "' + adapterName + '" and map to TV-channels in tvheadend', @@ -87,11 +87,11 @@ tvheadend.dvb_adapterdetails = function(adapterId, adapterName, treenode) { return; Ext.Ajax.request({url: '/dvbadapter', - params: {adapterId: adapterId, - op: 'serviceprobe'} - }) + params: {adapterId: adapterId, + op: 'serviceprobe'} + }) }); - }; + }; /** @@ -99,57 +99,57 @@ tvheadend.dvb_adapterdetails = function(adapterId, adapterName, treenode) { */ function saveconfig() { panel.getForm().submit({url:'/dvbadapter', - params:{'adapterId': adapterId, 'op':'save'}, - waitMsg:'Saving Data...' - }); + params:{'adapterId': adapterId, 'op':'save'}, + waitMsg:'Saving Data...' + }); }; - var panel = new Ext.FormPanel({ - border:false, - disabled:true, - title: adapterName, - bodyStyle:'padding:15px', - labelAlign: 'right', - labelWidth: 150, - waitMsgTarget: true, - reader: confreader, - defaultType: 'textfield', - items: [{ - fieldLabel: 'Adapter name', - name: 'name', - width: 400, - }, + var panel = new Ext.FormPanel({ + border:false, + disabled:true, + title: adapterName, + bodyStyle:'padding:15px', + labelAlign: 'right', + labelWidth: 150, + waitMsgTarget: true, + reader: confreader, + defaultType: 'textfield', + items: [{ + fieldLabel: 'Adapter name', + name: 'name', + width: 400, + }, new Ext.form.Checkbox({ - fieldLabel: 'Autodetect muxes', - name: 'automux', - }) - ], - tbar:[{ - tooltip: 'Manually add new transport multiplexes', - iconCls:'add', - text: 'Add mux(es)', - handler: addmux - }, '-', { - tooltip: 'Scan all transports on this adapter and map those who has a working video stream to a channel', - iconCls:'option', - text: 'Probe services', - handler: probeservices - }, '-', { - tooltip: 'Save and changes made to the configuation below', - iconCls:'save', - text: 'Save configuration', - handler: saveconfig - }] - }); + fieldLabel: 'Autodetect muxes', + name: 'automux', + }) + ], + tbar:[{ + tooltip: 'Manually add new transport multiplexes', + iconCls:'add', + text: 'Add mux(es)', + handler: addmux + }, '-', { + tooltip: 'Scan all transports on this adapter and map those who has a working video stream to a channel', + iconCls:'option', + text: 'Probe services', + handler: probeservices + }, '-', { + tooltip: 'Save and changes made to the configuation below', + iconCls:'save', + text: 'Save configuration', + handler: saveconfig + }] + }); panel.getForm().load({url:'/dvbadapter', - params:{'adapterId': adapterId, 'op':'load'}, - success:function(form, action) { - panel.enable(); - }}); + params:{'adapterId': adapterId, 'op':'load'}, + success:function(form, action) { + panel.enable(); + }}); return panel; @@ -161,42 +161,42 @@ tvheadend.dvb_adapterdetails = function(adapterId, adapterName, treenode) { */ tvheadend.dvb = function() { - - var tree = new Ext.tree.ColumnTree({ - region:'west', - autoScroll:true, - rootVisible:false, - columns:[{ - header:'Name', - width:300, - dataIndex:'name' - },{ - header:'Type', - width:100, - dataIndex:'type' - },{ - header:'Status', - width:100, - dataIndex:'status' - },{ - header:'Quality', - width:100, - dataIndex:'quality' - }], - - loader: new Ext.tree.TreeLoader({ - clearOnLoad: true, - dataUrl:'/dvbtree', - uiProviders:{ - 'col': Ext.tree.ColumnNodeUI - } - }), + var tree = new Ext.tree.ColumnTree({ + region:'west', + autoScroll:true, + rootVisible:false, + + columns:[{ + header:'Name', + width:300, + dataIndex:'name' + },{ + header:'Type', + width:100, + dataIndex:'type' + },{ + header:'Status', + width:100, + dataIndex:'status' + },{ + header:'Quality', + width:100, + dataIndex:'quality' + }], + + loader: new Ext.tree.TreeLoader({ + clearOnLoad: true, + dataUrl:'/dvbtree', + uiProviders:{ + 'col': Ext.tree.ColumnNodeUI + } + }), - root: new Ext.tree.AsyncTreeNode({ - id:'root', - }), - }); + root: new Ext.tree.AsyncTreeNode({ + id:'root', + }), + }); /** @@ -204,19 +204,19 @@ tvheadend.dvb = function() { */ var details = new Ext.Panel({ - region:'center', layout:'fit', - items:[{border: false}] - }); + region:'center', layout:'fit', + items:[{border: false}] + }); /** * */ var panel = new Ext.Panel({ - border: false, - title:'DVB Adapters', - layout:'border', - items: [tree, details] - }); + border: false, + title:'DVB Adapters', + layout:'border', + items: [tree, details] + }); /** * diff --git a/webui/static/app/tvheadend.js b/webui/static/app/tvheadend.js index b9261177..f0bb680a 100644 --- a/webui/static/app/tvheadend.js +++ b/webui/static/app/tvheadend.js @@ -7,7 +7,7 @@ tvheadend.comet_poller = function() { function parse_comet_response(responsetxt) { - + var response = Ext.util.JSON.decode(responsetxt); for (var x = 0; x < response.messages.length; x++) { @@ -18,26 +18,25 @@ tvheadend.comet_poller = function() { var sl = Ext.get('systemlog'); var e = Ext.DomHelper.append(sl, - '
' + m.logtxt + '
'); + '
' + m.logtxt + '
'); e.scrollIntoView(sl); break; - + case 'dvbadapter': case 'dvbmux': case 'dvbtransport': var n = tvheadend.dvbtree.getNodeById(m.id); if(n != null) { - if(m.reload != null && n.isLoaded()) { n.reload(); } - + if(m.name != null) { n.setText(m.name); n.attributes.name = m.name; } - + if(m.quality != null) { n.getUI().setColText(3, m.quality); n.attributes.quality = m.quality; @@ -54,19 +53,19 @@ tvheadend.comet_poller = function() { } Ext.Ajax.request({ - url: '/comet', - params : { boxid: response.boxid }, - success: function(result, request) { - parse_comet_response(result.responseText); - }}); + url: '/comet', + params : { boxid: response.boxid }, + success: function(result, request) { + parse_comet_response(result.responseText); + }}); }; Ext.Ajax.request({ - url: '/comet', - success: function(result, request) { - parse_comet_response(result.responseText); - }}); + url: '/comet', + success: function(result, request) { + parse_comet_response(result.responseText); + }}); } @@ -84,53 +83,52 @@ tvheadend.app = function() { init: function() { var confpanel = new Ext.TabPanel({ - activeTab:0, - autoScroll:true, - title: 'Configuration', - items: [new tvheadend.chconf, - new tvheadend.dvb, - new tvheadend.acleditor, - new tvheadend.cwceditor] - }); + activeTab:0, + autoScroll:true, + title: 'Configuration', + items: [new tvheadend.chconf, + new tvheadend.dvb, + new tvheadend.acleditor, + new tvheadend.cwceditor] + }); var pvrpanel = new Ext.TabPanel({ - autoScroll:true, - title: 'Video Recorder' - }); + autoScroll:true, + title: 'Video Recorder' + }); var chpanel = new Ext.TabPanel({ - autoScroll:true, - title: 'Channels' - }); - + autoScroll:true, + title: 'Channels' + }); + var viewport = new Ext.Viewport({ - layout:'border', - items:[ - { - region:'south', - contentEl: 'systemlog', - split:true, - autoScroll:true, - height: 150, - minSize: 100, - maxSize: 400, - collapsible: true, - title:'System log', - margins:'0 0 0 0' - }, - new Ext.TabPanel({region:'center', - activeTab:0, - items:[confpanel, - pvrpanel, - chpanel]}) - ] - }); - + layout:'border', + items:[{ + region:'south', + contentEl: 'systemlog', + split:true, + autoScroll:true, + height: 150, + minSize: 100, + maxSize: 400, + collapsible: true, + title:'System log', + margins:'0 0 0 0' + }, + new Ext.TabPanel({region:'center', + activeTab:0, + items:[confpanel, + pvrpanel, + chpanel]}) + ] + }); + new tvheadend.comet_poller; Ext.QuickTips.init(); } - + }; }(); // end of app