diff --git a/ajaxui/ajaxui_config_channels.c b/ajaxui/ajaxui_config_channels.c
index ffb5b93a..a62a9162 100644
--- a/ajaxui/ajaxui_config_channels.c
+++ b/ajaxui/ajaxui_config_channels.c
@@ -245,8 +245,10 @@ ajax_chgroup_editor(http_connection_t *hc, http_reply_t *hr,
tcp_queue_t *tq = &hr->hr_tq;
channel_t *ch;
channel_group_t *tcg, *tcg2;
- int rowcol = 1;
- int disprows;
+ th_transport_t *t;
+ char buf[10];
+ int nsources;
+ ajax_table_t ta;
if(remain == NULL || (tcg = channel_group_by_tag(atoi(remain))) == NULL)
return HTTP_STATUS_BAD_REQUEST;
@@ -281,6 +283,16 @@ ajax_chgroup_editor(http_connection_t *hc, http_reply_t *hr,
}
tcp_qprintf(tq, "}\r\n");
+ /* Invert selection */
+ tcp_qprintf(tq, "select_sources = function() {\r\n");
+ TAILQ_FOREACH(ch, &tcg->tcg_channels, ch_group_link) {
+ tcp_qprintf(tq,
+ "$('sel_%d').checked = %s;\r\n",
+ ch->ch_tag, LIST_FIRST(&ch->ch_transports) ? "true" : "false");
+ }
+ tcp_qprintf(tq, "}\r\n");
+
+
/* Invoke AJAX call containing all selected elements */
tcp_qprintf(tq,
@@ -309,38 +321,38 @@ ajax_chgroup_editor(http_connection_t *hc, http_reply_t *hr,
ajax_box_begin(tq, AJAX_BOX_SIDEBOX, NULL, NULL, tcg->tcg_name);
- tcp_qprintf(tq, "
"
- "Channels
");
-
- disprows = 30;
-
- tcp_qprintf(tq, "",
- disprows * 14);
+ ajax_table_top(&ta, hc, tq, (const char *[])
+ {"Channelname", "Sources", "", NULL},
+ (int[]){8,2,1});
TAILQ_FOREACH(ch, &tcg->tcg_channels, ch_group_link) {
- tcp_qprintf(tq,
- "
",
- rowcol ? "background: #fff; " : "",
- ch->ch_tag, ch->ch_name, ch->ch_tag);
- rowcol = !rowcol;
- }
+ snprintf(buf, sizeof(buf), "%d", ch->ch_tag);
+ ajax_table_row_start(&ta, buf);
+
+ nsources = 0;
+
+ LIST_FOREACH(t, &ch->ch_transports, tht_ch_link)
+ nsources++;
+
+ ajax_table_cell(&ta, NULL,
+ "
%s", ch->ch_tag, ch->ch_name);
+
+ ajax_table_cell(&ta, NULL, "%d", nsources);
+ ajax_table_cell_checkbox(&ta);
+ }
+ ajax_table_bottom(&ta);
- tcp_qprintf(tq, "
");
tcp_qprintf(tq, "
\r\n");
tcp_qprintf(tq, "");
ajax_button(tq, "Select all", "select_all()");
ajax_button(tq, "Select none", "select_none()");
+ ajax_button(tq, "Invert selection", "select_invert()");
+ ajax_button(tq, "Select channels with sources", "select_sources()");
tcp_qprintf(tq, "
\r\n");
tcp_qprintf(tq, "
\r\n");
@@ -352,11 +364,6 @@ ajax_chgroup_editor(http_connection_t *hc, http_reply_t *hr,
"Delete all selected...",
"select_do('delete', '%d', 0, true);", tcg->tcg_tag);
- tcp_qprintf(tq, "
\r\n");
-
-
- tcp_qprintf(tq, "");
tcp_qprintf(tq,
"