summaryrefslogtreecommitdiff
path: root/html.c
diff options
context:
space:
mode:
authordefault <nobody@localhost>2023-05-24 12:12:06 +0200
committerdefault <nobody@localhost>2023-05-24 12:12:06 +0200
commit67b21a9ecd23d0c26752870ae607b26084af065c (patch)
treec6e67c2977aa200d5cc968de2ec0e59b70c4f392 /html.c
parent0d8a040d9086cd7a9e13a7b070e425df9201f7e5 (diff)
Show HTML form code for oneOf polls.
Diffstat (limited to 'html.c')
-rw-r--r--html.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/html.c b/html.c
index 518ac1f..56b0dee 100644
--- a/html.c
+++ b/html.c
@@ -919,6 +919,29 @@ xs_str *html_entry(snac *snac, xs_str *os, const xs_dict *msg, int local,
}
else {
/* poll still active */
+ xs *s1 = xs_fmt("<form method=\"post\" action=\"%s/admin/vote\">\n"
+ "<input type=\"hidden\" name=\"irt\" value=\"%s\">\n",
+ snac->actor, id);
+
+ while (xs_list_iter(&p, &v)) {
+ const char *name = xs_dict_get(v, "name");
+
+ if (name) {
+ /* FIXME: process anyOf (checkbox) correctly */
+ xs *opt = xs_fmt("<input type=\"radio\""
+ " id=\"%s\" value=\"%s\" name=\"question\"> %s<br>\n",
+ name, name, name);
+
+ s1 = xs_str_cat(s1, opt);
+ }
+ }
+
+ xs *s2 = xs_fmt("<p><input type=\"submit\" "
+ "class=\"button\" value=\"%s\">\n</form>\n\n", L("Vote"));
+
+ s1 = xs_str_cat(s1, s2);
+
+ c = xs_str_cat(c, s1);
}
}