From 9a6fe2bf696c4c364518159735f4f5d12c666681 Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Fri, 15 Mar 2013 08:20:00 +0100 Subject: Reaorganization of folders for the CSS, templates and pictures. --- source/static/templates/article.html | 58 ++++++++++++ source/static/templates/articles.html | 39 ++++++++ source/static/templates/base.html | 28 ++++++ source/static/templates/confirmation.html | 5 ++ source/static/templates/error.html | 5 ++ source/static/templates/favorites.html | 30 +++++++ source/static/templates/feed.html | 138 +++++++++++++++++++++++++++++ source/static/templates/history.html | 80 +++++++++++++++++ source/static/templates/inactives.html | 15 ++++ source/static/templates/index.html | 107 ++++++++++++++++++++++ source/static/templates/languages.html | 25 ++++++ source/static/templates/management.html | 80 +++++++++++++++++ source/static/templates/notifications.html | 18 ++++ source/static/templates/plain_text.html | 5 ++ source/static/templates/search.html | 53 +++++++++++ source/static/templates/statistics.html | 14 +++ source/static/templates/unread.html | 76 ++++++++++++++++ 17 files changed, 776 insertions(+) create mode 100644 source/static/templates/article.html create mode 100644 source/static/templates/articles.html create mode 100644 source/static/templates/base.html create mode 100644 source/static/templates/confirmation.html create mode 100644 source/static/templates/error.html create mode 100644 source/static/templates/favorites.html create mode 100644 source/static/templates/feed.html create mode 100644 source/static/templates/history.html create mode 100644 source/static/templates/inactives.html create mode 100644 source/static/templates/index.html create mode 100644 source/static/templates/languages.html create mode 100644 source/static/templates/management.html create mode 100644 source/static/templates/notifications.html create mode 100644 source/static/templates/plain_text.html create mode 100644 source/static/templates/search.html create mode 100644 source/static/templates/statistics.html create mode 100644 source/static/templates/unread.html (limited to 'source/static/templates') diff --git a/source/static/templates/article.html b/source/static/templates/article.html new file mode 100644 index 00000000..bd459c4e --- /dev/null +++ b/source/static/templates/article.html @@ -0,0 +1,58 @@ +## article.html +<%inherit file="base.html"/> +
+
+

${article["article_title"]} from ${feed["feed_title"]}

+
+ %if article["article_like"]: + + %else: + + %endif +    +

+ + ${description} + +
+
+
+ +
+ Plain text + - Export to EPUB +
+ Complete story +
+ + Share this article:
+ + + + + + + + + + + + + + + + + + + + + + + +
+ \ No newline at end of file diff --git a/source/static/templates/articles.html b/source/static/templates/articles.html new file mode 100644 index 00000000..cbba2508 --- /dev/null +++ b/source/static/templates/articles.html @@ -0,0 +1,39 @@ +## articles.html +<%inherit file="base.html"/> +<% +import utils +%> + + +
+

Articles of the feed ${feed['feed_title']}

+
+ %for article in articles: + <% + if article["article_readed"] == False: + not_read_begin, not_read_end = "", "" + else: + not_read_begin, not_read_end = "", "" + + if article["article_like"] == True: + like = """ """ + else: + like = "" + + article_content = utils.clear_string(article["article_content"]) + if article_content: + description = " ".join(article_content[:500].split(' ')[:-1]) + else: + description = "No description." + %> + ${article["article_date"].strftime('%Y-%m-%d %H:%M')} - ${not_read_begin}${article["article_title"][:150]}${not_read_end}${description} +
+ %endfor +

All feeds

\ No newline at end of file diff --git a/source/static/templates/base.html b/source/static/templates/base.html new file mode 100644 index 00000000..aa375470 --- /dev/null +++ b/source/static/templates/base.html @@ -0,0 +1,28 @@ +## base.html + + + + + %if header_text is UNDEFINED: + pyAggr3g470r + %elif header_text == 0: + pyAggr3g470r + %else: + ${header_text} - pyAggr3g470r + %endif + + + + + +

pyAggr3g470r

+ ${self.body()} +
+

This software is under GPLv3 license. You are welcome to copy, modify or + redistribute the source code according to the GPLv3 license.
+ Source code of pyAggr3g470r.

+
+ + \ No newline at end of file diff --git a/source/static/templates/confirmation.html b/source/static/templates/confirmation.html new file mode 100644 index 00000000..ae206838 --- /dev/null +++ b/source/static/templates/confirmation.html @@ -0,0 +1,5 @@ +## confirmation.html +<%inherit file="base.html"/> +
+

Your request processed successfully:

+

${message}

diff --git a/source/static/templates/error.html b/source/static/templates/error.html new file mode 100644 index 00000000..3790d3e9 --- /dev/null +++ b/source/static/templates/error.html @@ -0,0 +1,5 @@ +## error.html +<%inherit file="base.html"/> +
+

An error occured:

+ ${message} \ No newline at end of file diff --git a/source/static/templates/favorites.html b/source/static/templates/favorites.html new file mode 100644 index 00000000..4dd17b6b --- /dev/null +++ b/source/static/templates/favorites.html @@ -0,0 +1,30 @@ +## favorites.html +<%inherit file="base.html"/> +<% +import utils +%> +
+

Your favorites articles (${sum([elem.count() for elem in articles.values()])})

+ %for feed in feeds: + <% + new_feed_section = True + %> + %for article in articles[feed["feed_id"]]: + <% + if new_feed_section: + new_feed_section = False + title = """

%s

\n""" % \ + (feed["feed_id"], feed["site_link"], feed["feed_title"], feed["feed_link"], feed["feed_image"]) + else: + title = "" + article_content = utils.clear_string(article["article_content"]) + if article_content: + description = " ".join(article_content[:500].split(' ')[:-1]) + else: + description = "No description." + %> + ${title} + + ${article["article_date"].strftime('%Y-%m-%d %H:%M')} - ${article["article_title"][:150]}${description}
+ %endfor + %endfor diff --git a/source/static/templates/feed.html b/source/static/templates/feed.html new file mode 100644 index 00000000..f4a35e77 --- /dev/null +++ b/source/static/templates/feed.html @@ -0,0 +1,138 @@ +## feed.html +<%inherit file="base.html"/> +<% +import utils +%> +
+

The feed ${feed['feed_title']} contains ${format(nb_articles_feed, ',d')} articles. + Representing ${round((nb_articles_feed / nb_articles_total) * 100, 4)} percent of the total (${format(nb_articles_total, ',d')} articles). +
+ Address of the feed: ${feed['feed_link']}. +
+ Address of the site: ${feed['site_link']}.

+ + %if articles: +

${(nb_unread_articles_feed == 0 and ["All articles are read"] or [str(nb_unread_articles_feed) + " unread article" + (nb_unread_articles_feed == 1 and [""] or ["s"])[0]])[0]}.

+ %endif + + %if feed["mail"] == True: +

+ You are receiving articles from this feed to the address: ${mail_to}. + Stop receiving articles from this feed. + %if not mail_notification_enabled: +
However e-mail notification is disabled in the configuration file. + %endif +

+ %endif + + %if articles != []: +

The last article was posted ${elapsed.days} day(s) ago.
+ Daily average: ${average}, between the ${first_post_date.strftime('%Y-%m-%d')} and the ${end_post_date.strftime('%Y-%m-%d')}.

+ +
+

Recent articles

+ <% + html = "" + %> + %for article in articles: + <% + if article["article_readed"] == False: + # not readed articles are in bold + not_read_begin, not_read_end = "", "" + else: + not_read_begin, not_read_end = "", "" + + # display a heart for faved articles + if article["article_like"] == True: + like = """ """ + 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') + " - " + \ + """%s%s%s%s""" % \ + (feed["feed_id"], article["article_id"], not_read_begin, \ + article_title, not_read_end, description) + like + "
\n" + %> + %endfor + ${html} + + All articles    +
+ + %if nb_favorites != 0: +

+

Your favorites articles for this feed

+ <% + 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') + " - " + \ + """%s%s
\n""" % \ + (feed["feed_id"], article["article_id"], article["article_title"][:150], description) + %> + %endfor + ${html} + %endif + %else: +

No articles yet.

+ %endif + + + +
+

Edit this feed

+
+ + +
+ +
+ + + +
+ +
+ + + +
+ +
+ + +
+ + + %if articles != []: +
+

Tag cloud

+
+ Minimum size of a word: + +
+
${tag_cloud}
+ %endif diff --git a/source/static/templates/history.html b/source/static/templates/history.html new file mode 100644 index 00000000..e6826032 --- /dev/null +++ b/source/static/templates/history.html @@ -0,0 +1,80 @@ +## history.html +<%inherit file="base.html"/> +<% +import utils +import calendar +from collections import Counter +%> +
+ <% + html = "" + # Get the date from the tag cloud + # Format: /history/?query=year:2011-month:06 to get the + # list of articles of June, 2011. + if query == "all": + html += "

Search with tags cloud

\n" + html += "

Choose a year

\n" + if "year" in query: + the_year = query.split('-')[0].split(':')[1] + if "month" not in query: + html += "

Choose a month for " + the_year + "

\n" + if "month" in query: + the_month = query.split('-')[1].split(':')[1] + html += "

Articles of "+ calendar.month_name[int(the_month)] + ", "+ the_year +".

\n" + + timeline = Counter() + for feed in feeds: + new_feed_section = True + for article in mongo.get_articles(feed["feed_id"]): + + if query == "all": + timeline[article["article_date"].strftime('%Y')] += 1 + + elif query[:4] == "year": + + if article["article_date"].strftime('%Y') == the_year: + timeline[article["article_date"].strftime('%m')] += 1 + + if "month" in query: + if article["article_date"].strftime('%m') == the_month: + if article["article_readed"] == False: + # not readed articles are in bold + not_read_begin, not_read_end = "", "" + else: + not_read_begin, not_read_end = "", "" + + if article["article_like"] == True: + like = """ """ + 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] + " ..." + + if new_feed_section is True: + new_feed_section = False + html += """

%s

\n""" % \ + (feed["feed_id"], feed["site_link"], feed["feed_title"], feed["feed_link"], feed["feed_image"]) + + html += article["article_date"].strftime("%a %d (%H:%M:%S) ") + " - " + \ + """%s%s%s%s""" % \ + (feed["feed_id"], article["article_id"], not_read_begin, \ + article_title, not_read_end, description) + like + "
\n" + if query == "all": + query_string = "year" + elif "year" in query: + query_string = "year:" + the_year + "-month" + if "month" not in query: + html += '
' + \ + utils.tag_cloud([(elem, timeline[elem]) for elem in timeline.keys()], query_string) + '
' + %> + ${html} \ No newline at end of file diff --git a/source/static/templates/inactives.html b/source/static/templates/inactives.html new file mode 100644 index 00000000..57482b61 --- /dev/null +++ b/source/static/templates/inactives.html @@ -0,0 +1,15 @@ +## inactives.html +<%inherit file="base.html"/> +
+ %if inactives != []: +
+

Feeds with no recent articles since days:

+
+ + %else: +

No inactive feeds.

+ %endif diff --git a/source/static/templates/index.html b/source/static/templates/index.html new file mode 100644 index 00000000..43269f0a --- /dev/null +++ b/source/static/templates/index.html @@ -0,0 +1,107 @@ +## index.html +<%inherit file="base.html"/> +<% +import utils +%> +

+
+ +
+
+ +
+ +
+
+ <% + html = "" + %> + <% + for feed in feeds: + html += """\n

%s + + + +

\n
""" % \ + (feed["feed_id"], feed["site_link"], feed["feed_title"], \ + feed["feed_link"], feed["feed_image"]) + + # The main page display only 10 articles by feeds. + for article in mongo.get_articles(feed["feed_id"], limit=10): + if article["article_readed"] == False: + # not readed articles are in bold + not_read_begin, not_read_end = "", "" + else: + not_read_begin, not_read_end = "", "" + + # display a heart for faved articles + if article["article_like"] == True: + like = """ """ + else: + like = "" + + # Descrition for the CSS ToolTips + article_content = utils.clear_string(article["article_content"]) + if article_content: + description = " ".join(article_content.split(' ')[:55]) + 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') + " - " + \ + """%s%s%s%s""" % \ + (feed["feed_id"], article["article_id"], not_read_begin, \ + article_title, not_read_end, description) + like + "
\n" + html += "
\n" + + # some options for the current feed + html += """All articles   """ % (feed["feed_id"],) + html += """Feed summary   """ % (feed["feed_id"],) + html += """

\n""" % (feed["feed_id"],) + if mongo.nb_unread_articles(feed["feed_id"]) != 0: + html += """  Mark all as read""" % (feed["feed_id"],) + html += """     Unread article(s) (%s)""" % (feed["feed_id"], mongo.nb_unread_articles(feed["feed_id"])) + if feed["mail"] == False: + html += """
\nStay tuned""" % (feed["feed_id"],) + else: + html += """
\nStop staying tuned""" % (feed["feed_id"],) + html += """

Top

\n""" + %> + ${html} diff --git a/source/static/templates/languages.html b/source/static/templates/languages.html new file mode 100644 index 00000000..d186677d --- /dev/null +++ b/source/static/templates/languages.html @@ -0,0 +1,25 @@ +## languages.html +<%inherit file="base.html"/> +
+

Summary

+
    + %for language in articles_sorted_by_languages.keys(): +
  • ${language}: ${sum(map(len, articles_sorted_by_languages[language].values()))} articles
  • + %endfor +
+ %for language in articles_sorted_by_languages.keys(): +
+

${language}

+ %for feed_id in articles_sorted_by_languages[language]: + <% + feed = mongo.get_feed(feed_id) + %> +

${feed["feed_title"]}

+ %for article in articles_sorted_by_languages[language][feed_id][:10]: + ${article["article_date"].strftime('%Y-%m-%d %H:%M')} - ${article["article_title"]} +
+ %endfor +
+ %endfor +
+ %endfor \ No newline at end of file diff --git a/source/static/templates/management.html b/source/static/templates/management.html new file mode 100644 index 00000000..a2bce1dc --- /dev/null +++ b/source/static/templates/management.html @@ -0,0 +1,80 @@ +## management.html +<%inherit file="base.html"/> +
+

Subscriptions

+
+

+ Add a feed: + + +

+
+ + %if feeds: +
+ Delete the feed: + + +
+ %endif + + %if not mail_notification_enabled: +

E-mail notification is disabled in the configuration file.

+ %endif + + %if feeds: +
+

Facts

+ + %endif + +
+ +

Account

+

+

+ +
+
+
+ +
+

+ +
+ + +

Database

+

${nb_articles} article(s) are stored in the database with ${nb_unread_articles} unread article(s). + +

+ +
+
+ +
+ +
+ +

Export articles

+

+

+ + +
+

diff --git a/source/static/templates/notifications.html b/source/static/templates/notifications.html new file mode 100644 index 00000000..88558b05 --- /dev/null +++ b/source/static/templates/notifications.html @@ -0,0 +1,18 @@ +## article.html +<%inherit file="base.html"/> +
+ %if feeds != []: +

You are receiving e-mails for the following feeds:

+ + %else: +

No active notifications.

+ %endif +

Notifications are sent to: ${mail_to}. + %if not mail_notification_enabled: + However e-mail notification is disabled in the configuration file. + %endif +

diff --git a/source/static/templates/plain_text.html b/source/static/templates/plain_text.html new file mode 100644 index 00000000..44b7da91 --- /dev/null +++ b/source/static/templates/plain_text.html @@ -0,0 +1,5 @@ +## plain_text.html +<%inherit file="base.html"/> +
+

${article_title} from ${feed_title}


+ ${description} \ No newline at end of file diff --git a/source/static/templates/search.html b/source/static/templates/search.html new file mode 100644 index 00000000..da766ee9 --- /dev/null +++ b/source/static/templates/search.html @@ -0,0 +1,53 @@ +## search.html +<%inherit file="base.html"/> +<% +import utils +%> +
+%if len(search_result) != 0: +

Articles containing the string ${query} (${sum([articles.count() for articles in search_result.values()])} results)

+%else: +

String ${query} not found.

+%endif +<% + html = "" + feed_id = None +%> + +%for feed_id in search_result.keys(): + <% + new_feed_section = True + feed = mongo.get_feed(feed_id) + print(search_result[feed["feed_id"]].count()) + for article in search_result[feed["feed_id"]]: + if new_feed_section is True: + new_feed_section = False + html += """

%s

\n""" % \ + (feed["feed_id"], feed["feed_title"], feed["feed_link"], feed["feed_image"]) + + if article["article_readed"] == False: + # not readed articles are in bold + not_read_begin, not_read_end = "", "" + else: + not_read_begin, not_read_end = "", "" + + # display a heart for faved articles + if article["article_like"] == True: + like = """ """ + else: + like = "" + + # descrition for the CSS ToolTips + article_content = utils.clear_string(article["article_content"]) + description = " ".join(article_content[:500].split(' ')[:-1]) + + # 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') + " - " + \ + """%s%s%s%s""" % \ + (feed["feed_id"], article["article_id"], not_read_begin, \ + article["article_title"][:150], not_read_end, description) + like + "
\n" + %> +%endfor + +${html} \ No newline at end of file diff --git a/source/static/templates/statistics.html b/source/static/templates/statistics.html new file mode 100644 index 00000000..5dfcbfa8 --- /dev/null +++ b/source/static/templates/statistics.html @@ -0,0 +1,14 @@ +## statistics.html +<%inherit file="base.html"/> +
+ %if articles: +

Statistics

+

Tag cloud

+
+ Minimum size of a word: + +
+
+ ${tag_cloud} +
+ %endif \ No newline at end of file diff --git a/source/static/templates/unread.html b/source/static/templates/unread.html new file mode 100644 index 00000000..d37d3034 --- /dev/null +++ b/source/static/templates/unread.html @@ -0,0 +1,76 @@ +## unread.html +<%inherit file="base.html"/> +<% +import utils +%> +
+ <% + html = "" + if mongo.nb_unread_articles() != 0: + + # List unread articles of all the database + if feed_id == "": + html += "

Unread article(s)

" + html += """\n
\nMark articles as read\n
\n""" + for feed in feeds: + new_feed_section = True + nb_unread = 0 + + # For all unread article of the current feed. + for article in mongo.get_articles(feed["feed_id"], condition=("article_readed", False)): + nb_unread += 1 + if new_feed_section is True: + new_feed_section = False + html += """

%s

\n""" % \ + (feed["feed_id"], feed["site_link"], feed["feed_title"], feed["feed_link"], feed["feed_image"]) + + # 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') + " - " + \ + """%s%s
\n""" % \ + (feed["feed_id"], article["article_id"], article["article_title"][:150], description) + + if nb_unread == mongo.nb_unread_articles(feed["feed_id"]): + html += """
\nMark all articles from this feed as read\n""" % \ + (feed["feed_id"],) + html += """
\nMark articles as read\n""" + + + # List unread articles of a feed + else: + try: + feed = mongo.get_feed(feed_id) + except: + return "

This feed do not exists.

" + html += """

Unread article(s) of the feed %s

+
""" % (feed_id, feed["feed_title"]) + + # For all unread article of the feed. + for article in mongo.get_articles(feed_id, condition=("article_readed", False)): + # 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') + " - " + \ + """%s%s
\n""" % \ + (feed_id, article["article_id"], article["article_title"][:150], description) + + html += """
\nMark all as read""" % (feed_id,) + # No unread article + else: + html += '

No unread article(s)

\n
\nWhy not check for news?' + html += """\n

All feeds

""" + %> + ${html} \ No newline at end of file -- cgit