commit a28638b4c18abacabd02fef4a51dde80bf4d5db4
parent 848bd3e865fb2daf75d76cbb75a4a39f9b82b516
Author: default <nobody@localhost>
Date: Sun, 13 Apr 2025 14:39:46 +0200
More timezone work.
Diffstat:
M | html.c | | | 28 | ++++++++++++++++++++++++++++ |
1 file changed, 28 insertions(+), 0 deletions(-)
diff --git a/html.c b/html.c
@@ -1318,6 +1318,27 @@ xs_html *html_top_controls(snac *user)
xs_html_attr("value", lang)));
}
+ /* timezone */
+ xs_html *tz_select = xs_html_tag("select",
+ xs_html_attr("name", "tz"));
+
+ xs *tzs = xs_tz_list();
+ const char *tz;
+
+ xs_list_foreach(tzs, tz) {
+ if (strcmp(tz, user->tz) == 0)
+ xs_html_add(tz_select,
+ xs_html_tag("option",
+ xs_html_text(tz),
+ xs_html_attr("value", tz),
+ xs_html_attr("selected", "selected")));
+ else
+ xs_html_add(tz_select,
+ xs_html_tag("option",
+ xs_html_text(tz),
+ xs_html_attr("value", tz)));
+ }
+
xs *user_setup_action = xs_fmt("%s/admin/user-setup", user->actor);
xs_html_add(top_controls,
@@ -1514,6 +1535,11 @@ xs_html *html_top_controls(snac *user)
lang_select),
xs_html_tag("p",
+ xs_html_text(L("Time zone:")),
+ xs_html_sctag("br", NULL),
+ tz_select),
+
+ xs_html_tag("p",
xs_html_text(L("New password:")),
xs_html_sctag("br", NULL),
xs_html_sctag("input",
@@ -4755,6 +4781,8 @@ int html_post_handler(const xs_dict *req, const char *q_path,
snac.config = xs_dict_set(snac.config, "show_contact_metrics", xs_stock(XSTYPE_FALSE));
if ((v = xs_dict_get(p_vars, "web_ui_lang")) != NULL)
snac.config = xs_dict_set(snac.config, "lang", v);
+ if ((v = xs_dict_get(p_vars, "tz")) != NULL)
+ snac.config = xs_dict_set(snac.config, "tz", v);
snac.config = xs_dict_set(snac.config, "latitude", xs_dict_get_def(p_vars, "latitude", ""));
snac.config = xs_dict_set(snac.config, "longitude", xs_dict_get_def(p_vars, "longitude", ""));