From 4276d87d4eee6c03d9a538919409fa9aa5fae08a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=96man?= Date: Fri, 2 May 2008 09:04:34 +0000 Subject: [PATCH] Add support for displaying/editing all services on an adapter --- ajaxui/ajaxui_config_dvb.c | 54 +++++++++++++++++++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) diff --git a/ajaxui/ajaxui_config_dvb.c b/ajaxui/ajaxui_config_dvb.c index e0799209..b294ce3e 100644 --- a/ajaxui/ajaxui_config_dvb.c +++ b/ajaxui/ajaxui_config_dvb.c @@ -640,7 +640,7 @@ ajax_adaptermuxlist(http_connection_t *hc, http_reply_t *hr, th_dvb_mux_instance_t *tdmi; tcp_queue_t *tq = &hr->hr_tq; th_dvb_adapter_t *tda; - char buf[50]; + char buf[200]; int fetype, n, m; th_transport_t *t; int nmuxes = 0; @@ -704,7 +704,18 @@ ajax_adaptermuxlist(http_connection_t *hc, http_reply_t *hr, ajax_table_cell(&ta, "nsvc", "%d / %d", m, n); ajax_table_cell_checkbox(&ta); } + + ajax_table_row_start(&ta, NULL); + + ajax_table_cell(&ta, NULL, + "All", tda->tda_identifier); + ajax_table_bottom(&ta); + tcp_qprintf(tq, "
"); tcp_qprintf(tq, "
Select:
"); ajax_a_jsfuncf(tq, "All", "mux_sel_all();"); @@ -780,6 +791,45 @@ ajax_dvbmuxeditor(http_connection_t *hc, http_reply_t *hr, return 0; } +/** + * Display all transports on an adapter + */ +static int +ajax_dvbmuxall(http_connection_t *hc, http_reply_t *hr, + const char *remain, void *opaque) +{ + th_dvb_adapter_t *tda; + th_dvb_mux_instance_t *tdmi; + tcp_queue_t *tq = &hr->hr_tq; + th_transport_t *t; + struct th_transport_list head; + int n = 0; + char buf[100]; + + if(remain == NULL || (tda = dvb_adapter_find_by_identifier(remain)) == NULL) + return HTTP_STATUS_NOT_FOUND; + + snprintf(buf, sizeof(buf), "All services on %s\n", tda->tda_displayname); + + LIST_INIT(&head); + + LIST_FOREACH(tdmi, &tda->tda_muxes, tdmi_adapter_link) { + LIST_FOREACH(t, &tdmi->tdmi_transports, tht_mux_link) { + if(transport_is_available(t)) { + LIST_INSERT_SORTED(&head, t, tht_tmp_link, dvbsvccmp); + n++; + } + } + } + + ajax_box_begin(tq, AJAX_BOX_SIDEBOX, NULL, NULL, buf); + ajax_transport_build_list(hc, tq, &head, n); + ajax_box_end(tq, AJAX_BOX_SIDEBOX); + + http_output_html(hc, hr); + return 0; +} + /** * Delete muxes on an adapter @@ -990,6 +1040,8 @@ ajax_config_dvb_init(void) AJAX_ACCESS_CONFIG); http_path_add("/ajax/dvbmuxeditor", NULL, ajax_dvbmuxeditor, AJAX_ACCESS_CONFIG); + http_path_add("/ajax/dvbmuxall", NULL, ajax_dvbmuxall, + AJAX_ACCESS_CONFIG); http_path_add("/ajax/dvbnetworkinfo", NULL, ajax_dvbnetworkinfo, AJAX_ACCESS_CONFIG); http_path_add("/ajax/dvbadapteraddnetwork", NULL, ajax_dvbadapteraddnetwork,