diff options
| author | 2025-04-13 14:39:46 +0200 | |
|---|---|---|
| committer | 2025-04-13 14:39:46 +0200 | |
| commit | a28638b4c18abacabd02fef4a51dde80bf4d5db4 (patch) | |
| tree | b1ee1da867543ef6377babdb7bdbc72c0cc11ddb /html.c | |
| parent | Cache the timezone inside the snac struct. (diff) | |
| download | penes-snac2-a28638b4c18abacabd02fef4a51dde80bf4d5db4.tar.gz penes-snac2-a28638b4c18abacabd02fef4a51dde80bf4d5db4.tar.xz penes-snac2-a28638b4c18abacabd02fef4a51dde80bf4d5db4.zip | |
More timezone work.
Diffstat (limited to 'html.c')
| -rw-r--r-- | html.c | 28 |
1 files changed, 28 insertions, 0 deletions
| @@ -1318,6 +1318,27 @@ xs_html *html_top_controls(snac *user) | |||
| 1318 | xs_html_attr("value", lang))); | 1318 | xs_html_attr("value", lang))); |
| 1319 | } | 1319 | } |
| 1320 | 1320 | ||
| 1321 | /* timezone */ | ||
| 1322 | xs_html *tz_select = xs_html_tag("select", | ||
| 1323 | xs_html_attr("name", "tz")); | ||
| 1324 | |||
| 1325 | xs *tzs = xs_tz_list(); | ||
| 1326 | const char *tz; | ||
| 1327 | |||
| 1328 | xs_list_foreach(tzs, tz) { | ||
| 1329 | if (strcmp(tz, user->tz) == 0) | ||
| 1330 | xs_html_add(tz_select, | ||
| 1331 | xs_html_tag("option", | ||
| 1332 | xs_html_text(tz), | ||
| 1333 | xs_html_attr("value", tz), | ||
| 1334 | xs_html_attr("selected", "selected"))); | ||
| 1335 | else | ||
| 1336 | xs_html_add(tz_select, | ||
| 1337 | xs_html_tag("option", | ||
| 1338 | xs_html_text(tz), | ||
| 1339 | xs_html_attr("value", tz))); | ||
| 1340 | } | ||
| 1341 | |||
| 1321 | xs *user_setup_action = xs_fmt("%s/admin/user-setup", user->actor); | 1342 | xs *user_setup_action = xs_fmt("%s/admin/user-setup", user->actor); |
| 1322 | 1343 | ||
| 1323 | xs_html_add(top_controls, | 1344 | xs_html_add(top_controls, |
| @@ -1514,6 +1535,11 @@ xs_html *html_top_controls(snac *user) | |||
| 1514 | lang_select), | 1535 | lang_select), |
| 1515 | 1536 | ||
| 1516 | xs_html_tag("p", | 1537 | xs_html_tag("p", |
| 1538 | xs_html_text(L("Time zone:")), | ||
| 1539 | xs_html_sctag("br", NULL), | ||
| 1540 | tz_select), | ||
| 1541 | |||
| 1542 | xs_html_tag("p", | ||
| 1517 | xs_html_text(L("New password:")), | 1543 | xs_html_text(L("New password:")), |
| 1518 | xs_html_sctag("br", NULL), | 1544 | xs_html_sctag("br", NULL), |
| 1519 | xs_html_sctag("input", | 1545 | xs_html_sctag("input", |
| @@ -4755,6 +4781,8 @@ int html_post_handler(const xs_dict *req, const char *q_path, | |||
| 4755 | snac.config = xs_dict_set(snac.config, "show_contact_metrics", xs_stock(XSTYPE_FALSE)); | 4781 | snac.config = xs_dict_set(snac.config, "show_contact_metrics", xs_stock(XSTYPE_FALSE)); |
| 4756 | if ((v = xs_dict_get(p_vars, "web_ui_lang")) != NULL) | 4782 | if ((v = xs_dict_get(p_vars, "web_ui_lang")) != NULL) |
| 4757 | snac.config = xs_dict_set(snac.config, "lang", v); | 4783 | snac.config = xs_dict_set(snac.config, "lang", v); |
| 4784 | if ((v = xs_dict_get(p_vars, "tz")) != NULL) | ||
| 4785 | snac.config = xs_dict_set(snac.config, "tz", v); | ||
| 4758 | 4786 | ||
| 4759 | snac.config = xs_dict_set(snac.config, "latitude", xs_dict_get_def(p_vars, "latitude", "")); | 4787 | snac.config = xs_dict_set(snac.config, "latitude", xs_dict_get_def(p_vars, "latitude", "")); |
| 4760 | snac.config = xs_dict_set(snac.config, "longitude", xs_dict_get_def(p_vars, "longitude", "")); | 4788 | snac.config = xs_dict_set(snac.config, "longitude", xs_dict_get_def(p_vars, "longitude", "")); |