aboutsummaryrefslogtreecommitdiff
path: root/html.c
diff options
context:
space:
mode:
authordefault <nobody@localhost>2025-04-13 14:39:46 +0200
committerdefault <nobody@localhost>2025-04-13 14:39:46 +0200
commita28638b4c18abacabd02fef4a51dde80bf4d5db4 (patch)
treeb1ee1da867543ef6377babdb7bdbc72c0cc11ddb /html.c
parent848bd3e865fb2daf75d76cbb75a4a39f9b82b516 (diff)
More timezone work.
Diffstat (limited to 'html.c')
-rw-r--r--html.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/html.c b/html.c
index 2e7f87c..d807f4b 100644
--- 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", ""));