diff options
Diffstat (limited to 'html.c')
| -rw-r--r-- | html.c | 31 |
1 files changed, 21 insertions, 10 deletions
| @@ -1542,7 +1542,8 @@ xs_str *html_footer(xs_str *s) | |||
| 1542 | } | 1542 | } |
| 1543 | 1543 | ||
| 1544 | 1544 | ||
| 1545 | xs_str *html_timeline(snac *user, const xs_list *list, int local, int skip, int show, int show_more) | 1545 | xs_str *html_timeline(snac *user, const xs_list *list, int local, |
| 1546 | int skip, int show, int show_more, char *tag) | ||
| 1546 | /* returns the HTML for the timeline */ | 1547 | /* returns the HTML for the timeline */ |
| 1547 | { | 1548 | { |
| 1548 | xs_str *s = xs_str_new(NULL); | 1549 | xs_str *s = xs_str_new(NULL); |
| @@ -1628,15 +1629,25 @@ xs_str *html_timeline(snac *user, const xs_list *list, int local, int skip, int | |||
| 1628 | } | 1629 | } |
| 1629 | 1630 | ||
| 1630 | if (show_more) { | 1631 | if (show_more) { |
| 1631 | const char *base_url = user ? user->actor : srv_baseurl; | 1632 | xs *t = NULL; |
| 1633 | xs *m = NULL; | ||
| 1634 | |||
| 1635 | if (tag) { | ||
| 1636 | t = xs_fmt("%s?t=%s", srv_baseurl, tag); | ||
| 1637 | m = xs_fmt("%s&skip=%d&show=%d", t, skip + show, show); | ||
| 1638 | } | ||
| 1639 | else { | ||
| 1640 | t = xs_fmt("%s%s", user ? user->actor : srv_baseurl, local ? "" : "/admin"); | ||
| 1641 | m = xs_fmt("%s?&skip=%d&show=%d", t, skip + show, show); | ||
| 1642 | } | ||
| 1632 | 1643 | ||
| 1633 | xs *s1 = xs_fmt( | 1644 | xs *s1 = xs_fmt( |
| 1634 | "<p>" | 1645 | "<p>" |
| 1635 | "<a href=\"%s%s\" name=\"snac-more\">%s</a> - " | 1646 | "<a href=\"%s\" name=\"snac-more\">%s</a> - " |
| 1636 | "<a href=\"%s%s?skip=%d&show=%d\" name=\"snac-more\">%s</a>" | 1647 | "<a href=\"%s\" name=\"snac-more\">%s</a>" |
| 1637 | "</p>\n", | 1648 | "</p>\n", |
| 1638 | base_url, local ? "" : "/admin", L("Back to top"), | 1649 | t, L("Back to top"), |
| 1639 | base_url, local ? "" : "/admin", skip + show, show, L("More...") | 1650 | m, L("More...") |
| 1640 | ); | 1651 | ); |
| 1641 | 1652 | ||
| 1642 | s = xs_str_cat(s, s1); | 1653 | s = xs_str_cat(s, s1); |
| @@ -1968,7 +1979,7 @@ int html_get_handler(const xs_dict *req, const char *q_path, | |||
| 1968 | xs *h = xs_str_localtime(0, "%Y-%m.html"); | 1979 | xs *h = xs_str_localtime(0, "%Y-%m.html"); |
| 1969 | 1980 | ||
| 1970 | if (xs_type(xs_dict_get(snac.config, "private")) == XSTYPE_TRUE) { | 1981 | if (xs_type(xs_dict_get(snac.config, "private")) == XSTYPE_TRUE) { |
| 1971 | *body = html_timeline(&snac, NULL, 1, 0, 0, 0); | 1982 | *body = html_timeline(&snac, NULL, 1, 0, 0, 0, NULL); |
| 1972 | *b_size = strlen(*body); | 1983 | *b_size = strlen(*body); |
| 1973 | status = 200; | 1984 | status = 200; |
| 1974 | } | 1985 | } |
| @@ -1986,7 +1997,7 @@ int html_get_handler(const xs_dict *req, const char *q_path, | |||
| 1986 | xs *pins = pinned_list(&snac); | 1997 | xs *pins = pinned_list(&snac); |
| 1987 | pins = xs_list_cat(pins, list); | 1998 | pins = xs_list_cat(pins, list); |
| 1988 | 1999 | ||
| 1989 | *body = html_timeline(&snac, pins, 1, skip, show, xs_list_len(next)); | 2000 | *body = html_timeline(&snac, pins, 1, skip, show, xs_list_len(next), NULL); |
| 1990 | 2001 | ||
| 1991 | *b_size = strlen(*body); | 2002 | *b_size = strlen(*body); |
| 1992 | status = 200; | 2003 | status = 200; |
| @@ -2017,7 +2028,7 @@ int html_get_handler(const xs_dict *req, const char *q_path, | |||
| 2017 | xs *pins = pinned_list(&snac); | 2028 | xs *pins = pinned_list(&snac); |
| 2018 | pins = xs_list_cat(pins, list); | 2029 | pins = xs_list_cat(pins, list); |
| 2019 | 2030 | ||
| 2020 | *body = html_timeline(&snac, pins, 0, skip, show, xs_list_len(next)); | 2031 | *body = html_timeline(&snac, pins, 0, skip, show, xs_list_len(next), NULL); |
| 2021 | 2032 | ||
| 2022 | *b_size = strlen(*body); | 2033 | *b_size = strlen(*body); |
| 2023 | status = 200; | 2034 | status = 200; |
| @@ -2065,7 +2076,7 @@ int html_get_handler(const xs_dict *req, const char *q_path, | |||
| 2065 | 2076 | ||
| 2066 | list = xs_list_append(list, md5); | 2077 | list = xs_list_append(list, md5); |
| 2067 | 2078 | ||
| 2068 | *body = html_timeline(&snac, list, 1, 0, 0, 0); | 2079 | *body = html_timeline(&snac, list, 1, 0, 0, 0, NULL); |
| 2069 | *b_size = strlen(*body); | 2080 | *b_size = strlen(*body); |
| 2070 | status = 200; | 2081 | status = 200; |
| 2071 | } | 2082 | } |