From: Jaroslav Kysela Date: Wed, 30 Mar 2016 12:33:09 +0000 (+0200) Subject: markdown/idclass: add ic_doc member X-Git-Tag: v4.2.1~767 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0128c904c48eb9ad4866119e9327d7f879ded2a4;p=thirdparty%2Ftvheadend.git markdown/idclass: add ic_doc member --- diff --git a/src/access.c b/src/access.c index 24d100414..d4bbd4185 100644 --- a/src/access.c +++ b/src/access.c @@ -1433,11 +1433,26 @@ theme_get_ui_list ( void *p, const char *lang ) return strtab2htsmsg_str(tab, 1, lang); } +static const char *access_entry_doc[] = { + N_("Setting up access control is an important initial step as " + "**the system is initially wide open**."), + N_("Tvheadend verifies access by scanning through all enabled access control " + "entries in sequence, from the top of the list to the bottom. " + "The permission flags, streaming profiles, DVR config profiles, " + "channel tags and so on are combined for all matching access entries. " + "An access entry is said to match if the username matches and the IP " + "source address of the requesting peer is within the prefix. There is " + "also anonymous access, if the user is set to asterisk. Only network " + "prefix is matched then."), + NULL +}; + const idclass_t access_entry_class = { .ic_class = "access", .ic_caption = N_("Access"), .ic_event = "access", .ic_perm_def = ACCESS_ADMIN, + .ic_doc = access_entry_doc, .ic_save = access_entry_class_save, .ic_get_title = access_entry_class_get_title, .ic_delete = access_entry_class_delete, diff --git a/src/idnode.h b/src/idnode.h index 13b4a2267..70a83cadd 100644 --- a/src/idnode.h +++ b/src/idnode.h @@ -67,6 +67,7 @@ struct idclass { const char *ic_class; ///< Class name const char *ic_caption; ///< Class description const char *ic_order; ///< Property order (comma-separated) + const char **ic_doc; ///< NULL terminated array of strings const property_group_t *ic_groups; ///< Groups for visual representation const property_t *ic_properties; ///< Property list const char *ic_event; ///< Events to fire on add/delete/title diff --git a/src/webui/doc_md.c b/src/webui/doc_md.c index 169a49ef9..35ef31d47 100644 --- a/src/webui/doc_md.c +++ b/src/webui/doc_md.c @@ -129,8 +129,8 @@ http_markdown_class(http_connection_t *hc, const char *clazz) htsbuf_queue_t *hq = &hc->hc_reply; htsmsg_t *m, *l, *n, *e, *x; htsmsg_field_t *f, *f2; - const char *s; - int nl = 0; + const char *s, **doc; + int nl = 0, first = 1; pthread_mutex_lock(&global_lock); ic = idclass_find(clazz); @@ -138,19 +138,36 @@ http_markdown_class(http_connection_t *hc, const char *clazz) pthread_mutex_unlock(&global_lock); return HTTP_STATUS_NOT_FOUND; } + doc = ic->ic_doc; m = idclass_serialize(ic, lang); pthread_mutex_unlock(&global_lock); s = htsmsg_get_str(m, "caption"); if (s) { - md_header(hq, "####", s); + md_header(hq, "##", s); nl = 1; } + for (; *doc; doc++) { + md_nl(hq, 1); + md_text(hq, NULL, NULL, tvh_gettext_lang(lang, *doc)); + md_nl(hq, 1); + } l = htsmsg_get_list(m, "props"); HTSMSG_FOREACH(f, l) { n = htsmsg_field_get_map(f); if (!n) continue; s = htsmsg_get_str(n, "caption"); if (!s) continue; + if (first) { + md_nl(hq, 1); + md_nl(hq, 1); + htsbuf_append_str(hq, "####"); + htsbuf_append_str(hq, tvh_gettext_lang(lang, N_("Items"))); + md_nl(hq, 1); + md_nl(hq, 1); + htsbuf_append_str(hq, tvh_gettext_lang(lang, N_("The items have the following functions:"))); + md_nl(hq, 1); + first = 0; + } nl = md_nl(hq, nl); md_style(hq, "**", s); md_nl(hq, 1); @@ -176,7 +193,6 @@ http_markdown_class(http_connection_t *hc, const char *clazz) } md_nl(hq, 1); } - htsmsg_print(n); } htsmsg_destroy(m); return 0;