From abde2507d82e90e818593d0a56880d32afeacb1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=96man?= Date: Mon, 19 Nov 2012 13:15:19 +0100 Subject: [PATCH] DVB networks view, WIP --- src/webui/extjs.c | 1 + src/webui/extjs_dvb.c | 52 +++++++++++++++++++++++++++++++ src/webui/static/app/tvheadend.js | 12 ++++--- 3 files changed, 60 insertions(+), 5 deletions(-) diff --git a/src/webui/extjs.c b/src/webui/extjs.c index 9ceef1df..df1ce74e 100644 --- a/src/webui/extjs.c +++ b/src/webui/extjs.c @@ -130,6 +130,7 @@ extjs_root(http_connection_t *hc, const char *remain, void *opaque) extjs_load(hq, "static/app/tvadapters.js"); #if ENABLE_LINUXDVB extjs_load(hq, "static/app/dvb.js"); + extjs_load(hq, "static/app/dvb_networks.js"); #endif extjs_load(hq, "static/app/iptv.js"); #if ENABLE_V4L diff --git a/src/webui/extjs_dvb.c b/src/webui/extjs_dvb.c index c1c1c632..3f007529 100644 --- a/src/webui/extjs_dvb.c +++ b/src/webui/extjs_dvb.c @@ -685,6 +685,55 @@ extjs_list_dvb_adapters(htsmsg_t *array) } +/** + * + */ +static int +extjs_dvbnetworks(http_connection_t *hc, const char *remain, void *opaque) +{ + htsbuf_queue_t *hq = &hc->hc_reply; + const char *s = http_arg_get(&hc->hc_req_args, "node"); + htsmsg_t *out = NULL; + + if(s == NULL) + return HTTP_STATUS_BAD_REQUEST; + + pthread_mutex_lock(&global_lock); + + if(http_access_verify(hc, ACCESS_ADMIN)) { + pthread_mutex_unlock(&global_lock); + return HTTP_STATUS_UNAUTHORIZED; + } + + printf("s=%s\n", s); + + out = htsmsg_create_list(); + if(!strcmp(s, "root")) { + htsmsg_t *n = htsmsg_create_map(); + htsmsg_add_str(n, "text", "Network1"); + htsmsg_add_str(n, "id", "net/1"); + htsmsg_add_str(n, "cls", "folder"); + htsmsg_add_str(n, "iconCls", "iptv"); + htsmsg_add_msg(out, NULL, n); + + n = htsmsg_create_map(); + htsmsg_add_str(n, "text", "Network2"); + htsmsg_add_str(n, "id", "net/2"); + htsmsg_add_str(n, "cls", "folder"); + htsmsg_add_msg(out, NULL, n); + } + + + pthread_mutex_unlock(&global_lock); + + htsmsg_json_serialize(out, hq, 0); + htsmsg_destroy(out); + http_output_content(hc, "text/x-json; charset=UTF-8"); + return 0; +} + + + /** * DVB WEB user interface */ @@ -694,6 +743,9 @@ extjs_start_dvb(void) http_path_add("/dvb/locations", NULL, extjs_dvblocations, ACCESS_WEB_INTERFACE); + http_path_add("/dvb/networks", + NULL, extjs_dvbnetworks, ACCESS_WEB_INTERFACE); + http_path_add("/dvb/adapter", NULL, extjs_dvbadapter, ACCESS_ADMIN); diff --git a/src/webui/static/app/tvheadend.js b/src/webui/static/app/tvheadend.js index 3b44f6ca..ec990c58 100644 --- a/src/webui/static/app/tvheadend.js +++ b/src/webui/static/app/tvheadend.js @@ -235,11 +235,13 @@ function accessUpdate(o) { autoScroll : true, title : 'Configuration', 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 ] + items : [ new tvheadend.dvb_networks, + 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 ] }); tvheadend.rootTabPanel.add(tvheadend.confpanel); }