From 79dfa104623d51b7e0bdb411eadceda1747d0a20 Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Sat, 14 Sep 2013 10:44:59 +0200 Subject: Templates has been removed to the upper folder. --- source/templates/article.html | 67 ++++++++++++++++ source/templates/articles.html | 43 +++++++++++ source/templates/base.html | 28 +++++++ source/templates/confirmation.html | 5 ++ source/templates/error.html | 5 ++ source/templates/favorites.html | 30 ++++++++ source/templates/feed.html | 148 ++++++++++++++++++++++++++++++++++++ source/templates/history.html | 80 +++++++++++++++++++ source/templates/inactives.html | 15 ++++ source/templates/index.html | 108 ++++++++++++++++++++++++++ source/templates/languages.html | 25 ++++++ source/templates/management.html | 84 ++++++++++++++++++++ source/templates/notifications.html | 18 +++++ source/templates/search.html | 57 ++++++++++++++ source/templates/statistics.html | 14 ++++ source/templates/subscriptions.html | 13 ++++ source/templates/unread.html | 76 ++++++++++++++++++ 17 files changed, 816 insertions(+) create mode 100644 source/templates/article.html create mode 100644 source/templates/articles.html create mode 100644 source/templates/base.html create mode 100644 source/templates/confirmation.html create mode 100644 source/templates/error.html create mode 100644 source/templates/favorites.html create mode 100644 source/templates/feed.html create mode 100644 source/templates/history.html create mode 100644 source/templates/inactives.html create mode 100644 source/templates/index.html create mode 100644 source/templates/languages.html create mode 100644 source/templates/management.html create mode 100644 source/templates/notifications.html create mode 100644 source/templates/search.html create mode 100644 source/templates/statistics.html create mode 100644 source/templates/subscriptions.html create mode 100644 source/templates/unread.html (limited to 'source/templates') diff --git a/source/templates/article.html b/source/templates/article.html new file mode 100644 index 00000000..c1fe41e5 --- /dev/null +++ b/source/templates/article.html @@ -0,0 +1,67 @@ +## article.html +<%inherit file="base.html"/> +
+
+

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

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

+ ${description} +
+ + + +
+
+ + + +
+


+ + %if plain_text == "1": + HTML version + %else: + Plain text + %endif + - Export to EPUB +
+ + Share this article:

+ + + + + + + + + + + + + + + + + + + + + + +

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

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

+ %if articles.count() == 0: +

No articles yet.

+ %else: +
+ %endif + %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} ${like} +
+ %endfor +

All feeds

diff --git a/source/templates/base.html b/source/templates/base.html new file mode 100644 index 00000000..03c40f90 --- /dev/null +++ b/source/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.

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

Your request processed successfully:

+

${message}

diff --git a/source/templates/error.html b/source/templates/error.html new file mode 100644 index 00000000..3790d3e9 --- /dev/null +++ b/source/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/templates/favorites.html b/source/templates/favorites.html new file mode 100644 index 00000000..4dd17b6b --- /dev/null +++ b/source/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/templates/feed.html b/source/templates/feed.html new file mode 100644 index 00000000..2dadb8b4 --- /dev/null +++ b/source/templates/feed.html @@ -0,0 +1,148 @@ +## feed.html +<%inherit file="base.html"/> +<% +import utils +%> +
+ %if articles != []: +

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']}. +
+ Logo:

+ +

${(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]}.

+ %else: +

No articles for the feed ${feed['feed_title']}. +
+ Address of the feed: ${feed['feed_link']}. +
+ Address of the site: ${feed['site_link']}.

+ %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 + %endif + + + +
+

Edit this feed

+
+ + +
+ +
+ + + +
+ +
+ + + +
+ +
+ + +
+ +
+

+ (deletes corresponding articles)

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

Tag cloud

+
+ Minimum size of a word: + +
+
${tag_cloud}
+ %endif diff --git a/source/templates/history.html b/source/templates/history.html new file mode 100644 index 00000000..16f909dc --- /dev/null +++ b/source/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 " + 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} diff --git a/source/templates/inactives.html b/source/templates/inactives.html new file mode 100644 index 00000000..57482b61 --- /dev/null +++ b/source/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/templates/index.html b/source/templates/index.html new file mode 100644 index 00000000..88ca7a87 --- /dev/null +++ b/source/templates/index.html @@ -0,0 +1,108 @@ +## 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""" + html += """     %s unread article(s)""" % (feed["feed_id"], mongo.nb_unread_articles(feed["feed_id"])) + if feed["mail"] == False: + html += """
\nEnable email notifications""" % (feed["feed_id"],) + else: + html += """
\nDisable email notifications""" % (feed["feed_id"],) + html += """

Top

\n""" + %> + ${html} diff --git a/source/templates/languages.html b/source/templates/languages.html new file mode 100644 index 00000000..d186677d --- /dev/null +++ b/source/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/templates/management.html b/source/templates/management.html new file mode 100644 index 00000000..f6c68ace --- /dev/null +++ b/source/templates/management.html @@ -0,0 +1,84 @@ +## management.html +<%inherit file="base.html"/> +
+

Subscriptions

+

Add a new subscription (current subscriptions):

+
+ + +
+ + %if feeds: +

Unsubscribe from a source (deletes corresponding articles):

+
+ + +
+ %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). + +

+ +
+
+ +
+ +
+
+ (${nb_indexed_documents} indexed documents) +
+ + +
+ +

Export articles

+

+

+ + +
+

diff --git a/source/templates/notifications.html b/source/templates/notifications.html new file mode 100644 index 00000000..88558b05 --- /dev/null +++ b/source/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/templates/search.html b/source/templates/search.html new file mode 100644 index 00000000..435ef443 --- /dev/null +++ b/source/templates/search.html @@ -0,0 +1,57 @@ +## search.html +<%inherit file="base.html"/> +<% +import utils +%> +
+%if len(search_result) != 0: +

Articles containing the string ${query} (${sum([len(articles) 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) + 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/templates/statistics.html b/source/templates/statistics.html new file mode 100644 index 00000000..5dfcbfa8 --- /dev/null +++ b/source/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/templates/subscriptions.html b/source/templates/subscriptions.html new file mode 100644 index 00000000..8cee08ab --- /dev/null +++ b/source/templates/subscriptions.html @@ -0,0 +1,13 @@ +## subscriptions.html +<%inherit file="base.html"/> +
+

Subscriptions

+ %if feeds: + + %else: +

No subscriptions.

+ %endif \ No newline at end of file diff --git a/source/templates/unread.html b/source/templates/unread.html new file mode 100644 index 00000000..93df53e7 --- /dev/null +++ b/source/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 all 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 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} -- cgit