webui: add some processing of capabilities for dynamic tab inclusion.
This commit is contained in:
parent
99b69cb860
commit
496808bbd4
2 changed files with 53 additions and 3 deletions
|
@ -1941,6 +1941,26 @@ extjs_config(http_connection_t *hc, const char *remain, void *opaque)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Capability check
|
||||
*/
|
||||
static int
|
||||
extjs_capabilities(http_connection_t *hc, const char *remain, void *opaque)
|
||||
{
|
||||
htsbuf_queue_t *hq = &hc->hc_reply;
|
||||
htsmsg_t *l;
|
||||
int i = 0;
|
||||
l = htsmsg_create_list();
|
||||
while (tvheadend_capabilities[i]) {
|
||||
htsmsg_add_str(l, NULL, tvheadend_capabilities[i]);
|
||||
i++;
|
||||
}
|
||||
htsmsg_json_serialize(l, hq, 0);
|
||||
htsmsg_destroy(l);
|
||||
http_output_content(hc, "text/x-json; charset=UTF-8");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* WEB user interface
|
||||
*/
|
||||
|
@ -1949,6 +1969,7 @@ extjs_start(void)
|
|||
{
|
||||
http_path_add("/about.html", NULL, page_about, ACCESS_WEB_INTERFACE);
|
||||
http_path_add("/extjs.html", NULL, extjs_root, ACCESS_WEB_INTERFACE);
|
||||
http_path_add("/capabilities", NULL, extjs_capabilities, ACCESS_WEB_INTERFACE);
|
||||
http_path_add("/tablemgr", NULL, extjs_tablemgr, ACCESS_WEB_INTERFACE);
|
||||
http_path_add("/channels", NULL, extjs_channels, ACCESS_WEB_INTERFACE);
|
||||
http_path_add("/epggrab", NULL, extjs_epggrab, ACCESS_WEB_INTERFACE);
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
tvheadend.accessupdate = null;
|
||||
tvheadend.capabilties = null;
|
||||
|
||||
/**
|
||||
* Displays a help popup window
|
||||
*/
|
||||
|
@ -27,6 +30,21 @@ tvheadend.help = function(title, pagename) {
|
|||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* General capabilities
|
||||
*/
|
||||
Ext.Ajax.request({
|
||||
url: '/capabilities',
|
||||
success: function(d)
|
||||
{
|
||||
if (d && d.responseText)
|
||||
tvheadend.capabilities = Ext.util.JSON.decode(d.responseText);
|
||||
if (tvheadend.capabilities && tvheadend.accessupdate)
|
||||
accessUpdate(tvheadend.accessUpdate);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Displays a mediaplayer using VLC plugin
|
||||
*/
|
||||
|
@ -223,6 +241,7 @@ tvheadend.VLC = function(url) {
|
|||
* Obviosuly, access is verified in the server too.
|
||||
*/
|
||||
function accessUpdate(o) {
|
||||
tvheadend.accessUpdate = o;
|
||||
|
||||
if (o.dvr == true && tvheadend.dvrpanel == null) {
|
||||
tvheadend.dvrpanel = new tvheadend.dvr;
|
||||
|
@ -237,12 +256,22 @@ function accessUpdate(o) {
|
|||
iconCls : 'wrench',
|
||||
items : [ new tvheadend.miscconf, new tvheadend.chconf,
|
||||
new tvheadend.epggrab, new tvheadend.cteditor,
|
||||
new tvheadend.dvrsettings, new tvheadend.tvadapters,
|
||||
new tvheadend.iptv, new tvheadend.acleditor,
|
||||
new tvheadend.cwceditor, new tvheadend.capmteditor ]
|
||||
new tvheadend.dvrsettings,
|
||||
new tvheadend.iptv, new tvheadend.acleditor ]
|
||||
});
|
||||
tvheadend.rootTabPanel.add(tvheadend.confpanel);
|
||||
}
|
||||
if (tvheadend.capabilities && tvheadend.confpanel) {
|
||||
if (tvheadend.capabilities.indexOf('linuxdvb') != -1 ||
|
||||
tvheadend.capabilities.indexOf('v4l') != -1) {
|
||||
tvheadend.confpanel.add(new tvheadend.tvadapters);
|
||||
}
|
||||
if (tvheadend.capabilities.indexOf('cwc') != -1) {
|
||||
tvheadend.confpanel.add(new tvheadend.cwceditor);
|
||||
tvheadend.confpanel.add(new tvheadend.capmteditor);
|
||||
}
|
||||
tvheadend.confpanel.doLayout();
|
||||
}
|
||||
|
||||
if (o.admin == true && tvheadend.statuspanel == null) {
|
||||
tvheadend.statuspanel = new tvheadend.status;
|
||||
|
|
Loading…
Add table
Reference in a new issue