]> git.ipfire.org Git - ipfire.org.git/commitdiff
Updated rss stuff.
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 28 Mar 2009 14:14:21 +0000 (15:14 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 28 Mar 2009 14:14:21 +0000 (15:14 +0100)
Added news archieve site.
Added rss feed. URL HAS CHANGED!
Added old news massages.

www/news.json
www/pages/news.rss/__init__.py [new file with mode: 0644]
www/pages/static/index.xml
www/pages/static/news.xml [new file with mode: 0644]
www/rss.inc [new file with mode: 0644]
www/web/__init__.py

index 8c70648a8c38ddbf944bea0a61db42c13e74f308..fc829e6360d2bc8f762b2034d969f50ec9af525f 100644 (file)
 {
-         "1" : {       "author"   : "Michael Tremer",
+               "01" : {"author"   : "Michael Tremer",
+                               "mail"     : "michael.tremer@ipfire.org",
+                               "subject"  : "IPFire 2.1 Final",
+                               "date"     : "2007-08-11",
+                               "link"     : "",
+                               "content"  :
+                                       { "en" : "<p>Today, we released the final version of <strong>IPFire 2.1</strong>.</p>",
+                                         "de" : "<p>Heute wurde die finale Version von <strong>IPFire 2.1</strong> herausgegeben.</p>"}},
+
+               "02" : {"author"   : "Michael Tremer",
+                               "mail"     : "michael.tremer@ipfire.org",
+                               "subject"  : { "en" : "IPFire's first rss feed", "de" : "IPFires RSS-Feed" },
+                               "date"     : "2008-07-24",
+                               "link"     : "",
+                               "content"  :
+                                       { "en" : "<p>Now, the ipfire project has got it's own rss feed. This feed is for you, to keep you up on latest
+                                                               security updates and releases.</strong>.</p>",
+                                         "de" : "<p>Ab heute hat das IPFire-Projekt seinen eigenen RSS-Feed. Dieser soll die Möglichkeit bieten
+                                                               auf dem Stand der Dinge zu bleiben.</p>"}},
+
+               "03" : {"author"   : "Michael Tremer",
+                               "mail"     : "michael.tremer@ipfire.org",
+                               "subject"  : "Core Update 15",
+                               "date"     : "2008-07-24",
+                               "link"     : "",
+                               "content"  :
+                                       { "en" : "<p>Today, we released the <strong>core update number #15</strong>.<br />
+                                                               This is an important update because it will fix
+                                                               the latest dns vulnerabilities.<br />
+                                                               <a href=\"http://www.heise-online.co.uk/news/DNS-security-problem-details-released--/111145\">Read this for more information.</a><br />
+                                                               Please install this update as soon as possible.</p>",
+                                         "de" : "<p>Heute wurde das <strong>Core Update #15</strong> herausgegeben.<br />
+                                                               Dieses Update wird als kritisch eingestuft, da es die Sicherheitslücke des
+                                                               DNS behebt.<br />
+                                                               <a href=\"http://www.heise-online.co.uk/news/DNS-security-problem-details-released--/111145\">Nähere Informationen dazu gibt es hier.</a><br />
+                                                               Bitte installieren Sie dieses Update möglichst schnell.</p>"}},
+
+               "04" : {"author"   : "Michael Tremer",
+                               "mail"     : "michael.tremer@ipfire.org",
+                               "subject"  : "LUG Lünen",
+                               "date"     : "2008-07-30",
+                               "link"     : "http://www.linux-luenen.de/?q=node/15",
+                               "content"  :
+                                       { "en" : "<p>The linux user group from Lünen
+                                                               released an article about ipfire.</p>",
+                                         "de" : "<p>Die Linux-User-Group aus Lünen hat einen Artikel
+                                                               über IPFire auf ihrer Webseite veröffentlicht.</p>"}},
+
+               "05" : {"author"   : "Michael Tremer",
+                               "mail"     : "michael.tremer@ipfire.org",
+                               "subject"  : "Core Update 16",
+                               "date"     : "2008-08-17",
+                               "link"     : "",
+                               "content"  :
+                                       { "en" : "<p>Today, we released the <strong>core update number #16</strong>.</p>",
+                                         "de" : "<p>Heute wurde das <strong>Core Update #16</strong> herausgegeben.</p>"}},
+
+               "06" : {"author"   : "Michael Tremer",
+                               "mail"     : "michael.tremer@ipfire.org",
+                               "subject"  : "IPFire 2.3 Beta 3",
+                               "date"     : "2008-08-20",
+                               "link"     : "http://forum.ipfire.org/index.php/topic,709.0.html",
+                               "content"  :
+                                       { "en" : "<p>Today, we released the beta version of <strong>IPFire 2.3</strong>.</p>",
+                                         "de" : "<p>Heute wurde die Beta-Version von <strong>IPFire 2.3</strong> herausgegeben.</p>"}},
+
+               "07" : {"author"   : "Michael Tremer",
+                               "mail"     : "michael.tremer@ipfire.org",
+                               "subject"  : { "en" : "Presentation of our project on kbarthel.de",
+                                                          "de" : "Projektpräsentation auf kbarthel.de" },
+                               "date"     : "2008-08-22",
+                               "link"     : "http://blog.kbarthel.de/?p=148",
+                               "content"  :
+                                       { "en" : "<p>Kim Barthel published on his blog a text about the project ipfire itself.</p>",
+                                         "de" : "<p>Kim Barthel veröffentlichte in seinem Blog einen umfassenden Bericht über IPFire.</p>"}},
+
+               "08" : {"author"   : "Michael Tremer",
+                               "mail"     : "michael.tremer@ipfire.org",
+                               "subject"  : "IPFire 2.3 Beta 5",
+                               "date"     : "2008-10-13",
+                               "link"     : "http://forum.ipfire.org/index.php/topic,788.0.html",
+                               "content"  :
+                                       { "en" : "<p>Today, we released the beta version of <strong>IPFire 2.3</strong>.</p>",
+                                         "de" : "<p>Heute wurde die Beta-Version von <strong>IPFire 2.3</strong> herausgegeben.</p>"}},
+
+               "09" : {"author"   : "Michael Tremer",
+                               "mail"     : "michael.tremer@ipfire.org",
                                "subject"  : "IPFire 2.3 Final",
                                "date"     : "2008-11-08",
+                               "link"     : "",
+                               "content"  :
+                                       { "en" : "<p>Today, we released the final version of <strong>IPFire 2.3</strong>.</p>",
+                                         "de" : "<p>Heute wurde die finale Version von <strong>IPFire 2.3</strong> herausgegeben.</p>"}},
+
+               "10" : {"author"   : "Michael Tremer",
+                               "mail"     : "michael.tremer@ipfire.org",
+                               "subject"  : "Core Update 24",
+                               "date"     : "2008-12-12",
+                               "link"     : "http://forum.ipfire.org/index.php?topic=882.0",
+                               "content"  :
+                                       { "en" : "<p>Today, we released the <strong>core update number #24</strong>.</p>",
+                                         "de" : "<p>Heute wurde das <strong>Core Update #24</strong> herausgegeben.</p>"}},
+
+               "11" : {"author"   : "Michael Tremer",
+                               "mail"     : "michael.tremer@ipfire.org",
+                               "subject"  : "Core Update 25",
+                               "date"     : "2008-12-21",
+                               "link"     : "http://forum.ipfire.org/index.php?topic=951.0",
+                               "content"  :
+                                       { "en" : "<p>Today, we released the <strong>core update number #25</strong>.</p>",
+                                         "de" : "<p>Heute wurde das <strong>Core Update #25</strong> herausgegeben.</p>"}},
+
+               "12" : {"author"   : "Michael Tremer",
+                               "mail"     : "michael.tremer@ipfire.org",
+                               "subject"  : "Core Update 26",
+                               "date"     : "2009-02-11",
+                               "link"     : "http://forum.ipfire.org/index.php?topic=991.0",
+                               "content"  :
+                                       { "en" : "<p>Today, we released the <strong>core update number #26</strong>.</p>",
+                                         "de" : "<p>Heute wurde das <strong>Core Update #26</strong> herausgegeben.</p>"}},
+
+               "13" : {"author"   : "Michael Tremer",
+                               "mail"     : "michael.tremer@ipfire.org",
+                               "subject"  : "Core Update 27",
+                               "date"     : "2009-03-10",
+                               "link"     : "http://forum.ipfire.org/index.php?topic=1018.0",
+                               "content"  :
+                                       { "en" : "<p>Today, we released the <strong>core update number #27</strong>.</p>",
+                                         "de" : "<p>Heute wurde das <strong>Core Update #27</strong> herausgegeben.</p>"}},
+
+               "14" : {"author"   : "Michael Tremer",
+                               "mail"     : "michael.tremer@ipfire.org",
+                               "subject"  : "Hosting Partner",
+                               "date"     : "2009-03-28",
+                               "link"     : "http://wiki.ipfire.org/de/project/contribute",
+                               "content"  :
+                                       { "en" : "<p>We would like to welcome to our hosting partner <strong>ISP42</strong> that
+                                                               has given a server to the project for free.</p>",
+                                         "de" : "<p>Wir möchten unseren neuen Hosting-Partner <strong>ISP42</strong>
+                                                               willkommen heißen, der uns einen Server konstenfrei zu Verfügung stellt.</p>"}},
+
+               "15" : {"author"   : "Michael Tremer",
+                               "mail"     : "michael.tremer@ipfire.org",
+                               "subject"  : { "en" : "rss feed url changed", "de" : "RSS-Feed-URL geändert" },
+                               "date"     : "2009-03-28",
+                               "link"     : "",
                                "content"  :
-                                       { "en" : "<p><strong>Dear Community!</strong></p>
-                                               <p>This day, we released the final version of IPFire 2.3.</p>
-                                               <p>Major changes since the first version 2.1 in Oktober 2007:</p>
-                                               <ul>
-                                                       <li class=\"first\">DNS-Securityupdate and many more packet updates</li>
-                                                       <li>Enhancement of the packet manager</li>
-                                                       <li>Improvement of the Quality-of-Service rules - Presets for QoS</li>
-                                                       <li>Adjustable Firewall Logging</li>
-                                                       <li>Kernel-Modules for better hardware suport</li>
-                                                       <li>Change the system statistic to collectd</li>
-                                                       <li>Better disk handling (S.M.A.R.T. and Standby)</li>
-                                                       <li>Status- and Serviceview in the Webinterface</li>
-                                                       <li>Proxy and Redirector now work more dynamic</li>
-                                               </ul>
-                                               <p>In addition, release 2.3 will change the following things:</p>
-                                               <ul>
-                                                       <li class=\"first\">Kernel update to Linux-2.6.25.19</li>
-                                                       <li>Update of many more packages (OpenSSL, OpenSSH, Apache, Squid, Snort, collectd, ntfs-3g, Openswan, Updatexlrator, iptables, l7protocols)</li>
-                                                       <li>With several Atheros Chips IPFire is able to work as Wireless Access Point</li>
-                                                       <li>Better support of UMTS-3G-Modems</li>
-                                                       <li>Use of tmpfs to reduce disk reads and writes</li>
-                                                       <li>Better hardware monitoring by the use of lmsensors</li>
-                                                       <li>Vnstat Traffic-Accounting replaces ipac-ng</li>
-                                               </ul>
-                                               <p>The IPFire Team</p>",
-                                         "de" : "<strong>Sehr geehrte Community!</strong><br />
-                                               <p>Heute wurde die Final Version von IPFire 2.3 veröffentlicht.</p>
-                                               <p>Wesentliche Änderungen seit der ersten Version 2.1 im Oktober 2007:</p>
-                                               <ul>
-                                                       <li class=\"first\">DNS-Sicherheitsupdate und viele weitere Paket-Aktualisierungen</li>
-                                                       <li>Erweiterung des Paketmanagers</li>
-                                                       <li>Verfeinerung der Quality-of-Service Regeln - Voreinstellungsmodell für QoS</li>
-                                                       <li>Feiner einstellbares Firewall Logging</li>
-                                                       <li>Kernel-Module zur Hardwareunterstützung wurden nachgeliefert</li>
-                                                       <li>Umstellung der Systemstatistiken auf collectd</li>
-                                                       <li>Verbessertes Festplatten-Handling (S.M.A.R.T. und Standby)</li>
-                                                       <li>Status- und Serviceübersicht im Webinterface</li>
-                                                       <li>Proxy und Redirector arbeiten dynamischer zusammen</li>
-                                               </ul>
-                                               <p>Mit der 2.3 wird sich zusätzlich folgendes ändern:</p>
-                                               <ul>
-                                                       <li class=\"first\">Der Kernel wurde auf Linux-2.6.25.19 aktualisiert</li>
-                                                       <li>Aktualisierungen von weiteren Paketen (OpenSSL, OpenSSH, Apache, Squid, Snort, collectd, ntfs-3g, Openswan, Updatexlrator, iptables, l7protocols)</li>
-                                                       <li>Mit einer passenden WLAN-Karte kann der IPFire als Access-Point für WLAN-Clients dienen</li>
-                                                       <li>Bessere Unterstützung für UMTS-3G-Modems</li>
-                                                       <li>Verwendung von tmpfs zur Reduzierung von Schreibzugriffen</li>
-                                                       <li>Verbesserte Hardwareüberwachung durch Lmsensors</li>
-                                                       <li>Vnstat Traffic-Accounting ersetzt ipac-ng</li>
-                                               </ul>
-                                               <p>Das IPFire-Team</p>" }}
+                                       { "en" : "<p>The url of our rss feed has changed. Please re-add it from the link in the sidebar.</p>",
+                                         "de" : "<p>Wir möchten darauf hinweisen, dass sich die URL des RSS-Feeds geändert hat. Es ist nötig
+                                                               den Feed neu hinzuzufügen von dem Link in der Sidebar.</p>"}}
 }
diff --git a/www/pages/news.rss/__init__.py b/www/pages/news.rss/__init__.py
new file mode 100644 (file)
index 0000000..0e0a0ba
--- /dev/null
@@ -0,0 +1,44 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+import time
+from urllib import quote
+
+import web
+
+class Content(web.Content):
+       def __init__(self, name):
+               web.Content.__init__(self, name)
+               
+               self.news = web.News(15)
+
+       def __call__(self, lang="en"):
+               s = ""
+               for item in self.news.items():
+                       for i in ("content", "subject",):
+                               if type(item[i]) == type({}):
+                                       item[i] = item[i][lang]
+                               item[i] = item[i].encode("utf-8")
+                       item["lang"] = lang
+                       item["date"] = time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.strptime(item["date"], "%Y-%m-%d"))
+                       item["guid"] = "http://www.ipfire.org/%s/news#%s" % (lang, quote(item["subject"]))
+                       s += """<item>
+                               <title>%(subject)s</title>
+                               <link>http://www.ipfire.org/%(lang)s/news</link>
+                               <author>%(mail)s (%(author)s)</author>
+                               <guid>%(guid)s</guid>
+                               <pubDate>%(date)s</pubDate>
+                               <description>
+                                       <![CDATA[
+                                               %(content)s
+                                       ]]>
+                               </description>
+                       </item>\n""" % item
+               return s
+
+class Sidebar(web.Sidebar):
+       def __init__(self, name):
+               web.Sidebar.__init__(self, name)
+       
+       def content(self, lang):
+               pass
index 05eaafe2fdd77df0ca7f6ab6ae93efdcd07436b7..7bbcc85c18f7251a7868295c9773c763819a4f14 100644 (file)
                        <Heading><![CDATA[<span>RSS</span> feed]]></Heading>
 
                        <Content lang="en"><![CDATA[
-                               <a class="feed" href="http://www.ipfire.org/data/feeds/main-en.rss">IPFire - News</a>
+                               <a class="feed" href="news.rss">IPFire - News</a>
                                <br />
-                               <a href="news.shtml">news archive</a>]]></Content>
+                               <a href="news">news archive</a>]]></Content>
                        <Content lang="de"><![CDATA[
-                               <a class="feed" href="http://www.ipfire.org/data/feeds/main-en.rss">IPFire - News</a>
+                               <a class="feed" href="news.rss">IPFire - News</a>
                                <br />
-                               <a href="news.shtml">News-Archiv</a>
-                               ]]></Content>
+                               <a href="news">News-Archiv</a>]]></Content>
                </Paragraph>
                
                <Paragraph>
diff --git a/www/pages/static/news.xml b/www/pages/static/news.xml
new file mode 100644 (file)
index 0000000..fe2fa5f
--- /dev/null
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Site>
+       <Config>
+               <Title>News</Title>
+       </Config>
+       <Paragraphs>
+               <Paragraph>
+                       <Heading lang="en">IPFire News Archive</Heading>
+                       <Heading lang="de">IPFire-News-Archiv</Heading>
+                       
+                       <Content lang="en"><![CDATA[
+                               In a big project like this, it might being simple to keep up
+                               with progress. That doesn't matter. This site will give you
+                               all information you need.<br />
+                               Additionally, you may subscribe to our 
+                               <a class="feed" href="/en/news.rss">rss feed</a>.
+                               ]]></Content>
+                       <Content lang="de"><![CDATA[
+                               In einem Projekt wie IPFire ist es nicht leicht sich auf dem
+                               neuesten Stand zu halten. Dazu gibt es aber diese Seite, auf
+                               der man alles wichtige chronologisch angeordnet nachlesen kann.
+                               <br />
+                               Weiterhin gibt es einen 
+                               <a class="feed" href="/de/news.rss">RSS-Feed</a>, der sich abbonieren
+                               lässt.
+                               ]]></Content>
+               </Paragraph>
+
+               <Paragraph news="1" count="50" />
+       </Paragraphs>
+       
+       <Sidebar>
+               <Paragraph banner="1" />
+       </Sidebar>
+</Site>
diff --git a/www/rss.inc b/www/rss.inc
new file mode 100644 (file)
index 0000000..3c899b5
--- /dev/null
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<rss version="2.0">
+       <channel>
+               <title>IPFire.org - News</title>
+               <link>http://www.ipfire.org/</link>
+               <description>IPFire News Feed</description>
+               <language>%(lang)s</language>
+               <copyright>IPFire-Team</copyright>
+               <pubDate>Thu, 8 Nov 2007 00:00:00 +0200</pubDate>
+               %(content)s
+       </channel>
+</rss>
index 00758083a6f7d5e43cd8459f4c9ebd17447172b1..32fd65d94dd28deb6ac2d6d2b5107e8a3f935499 100644 (file)
@@ -25,7 +25,7 @@ class Json:
                f = open(file)
                data = f.read()
                data = data.replace('\n', '') # Remove all \n
-               data = data.replace('\t', '') # Remove all \t
+               data = data.replace('\t', ' ') # Remove all \t
                self.json = json.loads(data)
                f.close()
 
@@ -43,6 +43,7 @@ class Page(Data):
 
        def __init__(self, title, content, sidebar=None):
                self.output  = ""
+               self.title   = title
                self.langs   = Languages()
                self.data    = {"server": os.environ["SERVER_NAME"].replace("ipfire", "<span>ipfire</span>"),
                                                "title" : "%s - %s" % (os.environ["SERVER_NAME"], title,),
@@ -58,22 +59,28 @@ class Page(Data):
                        self.data["sidebar"] = sidebar(self.langs.current)
 
        def __call__(self):
+               type = "text/html"
                try:
-                       self.include("template.inc")
+                       if self.title.endswith(".rss"):
+                               self.include("rss.inc")
+                               type = "application/rss+xml"
+                       else:
+                               self.include("template.inc")
                        code = 200
                except WebError:
                        code = 500
-               h = HTTPResponse(code)
+               h = HTTPResponse(code, type=type)
                h.execute(self.output)
 
 
 class News(Json):
        def __init__(self, limit=3):
                Json.__init__(self, "news.json")
-               self.news = self.json.values()
+               self.news = []
+               for key in sorted(self.json.keys()):
+                       self.news.insert(0, self.json[key])
                if limit:
                        self.news = self.news[:limit]
-               self.news.reverse()
 
        def html(self, lang="en"):
                s = ""
@@ -81,8 +88,13 @@ class News(Json):
                        for i in ("content", "subject",):
                                if type(item[i]) == type({}):
                                        item[i] = item[i][lang]
-                       b = Box(item["date"] + " - " + item["subject"], "by %s" % item["author"])
+                       b = Box(item["subject"], "%(date)s - by %(author)s" % item)
                        b.w(item["content"])
+                       if item["link"]:
+                               if lang == "en":
+                                       b.w("""<p><a href="%(link)s" target="_blank">Read more.</a></p>""" % item)
+                               elif lang == "de":
+                                       b.w("""<p><a href="%(link)s" target="_blank">Mehr Informationen.</a></p>""" % item)
                        s += b()
                return s
 
@@ -96,6 +108,9 @@ class News(Json):
                        headlines.append((item["subject"],))
                return headlines
 
+       def items(self):
+               return self.news
+
 
 class Menu(Json):
        def __init__(self, lang):