diff options
| author | 2023-05-24 12:12:06 +0200 | |
|---|---|---|
| committer | 2023-05-24 12:12:06 +0200 | |
| commit | 67b21a9ecd23d0c26752870ae607b26084af065c (patch) | |
| tree | c6e67c2977aa200d5cc968de2ec0e59b70c4f392 /html.c | |
| parent | Added some experimental 'Question' posting code. (diff) | |
| download | snac2-67b21a9ecd23d0c26752870ae607b26084af065c.tar.gz snac2-67b21a9ecd23d0c26752870ae607b26084af065c.tar.xz snac2-67b21a9ecd23d0c26752870ae607b26084af065c.zip | |
Show HTML form code for oneOf polls.
Diffstat (limited to 'html.c')
| -rw-r--r-- | html.c | 23 |
1 files changed, 23 insertions, 0 deletions
| @@ -919,6 +919,29 @@ xs_str *html_entry(snac *snac, xs_str *os, const xs_dict *msg, int local, | |||
| 919 | } | 919 | } |
| 920 | else { | 920 | else { |
| 921 | /* poll still active */ | 921 | /* poll still active */ |
| 922 | xs *s1 = xs_fmt("<form method=\"post\" action=\"%s/admin/vote\">\n" | ||
| 923 | "<input type=\"hidden\" name=\"irt\" value=\"%s\">\n", | ||
| 924 | snac->actor, id); | ||
| 925 | |||
| 926 | while (xs_list_iter(&p, &v)) { | ||
| 927 | const char *name = xs_dict_get(v, "name"); | ||
| 928 | |||
| 929 | if (name) { | ||
| 930 | /* FIXME: process anyOf (checkbox) correctly */ | ||
| 931 | xs *opt = xs_fmt("<input type=\"radio\"" | ||
| 932 | " id=\"%s\" value=\"%s\" name=\"question\"> %s<br>\n", | ||
| 933 | name, name, name); | ||
| 934 | |||
| 935 | s1 = xs_str_cat(s1, opt); | ||
| 936 | } | ||
| 937 | } | ||
| 938 | |||
| 939 | xs *s2 = xs_fmt("<p><input type=\"submit\" " | ||
| 940 | "class=\"button\" value=\"%s\">\n</form>\n\n", L("Vote")); | ||
| 941 | |||
| 942 | s1 = xs_str_cat(s1, s2); | ||
| 943 | |||
| 944 | c = xs_str_cat(c, s1); | ||
| 922 | } | 945 | } |
| 923 | } | 946 | } |
| 924 | 947 | ||