From 186e1b8c6ae2bcac3e7d55596236db65b298c6cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=96man?= Date: Wed, 9 Apr 2008 19:34:42 +0000 Subject: [PATCH] Add tab for editing channels (currently not working very well) --- ajaxui/ajaxui_config_channels.c | 79 +++++++++++++++++++++++++++++---- 1 file changed, 71 insertions(+), 8 deletions(-) diff --git a/ajaxui/ajaxui_config_channels.c b/ajaxui/ajaxui_config_channels.c index 05ae7f8d..799ac6e8 100644 --- a/ajaxui/ajaxui_config_channels.c +++ b/ajaxui/ajaxui_config_channels.c @@ -40,14 +40,21 @@ ajax_chgroup_build(tcp_queue_t *tq, th_channel_group_t *tcg) ajax_box_begin(tq, AJAX_BOX_BORDER, NULL, NULL, NULL); + tcp_qprintf(tq, "
"); + tcp_qprintf(tq, - "
%s
", - tcg == defgroup ? "" : "style=\"float: left\" ", - tcg->tcg_name); + "
" + "" + "%s
", + tcg->tcg_tag, tcg->tcg_name); + if(tcg != defgroup) { tcp_qprintf(tq, - "
" + "
" "Delete
", @@ -55,6 +62,7 @@ ajax_chgroup_build(tcp_queue_t *tq, th_channel_group_t *tcg) } + tcp_qprintf(tq, "
"); ajax_box_end(tq, AJAX_BOX_BORDER); tcp_qprintf(tq, ""); } @@ -170,7 +178,7 @@ ajax_config_channels_tab(http_connection_t *hc) tcp_init_queue(&tq, -1); - tcp_qprintf(&tq, "
"); + tcp_qprintf(&tq, "
"); ajax_box_begin(&tq, AJAX_BOX_SIDEBOX, "channelgroups", NULL, "Channel groups"); @@ -216,6 +224,63 @@ ajax_config_channels_tab(http_connection_t *hc) ajax_box_end(&tq, AJAX_BOX_SIDEBOX); tcp_qprintf(&tq, "
"); + + tcp_qprintf(&tq, + "
"); + + + tcp_qprintf(&tq, "
"); + + + http_output_queue(hc, &tq, "text/html; charset=UTF-8", 0); + return 0; +} + +/** + * Display all channels within the group + */ +static int +ajax_chgroup_editor(http_connection_t *hc, const char *remain, void *opaque) +{ + tcp_queue_t tq; + th_channel_t *ch; + th_channel_group_t *tcg; + + if(remain == NULL || (tcg = channel_group_by_tag(atoi(remain))) == NULL) + return HTTP_STATUS_BAD_REQUEST; + + tcp_init_queue(&tq, -1); + + ajax_box_begin(&tq, AJAX_BOX_SIDEBOX, NULL, NULL, tcg->tcg_name); + + tcp_qprintf(&tq, "
    "); + + TAILQ_FOREACH(ch, &tcg->tcg_channels, ch_group_link) { + tcp_qprintf(&tq, "
  • ", ch->ch_tag); + + ajax_box_begin(&tq, AJAX_BOX_BORDER, NULL, NULL, NULL); + + tcp_qprintf(&tq, "
    "); + + tcp_qprintf(&tq, + "
    " + "" + "%s" + "
    ", + ch->ch_name); + + tcp_qprintf(&tq, "
    "); + ajax_box_end(&tq, AJAX_BOX_BORDER); + tcp_qprintf(&tq, "
  • "); + } + + tcp_qprintf(&tq, "
"); + + ajax_box_end(&tq, AJAX_BOX_SIDEBOX); + + http_output_queue(hc, &tq, "text/html; charset=UTF-8", 0); return 0; } @@ -229,7 +294,5 @@ ajax_config_channels_init(void) http_path_add("/ajax/chgroup_add" , NULL, ajax_chgroup_add); http_path_add("/ajax/chgroup_del" , NULL, ajax_chgroup_del); http_path_add("/ajax/chgroup_updateorder", NULL, ajax_chgroup_updateorder); - - - + http_path_add("/ajax/chgroup_editor", NULL, ajax_chgroup_editor); }