]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
markdown/idclass: add ic_doc member
authorJaroslav Kysela <perex@perex.cz>
Wed, 30 Mar 2016 12:33:09 +0000 (14:33 +0200)
committerJaroslav Kysela <perex@perex.cz>
Wed, 30 Mar 2016 12:33:09 +0000 (14:33 +0200)
src/access.c
src/idnode.h
src/webui/doc_md.c

index 24d100414cce1b2540b045742e294f5b413ae561..d4bbd41855299e209398b8d8ca750a72502a5b82 100644 (file)
@@ -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,
index 13b4a2267f43d31eb564a7657291cf66757cb675..70a83cadde80d62ce596b5854536290c06995970 100644 (file)
@@ -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
index 169a49ef9e74a6ddd21f2aca53c48d5ee093faeb..35ef31d475ff6ef6857638096160e62bf3ef826c 100644 (file)
@@ -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;