commit 2e19c19
default
·
2023-06-02 08:48:05 +0000 UTC
parent 97b8dde
Use a select instead of a checkbox for setting multiple-choice polls.
1 files changed,
+13,
-6
M
html.c
M
html.c
+13,
-6
1@@ -384,7 +384,10 @@ d_char *html_top_controls(snac *snac, d_char *s)
2 "<p>%s:<br>\n"
3 "<textarea class=\"snac-textarea\" name=\"poll_options\" "
4 "rows=\"6\" wrap=\"virtual\"></textarea>\n"
5- "<p>%s: <input type=\"checkbox\" name=\"poll_multiple\">\n"
6+ "<p><select name=\"poll_multiple\">\n"
7+ "<option value=\"off\">%s</option>\n"
8+ "<option value=\"on\">%s</option>\n"
9+ "</select>\n"
10 "<select name=\"poll_end_secs\" id=\"poll_end_secs\">\n"
11 "<option value=\"300\">%s</option>\n"
12 "<option value=\"3600\">%s</option>\n"
13@@ -495,10 +498,11 @@ d_char *html_top_controls(snac *snac, d_char *s)
14
15 L("Poll..."),
16 L("Poll options (one per line, up to 8)"),
17- L("Multiple"),
18- L("5 minutes"),
19- L("1 hour"),
20- L("1 day"),
21+ L("One choice"),
22+ L("Multiple choices"),
23+ L("End in 5 minutes"),
24+ L("End in 1 hour"),
25+ L("End in 1 day"),
26
27 L("Post"),
28
29@@ -1834,9 +1838,12 @@ int html_post_handler(const xs_dict *req, const char *q_path,
30 /* get the rest of poll configuration */
31 const char *p_multiple = xs_dict_get(p_vars, "poll_multiple");
32 const char *p_end_secs = xs_dict_get(p_vars, "poll_end_secs");
33+ int multiple = 0;
34
35 int end_secs = atoi(!xs_is_null(p_end_secs) ? p_end_secs : "60");
36- int multiple = !xs_is_null(p_multiple);
37+
38+ if (!xs_is_null(p_multiple) && strcmp(p_multiple, "on") == 0)
39+ multiple = 1;
40
41 msg = msg_question(&snac, content_2, attach_list,
42 poll_opts, multiple, end_secs);