aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCédric Bonhomme <kimble.mandel@gmail.com>2012-11-22 15:09:03 +0100
committerCédric Bonhomme <kimble.mandel@gmail.com>2012-11-22 15:09:03 +0100
commit84de9af5e55e5cf52345a1d78bde436c5ba87b61 (patch)
tree1c03f1d2147d20c3fa8ccd851abfe208e8104080
parentTemplate for the /article page. (diff)
downloadnewspipe-84de9af5e55e5cf52345a1d78bde436c5ba87b61.tar.gz
newspipe-84de9af5e55e5cf52345a1d78bde436c5ba87b61.tar.bz2
newspipe-84de9af5e55e5cf52345a1d78bde436c5ba87b61.zip
Template for the /management page.
-rwxr-xr-xsource/pyAggr3g470r.py48
-rw-r--r--source/templates/management.html50
2 files changed, 54 insertions, 44 deletions
diff --git a/source/pyAggr3g470r.py b/source/pyAggr3g470r.py
index a8659e1a..9c4e6766 100755
--- a/source/pyAggr3g470r.py
+++ b/source/pyAggr3g470r.py
@@ -276,50 +276,10 @@ class pyAggr3g470r(object):
nb_articles = self.mongo.nb_articles()
nb_unread_articles = self.mongo.nb_unread_articles()
- html = htmlheader()
- html += htmlnav
- html += """<div class="left inner">\n"""
- html += "<h1>Add Feeds</h1>\n"
- # Form: add a feed
- html += """<form method=get action="/add_feed/"><input type="url" name="url" placeholder="URL of a site" maxlength=2048 autocomplete="off">\n<input type="submit" value="OK"></form>\n"""
-
- if feeds:
- # Form: delete a feed
- html += "<h1>Delete Feeds</h1>\n"
- html += """<form method=get action="/remove_feed/"><select name="feed_id">\n"""
- for feed in feeds:
- html += """\t<option value="%s">%s</option>\n""" % (feed["feed_id"], feed["feed_title"])
- html += """</select><input type="submit" value="OK"></form>\n"""
-
- html += """<p>Active e-mail notifications: <a href="/notifications/">%s</a></p>\n""" % \
- (nb_mail_notifications,)
- html += """<p>You like <a href="/favorites/">%s</a> article(s).</p>\n""" % \
- (nb_favorites, )
-
- html += "<hr />\n"
-
- # Informations about the data base of articles
- html += """<p>%s article(s) are stored in the database with
- <a href="/unread/">%s unread article(s)</a>.<br />\n""" % \
- (nb_articles, nb_unread_articles)
- #html += """Database: %s.\n<br />Size: %s bytes.<br />\n""" % \
- #(os.path.abspath(utils.sqlite_base), os.path.getsize(utils.sqlite_base))
- html += '<a href="/statistics/">Advanced statistics.</a></p>\n'
-
- html += """<form method=get action="/fetch/">\n<input type="submit" value="Fetch all feeds"></form>\n"""
- html += """<form method=get action="/drop_base">\n<input type="submit" value="Delete all articles"></form>\n"""
-
- # Export functions
- html += "<h1>Export articles</h1>\n\n"
- html += """<form method=get action="/export/"><select name="export_method">\n"""
- html += """\t<option value="export_html" selected='selected'>HTML (simple Webzine)</option>\n"""
- html += """\t<option value="export_epub">ePub</option>\n"""
- html += """\t<option value="export_pdf">PDF</option>\n"""
- html += """\t<option value="export_txt">Text</option>\n"""
- html += """</select>\n\t<input type="submit" value="Export">\n</form>\n"""
- html += "<hr />"
- html += htmlfooter
- return html
+ tmpl = lookup.get_template("management.html")
+ return tmpl.render(feeds=feeds, nb_mail_notifications=nb_mail_notifications, \
+ nb_favorites=nb_favorites, nb_articles=nb_articles, \
+ nb_unread_articles=nb_unread_articles)
management.exposed = True
diff --git a/source/templates/management.html b/source/templates/management.html
new file mode 100644
index 00000000..fbb27c37
--- /dev/null
+++ b/source/templates/management.html
@@ -0,0 +1,50 @@
+## management.html
+<%inherit file="base.html"/>
+<h1><div class="right innerlogo"><a href="/"><img src="/img/tuxrss.png" title="What's new today?"/></a>
+</div><a name="top"><a href="/">pyAggr3g470r - News aggregator</a></a></h1>
+<a href="http://bitbucket.org/cedricbonhomme/pyaggr3g470r/" rel="noreferrer" target="_blank">pyAggr3g470r (source code)</a>
+<div class="left inner">
+ <h1>Add Feeds</h1>
+ <form method=get action="/add_feed/">
+ <input type="url" name="url" placeholder="URL of a site" maxlength=2048 autocomplete="off">
+ <input type="submit" value="OK">
+ </form>
+
+ %if feeds:
+ <h1>Delete Feeds</h1>
+ <form method=get action="/remove_feed/">
+ <select name="feed_id">
+ %for feed in feeds:
+ <option value="${feed['feed_id']}">${feed['feed_title']}</option>
+ %endfor
+ </select>
+ <input type="submit" value="OK">
+ </form>
+
+ <p>Active e-mail notifications: <a href="/notifications/">${nb_mail_notifications}</a></p>
+
+ <p>You like <a href="/favorites/">${nb_favorites}</a> article(s).</p>
+ %endif
+
+ <hr />
+
+ <p>${nb_articles} article(s) are stored in the database with <a href="/unread/">${nb_unread_articles} unread article(s)</a>.<br />
+ <a href="/statistics/">Advanced statistics.</a></p>
+
+ <form method=get action="/fetch/">
+ <input type="submit" value="Fetch all feeds">
+ </form>
+ <form method=get action="/drop_base">
+ <input type="submit" value="Delete all articles">
+ </form>
+
+ <h1>Export articles</h1>
+ <form method=get action="/export/">
+ <select name="export_method">
+ <option value="export_html" selected='selected'>HTML (simple Webzine)</option>
+ <option value="export_epub">ePub</option>
+ <option value="export_pdf">PDF</option>
+ <option value="export_txt">Text</option>
+ </select>
+ <input type="submit" value="Export">
+ </form> \ No newline at end of file
bgstack15