aboutsummaryrefslogtreecommitdiff
path: root/source/static/templates/feed.html
blob: 2dadb8b40ed55cc5bb12740c68e84eb9d4a91a88 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
## feed.html
<%inherit file="base.html"/>
<%
import utils
%>
<div class="left inner">
    %if articles != []:
        <p>The feed <b>${feed['feed_title']}</b> contains <b>${format(nb_articles_feed, ',d')}</b> articles.
        Representing ${round((nb_articles_feed / nb_articles_total) * 100, 4)} percent of the total (${format(nb_articles_total, ',d')} articles).
        <br />
        Address of the feed: <a href="${feed['feed_link']}">${feed['feed_link']}</a>.
        <br />
        Address of the site: <a href="${feed['site_link']}">${feed['site_link']}</a>.
        <br />
        Logo: <img src="${feed['feed_image']}" width="28px" height="28px" /></p>

        <p>${(nb_unread_articles_feed == 0 and ["All articles are read"] or ['<a href="/unread/'+feed["feed_id"] + ' ">'+str(nb_unread_articles_feed)+'</a>' + ' unread article' + (nb_unread_articles_feed == 1 and [""] or ["s"])[0]])[0]}.</p>
    %else:
        <p>No articles for the feed <b>${feed['feed_title']}</b>.
        <br />
        Address of the feed: <a href="${feed['feed_link']}">${feed['feed_link']}</a>.
        <br />
        Address of the site: <a href="${feed['site_link']}">${feed['site_link']}</a>.</p>
    %endif

    %if feed["mail"] == True:
        <p>
        You are receiving articles from this feed to the address: <a href="mail:${mail_to}">${mail_to}</a>.
        <a href="/mail_notification/0:${feed['feed_id']}">Stop</a> receiving articles from this feed.
        %if not mail_notification_enabled:
            <br />However e-mail notification is disabled in the configuration file.
        %endif
        </p>
    %endif

    %if articles != []:
        <p>The last article was posted ${elapsed.days} day(s) ago.<br />
        Daily average: ${average}, between the ${first_post_date.strftime('%Y-%m-%d')} and the ${end_post_date.strftime('%Y-%m-%d')}.</p>

        <br />
        <h1>Recent articles</h1>
        <%
        html = ""
        %>
        %for article in articles:
            <%
                if article["article_readed"] == False:
                    # not readed articles are in bold
                    not_read_begin, not_read_end = "<b>", "</b>"
                else:
                    not_read_begin, not_read_end = "", ""

                # display a heart for faved articles
                if article["article_like"] == True:
                    like = """ <img src="/static/img/heart.png" title="I like this article!" />"""
                else:
                    like = ""

                # Descrition for the CSS ToolTips
                article_content = utils.clear_string(article["article_content"])
                if article_content:
                    description = " ".join(article_content[:500].split(' ')[:-1])
                else:
                    description = "No description."
                # Title of the article
                article_title = article["article_title"]
                if len(article_title) >= 80:
                    article_title = article_title[:80] + " ..."

                # a description line per article (date, title of the article and
                # CSS description tooltips on mouse over)
                html += article["article_date"].strftime('%Y-%m-%d %H:%M') + " - " + \
                        """<a class="tooltip" href="/article/%s:%s" rel="noreferrer" target="_blank">%s%s%s<span class="classic">%s</span></a>""" % \
                                (feed["feed_id"], article["article_id"], not_read_begin, \
                                article_title, not_read_end, description) + like + "<br />\n"
            %>
        %endfor
        ${html}

        <a href="/articles/${feed['feed_id']}">All articles</a>&nbsp;&nbsp;&nbsp;
        <br />

        %if nb_favorites != 0:
            <br /></br />
            <h1>Your favorites articles for this feed</h1>
            <%
                html = ""
            %>
            %for article in favorites:
                <%
                    #descrition for the CSS ToolTips
                    article_content = utils.clear_string(article["article_content"])
                    if article_content:
                        description = " ".join(article_content[:500].split(' ')[:-1])
                    else:
                        description = "No description."

                    # a description line per article (date, title of the article and
                    # CSS description tooltips on mouse over)
                    html += article["article_date"].strftime('%Y-%m-%d %H:%M') + " - " + \
                            """<a class="tooltip" href="/article/%s:%s" rel="noreferrer" target="_blank">%s<span class="classic">%s</span></a><br />\n""" % \
                                    (feed["feed_id"], article["article_id"], article["article_title"][:150], description)
                %>
            %endfor
            ${html}
        %endif
    %endif



    <br />
    <h1>Edit this feed</h1>
    <form method=post action="/change_feed_name/">
        <input type="text" name="new_feed_name" value="" placeholder="Enter a new name (then press Enter)." maxlength=2048 autocomplete="on" size="50" />
        <input type="hidden" name="feed_id" value="${feed['feed_id']}" />
    </form>

    <form method=post action="/change_site_url/">
        <input type="url" name="new_site_url" value="" placeholder="Enter a new URL for this site (then press Enter)." maxlength=2048 autocomplete="on" size="50" />
        <input type="hidden" name="feed_id" value="${feed['feed_id']}" />
        <input type="hidden" name="old_site_url" value="${feed['site_link']}" />
    </form>

    <form method=post action="/change_feed_url/">
        <input type="url" name="new_feed_url" value="" placeholder="Enter a new URL in order to retrieve articles (then press Enter)." maxlength=2048 autocomplete="on" size="50" />
        <input type="hidden" name="feed_id" value="${feed['feed_id']}" />
        <input type="hidden" name="old_feed_url" value="${feed['feed_link']}" />
    </form>

    <form method=post action="/change_feed_logo/">
        <input type="text" name="new_feed_logo" value="" placeholder="Enter the URL of the logo (then press Enter)." maxlength=2048 autocomplete="on" size="50" />
        <input type="hidden" name="feed_id" value="${feed['feed_id']}" />
    </form>

    <form method=get action="/remove_feed/${feed['feed_id']}">
        <p><input type="submit" value="Unsubscribe" />
        (deletes corresponding articles)</p>
    </form>

    %if articles != []:
        </br />
        <h1>Tag cloud</h1>
        <form method=get action="/feed/${feed['feed_id']}">
            Minimum size of a word:
            <input type="number" name="word_size" value="${word_size}" min="2" max="15" step="1" size="2">
        </form>
        <div style="width: 35%; overflow:hidden; text-align: justify">${tag_cloud}</div>
    %endif
bgstack15