]> git.ipfire.org Git - ipfire.org.git/commitdiff
Drop planet
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 17 Jul 2018 12:52:40 +0000 (13:52 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 17 Jul 2018 12:56:21 +0000 (13:56 +0100)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
12 files changed:
Makefile.am
src/templates/modules/planet-entry.html [deleted file]
src/templates/planet/base.html [deleted file]
src/templates/planet/hottest.html [deleted file]
src/templates/planet/index.html [deleted file]
src/templates/planet/list.html [deleted file]
src/templates/planet/modules/author-box.html [deleted file]
src/templates/planet/posting.html [deleted file]
src/templates/planet/search.html [deleted file]
src/web/__init__.py
src/web/handlers_planet.py [deleted file]
src/web/ui_modules.py

index d4a247e84c4616aac77913f4e999f45b24183740..6bbb4840b502218ab5559efcc382ef24c4c43e65 100644 (file)
@@ -88,7 +88,6 @@ web_PYTHON = \
        src/web/handlers_mirrors.py \
        src/web/handlers_news.py \
        src/web/handlers_nopaste.py \
-       src/web/handlers_planet.py \
        src/web/handlers_rss.py \
        src/web/handlers_talk.py \
        src/web/ui_modules.py
diff --git a/src/templates/modules/planet-entry.html b/src/templates/modules/planet-entry.html
deleted file mode 100644 (file)
index c0760a1..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-<div class="container blog-content">
-       <section id="{{ entry.slug }}" class="col-12 blog-entry">
-               {% if entry.is_draft() %}
-                       <div class="alert alert-info alert-dismissable">
-                               <button type="button" class="close" data-dismiss="alert">&times;</button>
-                               <strong>{{ _("Heads up!") }}</strong> {{ _("This post is a draft and has not been published, yet.") }}
-                       </div>
-               {% end %}
-               
-               <div class="row">
-                       <div class="col-9">     
-                               <h3 class="display-3 mb-3">
-                                       <a href="/post/{{ entry.slug }}">{{ entry.title }}</a>
-                               </h3>
-                       
-                               {% raw entry.text %}
-                       </div>
-               
-                       {% if show_avatar %}
-                       <div class="col-3 pt-4">
-                               <div class="row mb-3 d-flex justify-content-end">
-                                       <small>
-                                               {{ _("by") }} <a href="/user/{{ entry.author.uid }}">{{ entry.author.name }}</a>,
-                                               {{ locale.format_date(entry.published, shorter=True) }}
-                                       </small>
-                               </div>
-                               <div class="row d-flex justify-content-end">
-                                       <a href="/user/{{ entry.author.uid }}">
-                                               <img class="rounded" src="{{ entry.author.gravatar_icon(128) }}" alt="{{ entry.author.name }}" />
-                                       </a>
-                               </div>
-                       </div>
-                       {% end %}
-               </div>
-       </section>
-</div>
\ No newline at end of file
diff --git a/src/templates/planet/base.html b/src/templates/planet/base.html
deleted file mode 100644 (file)
index d108a0c..0000000
+++ /dev/null
@@ -1 +0,0 @@
-{% extends "../base.html" %}
diff --git a/src/templates/planet/hottest.html b/src/templates/planet/hottest.html
deleted file mode 100644 (file)
index 6edacff..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-{% extends "base.html" %}
-
-{% block title %}{{ _("Hottest posts") }}{% end block %}
-
-{% block container %}
-<div class="container features-content">
-       <h2 class="display-2 text-center">{{ _("The hottest posts of the last month") }}</h2>
-
-       <section class="container">
-               <dl>
-                       {% for entry in entries %}
-                               <dt>
-                                       <img class="img-responsive img-rounded pull-right" src="{{ entry.author.gravatar_icon(64) }}" alt="{{ entry.author.name }}" />
-                                       <h4><a href="/post/{{ entry.slug }}">{{ entry.title }}</a></h4>
-                               </dt>
-                               <dd>
-                                       {{ _("by") }} <a href="/user/{{ entry.author.uid }}">{{ entry.author.name }}</a>,
-                                       {{ locale.format_date(entry.published, relative=True, shorter=True) }}
-                               </dd>
-
-                               <br>
-                       {% end %}
-               </dl>
-       </section>
-</div>
-{% end block %}
diff --git a/src/templates/planet/index.html b/src/templates/planet/index.html
deleted file mode 100644 (file)
index dc3fb45..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-{% extends "base.html" %}
-
-{% block title %}{{ _("IPFire Planet") }}{% end block %}
-
-{% block container %}
-<div class="container">
-       <h2 class="display-2 text-center features-content">The Blog of the IPFire Team</h2>
-       
-       {% for entry in entries %}
-               {% module PlanetEntry(entry) %}
-       {% end %}
-       
-       <div class="col-9 my-4">
-               <div class="row d-flex flex-row justify-content-between">
-                       <a href="?offset={{ offset }}">&larr; {{ _("Older posts") }}</a>
-                       <a href="?offset={{ offset - (2 * limit) }}">{{ _("Newer posts") }} &rarr;</a>
-               </div>
-       </div>
-
-       <div class="btn-toolbar mb-6">
-               <div class="btn-group">
-                       <button type="button" class="btn btn-light"><a href="/hottest">{{ _("Hottest posts") }}</a></button>
-
-                       {% for y in range(year, 2010, -1) %}
-                               <button tyle="button" class="btn btn-light"><a href="/year/{{ y }}">{{ y }}</a></button>
-                       {% end %}
-               </div>
-       </div>
-</div>
-{% end block %}
diff --git a/src/templates/planet/list.html b/src/templates/planet/list.html
deleted file mode 100644 (file)
index 082c229..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-{% extends "../base.html" %}
-
-{% block title %}{{ _("IPFire Planet") }} - {% if author %}{{ _("%s's posts") % author.name }}{% elif year %}{{ _("Posts from %s") % year }}{% end %}{% end block %}
-
-{% block body %}
-<div class="container features-content">
-       <div class="row">
-               <div class="{% if author %}col-md-9{% else %}col-md-12{% end %}">
-                       {% block bodyA %}
-                               <div class="page-header">
-                                       <h2 class="display-2">
-                                               {% if author %}
-                                                       {{ _("%s's posts") % author.name }}
-                                               {% elif year %}
-                                                       {{ _("Posts from %s") % year }}
-                                               {% end %}
-                                       </h2>
-                               </div>
-
-                               {% if entries %}
-                                       {% for (y, m), posts in entries %}
-                                               <h3>
-                                                       {% if not year %}{{ y }},{% end %}
-                                                       {{ format_month_name(m) }}
-                                               </h3>
-
-                                               <dl class="dl-horizontal">
-                                                       {% for p in posts %}
-                                                               <dt>{{ locale.format_date(p.published, shorter=True) }}</dt>
-                                                               <dd class="text-overflow">
-                                                                       {% if not author %}
-                                                                               <span class="pull-right">
-                                                                                       {{ p.author.name }}
-                                                                               </span>
-                                                                               <img class="img-rounded" src="{{ p.author.gravatar_icon(20) }}"
-                                                                                       alt="{{ p.author.name }}" />
-                                                                       {% end %}
-                                                                       <a href="/post/{{ p.slug }}">{{ p.title }}</a>
-                                                               </dd>
-                                                       {% end %}
-                                               {% end %}
-                                       </dl>
-                               {% else %}
-                                       {% if author %}
-                                               <p>{{ _("%s did not write any posts, yet.") % author.name }}</p>
-                                       {% end %}
-                               {% end %}
-                       {% end block %}
-               </div>
-
-               {% if author %}
-                       <div class="col-md-3">
-                               {% module PlanetAuthorBox(author) %}
-                       </div>
-               {% end %}
-       </div>
-</div>
-{% end block %}
diff --git a/src/templates/planet/modules/author-box.html b/src/templates/planet/modules/author-box.html
deleted file mode 100644 (file)
index ed9de65..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-<div class="well pull-right ac" style="margin-left: 1em;">
-       <img class="img-thumbnail" src="{{ author.gravatar_icon(213) }}" alt="{{ author.name }}" />
-
-       <h3>
-               <a href="/user/{{ author.uid }}">{{ author.name }}</a>
-       </h3>
-
-       <br>
-
-       <ul class="list-inline">
-               <li>
-                       <a href="mailto:{{ author.email }}" title="{{ _("Write an email") }}">
-                               <i class="glyphicon glyphicon-envelope"></i>
-                       </a>
-               </li>
-
-               {% if author.is_talk_enabled() %}
-                       <li>
-                               <a href="https://talk.ipfire.org/phonebook/{{ author.uid }}"
-                                               title="{{ _("%s on talk.ipfire.org") % author.name }}">
-                                       <i class="glyphicon glyphicon-earphone"></i>
-                               </a>
-                       </li>
-               {% end %}
-       </ul>
-</div>
diff --git a/src/templates/planet/posting.html b/src/templates/planet/posting.html
deleted file mode 100644 (file)
index ede692e..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-{% extends "../base.html" %}
-
-{% block title %}{{ entry.title }}{% end block %}
-
-{% block container %}
-       {% module PlanetEntry(entry) %}
-
-       <div class="container mb-6">
-               <div class="col-12">
-                       <small>
-                               {{ _("Posted:") }} {{ locale.format_date(entry.published, shorter=True, relative=False) }}
-               
-                               &bull;
-               
-                               {{ _("One view", "%(views)s views", entry.views) % { "views" : entry.views } }}
-                       </small>
-               </div>
-       </div>
-{% end block %}
diff --git a/src/templates/planet/search.html b/src/templates/planet/search.html
deleted file mode 100644 (file)
index b150d82..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-{% extends "base.html" %}
-
-{% block title %}{{ _("IPFire Planet") }}{% end block %}
-
-{% block container %}
-       <div class="page-header container">
-               <h1>{{ _("Search results for '%s'") % query }}</h1>
-       </div>
-
-       <section class="container context-section text-center">
-               {% module PlanetSearchBox(query=query) %}
-       </section>
-
-       {% if entries %}
-               {% for entry in entries %}
-                       {% module PlanetEntry(entry) %}
-               {% end %}
-       {% else %}
-               <p class="lead text-muted ac">
-                       {{ _("No results found for '%s'") % query }}
-               </p>
-       {% end %}
-{% end block %}
index b6bfab197c9d51d3823a079d127a20aefc9d67fd..4c1b306889b050b9e193cd5cfe53300fbead0a9a 100644 (file)
@@ -60,9 +60,6 @@ class Application(tornado.web.Application):
                                "NewsLine"             : NewsLineModule,
                                "NewsTable"            : NewsTableModule,
                                "NewsYearNavigation"   : NewsYearNavigationModule,
-                               "PlanetAuthorBox"      : PlanetAuthorBoxModule,
-                               "PlanetEntry"          : PlanetEntryModule,
-                               "PlanetSearchBox"      : PlanetSearchBoxModule,
                                "ProgressBar"          : ProgressBarModule,
                                "ReleaseItem"          : ReleaseItemModule,
                                "SidebarBanner"        : SidebarBannerModule,
@@ -154,17 +151,14 @@ class Application(tornado.web.Application):
 
                # planet.ipfire.org
                self.add_handlers(r"planet(\.dev)?\.ipfire\.org", [
-                       (r"/", PlanetMainHandler),
-                       (r"/hottest", PlanetHotEntriesHandler),
-                       (r"/post/([A-Za-z0-9_-]+)", PlanetPostingHandler),
-                       (r"/user/([a-z0-9_-]+)", PlanetUserHandler),
-                       (r"/search", PlanetSearchHandler),
-                       (r"/year/(\d+)", PlanetYearHandler),
+                       (r"/", tornado.web.RedirectHandler, { "url" : "https://blog.ipfire.org/" }),
+                       (r"/post/([A-Za-z0-9_-]+)", tornado.web.RedirectHandler, { "url" : "https://blog.ipfire.org/posts/{1}" }),
+                       (r"/user/([a-z0-9_-]+)", tornado.web.RedirectHandler, { "url" : "https://blog.ipfire.org/authors/{1}" }),
 
                        # RSS
-                       (r"/rss", RSSPlanetAllHandler),
-                       (r"/user/([a-z0-9_-]+)/rss", RSSPlanetUserHandler),
-                       (r"/news.rss", tornado.web.RedirectHandler, { "url" : "/rss" }),
+                       (r"/rss", tornado.web.RedirectHandler, { "url" : "https://blog.ipfire.org/feed.rss" }),
+                       (r"/user/([a-z0-9_-]+)/rss", tornado.web.RedirectHandler, { "url" : "https://blog.ipfire.org/authors/{1}.rss" }),
+                       (r"/news.rss", tornado.web.RedirectHandler, { "url" : "https://blog.ipfire.org/feed.rss" }),
                ])
 
                # fireinfo.ipfire.org
diff --git a/src/web/handlers_planet.py b/src/web/handlers_planet.py
deleted file mode 100644 (file)
index 3eb1599..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-#!/usr/bin/python
-
-import tornado.web
-
-from handlers_base import *
-
-class PlanetBaseHandler(BaseHandler):
-       def group_entries_by_month(self, entries):
-               months = {}
-
-               for entry in entries:
-                       key = (entry.published.year, entry.published.month)
-
-                       try:
-                               months[key].append(entry)
-                       except KeyError:
-                               months[key] = [entry]
-
-               months = months.items()
-               months.sort(reverse=True)
-
-               return months
-
-
-class PlanetMainHandler(PlanetBaseHandler):
-       rss_url = "/rss"
-
-       def get(self):
-               offset = int(self.get_argument("offset", 0))
-               limit = int(self.get_argument("limit", 4))
-
-               entries = self.planet.get_entries(offset=offset, limit=limit)
-
-               self.render("planet/index.html", entries=entries, offset=offset + limit, limit=limit)
-
-
-class PlanetHotEntriesHandler(PlanetBaseHandler):
-       def get(self):
-               days = self.get_argument("days", None)
-               try:
-                       days = int(days)
-               except (TypeError, ValueError):
-                       days = 30
-
-               entries = self.planet.get_hot_entries(days, limit=25)
-
-               self.render("planet/hottest.html", entries=entries)
-
-
-class PlanetUserHandler(PlanetBaseHandler):
-       def get(self, author):
-               author = self.accounts.get_by_uid(author)
-               if not author:
-                       raise tornado.web.HTTPError(404, "User is unknown")
-
-               entries = self.planet.get_entries_by_author(author.uid)
-               entries = self.group_entries_by_month(entries)
-
-               self.render("planet/list.html", author=author, year=None,
-                       entries=entries, rss_url="/user/%s/rss" % author.uid)
-
-
-class PlanetPostingHandler(PlanetBaseHandler):
-       def get(self, slug):
-               entry = self.planet.get_entry_by_slug(slug)
-               if not entry:
-                       raise tornado.web.HTTPError(404)
-
-               # Get the referer and location for statistical purposes
-               referer = self.request.headers.get("Referer", None)
-               location = self.get_remote_location()
-               if location:
-                       location = location.country
-
-                # Log the request
-                with self.db.transaction():
-                        entry.count_view(referer=referer, location=location)
-
-               self.render("planet/posting.html",
-                       author=entry.author, entry=entry)
-
-
-class PlanetSearchHandler(PlanetBaseHandler):
-       def get(self):
-               query = self.get_argument("q", "")
-
-               if query:
-                       entries = self.planet.search(query)
-               else:
-                       entries = []
-
-               self.render("planet/search.html", entries=entries, query=query)
-
-
-class PlanetYearHandler(PlanetBaseHandler):
-       def get(self, year):
-               entries = self.planet.get_entries_by_year(year)
-               entries = self.group_entries_by_month(entries)
-
-               self.render("planet/list.html", author=None, year=year,
-                       entries=entries)
index 67a4d75a08d0b3c46d75a12e6f6a3eb492b019ed..c9ef546e95b5a12cea3027f594c2adc90493dd98 100644 (file)
@@ -44,10 +44,6 @@ class UIModule(tornado.web.UIModule):
        def news(self):
                return self.handler.news
 
-       @property
-       def planet(self):
-               return self.handler.planet
-
        @property
        def talk(self):
                return self.handler.talk
@@ -242,11 +238,6 @@ class NewsYearNavigationModule(UIModule):
                        active=active, years=self.news.years)
 
 
-class PlanetSearchBoxModule(UIModule):
-       def render(self, query=None):
-               return self.render_string("modules/planet/search-box.html", query=query)
-
-
 class SidebarItemModule(UIModule):
        def render(self):
                return self.render_string("modules/sidebar-item.html")
@@ -305,17 +296,6 @@ class DownloadButtonModule(UIModule):
                        release=release, image=best_image)
 
 
-class PlanetAuthorBoxModule(UIModule):
-       def render(self, author):
-               return self.render_string("planet/modules/author-box.html", author=author)
-
-
-class PlanetEntryModule(UIModule):
-       def render(self, entry, show_avatar=True):
-               return self.render_string("modules/planet-entry.html",
-                       entry=entry, show_avatar=show_avatar)
-
-
 class ProgressBarModule(UIModule):
        def render(self, value, colour=None):
                value *= 100