diff --git a/ajaxui/ajaxui_config_dvb.c b/ajaxui/ajaxui_config_dvb.c
index bfc62844..92b75896 100644
--- a/ajaxui/ajaxui_config_dvb.c
+++ b/ajaxui/ajaxui_config_dvb.c
@@ -195,13 +195,18 @@ ajax_adaptereditor(http_connection_t *hc, http_reply_t *hr,
ajax_box_begin(tq, AJAX_BOX_FILLED, NULL, NULL, NULL);
tcp_qprintf(tq,
- "
%s
",
- tda->tda_displayname);
+ "%s
",
+ tda->tda_identifier, tda->tda_displayname);
ajax_box_end(tq, AJAX_BOX_FILLED);
/* Type */
+ tcp_qprintf(tq, "");
+
+ tcp_qprintf(tq, "
");
+
tcp_qprintf(tq, "
Model:
"
"
%s (%s)
",
tda->tda_fe_info ? tda->tda_fe_info->name : "
",
@@ -231,7 +236,17 @@ ajax_adaptereditor(http_connection_t *hc, http_reply_t *hr,
// tcp_qprintf(tq, "Capabilities:
");
}
+ tcp_qprintf(tq, "");
+
+ ajax_a_jsfuncf(tq, "Rename adapter...",
+ "dvb_adapter_rename('%s', '%s');",
+ tda->tda_identifier, tda->tda_displayname);
+ tcp_qprintf(tq, "
");
+
+ /* Muxes and transports */
+
+
tcp_qprintf(tq, "");
ajax_box_begin(tq, AJAX_BOX_SIDEBOX, NULL, NULL, "Multiplexes");
@@ -691,7 +706,7 @@ ajax_dvbmuxeditor(http_connection_t *hc, http_reply_t *hr,
/**
- * Delete all muxes on an adapter
+ * Delete muxes on an adapter
*/
static int
ajax_adapterdelmux(http_connection_t *hc, http_reply_t *hr,
@@ -725,6 +740,42 @@ ajax_adapterdelmux(http_connection_t *hc, http_reply_t *hr,
return 0;
}
+/**
+ * Rename adapter
+ */
+static int
+ajax_adapterrename(http_connection_t *hc, http_reply_t *hr,
+ const char *remain, void *opaque)
+{
+ th_dvb_adapter_t *tda;
+
+ tcp_queue_t *tq = &hr->hr_tq;
+ const char *s;
+
+ if(remain == NULL || (tda = dvb_adapter_find_by_identifier(remain)) == NULL)
+ return HTTP_STATUS_NOT_FOUND;
+
+ if((s = http_arg_get(&hc->hc_req_args, "newname")) == NULL)
+ return HTTP_STATUS_BAD_REQUEST;
+
+ free(tda->tda_displayname);
+ tda->tda_displayname = strdup(s);
+ dvb_tda_save(tda);
+
+ tcp_qprintf(tq,
+ "$('adaptername_%s').innerHTML='%s';",
+ tda->tda_identifier, tda->tda_displayname);
+
+ tcp_qprintf(tq,
+ "new Ajax.Updater('summary_%s', "
+ "'/ajax/dvbadaptersummary/%s', {method: 'get'})",
+ tda->tda_identifier, tda->tda_identifier);
+
+ http_output(hc, hr, "text/javascript; charset=UTF8", NULL, 0);
+ return 0;
+}
+
+
/**
*
*/
@@ -733,6 +784,7 @@ ajax_config_dvb_init(void)
{
http_path_add("/ajax/dvbadaptermuxlist" , NULL, ajax_adaptermuxlist);
http_path_add("/ajax/dvbadaptersummary" , NULL, ajax_adaptersummary);
+ http_path_add("/ajax/dvbadapterrename" , NULL, ajax_adapterrename);
http_path_add("/ajax/dvbadaptereditor", NULL, ajax_adaptereditor);
http_path_add("/ajax/dvbadapteraddmux", NULL, ajax_adapteraddmux);
http_path_add("/ajax/dvbadapterdelmux", NULL, ajax_adapterdelmux);
diff --git a/ajaxui/tvheadend.js b/ajaxui/tvheadend.js
index 51b532bc..c68587e9 100644
--- a/ajaxui/tvheadend.js
+++ b/ajaxui/tvheadend.js
@@ -74,4 +74,13 @@ function mailboxquery(boxid)
onFailure: function(req) { alert(req.responseText); },
onException: function(t,e) { alert(e); }
})
+}
+
+function dvb_adapter_rename(id, oldname)
+{
+ newname = prompt("Enter new name for adapter", oldname);
+ if(newname != null && newname != oldname) {
+ a = new Ajax.Request('/ajax/dvbadapterrename/' + id,
+ { parameters: { 'newname': newname}});
+ }
}
\ No newline at end of file