diff options
Diffstat (limited to 'html.c')
| -rw-r--r-- | html.c | 37 |
1 files changed, 28 insertions, 9 deletions
| @@ -368,7 +368,8 @@ xs_html *html_note(snac *user, const char *summary, | |||
| 368 | const xs_val *mnt_only, const char *redir, | 368 | const xs_val *mnt_only, const char *redir, |
| 369 | const char *in_reply_to, int poll, | 369 | const char *in_reply_to, int poll, |
| 370 | const xs_list *att_files, const xs_list *att_alt_texts, | 370 | const xs_list *att_files, const xs_list *att_alt_texts, |
| 371 | int is_draft, const char *published) | 371 | int is_draft, const char *published, |
| 372 | const char *note_lang) | ||
| 372 | /* Yes, this is a FUCKTON of arguments and I'm a bit embarrased */ | 373 | /* Yes, this is a FUCKTON of arguments and I'm a bit embarrased */ |
| 373 | { | 374 | { |
| 374 | xs *action = xs_fmt("%s/admin/note", user->actor); | 375 | xs *action = xs_fmt("%s/admin/note", user->actor); |
| @@ -469,10 +470,19 @@ xs_html *html_note(snac *user, const char *summary, | |||
| 469 | 470 | ||
| 470 | xs_list_foreach(ll, lang) { | 471 | xs_list_foreach(ll, lang) { |
| 471 | if (*lang) { | 472 | if (*lang) { |
| 472 | xs_html_add(post_lang, | 473 | if (xs_is_string(note_lang) && strcmp(lang, note_lang) == 0) { |
| 473 | xs_html_tag("option", | 474 | xs_html_add(post_lang, |
| 474 | xs_html_text(lang), | 475 | xs_html_tag("option", |
| 475 | xs_html_attr("value", lang))); | 476 | xs_html_text(lang), |
| 477 | xs_html_attr("selected", NULL), | ||
| 478 | xs_html_attr("value", lang))); | ||
| 479 | } | ||
| 480 | else { | ||
| 481 | xs_html_add(post_lang, | ||
| 482 | xs_html_tag("option", | ||
| 483 | xs_html_text(lang), | ||
| 484 | xs_html_attr("value", lang))); | ||
| 485 | } | ||
| 476 | } | 486 | } |
| 477 | } | 487 | } |
| 478 | 488 | ||
| @@ -1227,7 +1237,7 @@ xs_html *html_top_controls(snac *user) | |||
| 1227 | NULL, NULL, | 1237 | NULL, NULL, |
| 1228 | xs_stock(XSTYPE_FALSE), "", | 1238 | xs_stock(XSTYPE_FALSE), "", |
| 1229 | xs_stock(XSTYPE_FALSE), NULL, | 1239 | xs_stock(XSTYPE_FALSE), NULL, |
| 1230 | NULL, 1, NULL, NULL, 0, NULL), | 1240 | NULL, 1, NULL, NULL, 0, NULL, NULL), |
| 1231 | 1241 | ||
| 1232 | /** operations **/ | 1242 | /** operations **/ |
| 1233 | xs_html_tag("details", | 1243 | xs_html_tag("details", |
| @@ -1913,6 +1923,15 @@ xs_html *html_entry_controls(snac *user, const char *actor, | |||
| 1913 | } | 1923 | } |
| 1914 | } | 1924 | } |
| 1915 | 1925 | ||
| 1926 | const char *note_lang = NULL; | ||
| 1927 | const xs_dict *cmap = xs_dict_get(msg, "contentMap"); | ||
| 1928 | if (xs_is_dict(cmap)) { | ||
| 1929 | const char *dummy; | ||
| 1930 | int c = 0; | ||
| 1931 | |||
| 1932 | xs_dict_next(cmap, ¬e_lang, &dummy, &c); | ||
| 1933 | } | ||
| 1934 | |||
| 1916 | xs_html_add(controls, xs_html_tag("div", | 1935 | xs_html_add(controls, xs_html_tag("div", |
| 1917 | xs_html_tag("p", NULL), | 1936 | xs_html_tag("p", NULL), |
| 1918 | html_note(user, L("Edit..."), | 1937 | html_note(user, L("Edit..."), |
| @@ -1922,7 +1941,7 @@ xs_html *html_entry_controls(snac *user, const char *actor, | |||
| 1922 | xs_dict_get(msg, "sensitive"), xs_dict_get(msg, "summary"), | 1941 | xs_dict_get(msg, "sensitive"), xs_dict_get(msg, "summary"), |
| 1923 | xs_stock(is_msg_public(msg) ? XSTYPE_FALSE : XSTYPE_TRUE), redir, | 1942 | xs_stock(is_msg_public(msg) ? XSTYPE_FALSE : XSTYPE_TRUE), redir, |
| 1924 | NULL, 0, att_files, att_alt_texts, is_draft(user, id), | 1943 | NULL, 0, att_files, att_alt_texts, is_draft(user, id), |
| 1925 | xs_dict_get(msg, "published"))), | 1944 | xs_dict_get(msg, "published"), note_lang)), |
| 1926 | xs_html_tag("p", NULL)); | 1945 | xs_html_tag("p", NULL)); |
| 1927 | } | 1946 | } |
| 1928 | 1947 | ||
| @@ -1941,7 +1960,7 @@ xs_html *html_entry_controls(snac *user, const char *actor, | |||
| 1941 | NULL, NULL, | 1960 | NULL, NULL, |
| 1942 | xs_dict_get(msg, "sensitive"), xs_dict_get(msg, "summary"), | 1961 | xs_dict_get(msg, "sensitive"), xs_dict_get(msg, "summary"), |
| 1943 | xs_stock(is_msg_public(msg) ? XSTYPE_FALSE : XSTYPE_TRUE), redir, | 1962 | xs_stock(is_msg_public(msg) ? XSTYPE_FALSE : XSTYPE_TRUE), redir, |
| 1944 | id, 0, NULL, NULL, 0, NULL)), | 1963 | id, 0, NULL, NULL, 0, NULL, NULL)), |
| 1945 | xs_html_tag("p", NULL)); | 1964 | xs_html_tag("p", NULL)); |
| 1946 | } | 1965 | } |
| 1947 | 1966 | ||
| @@ -3329,7 +3348,7 @@ xs_html *html_people_list(snac *user, xs_list *list, const char *header, const c | |||
| 3329 | NULL, actor_id, | 3348 | NULL, actor_id, |
| 3330 | xs_stock(XSTYPE_FALSE), "", | 3349 | xs_stock(XSTYPE_FALSE), "", |
| 3331 | xs_stock(XSTYPE_FALSE), NULL, | 3350 | xs_stock(XSTYPE_FALSE), NULL, |
| 3332 | NULL, 0, NULL, NULL, 0, NULL), | 3351 | NULL, 0, NULL, NULL, 0, NULL, NULL), |
| 3333 | xs_html_tag("p", NULL)); | 3352 | xs_html_tag("p", NULL)); |
| 3334 | 3353 | ||
| 3335 | xs_html_add(snac_post, snac_controls); | 3354 | xs_html_add(snac_post, snac_controls); |