commit 073140e
default
·
2023-11-23 21:55:20 +0000 UTC
parent 9880ac3
The post edit box also uses html_note().
1 files changed,
+15,
-45
M
html.c
M
html.c
+15,
-45
1@@ -1065,54 +1065,24 @@ xs_str *html_entry_controls(snac *snac, xs_str *os, const xs_dict *msg, const ch
2
3 s = xs_str_cat(s, "</form>\n");
4
5- const char *prev_src1 = xs_dict_get(msg, "sourceContent");
6-
7- if (!xs_is_null(prev_src1) && strcmp(actor, snac->actor) == 0) { /** edit **/
8- xs *prev_src = encode_html(prev_src1);
9- const xs_val *sensitive = xs_dict_get(msg, "sensitive");
10- const char *summary = xs_dict_get(msg, "summary");
11+ char *prev_src = xs_dict_get(msg, "sourceContent");
12
13+ if (!xs_is_null(prev_src) && strcmp(actor, snac->actor) == 0) { /** edit **/
14 /* post can be edited */
15- xs *s1 = xs_fmt(
16- "<p><details><summary>%s</summary>\n"
17- "<p><div class=\"snac-note\" id=\"%s_edit\">\n"
18- "<form autocomplete=\"off\" method=\"post\" action=\"%s/admin/note\" "
19- "enctype=\"multipart/form-data\" id=\"%s_edit_form\">\n"
20- "<textarea class=\"snac-textarea\" name=\"content\" "
21- "rows=\"4\" wrap=\"virtual\" required=\"required\">%s</textarea>\n"
22- "<input type=\"hidden\" name=\"edit_id\" value=\"%s\">\n"
23-
24- "<p>%s: <input type=\"checkbox\" name=\"sensitive\" %s> "
25- "<input type=\"text\" name=\"summary\" placeholder=\"%s\" value=\"%s\">\n"
26- "<p>%s: <input type=\"checkbox\" name=\"mentioned_only\">\n"
27-
28- "<details><summary>%s</summary>\n"
29- "<p>%s: <input type=\"file\" name=\"attach\">\n"
30- "<p>%s: <input type=\"text\" name=\"alt_text\">\n"
31- "</details>\n"
32+ xs *div_id = xs_fmt("%s_edit", md5);
33+ xs *form_id = xs_fmt("%s_edit_form", md5);
34+ xs *redir = xs_fmt("%s_entry", md5);
35
36- "<input type=\"hidden\" name=\"redir\" value=\"%s_entry\">\n"
37- "<p><input type=\"submit\" class=\"button\" value=\"%s\">\n"
38- "</form><p></div>\n"
39- "</details><p>"
40- "\n",
41+ xs_html *h = xs_html_tag("p",
42+ html_note(snac, L("Edit..."),
43+ div_id, form_id,
44+ "", prev_src,
45+ (char *)id, NULL,
46+ xs_dict_get(msg, "sensitive"), xs_dict_get(msg, "summary"),
47+ xs_stock_false, redir,
48+ NULL, 0));
49
50- L("Edit..."),
51- md5,
52- snac->actor, md5,
53- prev_src,
54- id,
55- L("Sensitive content"),
56- xs_type(sensitive) == XSTYPE_TRUE ? "checked" : "",
57- L("Sensitive content description"),
58- xs_is_null(summary) ? "" : summary,
59- L("Only for mentioned people"),
60- L("Attach..."),
61- L("File"),
62- L("File description"),
63- md5,
64- L("Post")
65- );
66+ xs *s1 = xs_html_render(h);
67
68 s = xs_str_cat(s, s1);
69 }
70@@ -1125,7 +1095,7 @@ xs_str *html_entry_controls(snac *snac, xs_str *os, const xs_dict *msg, const ch
71 xs *redir = xs_fmt("%s_entry", md5);
72
73 xs_html *h = xs_html_tag("p",
74- html_note(snac, L("Reply..."),
75+ html_note(snac, L("Reply..."),
76 div_id, form_id,
77 "", ct,
78 NULL, NULL,