]> ToastFreeware Gitweb - philipp/winterrodeln/wradmin.git/commitdiff
Sledding routes use SQL alchemy now.
authorphilipp <philipp@7aebc617-e5e2-0310-91dc-80fb5f6d2477>
Sat, 28 Mar 2009 16:41:26 +0000 (16:41 +0000)
committerphilipp <philipp@7aebc617-e5e2-0310-91dc-80fb5f6d2477>
Sat, 28 Mar 2009 16:41:26 +0000 (16:41 +0000)
git-svn-id: http://www.winterrodeln.org/svn/servermediawiki/trunk/wradmin@436 7aebc617-e5e2-0310-91dc-80fb5f6d2477

16 files changed:
wradmin/development.ini
wradmin/wradmin/config/deployment.ini_tmpl
wradmin/wradmin/config/routing.py
wradmin/wradmin/controllers/gasthaus.py
wradmin/wradmin/controllers/rodelbahn.py
wradmin/wradmin/controllers/wrcontroller.py [deleted file]
wradmin/wradmin/lib/helpers.py
wradmin/wradmin/lib/mediawiki.py
wradmin/wradmin/lib/wrcachelists.py [deleted file]
wradmin/wradmin/lib/wrdatabase.py [deleted file]
wradmin/wradmin/templates/forumlink.html [deleted file]
wradmin/wradmin/templates/index.html
wradmin/wradmin/templates/master.html
wradmin/wradmin/templates/rodelbahn_list.html
wradmin/wradmin/templates/rodelbahn_view.html
wradmin/wradmin/templates/rodelbahnbox.html [deleted file]

index 7edb92e54f0f31e686acedfef4b2125893e43794..ccfe1a58cdab918f745e6e7418698224cc26d05c 100644 (file)
@@ -24,12 +24,6 @@ cache_dir = %(here)s/data
 beaker.session.key = wradmin
 beaker.session.secret = somesecret
 
-wikidbtype = mysql
-wikidbserver = localhost
-wikidbname = winterrodeln_wiki
-wikidbuser = philipp
-wikidbpassword =
-
 authkit.setup.method = basic
 authkit.basic.realm = Winterrodeln Admin
 authkit.basic.authenticate.user.type = wradmin.lib.mediawiki:MediaWikiUsers
index 27ad0602e08a730a2c4fcd210cbb13a5d062a518..8fd5e050f02906c4541369c961c3660d7184100e 100644 (file)
@@ -24,12 +24,6 @@ beaker.session.key = wradmin
 beaker.session.secret = ${app_instance_secret}
 app_instance_uuid = ${app_instance_uuid}
 
-wikidbtype = mysql
-wikidbserver = localhost
-wikidbname = wiki
-wikidbuser = username
-wikidbpassword =
-
 authkit.setup.method = basic
 authkit.basic.realm = Winterrodeln Admin
 authkit.basic.authenticate.user.type = wradmin.lib.mediawiki:MediaWikiUsers
index f8a9f6f2d63fb4fa7ce50574ea8f965720e9a5cc..2c038fb5d82ca65200ac53c18d9442d79ee966d3 100644 (file)
@@ -20,9 +20,7 @@ def make_map():
 
     # CUSTOM ROUTES HERE
 
-    map.connect('/', controller='wrcontroller', action='index')
-    map.connect('/{action}', controller='wrcontroller')
-    map.connect('rodelbahnbox_update', '/wrcontroller/rodelbahnbox/update', controller='wrcontroller', action='rodelbahnbox', update=True)
+    map.connect('/', controller='rodelbahn', action='index')
     map.connect('/{controller}/{action}')
     map.connect('/{controller}/{action}/{id}')
 
index 73fd65828424dbe16a3f91243948e4baed533f6f..7df806561a552e2e49f2bca746eb0ba8c90b675a 100644 (file)
@@ -58,15 +58,14 @@ class GasthausController(BaseController):
             if key == u'Gasthausnummer': pass
             elif key == u'E-Mail': inn.email = conv(to_email, value, u'E-Mail')
             elif key == u'Homepage': inn.homepage = conv(to_url, value, u'Homepage')
-            elif key == u'Höhe':
-                if value: inn.height = conv(to_unsigned, value, u'Höhe')
+            elif key == u'Höhe': inn.height = conv(to_unsigned, value, u'Höhe')
             elif key == u'Bild': inn.image = value
             elif key == u'Position': (inn.position_latitude, inn.position_longitude) = conv(to_geo, value, u'Position') # '47.583333 N 15.75 E'
             elif key == u'Telefon (Festnetz)': inn.phone = conv(to_phone, value, u'Telefon (Festnetz)')
             elif key == u'Telefon (Mobil)': inn.mobile_phone = conv(to_phone, value, u'Telefon (Mobil)')
             elif key == u'Rauchfrei': (inn.nonsmoker_area, inn.smoker_area) = conv(to_tristate, value, u'Rauchfrei')
             elif key == u'Aufnahmedatum': inn.creation_date = conv(to_date, value, u'Aufnahmedatum') # '2006-03-15'
-            else: raise Exception(u"Unbekannte Eigenschaft der Rodelbahnbox: '%s' (mit Wert '%s')" % (key, value))
+            else: raise Exception(u"Unbekannte Eigenschaft der Gasthausbox: '%s' (mit Wert '%s')" % (key, value))
         inn.under_construction = None
         return inn
     
index 8c58288865d1b4f5206031d7178b6c7d9d296c3f..f0de25766492e251b50f906ee0f366ff5449ad2f 100644 (file)
@@ -1,3 +1,5 @@
+#!/usr/bin/python2.5
+# -*- coding: iso-8859-15 -*-
 import logging
 
 from pylons import request, response, session, tmpl_context as c
@@ -7,11 +9,16 @@ import webhelpers.paginate as paginate
 from wradmin.lib.base import BaseController, render
 import wradmin.model as model
 import sqlalchemy as sa
+import re
+from wradmin.lib.mediawiki import to_bool, to_unsigned, to_date, to_geo, to_title, to_tristate, to_email, to_url, to_phone, conv, unicode_e
 
 log = logging.getLogger(__name__)
 
 class RodelbahnController(BaseController):
 
+    def index(self):
+        return render('index.html')
+
     def list(self):
         "Lists all sledding routes"
         q = model.meta.Session.query(model.WrSleddingCache)
@@ -19,6 +26,7 @@ class RodelbahnController(BaseController):
         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)
@@ -28,3 +36,83 @@ class RodelbahnController(BaseController):
         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')
+    
+    
+    def _wikipage_to_wrsleddingcache(self, sledding_wiki):
+        "Converts a sledding route wiki page to a sledding route wrsleddingcache database record."
+        sl = model.WrSleddingCache()
+        sl.page_id = sledding_wiki.page_id
+        sl.page_title = to_title(sledding_wiki.page_title)
+        
+        # Match Rodelbahnbox
+        wikitext = sledding_wiki.old_text
+        regexp = re.compile(u"\{\{(Rodelbahnbox[^\}]*)\}\}", re.DOTALL)
+        match = regexp.search(wikitext)
+        if not match:
+            raise Exception(u"No 'Rodelbahnbox' found")
+        box = match.group(1)
+        
+        # Process Rodelbahnbox
+        for property in box.split('|'):
+            property = property.strip()
+            if property == u'Rodelbahnbox': continue
+            key_value = property.split('=')
+            if len(key_value) != 2:
+                raise Exception(u"Property '%s' has unexpected format" % key_value)
+            key = key_value[0].strip()
+            value = key_value[1].strip()
+            if key == u'Rodelbahnnummer': pass
+            elif key == u'Länge': sl.length = conv(to_unsigned, value, u'Länge')
+            elif key == u'Gehzeit': sl.walktime = conv(to_unsigned, value, u'Gehzeit')
+            elif key == u'Höhe oben': sl.height_top = conv(to_unsigned, value, u'Höhe oben')
+            elif key == u'Höhe unten': sl.height_bottom = conv(to_unsigned, value, u'Höhe unten')
+            elif key == u'Aufstieg getrennt': sl.walkup_separate = conv(to_bool, value, u'Aufstieg getrennt')
+            elif key == u'Lift': sl.lift = conv(to_bool, value, u'Lift')
+            elif key == u'Beleuchtung': sl.night_light = conv(to_bool, value, u'Beleuchtung')
+            elif key == u'Rodelverleih': sl.sledge_rental = conv(to_bool, value, u'Rodelverleih')
+            elif key == u'Öffentliche Anreise': sl.public_transport = conv(to_bool, value, u'Öffentliche Anreise')
+            elif key == u'Bild': sl.image = value
+            elif key == u'Position': (sl.position_latitude, sl.position_longitude) = conv(to_geo, value, u'Position') # '47.583333 N 15.75 E'
+            elif key == u'Auskunft': sl.information = value
+            elif key == u'In Übersichtskarte': sl.show_in_overview = conv(to_bool, value, u'In Übersichtskarte')
+            elif key == u'Aufnahmedatum': sl.creation_date = conv(to_date, value, u'Aufnahmedatum') # '2006-03-15'
+            else: raise Exception(u"Unbekannte Eigenschaft der Rodelbahnbox: '%s' (mit Wert '%s')" % (key, value))
+        sl.under_construction = None
+        
+        # Match Forumlink (e.g. {{Forumlink|68}})
+        match = re.search(u"\{\{Forumlink\|(\d+)\}\}", wikitext)
+        if match: sl.forum_id = match.group(1)
+        
+        return sl
+    
+    
+    def update(self):
+        "Updates the wrsleddingcache table from the wiki"
+        from wradmin.model import page_table as page, wrsleddingcache_table as wrsleddingcache, categorylinks_table as categorylinks, revision_table as revision, text_table as text
+        from sqlalchemy.sql import select
+        c = model.meta.Session.connection()
+        
+        # Query all sledding routes
+        q = select([page, categorylinks, revision, text], (page.c.page_latest==revision.c.rev_id) & (text.c.old_id==revision.c.rev_text_id) & (categorylinks.c.cl_from==page.c.page_id) & (categorylinks.c.cl_to==u'Rodelbahn'))
+        sledding_pages = c.execute(q)
+        # Original SQL:
+        # sql = u"select page_id, rev_id, old_id, page_title, old_text, 'In_Arbeit' in (select cl_to from categorylinks where cl_from=page_id) as under_construction from page, revision, text, categorylinks where page_latest=rev_id and old_id=rev_text_id and cl_from=page_id and cl_to='Rodelbahn' order by page_title"
+        
+        # Delete all existing entries in wrsleddingcache
+        c.execute(wrsleddingcache.delete())
+        
+        # Refill wrsleddingcache table
+        error_msg = ''
+        for sl in sledding_pages:
+            try: 
+                sl = self._wikipage_to_wrsleddingcache(sl)
+                sl.under_construction = c.execute(select([categorylinks], (categorylinks.c.cl_from==sl.page_id) & (categorylinks.c.cl_to == u'In_Arbeit')).alias('x').count()).fetchone()[0] > 0 # It would be better to do this in the query above
+                model.meta.Session.add(sl)
+            except Exception, e: error_msg = u"Fehler bei Rodelbahn '%s': " % sl.page_title + unicode_e(e)
+        model.meta.Session.commit()
+        
+        # Redirect to result page
+        if error_msg == '': session['flash'] = u'Die Rodelbahnliste wurde erfolgreich aktualisiert.'
+        else: session['flash'] = error_msg
+        session.save()
+        return redirect_to(controller='rodelbahn', action='list')
diff --git a/wradmin/wradmin/controllers/wrcontroller.py b/wradmin/wradmin/controllers/wrcontroller.py
deleted file mode 100644 (file)
index a145b15..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-import logging
-
-from pylons import request, response, session, tmpl_context as c
-from pylons.controllers.util import abort, redirect_to
-from pylons.templating import render_genshi as render
-
-from wradmin.lib.base import BaseController
-from wradmin.lib.wrdatabase import query_sledding_routes
-from wradmin.lib.wrcachelists import update_rodelbahnbox, unicode_e
-
-log = logging.getLogger(__name__)
-
-class WrcontrollerController(BaseController):
-
-    def index(self):
-        return render('index.html')
-
-    def rodelbahnbox(self, update=False):
-        "update ... update the database from the Rodelbahnbox structures"
-        if update:
-            try: c.sledding_routes = update_rodelbahnbox()
-            except Exception, e:
-                c.update_error = unicode_e(e)
-        c.update_performed = update
-        c.update_success = hasattr(c, 'sledding_routes')
-        return render('rodelbahnbox.html')
-
-    def forumlink(self, **kw):
-        c.sledding_routes = query_sledding_routes()
-        return render('forumlink.html')
index 6ecfeab942ab8aff5dd0ba5236a1cb1252f164bf..5db13d96ea0f3123d2479d76c806eb3e1f843bee 100644 (file)
@@ -9,14 +9,15 @@ available to Controllers. This module is available to templates as 'h'.
 from routes import url_for
 
 def wiki(page_title=None):
-    "TODO: Improve, escape, ..."
+    "Creates a link to the specified page in the www.winterrodeln.org wiki"
     if page_title is None: page_title = 'Hauptseite'
     return u'http://www.winterrodeln.org/wiki/' + page_title
 
 
 def forum(forum=None):
-    "forum ... id"
-    return u'http://winterrodeln-forum.org/'
+    "Creates a link to the specified forum. If no id is given, a general link is created."
+    if forum is None: return u'http://winterrodeln-forum.org/'
+    return u'http://winterrodeln-forum.org/viewforum.php?f=%d' % forum
 
 
 def google_maps(latitude, longitude):
@@ -25,12 +26,14 @@ def google_maps(latitude, longitude):
 
 
 def bool(value):
+    "Takes a bool value and creates a German representation"
     if value is None: return None
     if value: return u'Ja'
     return u'Nein'
 
 
 def tristate(yes, no):
+    "Takes a German representation of a tristate value"
     if yes is None or no is None: return None
     if yes == no: return u'Teilweise'
     if yes: return u'Ja'
index 891233b4ae0425d33ea774839bee743560586c9d..6e725b4ae69511b57c11b5036d23f86ad66b33a1 100644 (file)
@@ -1,7 +1,7 @@
 "MediaWiki communication functions"
 
 from authkit.users import UsersReadOnly, md5
-from wradmin.lib.wrdatabase import get_wiki_connection
+import datetime
 import re
 
 import logging
@@ -19,17 +19,20 @@ def to_bool(value):
 
 
 def to_unsigned(value):
+    if value is None or value == u'': return None
     v = int(value)
     if v < 0: raise Exception('The value %v has to be positive.')
     return v
 
 
 def to_date(value):
-    return None #!!!! TODO
+    "Parses a date in the form 'yyy-mm-dd'"
+    if value is None: return None
+    return datetime.datetime.strptime(value, '%Y-%m-%d')
 
 
 def to_geo(value):
-    """Formats to coordinates '47.076207 N 11.453553 E' to the (latitude, longitude) tuplet."""
+    "Formats to coordinates '47.076207 N 11.453553 E' to the (latitude, longitude) tuplet."
     if not value: return (None, None)
     r = re.match(u'(\d+\.\d+) N (\d+\.\d+) E', value)
     if r is None: raise Exception(u"Coordinates '%s' have not a format like '47.076207 N 11.453553 E'" % value)
diff --git a/wradmin/wradmin/lib/wrcachelists.py b/wradmin/wradmin/lib/wrcachelists.py
deleted file mode 100644 (file)
index 6fc980e..0000000
+++ /dev/null
@@ -1,140 +0,0 @@
-#!/usr/bin/python2.5
-# -*- coding: iso-8859-15 -*-
-#
-# This file was copied from http://www.winterrodeln.org/svn/servermediawiki/trunk/maintenance/wrcachelists.py
-# which containts the "more complete" code. In this file, only needed parts are included: For example,
-# the PostgreSQL support was dropped here.
-"Updates caching table for sledding runs."
-
-from wrdatabase import get_wiki_connection
-import re
-
-# Converter functions
-# -------------------
-
-from wradmin.lib.mediawiki import to_bool, to_geo, to_title, unicode_e
-
-
-# Sledding run
-# ------------
-
-def update_rodelbahnbox():
-    """Collects information from the Rodelbahnbox wiki structures.
-    It stores them in the database in case of success and returns a list of tuples (page_id, page_title) of successfully processed pages.
-    It raises an exception in case of errors and does not change the database."""
-    
-    def to_bool_f(value, fieldname):
-        "Like 'to_bool' but adds the field name to the exception description"
-        try: return to_bool(value)
-        except Exception, e:
-            raise Exception(u"Error converting to bool in field '%s': %s" % (fieldname, unicode_e(e)))
-    
-    def to_geo_f(value, fieldname):
-        "Like 'to_geo' but adds the field name to the exception description"
-        try: return to_geo(value)
-        except Exception, e:
-            raise Exception(u"Error converting to geo-coordinates in field '%s': %s" % (fieldname, unicode_e(e)))
-    
-    def process_row(row):
-        "It converts a database row to a dictionary and performs checks."
-        (page_id, rev_id, old_id, page_title, old_text, under_construction) = row
-        page_title = unicode(page_title, 'UTF-8')
-        old_text = unicode(old_text, 'UTF-8')
-        # Initialize property dict
-        property_keys = [
-            u'page_id',
-            u'page_title',
-            u'length',
-            u'walktime',
-            u'height_top',
-            u'height_bottom',
-            u'walkup_separate',
-            u'lift',
-            u'night_light',
-            u'sledge_rental',
-            u'public_transport',
-            u'image',
-            u'position_latitude',
-            u'position_longitude',
-            u'information',
-            u'show_in_overview',
-            u'creation_date']
-        properties = dict()
-        for property in property_keys:
-            properties[property] = None
-        # Match Rodelbahnbox
-        match = regexp.search(old_text)
-        if not match:
-            raise Exception(u"No 'Rodelbahnbox' found")
-        box = match.group(1)
-        # Process Rodelbahnbox
-        for property in box.split('|'):
-            property = property.strip()
-            if property == u'Rodelbahnbox': continue
-            key_value = property.split('=')
-            if len(key_value) != 2:
-                raise Exception(u"Property '%s' has unexpected format" % key_value)
-            key = key_value[0].strip()
-            value = key_value[1].strip()
-            if key == u'Rodelbahnnummer': pass
-            elif key == u'Länge' and value: properties[u'length'] = int(value)
-            elif key == u'Gehzeit' and value: properties[u'walktime'] = int(value)
-            elif key == u'Höhe oben' and value: properties[u'height_top'] = int(value)
-            elif key == u'Höhe unten' and value: properties[u'height_bottom'] = int(value)
-            elif key == u'Aufstieg getrennt': properties[u'walkup_separate'] = to_bool_f(value, u'Aufstieg getrennt')
-            elif key == u'Lift': properties['lift'] = to_bool_f(value, u'Lift')
-            elif key == u'Beleuchtung': properties[u'night_light'] = to_bool_f(value, u'Beleuchtung')
-            elif key == u'Rodelverleih': properties[u'sledge_rental'] = to_bool_f(value, u'Rodelverleih')
-            elif key == u'Öffentliche Anreise': properties[u'public_transport'] = to_bool_f(value, u'Öffentliche Anreise')
-            elif key == u'Bild': properties[u'image'] = value
-            elif key == u'Position': (properties[u'position_latitude'], properties[u'position_longitude']) = to_geo_f(value, u'Position') # '47.583333 N 15.75 E'
-            elif key == u'Auskunft': properties[u'information'] = value
-            elif key == u'In Übersichtskarte': properties[u'show_in_overview']  = to_bool_f(value, u'In Übersichtskarte')
-            elif key == u'Aufnahmedatum': properties[u'creation_date'] = value # '2006-03-15'
-        properties[u'page_id'] = page_id
-        properties[u'page_title'] = to_title(page_title)
-        properties[u'under_construction'] = under_construction
-        del properties[u'creation_date'] # this is not saved in the database yet
-        return properties
-    
-    
-    # Load database modul
-    import MySQLdb
-    import re
-
-    conn = get_wiki_connection()
-    cuo = conn.cursor() # cursor for output (out of the database)
-    cui = conn.cursor() # cursor for input (into the database)
-    
-    sql = u"select page_id, rev_id, old_id, page_title, old_text, 'In_Arbeit' in (select cl_to from categorylinks where cl_from=page_id) as under_construction from page, revision, text, categorylinks where page_latest=rev_id and old_id=rev_text_id and cl_from=page_id and cl_to='Rodelbahn' order by page_title"
-    cuo.execute(sql)
-    
-    regexp = re.compile(u"\{\{(Rodelbahnbox[^\}]*)\}\}", re.DOTALL)
-    try:
-        sledding_list = [];
-        for row in cuo:
-            try:
-                page_id = row[0]
-                page_title = unicode(row[3], 'UTF-8')
-                properties = process_row(row)
-            except Exception, e:
-                raise Exception(unicode_e(e) + u". Seite '%s' (page_id %d)." % (page_title, page_id))
-            sledding_list.append(properties)
-        
-        sql = u'delete from wrsleddingcache'
-        cui.execute(sql)
-        
-        if len(sledding_list) > 0:
-            columns = sledding_list[0].keys()
-            sql = u'insert into wrsleddingcache (' + ', '.join(columns)  + ') values '
-            sql = sql + '(' + ', '.join(['%s' for c in columns]) + ')'
-            for sledding in sledding_list:
-                cui.execute(sql, sledding.values())
-
-        conn.commit()
-        conn.close()
-    except:
-        conn.rollback()
-        conn.close()
-        raise
-    return sledding_list
\ No newline at end of file
diff --git a/wradmin/wradmin/lib/wrdatabase.py b/wradmin/wradmin/lib/wrdatabase.py
deleted file mode 100644 (file)
index 429008b..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/usr/bin/python2.5
-# -*- coding: iso-8859-15 -*-
-
-import MySQLdb
-from pylons import config
-
-def get_wiki_connection():
-    "Returns a connection object to the wiki database."
-    host = config['wikidbserver']
-    database = config['wikidbname']
-    username = config['wikidbuser']
-    password = config['wikidbpassword']
-    return MySQLdb.connect(host=host, db=database, user=username, passwd=password, use_unicode=True, charset='utf8')
-
-
-def query_sledding_routes():
-    conn = get_wiki_connection()
-    cu = conn.cursor(cursorclass=MySQLdb.cursors.DictCursor)
-    sql = "select page_id, rev_id, old_id, cast(page_title as char) as page_title, 'In_Arbeit' in (select cl_to from categorylinks where cl_from=page_id) as under_construction, page_id in (select tl_from from templatelinks where tl_title='Forumlink' and tl_namespace='10') as forum_link_present from page, revision, text, categorylinks where page_latest=rev_id and old_id=rev_text_id and cl_from=page_id and cl_to='Rodelbahn' order by page_title"
-    cu.execute(sql)
-    sledding_routes = cu.fetchall()
-    return sledding_routes
diff --git a/wradmin/wradmin/templates/forumlink.html b/wradmin/wradmin/templates/forumlink.html
deleted file mode 100644 (file)
index 007de06..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-<?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>Forum-Links zu Rodelbahnen</title>
-</head>
-
-<body>
-<h2>Forum-Links zu Rodelbahnen</h2>
-
-<p>Die folgende Tabelle zeigt "live" die der Kategorie <em>Rodelbahnen</em> zugeordneten Wiki-Seiten. Die Spalte <em>In Arbeit</em> gibt an, ob die Seite zusätzlich der Kategorie <em>In Arbeit</em> angehört und die Spalte <em>Forumlink</em> zeigt, ob die Seite mindestens einmal das Makro <tt>{{Forumlink ...}}</tt> enthält.</p>
-
-<table>        
-       <tr><th>Name</th><th>In Arbeit</th><th>Forumlink</th></tr>
-       <tr py:for="sl in c.sledding_routes"><td>${sl['page_title']}</td><td>${sl['under_construction']}</td><td>${sl['forum_link_present']}</td></tr>
-</table>
-
-</body>
-</html>
index cb236e1b73c0aa955641be4b59383e30055ac7eb..bd37ee1c3894adf480a786e61c6a06de6968e03d 100644 (file)
 <p>Willkommen auf den Administrationsseiten von Winterrodeln.</p>
 
 <ul>
-    <li><a href="${h.url_for(controller='wrcontroller', action='forumlink')}">Forum-Links auf Rodelbahnen</a></li>
     <li><a href="${h.url_for(controller='rodelbahn', action='list')}">Rodelbahnen</a></li>
     <li><a href="${h.url_for(controller='bericht', action='list')}">Rodelbahnberichte</a></li>
-    <li><a href="${h.url_for(controller='wrcontroller', action='rodelbahnbox')}">Rodelbahn-Infoboxen</a> überprüfen und Koordinaten aktualisieren</li>
     <li><a href="${h.url_for(controller='gasthaus', action='list')}">Gasthäuser</a></li>
 </ul>
 
index 1fe1f06b9122c3970e9f63bb530004b159ed6b83..a3f2ecb2ec29e025faa8764ca6c23e78865fae7a 100644 (file)
 <h1 id="header"><img src="${h.url_for('/titlebanner.png')}" alt="Winterrodeln Administration"/></h1>
 
 <ul id="mainmenu">
-    <li><a href="${h.url_for(controller='wrcontroller', action='index')}">Übersicht</a></li>
+    <li><a href="${h.url_for(controller='rodelbahn', action='index')}">Übersicht</a></li>
     <li><a href="${h.url_for(controller='rodelbahn', action='list')}">Rodelbahnen</a></li>
-    <li><a href="${h.url_for(controller='wrcontroller', action='rodelbahnbox')}">Rodelbahnboxen</a></li>
-    <li><a href="${h.url_for(controller='bericht', action='list')}">Berichte</a></li>
-    <li><a href="${h.url_for(controller='wrcontroller', action='forumlink')}">Forum-Links</a></li>
+    <li><a href="${h.url_for(controller='bericht', action='list')}">Rodelbahnberichte</a></li>
     <li><a href="${h.url_for(controller='gasthaus', action='list')}">Gasthäuser</a></li>
 </ul>
 
index f5e9cb9197940f6a34cdfdfbe8e03e98786cd086..b9ffe04a97a1f44e1eaefa9dfc130dc5598ce89e 100644 (file)
@@ -15,6 +15,8 @@
 
 <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>
 
+<a href="${h.url_for(controller='rodelbahn', action='update')}" class="button">Rodelbahnboxen auslesen und DB aktualisieren</a>
+
 <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>
@@ -34,6 +36,7 @@
         <th>Latitude</th>
         <th>Longitude</th>
         <th>Information</th>
+        <th>Forum-ID</th>
         <th>In Arbeit</th>
         <th>In Übersicht</th>
     </tr>
@@ -53,6 +56,7 @@
         <td>${s.position_latitude}</td>
         <td>${s.position_longitude}</td>
         <td>${s.information}</td>
+        <td>${s.forum_id}</td>
         <td>${h.bool(s.under_construction)}</td>
         <td>${h.bool(s.show_in_overview)}</td>
     </tr>
index 4b35bf16421e5b6358a574831df1a9126e3cb8f7..10fa68579afa9602824f6c2ee130ad973e99a66f 100644 (file)
     </tr>
     <tr>
         <th>Aufstieg getrennt</th>
-        <td>${c.sledding.walkup_separate}</td>
+        <td>${h.bool(c.sledding.walkup_separate)}</td>
     </tr>
     <tr>
         <th>Lift</th>
-        <td>${c.sledding.lift}</td>
+        <td>${h.bool(c.sledding.lift)}</td>
     </tr>
     <tr>
         <th>Licht</th>
-        <td>${c.sledding.night_light}</td>
+        <td>${h.bool(c.sledding.night_light)}</td>
     </tr>
     <tr>
         <th>Rodelverleih</th>
-        <td>${c.sledding.sledge_rental}</td>
+        <td>${h.bool(c.sledding.sledge_rental)}</td>
     </tr>
     <tr>
         <th>Öffentliche Anreise</th>
-        <td>${c.sledding.public_transport}</td>
+        <td>${h.bool(c.sledding.public_transport)}</td>
     </tr>
     <tr>
         <th>Bild</th>
         <th>Information</th>
         <td>${c.sledding.information}</td>
     </tr>
+    <tr>
+        <th>Forum-ID</th>
+        <td>${c.sledding.forum_id}</td>
+    </tr>
     <tr>
         <th>In Arbeit</th>
-        <td>${c.sledding.under_construction}</td>
+        <td>${h.bool(c.sledding.under_construction)}</td>
     </tr>
     <tr>
         <th>In Übersicht</th>
-        <td>${c.sledding.show_in_overview}</td>
+        <td>${h.bool(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>
+    <li py:if="c.sledding.position_latitude and c.sledding.position_longitude"><a href="${h.google_maps(c.sledding.position_latitude, c.sledding.position_longitude)}">Zeige bei Google Maps</a></li>
+    <li py:if="c.sledding.forum_id"><a href="${h.forum(c.sledding.forum_id)}">Zeige im Forum</a></li>
 </ul>
 
 
 <h3>Rodelbahnberichte</h3>
 
+<py:if test="len(c.paginator) > 0">
 <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>
 </table>
 
 <p>${c.paginator.pager('~2~', controller='rodelbahn', action='view', id=c.id)}</p>
+</py:if>
+<py:if test="len(c.paginator) == 0">
+<p><em>Es sind keine Rodelbahnberichte zu dieser Rodelbahn vorhanden.</em></p>
+</py:if>
 
 </body>
 </html>
diff --git a/wradmin/wradmin/templates/rodelbahnbox.html b/wradmin/wradmin/templates/rodelbahnbox.html
deleted file mode 100644 (file)
index 68eb06d..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-<?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>Rodelbahnboxen aktualisieren</title>
-</head>
-
-<body>
-<h2>Rodelbahnboxen aktualisieren</h2>
-
-<py:if test="c.update_performed">
-<py:if test="c.update_success">
-<p>Das Update der Rodelbahnboxen wurde erfolgreich durchgeführt. Folgende Informationen wurden aktualisiert:</p>
-
-<table>
-       <tr>
-               <th>Seite</th>
-               <th>Länge</th>
-               <th>Gehzeit</th>
-               <th>Höhe unten</th>
-               <th>Höhe oben</th>
-               <th>Information</th>
-               <th>Licht</th>
-               <th>Verleih</th>
-               <th>Lift</th>
-               <th>Öff. Anreise</th>
-               <th>Aufst. getr.</th>
-               <th>Position</th>
-               <th>Bild</th>
-               <th>In Übersicht</th>
-               <th>In Arbeit</th>
-               <th>Seiten-ID</th>
-       </tr>
-       <tr py:for="sl in c.sledding_routes">
-               <td>${sl['page_title']}</td>
-               <td>${sl['length']}</td>
-               <td>${sl['walktime']}</td>
-               <td>${sl['height_bottom']}</td>
-               <td>${sl['height_top']}</td>
-               <td>${sl['information']}</td>
-               <td>${sl['night_light']}</td>
-               <td>${sl['sledge_rental']}</td>
-               <td>${sl['lift']}</td>
-               <td>${sl['public_transport']}</td>
-               <td>${sl['walkup_separate']}</td>
-               <td>${sl['position_latitude']}, ${sl['position_longitude']}</td>
-               <td>${sl['image']}</td>
-               <td>${sl['show_in_overview']}</td>
-               <td>${sl['under_construction']}</td>
-               <td>${sl['page_id']}</td>
-       </tr>
-</table>
-
-</py:if>
-<py:if test="not c.update_success">
-<p>Beim Update der Rodelbahnboxen ist ein Fehler aufgetreten:</p>
-<p>${c.update_error}</p>
-</py:if>
-</py:if>
-
-<py:if test="not c.update_performed">
-<p>Die in den Rodelbahnboxen eingetragenen Informationen können mit folgendem Button ausgelesen und in eine Datenbanktabelle (<tt>wrsleddingcache</tt>) eingetragen werden. Diese Tabelle wird im Folgenden u.A. benutzt, um die Positionen der Rodelbahnen auf der Landkarte zu zeichnen. Auch die Daten der neuen Übersichtslisten im Wiki kommen aus dieser Tabelle.</p>
-
-<p>Nun ist es nicht unwahrscheinlich, dass Benutzer Fehler machen beim Ausfühllen der Rodelbahnbox. In dem Fall wird die Seite mit dem Fehler angezeigt und die Datenbanktabelle wird nicht geändert. Es kann dann das Wiki korrigiert werden und anschließend das Auslesen neu gestartet werden.</p>
-</py:if>
-
-<a href="${h.url_for('rodelbahnbox_update')}" class="button">Rodelbahnboxen auslesen und DB aktualisieren</a>
-
-</body>
-</html>