]> ToastFreeware Gitweb - philipp/winterrodeln/wradmin.git/commitdiff
Added "rodelbahn" controller to list sledding routes.
authorphilipp <philipp@7aebc617-e5e2-0310-91dc-80fb5f6d2477>
Wed, 18 Mar 2009 21:02:36 +0000 (21:02 +0000)
committerphilipp <philipp@7aebc617-e5e2-0310-91dc-80fb5f6d2477>
Wed, 18 Mar 2009 21:02:36 +0000 (21:02 +0000)
git-svn-id: http://www.winterrodeln.org/svn/servermediawiki/trunk/wradmin@428 7aebc617-e5e2-0310-91dc-80fb5f6d2477

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

index 2e6ec4545b3d5be5a0c4d2e20b6c41ed46ee4f51..fd1a030421e23d6a93927da5afde5af636689180 100644 (file)
@@ -37,7 +37,7 @@ class BerichtController(BaseController):
         return u"Nicht implementiert."
     
     def list(self):
-        "Lists all pages"
+        "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)
diff --git a/wradmin/wradmin/controllers/rodelbahn.py b/wradmin/wradmin/controllers/rodelbahn.py
new file mode 100644 (file)
index 0000000..065568b
--- /dev/null
@@ -0,0 +1,20 @@
+import logging
+
+from pylons import request, response, session, tmpl_context as c
+from pylons.controllers.util import abort, redirect_to
+import webhelpers.paginate as paginate
+
+from wradmin.lib.base import BaseController, render
+import wradmin.model as model
+import sqlalchemy as sa
+
+log = logging.getLogger(__name__)
+
+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
index 23a6e58e345fb3fb2fcdb97b75317415d04a3510..cc09fb66ff8dc95a1aa0c0960387e92cdd0b73ab 100644 (file)
@@ -7,3 +7,7 @@ available to Controllers. This module is available to templates as 'h'.
 #from webhelpers.html.tags import checkbox, password
 
 from routes import url_for
+
+def wiki(page=None):
+    "TODO: Improve, escape, ..."
+    return 'http://www.winterrodeln.org/wiki/' + page
\ No newline at end of file
index 838a58be995973df017b063b8b2acba7a1ac886d..39c83098f904067ac0ef76ecf57d109836d00213 100644 (file)
@@ -55,5 +55,5 @@ class MediaWikiUsers(UsersReadOnly):
             salt, pwd_md5 = tuple(pwd_parts[2:4]) # salt = 'd25b2886'; pwd_md5 = '41e46c952790b1b442aac4f24f7ea7a8'
         else:
             raise AuthKitError("Password in the MediaWiki database format has an unexpected format ('%s' instead of e.g. ':B:d25b2886:41e46c952790b1b442aac4f24f7ea7a8')" % pwd)
-        log.info("user: '%s'; md5 of salt+' '+entered_pwd: '%s'; md5-part of DB-pwd: %s" % (username, md5(salt + '-' + md5(password)), pwd_md5))
+        log.info("user: '%s'; md5 of salt+' '+entered_pwd: '%s'; md5-part of DB-pwd: %s" % (username, md5(salt + '-' + md5(password)), pwd_md5))
         return md5(salt + '-' + md5(password)) == pwd_md5
index c8c3191b5c3b15a20bc64608734828b812d32591..2cf814905fc5dbf4abb22568c1dcfc47fb15f90e 100644 (file)
@@ -6,48 +6,61 @@ import datetime
 
 def init_model(engine):
     """Call me before using any of the tables or classes in the model"""
-    ## Reflected tables must be defined and mapped here
-    #global reflected_table
-    #reflected_table = sa.Table("Reflected", meta.metadata, autoload=True,
-    #                           autoload_with=engine)
-    #orm.mapper(Reflected, reflected_table)
-    #
     meta.Session.configure(bind=engine)
     meta.engine = engine
 
 
-## Non-reflected tables may be defined and mapped at module level
 wrreport_table = sa.Table("wrreport", meta.metadata,
-    sa.Column("id", sa.types.Integer, primary_key=True),
-    sa.Column("page_id", sa.types.Integer, nullable=False),
-    sa.Column("page_title", sa.types.Unicode(255), nullable=False),
-    sa.Column("date_report", sa.types.Date),
-    sa.Column("date_entry", sa.types.DateTime, nullable=False),
-    sa.Column("date_invalid", sa.types.DateTime),
-    sa.Column("condition", sa.types.Integer),
-    sa.Column("description", sa.types.Unicode),
-    sa.Column("author_name", sa.types.Unicode(30)),
-    sa.Column("author_ip", sa.types.Unicode(15)),
-    sa.Column("author_userid", sa.types.Integer),
-    sa.Column("author_username", sa.types.Unicode(30)),
-    sa.Column("delete_date", sa.types.DateTime),
-    sa.Column("delete_person_name", sa.types.Unicode(30)),
-    sa.Column("delete_person_ip", sa.types.Unicode(15)),
-    sa.Column("delete_person_userid", sa.types.Integer),
-    sa.Column("delete_person_username", sa.types.Unicode(30)),
-    sa.Column("delete_reason_public", sa.types.Unicode),
+    sa.Column("id", types.Integer, primary_key=True),
+    sa.Column("page_id", types.Integer, nullable=False),
+    sa.Column("page_title", types.Unicode(255), nullable=False),
+    sa.Column("date_report", types.Date),
+    sa.Column("date_entry", types.DateTime, nullable=False),
+    sa.Column("date_invalid", types.DateTime),
+    sa.Column("condition", types.Integer),
+    sa.Column("description", types.Unicode),
+    sa.Column("author_name", types.Unicode(30)),
+    sa.Column("author_ip", types.Unicode(15)),
+    sa.Column("author_userid", types.Integer),
+    sa.Column("author_username", types.Unicode(30)),
+    sa.Column("delete_date", types.DateTime),
+    sa.Column("delete_person_name", types.Unicode(30)),
+    sa.Column("delete_person_ip", types.Unicode(15)),
+    sa.Column("delete_person_userid", types.Integer),
+    sa.Column("delete_person_username", types.Unicode(30)),
+    sa.Column("delete_reason_public", types.Unicode),
+    )
+
+
+wrsleddingcache_table =  sa.Table("wrsleddingcache", meta.metadata,
+    sa.Column("page_id", types.Integer, primary_key=True),
+    sa.Column("page_title", types.Unicode(255)),
+    sa.Column("length", types.Integer),
+    sa.Column("walktime", types.Integer),
+    sa.Column("height_top", types.Integer),
+    sa.Column("height_bottom", types.Integer),
+    sa.Column("walkup_separate", types.Boolean),
+    sa.Column("lift", types.Boolean),
+    sa.Column("night_light", types.Boolean),
+    sa.Column("sledge_rental", types.Boolean),
+    sa.Column("public_transport", types.Boolean),
+    sa.Column("image", types.Unicode(255)),
+    sa.Column("position_latitude", types.Float),
+    sa.Column("position_longitude", types.Float),
+    sa.Column("information", types.Unicode(255)),
+    sa.Column("under_construction", types.Boolean),
+    sa.Column("show_in_overview", types.Boolean),
     )
 
 
 class WrReport(object):
     pass
 
-orm.mapper(WrReport, wrreport_table)
 
+class WrSleddingCache(object):
+    pass
+
+
+orm.mapper(WrReport, wrreport_table)
+orm.mapper(WrSleddingCache, wrsleddingcache_table)
 
-## Classes for reflected tables may be defined here, but the table and
-## mapping itself must be done in the init_model function
-#reflected_table = None
-#
-#class Reflected(object):
-#    pass
index 073503471a46b6df0d2b76be74fbc8925d0d2eed..83ead2da46d8403d299d635c0d87786c6feecea1 100644 (file)
@@ -2,12 +2,12 @@
 <!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">
+    xmlns:py="http://genshi.edgewall.org/"
+    xmlns:xi="http://www.w3.org/2001/XInclude">
 <xi:include href="master.html" />
 
 <head>
-       <title>Rodelbahnberichte</title>
+    <title>Rodelbahnberichte</title>
 </head>
 
 <body>
@@ -16,9 +16,9 @@
 <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>
 
 <table>
-       <tr>
-               <th>ID</th>
-               <th>Seite</th>
+    <tr>
+        <th>ID</th>
+        <th>Seite</th>
         <th>Datum Eintrag</th>
         <th>Datum Ungültig</th>
         <th>Datum für Bericht</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.page_title}</td>
-               <td>${r.date_entry}</td>                
-               <td>${r.date_invalid}</td>
+    </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.page_title}</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.author_name}</td>
         <td>${r.delete_date}</td>
-       </tr>
+    </tr>
 </table>
 
 <p>${c.paginator.pager('~2~', controller='bericht', action='list')}</p>
index 9b32dc10b81504e326092bc3cf7c5007b4abcb12..af5dacf429d701547d84c34f07aeef47cbc8db13 100644 (file)
@@ -2,12 +2,12 @@
 <!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">
+    xmlns:py="http://genshi.edgewall.org/"
+    xmlns:xi="http://www.w3.org/2001/XInclude">
 <xi:include href="master.html" />
 
 <head>
-       <title>Hauptmenü</title>
+    <title>Hauptmenü</title>
 </head>
 
 <body>
 <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='wrcontroller', action='rodelbahnbox')}">Rodelbahn-Infoboxen</a> überprüfen und Koordinaten aktualisieren</li>
+    <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>
 </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="http://www.winterrodeln.org/wiki">Winterrodeln-Hauptseite</a></li>
+    <li><a href="http://www.winterrodeln-forum.org/">Forum</a></li>
 </ul>
 
 </body>
index 5b90712de5bde8295edae20c037c2777c1d4dbe2..2fec0ff8e80853393a63493a87ab0577fcd7a8da 100644 (file)
@@ -2,16 +2,16 @@
 <!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"
-       py:strip="True">
+    xmlns:py="http://genshi.edgewall.org/"
+    xmlns:xi="http://www.w3.org/2001/XInclude"
+    py:strip="True">
 
 <py:match path="head" once="True">
 <head py:attrs="select('@*')">
-       <title py:with="title = list(select('title/text()'))">Winterrodeln<py:if test="title"> - ${title}</py:if></title>
-       <meta content="text/html; charset=UTF-8" http-equiv="content-type" />
-       <meta name="robots" content="noindex, nofollow" />
-       <link rel="stylesheet" type="text/css" media="screen" href="${h.url_for('/style.css')}" />
+    <title py:with="title = list(select('title/text()'))">Winterrodeln<py:if test="title"> - ${title}</py:if></title>
+    <meta content="text/html; charset=UTF-8" http-equiv="content-type" />
+    <meta name="robots" content="noindex, nofollow" />
+    <link rel="stylesheet" type="text/css" media="screen" href="${h.url_for('/style.css')}" />
     <link rel="shortcut icon" href="${h.url_for('/favicon.png')}" />
 </head>
 </py:match>
 <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='wrcontroller', action='rodelbahnbox')}">Rodelbahnboxen</a></li>
-       <li><a href="${h.url_for(controller='wrcontroller', action='forumlink')}">Forum-Links</a></li>
+    <li><a href="${h.url_for(controller='wrcontroller', 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>
 </ul>
 
 <div id="content">
diff --git a/wradmin/wradmin/templates/rodelbahn_list.html b/wradmin/wradmin/templates/rodelbahn_list.html
new file mode 100644 (file)
index 0000000..333fcd5
--- /dev/null
@@ -0,0 +1,62 @@
+<?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>Rodelbahnen</title>
+</head>
+
+<body>
+<h2>Rodelbahnen</h2>
+
+<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>
+    <tr>
+        <th>ID</th>
+        <th>Name</th>
+        <th>Länge</th>
+        <th>Gehzeit</th>
+        <th>Höhe (oben)</th>
+        <th>Höhe (unten)</th>
+        <th>Aufstieg getrennt</th>
+        <th>Lift</th>
+        <th>Licht</th>
+        <th>Rodelverleih</th>
+        <th>Öffentl. Anreise</th>
+        <th>Bild</th>
+        <th>Latitude</th>
+        <th>Longitude</th>
+        <th>Information</th>
+        <th>In Arbeit</th>
+        <th>In Übersicht</th>
+    </tr>
+    <tr py:for="s in c.paginator">
+        <td>${s.page_id}</td>
+        <td>${s.page_title}</td>
+        <td>${s.length}</td>
+        <td>${s.walktime}</td>
+        <td>${s.height_top}</td>
+        <td>${s.height_bottom}</td>
+        <td>${s.walkup_separate}</td>
+        <td>${s.lift}</td>
+        <td>${s.night_light}</td>
+        <td>${s.sledge_rental}</td>
+        <td>${s.public_transport}</td>
+        <td><small>${s.image}</small></td>
+        <td>${s.position_latitude}</td>
+        <td>${s.position_longitude}</td>
+        <td>${s.information}</td>
+        <td>${s.under_construction}</td>
+        <td>${s.show_in_overview}</td>
+    </tr>
+</table>
+
+<p>${c.paginator.pager('~2~', controller='rodelbahn', action='list')}</p>
+
+</body>
+</html>