diff --git a/htmlui.c b/htmlui.c
index b5580b6d..be72cdba 100644
--- a/htmlui.c
+++ b/htmlui.c
@@ -38,6 +38,7 @@
#include "dvb.h"
#include "v4l.h"
#include "iptv_input.h"
+#include "transports.h"
static struct strtab recstatustxt[] = {
{ "Recording scheduled",HTSTV_PVR_STATUS_SCHEDULED },
@@ -157,6 +158,8 @@ page_css(http_connection_t *hc, const char *remain, void *opaque)
""
".drop {border: 1px dotted #000000; background: #ddddaa} "
""
+ ".prioval {border: 0px; background: #ddddaa} "
+ ""
"#meny {margin: 0; padding: 0}\r\n"
"#meny li{display: inline; list-style-type: none;}\r\n"
"#meny a{padding: 1.15em 0.8em; text-decoration: none;}\r\n"
@@ -1340,6 +1343,46 @@ page_chgroups(http_connection_t *hc, const char *remain, void *opaque)
*/
static int
page_chadm(http_connection_t *hc, const char *remain, void *opaque)
+{
+ tcp_queue_t tq;
+ int simple = is_client_simple(hc);
+
+ if(!html_verify_access(hc, "admin"))
+ return HTTP_STATUS_UNAUTHORIZED;
+
+ tcp_init_queue(&tq, -1);
+ html_header(&tq, "HTS/tvheadend", !simple, 800, 0);
+ top_menu(hc, &tq);
+
+ tcp_qprintf(&tq,
+ "
"
+ "");
+
+ box_top(&tq, "box");
+
+ tcp_qprintf(&tq,
+ " "
+ ""
+ " ");
+
+ box_bottom(&tq);
+
+ tcp_qprintf(&tq,
+ " | "
+ ""
+ " |
");
+
+ html_footer(&tq);
+ http_output_queue(hc, &tq, "text/html; charset=UTF-8", 0);
+ return 0;
+}
+
+
+
+static int
+page_chadm2(http_connection_t *hc, const char *remain, void *opaque)
{
tcp_queue_t tq;
th_channel_t *ch;
@@ -1349,14 +1392,12 @@ page_chadm(http_connection_t *hc, const char *remain, void *opaque)
return HTTP_STATUS_UNAUTHORIZED;
tcp_init_queue(&tq, -1);
- html_header(&tq, "HTS/tvheadend", !simple, 700, 0);
- top_menu(hc, &tq);
+ html_header(&tq, "HTS/tvheadend", !simple, 230, 0);
LIST_FOREACH(ch, &channels, ch_global_link) {
tcp_qprintf(&tq,
- "\r\n",
- ch->ch_tag);
+ "%s
",
+ ch->ch_tag, ch->ch_name);
}
html_footer(&tq);
@@ -1364,6 +1405,7 @@ page_chadm(http_connection_t *hc, const char *remain, void *opaque)
return 0;
}
+
/**
* Edit a single channel
*/
@@ -1371,35 +1413,32 @@ static int
page_editchannel(http_connection_t *hc, const char *remain, void *opaque)
{
tcp_queue_t tq;
- th_channel_t *ch;
+ th_channel_t *ch, *ch2;
th_channel_group_t *tcg, *dis;
- const char *grp;
+ th_transport_t *t;
+
if(!html_verify_access(hc, "admin"))
return HTTP_STATUS_UNAUTHORIZED;
if(remain == NULL || (ch = channel_by_tag(atoi(remain))) == NULL)
return 404;
- if((grp = http_arg_get(&hc->hc_url_args, "grp")) != NULL) {
- tcg = channel_group_find(grp, 1);
- channel_set_group(ch, tcg);
- }
dis = channel_group_find("-disabled-", 1);
tcp_init_queue(&tq, -1);
- html_header(&tq, "HTS/tvheadend", 0, 700, 0);
+ html_header(&tq, "HTS/tvheadend", 0, 530, 0);
tcp_qprintf(&tq,
- "");
@@ -1425,6 +1522,62 @@ page_editchannel(http_connection_t *hc, const char *remain, void *opaque)
return 0;
}
+/**
+ * Update a single channel, then redirect back to the edit page
+ */
+static int
+page_updatechannel(http_connection_t *hc, const char *remain, void *opaque)
+{
+ th_channel_t *ch, *ch2;
+ th_transport_t *t;
+ th_channel_group_t *tcg;
+ const char *grp, *s;
+ char buf[100];
+ int pri;
+
+ if(!html_verify_access(hc, "admin"))
+ return HTTP_STATUS_UNAUTHORIZED;
+
+ if(remain == NULL || (ch = channel_by_tag(atoi(remain))) == NULL)
+ return 404;
+
+ if((s = http_arg_get(&hc->hc_url_args, "merge")) != NULL) {
+ ch2 = channel_find(s, 0, NULL);
+ if(ch2 != NULL) {
+
+ if(LIST_FIRST(&ch->ch_subscriptions) == NULL) {
+ while((t = LIST_FIRST(&ch->ch_transports)) != NULL) {
+ transport_move(t, ch2);
+ }
+ }
+
+ /* Redirect to new channel */
+ snprintf(buf, sizeof(buf), "/editchannel/%d", ch2->ch_tag);
+ http_redirect(hc, buf);
+ return 0;
+ }
+ }
+
+ if((grp = http_arg_get(&hc->hc_url_args, "grp")) != NULL) {
+ tcg = channel_group_find(grp, 1);
+ channel_set_group(ch, tcg);
+ }
+
+ LIST_FOREACH(t, &ch->ch_transports, tht_channel_link) {
+ s = http_arg_get(&hc->hc_url_args, t->tht_uniquename);
+ if(s != NULL) {
+ pri = atoi(s);
+ if(pri >= 0 && pri <= 9999) {
+ transport_set_priority(t, pri);
+ }
+ }
+ }
+
+ snprintf(buf, sizeof(buf), "/editchannel/%d", ch->ch_tag);
+ http_redirect(hc, buf);
+ return 0;
+}
+
/**
@@ -1440,6 +1593,8 @@ htmlui_start(void)
http_path_add("/status", NULL, page_status);
http_path_add("/chgrp", NULL, page_chgroups);
http_path_add("/chadm", NULL, page_chadm);
+ http_path_add("/chadm2", NULL, page_chadm2);
http_path_add("/editchannel", NULL, page_editchannel);
+ http_path_add("/updatechannel", NULL, page_updatechannel);
http_path_add("/css.css", NULL, page_css);
}