From fd8fb5e76f8cfc637d3765f9cc0217064fe4a17c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=96man?= Date: Thu, 17 Apr 2008 20:22:35 +0000 Subject: [PATCH] Add support for moving channels between groups --- ajaxui/ajaxui.css | 13 ++++- ajaxui/ajaxui_config_channels.c | 94 +++++++++++++++++++++++++++++++-- 2 files changed, 101 insertions(+), 6 deletions(-) diff --git a/ajaxui/ajaxui.css b/ajaxui/ajaxui.css index 39830a09..a5a8deeb 100644 --- a/ajaxui/ajaxui.css +++ b/ajaxui/ajaxui.css @@ -61,14 +61,23 @@ img { border: 0; } } .infoprefixwide { - padding-right: 10px; + padding-right: 5px; float: left; width: 100px; text-align: right; } .infoprefixwidefat { - padding-right: 10px; + padding-right: 5px; + float: left; + width: 100px; + text-align: right; + margin-top: 4px; +} + + +.infoprefixwidewidefat { + padding-right: 5px; float: left; width: 130px; text-align: right; diff --git a/ajaxui/ajaxui_config_channels.c b/ajaxui/ajaxui_config_channels.c index 62d5a5d4..5052c932 100644 --- a/ajaxui/ajaxui_config_channels.c +++ b/ajaxui/ajaxui_config_channels.c @@ -245,7 +245,7 @@ ajax_chgroup_editor(http_connection_t *hc, http_reply_t *hr, { tcp_queue_t *tq = &hr->hr_tq; th_channel_t *ch; - th_channel_group_t *tcg; + th_channel_group_t *tcg, *tcg2; int rowcol = 1; int disprows; @@ -284,6 +284,26 @@ ajax_chgroup_editor(http_connection_t *hc, http_reply_t *hr, } tcp_qprintf(tq, "}\r\n"); + + /* Invoke AJAX call containing all selected elements */ + tcp_qprintf(tq, + "select_do = function(op, arg1, arg2) {\r\n" + "var h = new Hash();\r\n" + "h.set('arg1', arg1);\r\n" + "h.set('arg2', arg2);\r\n" + ); + + TAILQ_FOREACH(ch, &tcg->tcg_channels, ch_group_link) { + tcp_qprintf(tq, + "if($('sel_%d').checked) {h.set('%d', 'selected') }\r\n", + ch->ch_tag, ch->ch_tag); + } + + tcp_qprintf(tq, " new Ajax.Request('/ajax/chop/' + op, " + "{parameters: h});\r\n"); + tcp_qprintf(tq, "}\r\n"); + + tcp_qprintf(tq, "\r\n//]]>\r\n" "\r\n"); @@ -322,15 +342,35 @@ ajax_chgroup_editor(http_connection_t *hc, http_reply_t *hr, tcp_qprintf(tq, "
"); - tcp_qprintf(tq, "
Select:
"); + tcp_qprintf(tq, "
Select:
"); ajax_a_jsfunc(tq, "All", "select_all();", " / "); ajax_a_jsfunc(tq, "None", "select_none();", " / "); ajax_a_jsfunc(tq, "Invert", "select_invert();", ""); tcp_qprintf(tq, "
\r\n"); - + + tcp_qprintf(tq, "
"); + + tcp_qprintf(tq, + "
Move to group:
" + "
" + "
"); + tcp_qprintf(tq, "
"); + tcp_qprintf(tq, "
"); ajax_box_end(tq, AJAX_BOX_SIDEBOX); @@ -398,7 +438,8 @@ ajax_cheditor(http_connection_t *hc, http_reply_t *hr, tcp_qprintf(tq, "
\r\n"); tcp_qprintf(tq, - "
Commercial detection:
" + "
" + "Commercial detection:
" "
" "