]> ToastFreeware Gitweb - philipp/winterrodeln/wradmin.git/commitdiff
Added a page for a sledding route and links between several locations.
authorphilipp <philipp@7aebc617-e5e2-0310-91dc-80fb5f6d2477>
Sun, 22 Mar 2009 13:29:16 +0000 (13:29 +0000)
committerphilipp <philipp@7aebc617-e5e2-0310-91dc-80fb5f6d2477>
Sun, 22 Mar 2009 13:29:16 +0000 (13:29 +0000)
git-svn-id: http://www.winterrodeln.org/svn/servermediawiki/trunk/wradmin@434 7aebc617-e5e2-0310-91dc-80fb5f6d2477

wradmin/wradmin/controllers/bericht.py
wradmin/wradmin/controllers/rodelbahn.py
wradmin/wradmin/lib/helpers.py
wradmin/wradmin/model/__init__.py
wradmin/wradmin/templates/bericht_list.html
wradmin/wradmin/templates/bericht_view.html
wradmin/wradmin/templates/index.html
wradmin/wradmin/templates/rodelbahn_list.html
wradmin/wradmin/templates/rodelbahn_view.html [new file with mode: 0644]

index 4cc8e525068cb87faf276a109d1b4a730fbfc815..63f8ab873570d3d10c2a9910aec6c9e7abef5e6f 100644 (file)
@@ -60,8 +60,8 @@ class BerichtController(BaseController):
         
     def view(self, id):
         "Displays a report"
-        wrreport_q = model.meta.Session.query(model.WrReport)
-        c.wrreport =  wrreport_q.get(id)
+        q = model.meta.Session.query(model.WrReport)
+        c.wrreport =  q.get(id)
         if c.wrreport is None: abort(404)
         self._add_dates_to_c(c.wrreport.date_invalid)
         return render('bericht_view.html')
@@ -105,9 +105,9 @@ class BerichtController(BaseController):
     
     def list(self):
         "Lists all reports"
-        records = model.meta.Session.query(model.WrReport)
-        records = records.order_by(sa.sql.expression.desc(model.WrReport.id))
-        c.paginator = paginate.Page(records, page=int(request.params.get('page', 1)), items_per_page = 25)
+        q = model.meta.Session.query(model.WrReport)
+        q = q.order_by(sa.sql.expression.desc(model.WrReport.id))
+        c.paginator = paginate.Page(q, page=int(request.params.get('page', 1)), items_per_page = 25)
         return render('bericht_list.html')
         
     def delete(self, id):
index 065568b96fd447ed0d2023a0bb9143a038dfddf1..8c58288865d1b4f5206031d7178b6c7d9d296c3f 100644 (file)
@@ -14,7 +14,17 @@ class RodelbahnController(BaseController):
 
     def list(self):
         "Lists all sledding routes"
-        records = model.meta.Session.query(model.WrSleddingCache)
-        records = records.order_by(model.WrSleddingCache.page_title)
-        c.paginator = paginate.Page(records, page=int(request.params.get('page', 1)), items_per_page = 25)
-        return render('rodelbahn_list.html')
\ No newline at end of file
+        q = model.meta.Session.query(model.WrSleddingCache)
+        q = q.order_by(model.WrSleddingCache.page_title)
+        c.paginator = paginate.Page(q, page=int(request.params.get('page', 1)), items_per_page = 25)
+        return render('rodelbahn_list.html')
+    
+    def view(self, id):
+        "Displays a sledding route"
+        q = model.meta.Session.query(model.WrSleddingCache)
+        c.sledding =  q.get(id)
+        if c.sledding is None: abort(404)
+        q = model.meta.Session.query(model.WrReport)
+        q = q.filter_by(page_id=id).order_by(sa.sql.expression.desc(model.WrReport.id))
+        c.paginator = paginate.Page(q, page=int(request.params.get('page', 1)), items_per_page = 25)
+        return render('rodelbahn_view.html')
index cc09fb66ff8dc95a1aa0c0960387e92cdd0b73ab..dd021b87881783481be53e50d57cbd11c84d3a2c 100644 (file)
@@ -8,6 +8,17 @@ available to Controllers. This module is available to templates as 'h'.
 
 from routes import url_for
 
-def wiki(page=None):
+def wiki(page_title=None):
     "TODO: Improve, escape, ..."
-    return 'http://www.winterrodeln.org/wiki/' + page
\ No newline at end of file
+    if page_title is None: page_title = 'Hauptseite'
+    return 'http://www.winterrodeln.org/wiki/' + page_title
+
+
+def forum(forum=None):
+    "forum ... id"
+    return 'http://winterrodeln-forum.org/'
+
+
+def google_maps(latitude, longitude):
+    "Builds an URL like http://maps.google.at/maps?q=47.200607,11.260007"
+    return "http://maps.google.at/maps?q=%.6f,%.6f" % (latitude, longitude)
index 2cf814905fc5dbf4abb22568c1dcfc47fb15f90e..d5d35dfd86be6c509d18c9273a733ec8003a83e5 100644 (file)
@@ -12,7 +12,7 @@ def init_model(engine):
 
 wrreport_table = sa.Table("wrreport", meta.metadata,
     sa.Column("id", types.Integer, primary_key=True),
-    sa.Column("page_id", types.Integer, nullable=False),
+    sa.Column("page_id", types.Integer, schema.ForeignKey('wrsleddingcache.page_id')),
     sa.Column("page_title", types.Unicode(255), nullable=False),
     sa.Column("date_report", types.Date),
     sa.Column("date_entry", types.DateTime, nullable=False),
@@ -62,5 +62,7 @@ class WrSleddingCache(object):
 
 
 orm.mapper(WrReport, wrreport_table)
+# We could add a relation but we don't need it yet:
+# orm.mapper(WrSleddingCache, wrsleddingcache_table, properties = {'reports': orm.relation(WrReport, backref='sledding')})
 orm.mapper(WrSleddingCache, wrsleddingcache_table)
 
index 83ead2da46d8403d299d635c0d87786c6feecea1..e5d91e1db0c835cfa73585b1437678400f0500cd 100644 (file)
@@ -13,7 +13,7 @@
 <body>
 <h2>Rodelbahnberichte</h2>
 
-<p>${c.paginator.pager('$link_first $link_previous $first_item to $last_item of $item_count $link_next $link_last', controller='bericht', action='list')}</p>
+<p>${c.paginator.pager('$link_first $link_previous $first_item bis $last_item von $item_count $link_next $link_last', controller='bericht', action='list')}</p>
 
 <table>
     <tr>
index 78bcc58122780524a4f204625218472c82dd4544..a78ef7b89eaf36e8f27e97fc5668c81e1fae22ee 100644 (file)
@@ -24,6 +24,10 @@ Der Bericht wurde am ${c.wrreport.date_report} abgegeben.
                <th>Seite (Rodelbahn)</th>
                <td>${c.wrreport.page_title}</td>
        </tr>
+    <tr>
+               <th>Seiten-ID (Rodelbahn-ID)</th>
+               <td><a href="${h.url_for(controller='rodelbahn', action='view', id=c.wrreport.page_id)}">${c.wrreport.page_id}</a></td>
+    </tr>
        <tr>
                <th>Datum für Bericht</th>
                <td>${c.wrreport.date_report}</td>
index af5dacf429d701547d84c34f07aeef47cbc8db13..969a078a2874e8b5081f70603cd8977e6f234430 100644 (file)
@@ -23,8 +23,8 @@
 </ul>
 
 <ul>
-    <li><a href="http://www.winterrodeln.org/wiki">Winterrodeln-Hauptseite</a></li>
-    <li><a href="http://www.winterrodeln-forum.org/">Forum</a></li>
+    <li><a href="${h.wiki()}">Winterrodeln-Hauptseite</a></li>
+    <li><a href="${h.forum()}">Forum</a></li>
 </ul>
 
 </body>
index 333fcd5b63416b6509e454c726d87f0721c891c1..be4de35a24fd0f6644e4558e6e84a35a7bc4b7e3 100644 (file)
@@ -13,6 +13,8 @@
 <body>
 <h2>Rodelbahnen</h2>
 
+<p>Die folgende Lise wurde automatisiert von den Rodelbahnboxen gesammelt. Da dies nicht automatisch passiert, kann es sein, dass die Liste "veraltete" Information enthält.</p>
+
 <p>${c.paginator.pager('$link_first $link_previous $first_item bis $last_item von $item_count $link_next $link_last', controller='rodelbahn', action='list')}</p>
 
 <table>
@@ -36,7 +38,7 @@
         <th>In Übersicht</th>
     </tr>
     <tr py:for="s in c.paginator">
-        <td>${s.page_id}</td>
+        <td><a href="${h.url_for(controller='rodelbahn', action='view', id=s.page_id)}">${s.page_id}</a></td>
         <td>${s.page_title}</td>
         <td>${s.length}</td>
         <td>${s.walktime}</td>
diff --git a/wradmin/wradmin/templates/rodelbahn_view.html b/wradmin/wradmin/templates/rodelbahn_view.html
new file mode 100644 (file)
index 0000000..4b35bf1
--- /dev/null
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
+                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+    xmlns:py="http://genshi.edgewall.org/"
+    xmlns:xi="http://www.w3.org/2001/XInclude">
+<xi:include href="master.html" />
+
+<head>
+    <title>Rodelbahn</title>
+</head>
+
+<body>
+<h2>Rodelbahn #${c.sledding.page_id}: ${c.sledding.page_title}</h2>
+
+<h3>Inhalt der Rodelbahnbox</h3>
+<table>
+    <tr>
+        <th>ID</th>
+        <td>${c.sledding.page_id}</td>
+    </tr>
+    <tr>
+        <th>Name</th>
+        <td>${c.sledding.page_title}</td>
+    </tr>
+    <tr>
+        <th>Länge</th>
+        <td>${c.sledding.length}</td>
+    </tr>
+    <tr>
+        <th>Gehzeit</th>
+        <td>${c.sledding.walktime}</td>
+    </tr>
+    <tr>
+        <th>Höhe (oben)</th>
+        <td>${c.sledding.height_top}</td>
+    </tr>
+    <tr>
+        <th>Höhe (unten)</th>
+        <td>${c.sledding.height_bottom}</td>
+    </tr>
+    <tr>
+        <th>Aufstieg getrennt</th>
+        <td>${c.sledding.walkup_separate}</td>
+    </tr>
+    <tr>
+        <th>Lift</th>
+        <td>${c.sledding.lift}</td>
+    </tr>
+    <tr>
+        <th>Licht</th>
+        <td>${c.sledding.night_light}</td>
+    </tr>
+    <tr>
+        <th>Rodelverleih</th>
+        <td>${c.sledding.sledge_rental}</td>
+    </tr>
+    <tr>
+        <th>Öffentliche Anreise</th>
+        <td>${c.sledding.public_transport}</td>
+    </tr>
+    <tr>
+        <th>Bild</th>
+        <td>${c.sledding.image}</td>
+    </tr>
+    <tr>
+        <th>Latitude</th>
+        <td>${c.sledding.position_latitude}</td>
+    </tr>
+    <tr>
+        <th>Longitude</th>
+        <td>${c.sledding.position_longitude}</td>
+    </tr>
+    <tr>
+        <th>Information</th>
+        <td>${c.sledding.information}</td>
+    </tr>
+    <tr>
+        <th>In Arbeit</th>
+        <td>${c.sledding.under_construction}</td>
+    </tr>
+    <tr>
+        <th>In Übersicht</th>
+        <td>${c.sledding.show_in_overview}</td>
+    </tr>
+</table>
+
+<ul>
+    <li><a href="${h.wiki(c.sledding.page_title)}">Zeige bei <tt>www.winterrodeln.org</tt></a></li>
+    <py:if test="c.sledding.position_latitude and c.sledding.position_longitude">
+    <li><a href="${h.google_maps(c.sledding.position_latitude, c.sledding.position_longitude)}">Zeige bei Google Maps</a></li>
+    </py:if>
+</ul>
+
+
+<h3>Rodelbahnberichte</h3>
+
+<p>${c.paginator.pager('$link_first $link_previous $first_item bis $last_item von $item_count $link_next $link_last', controller='rodelbahn', action='view', id=c.id)}</p>
+
+<table>
+    <tr>
+        <th>ID</th>
+        <th>Datum Eintrag</th>
+        <th>Datum Ungültig</th>
+        <th>Datum für Bericht</th>
+        <th>Zustand (1 bis 5)</th>
+        <th>Beschreibung (WikiText)</th>
+        <th>Autor-Name</th>
+        <th>Gelöscht</th>
+    </tr>
+    <tr py:for="r in c.paginator">
+        <td><a href="${h.url_for(controller='bericht', action='view', id=r.id)}">${r.id}</a></td>
+        <td>${r.date_entry}</td>
+        <td>${r.date_invalid}</td>
+        <td>${r.date_report}</td>
+        <td>${r.condition}</td>
+        <td>${r.description}</td>
+        <td>${r.author_name}</td>
+        <td>${r.delete_date}</td>
+    </tr>
+</table>
+
+<p>${c.paginator.pager('~2~', controller='rodelbahn', action='view', id=c.id)}</p>
+
+</body>
+</html>