aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcedricbonhomme <devnull@localhost>2011-02-21 10:18:59 +0100
committercedricbonhomme <devnull@localhost>2011-02-21 10:18:59 +0100
commit902bd9c654b557e5f139e5bdc91fb3f7a34bd87c (patch)
treef94b74c532105f228973c95e0d79b31dd0947fa6
parentBitcoin donnation. (diff)
downloadnewspipe-902bd9c654b557e5f139e5bdc91fb3f7a34bd87c.tar.gz
newspipe-902bd9c654b557e5f139e5bdc91fb3f7a34bd87c.tar.bz2
newspipe-902bd9c654b557e5f139e5bdc91fb3f7a34bd87c.zip
Added new page (feed). This page is a kind of summary for each feeds.
-rwxr-xr-xpyAggr3g470r.py52
1 files changed, 52 insertions, 0 deletions
diff --git a/pyAggr3g470r.py b/pyAggr3g470r.py
index a3a015bb..04526dd8 100755
--- a/pyAggr3g470r.py
+++ b/pyAggr3g470r.py
@@ -516,6 +516,58 @@ class Root:
article.exposed = True
+ def feed(self, feed_id):
+ """
+ """
+ try:
+ feed = self.feeds[feed_id]
+ except KeyError:
+ return self.error_page("This feed do not exists.")
+ html = htmlheader()
+ html += htmlnav
+ html += """<div class="left inner">"""
+ html += "<p>The feed <b>" + feed.feed_title + "</b> contains <b>" + str(feed.nb_articles) + "</b> articles.</p>"
+ html += "<br /><p>Recent articles:</p>"
+ for article in feed.articles.values()[:10]:
+ if article.article_readed == "0":
+ # 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.like == "1":
+ like = """ <img src="/css/img/heart.png" title="I like this article!" />"""
+ else:
+ like = ""
+
+ # Descrition for the CSS ToolTips
+ article_content = utils.clear_string(article.article_description)
+ 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) >= 110:
+ article_title = article_title[:110] + " ..."
+
+ # a description line per article (date, title of the article and
+ # CSS description tooltips on mouse over)
+ html += article.article_date + " - " + \
+ """<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"
+ html += "<br />\n"
+ html += """<a href="/articles/%s">All articles</a>&nbsp;&nbsp;&nbsp;""" % (feed.feed_id,)
+
+ html += "<hr />"
+ html += htmlfooter
+ return html
+
+ feed.exposed = True
+
+
def articles(self, feed_id):
"""
Display all articles of a feed.
bgstack15