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')
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):
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')
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)
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),
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)
<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>
<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>
</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>
<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>
<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>
--- /dev/null
+<?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>