diff options
Diffstat (limited to 'sublab_project')
-rw-r--r-- | sublab_project/fixtures/flatpages.json | 15 | ||||
-rw-r--r-- | sublab_project/settings.py | 3 | ||||
-rw-r--r-- | sublab_project/urls.py | 1 |
3 files changed, 3 insertions, 16 deletions
diff --git a/sublab_project/fixtures/flatpages.json b/sublab_project/fixtures/flatpages.json index 9fa5991..88d9009 100644 --- a/sublab_project/fixtures/flatpages.json +++ b/sublab_project/fixtures/flatpages.json @@ -45,21 +45,6 @@ } }, { - "pk": 2, - "model": "flatpages.flatpage", - "fields": { - "registration_required": false, - "title": "Mate", - "url": "/mate/", - "template_name": "", - "sites": [ - 1 - ], - "content": "<h2>Mate</h2>\r\n<p>\r\n\tDiese Karte markiert alle Orte in Leipzig (bzw. sogar ganz Deutschland: einfach herauszoomen)\r\n\tan denen Club Mate zu haben ist und die bei <a href=\"http://www.openstreetmap.org\">OpenStreetMap</a> mit dem Tag \r\n\t<i>drink:club-mate=*</i> versehen wurden. Ein paar mehr Details findet Ihr\r\n\t<a href=\"http://bitfehler.net/mate\">hier</a>. Die Daten werden jede Nacht\r\n\taktualisiert.\r\n</p>\r\n<div id=\"spacer\" style=\"margin-left: 20px;\">\r\n<div id=\"mapdiv\"></div>\r\n</div>\r\n<p style=\"font-size: 10px;\">Javascript required. Click an icon for details. Map data \r\n<a style=\"font-size: 10px;\" href=\"http://creativecommons.org/licenses/by-sa/2.0/\">CC-BY-SA</a> 2011 \r\n<a style=\"font-size: 10px;\" href=\"http://www.openstreetmap.org\">OpenStreetMap</a> contributors.</p>\r\n\r\n<script type=\"text/javascript\" src=\"http://www.openlayers.org/api/OpenLayers.js\"></script>\r\n<script defer=\"defer\" type=\"text/javascript\">\r\n<!--\r\n\r\nvar obj, map, pois, styleMap, selectControl, selectedFeature, loadingPopup;\r\nvar numDots = 3;\r\n\r\nfunction resizeMap() {\r\n\tdocument.getElementById(\"mapdiv\").style.width = \"100px\"\r\n\tdocument.getElementById(\"mapdiv\").style.height = \"100px\";\r\n\tvar c = document.getElementsByClassName(\"content\")[0];\r\n\tvar w = c.offsetWidth;\r\n\tvar h = c.offsetHeight;\r\n\tw = Math.round(w * 0.90);\r\n\tdocument.getElementById(\"mapdiv\").style.width = w + \"px\"\r\n\tdocument.getElementById(\"mapdiv\").style.height = \"500px\";\r\n}\r\n\r\nfunction onPopupClose(evt) {\r\n\t// 'this' is the popup.\r\n\tselectControl.unselect(this.feature);\r\n}\r\n\r\n// Pretty-print an amenity tag (and others actually)\r\nfunction amenityPp(amenity) {\r\n\tvar words = amenity.split(\"_\");\r\n\tvar result = \"\";\r\n\tfor (w in words) {\r\n\t\tif (result != \"\") {\r\n\t\t\tresult += \" \";\r\n\t\t}\r\n\t\tresult += words[w].charAt(0).toUpperCase() + words[w].slice(1);\r\n\t}\r\n\treturn result;\r\n}\r\n\r\nfunction popupText(feature) {\r\n\tvar title = \"\";\r\n\tif (\"name\" in feature.attributes) {\r\n\t\ttitle = feature.attributes[\"name\"];\r\n\t}\r\n\telse {\r\n\t\ttitle = \"*no name*\";\r\n\t}\r\n\tif (\"website\" in feature.attributes) {\r\n\t\ttitle = '<a href=\"' + feature.attributes[\"website\"] + '\" rel=\"external\">' + title + '</a>';\r\n\t}\r\n\t\r\n\tvar desc = \"\";\r\n\tif (\"amenity\" in feature.attributes) {\r\n\t\tdesc = '<p style=\"font-size: smaller\">' + amenityPp(feature.attributes[\"amenity\"]) + '</p>';\r\n\t}\r\n\telse if (\"leisure\" in feature.attributes) {\r\n\t\tdesc = '<p style=\"font-size: smaller\">' + amenityPp(feature.attributes[\"leisure\"]) + '</p>';\r\n\t}\r\n\telse if (\"shop\" in feature.attributes) {\r\n\t\tdesc = '<p style=\"font-size: smaller\">' + amenityPp(feature.attributes[\"shop\"]) + '</p>';\r\n\t}\r\n\t\r\n\tvar addr = \"\";\r\n\tif (\"addr:street\" in feature.attributes) {\r\n\t\taddr += feature.attributes[\"addr:street\"]\r\n\t\tif (\"addr:housenumber\" in feature.attributes) {\r\n\t\t\taddr += \" \" + feature.attributes[\"addr:housenumber\"];\r\n\t\t}\r\n\t\taddr += \"</br>\";\r\n\t}\r\n\tif (\"addr:city\" in feature.attributes) {\r\n\t\tif (\"addr:postcode\" in feature.attributes) {\r\n\t\t\taddr += feature.attributes[\"addr:postcode\"] + \" \";\r\n\t\t}\r\n\t\taddr += feature.attributes[\"addr:city\"];\r\n\t}\r\n\r\n\tvar open = \"\";\r\n\tif (\"opening_hours\" in feature.attributes) {\r\n\t\topen += '<p style=\"font-size: smaller\">Open: ' + feature.attributes[\"opening_hours\"] + '</p>';\r\n\t}\r\n\r\n\treturn \"<h2>\" + title + \"</h2>\" + desc + \"<p>\" + addr + \"</p>\" + open;\r\n}\r\n\r\nfunction onFeatureSelect(feature) {\r\n\tvar lst = \"\";\r\n\tfor (var prop in feature.attributes) {\r\n\t\tlst += prop + \" \";\r\n\t}\r\n\tpopup = new OpenLayers.Popup.FramedCloud(\r\n\t\t\t\"featurePopup\",\r\n\t\t\tfeature.geometry.getBounds().getCenterLonLat(),\r\n\t\t\tnew OpenLayers.Size(100,100),\r\n\t\t\tpopupText(feature),\r\n\t\t\tnull, true, onPopupClose\r\n\t);\r\n\tfeature.popup = popup;\r\n\tpopup.feature = feature;\r\n\tmap.addPopup(popup);\r\n}\r\nfunction onFeatureUnselect(feature) {\r\n\tif (feature.popup) {\r\n\t\tpopup.feature = null;\r\n\t\tmap.removePopup(feature.popup);\r\n\t\tfeature.popup.destroy();\r\n\t\tfeature.popup = null;\r\n\t}\r\n}\r\n\r\nfunction dataCallback() {\r\n\tmap.removePopup(loadingPopup);\r\n}\r\n\r\nresizeMap();\r\nwindow.onresize = resizeMap;\r\n\r\nmap = new OpenLayers.Map(\"mapdiv\");\r\nlayer = new OpenLayers.Layer.OSM();\r\nlayer.attribution = 0;\r\n\r\n\r\nvar styleMap = new OpenLayers.Style({\r\n\texternalGraphic: '/static/img/mate_icon.png',\r\n\tgraphicWidth: 32,\r\n\tgraphicHeight: 32,\r\n\tgraphicXOffset: 0,\r\n\tgraphicYOffset: -32\r\n});\r\n\r\nvar pois = new OpenLayers.Layer.Vector(\"Marker\", { \r\n\tstyleMap: styleMap,\r\n\teventListeners: {\"featuresadded\": dataCallback },\r\n\tstrategies: [new OpenLayers.Strategy.Fixed],\r\n\tprojection:map.displayProjection,\r\n\tprotocol: new OpenLayers.Protocol.HTTP({\r\n\t\turl: \"/static/xml/mate.xml\",\r\n\t\tformat: new OpenLayers.Format.OSM,\r\n\t})\r\n});\r\n\r\nmap.addLayer(layer);\r\nmap.addLayer(pois);\r\n\r\n//Set start centrepoint and zoom \r\nvar lonLat = new OpenLayers.LonLat(12.3903, 51.342).transform(\r\n\tnew OpenLayers.Projection(\"EPSG:4326\"), // transform from WGS 1984\r\n\tmap.getProjectionObject() // to Spherical Mercator Projection\r\n);\r\nmap.setCenter(lonLat, 12); \r\n\r\nvar lonLatPopup = new OpenLayers.LonLat(12.34, 51.36).transform(\r\n\tnew OpenLayers.Projection(\"EPSG:4326\"), // transform from WGS 1984\r\n\tmap.getProjectionObject() // to Spherical Mercator Projection\r\n);\r\n\r\nloadingPopup = new OpenLayers.Popup(\"loadingPopup\",\r\n\t\tlonLatPopup,\r\n\t\tnew OpenLayers.Size(300,200),\r\n\t\t'<p style=\"font-weight: bold; text-align: center; margin-top: 60px\">Loading OpenStreetMap data.<br>Please wait.<br><br><span id=\"dots\">...</span></p>', false\r\n);\r\nloadingPopup.opacity = 0.9;\r\nmap.addPopup(loadingPopup);\r\n \r\nselectControl = new OpenLayers.Control.SelectFeature(pois, {\r\n\tonSelect: onFeatureSelect,\r\n\tonUnselect: onFeatureUnselect\r\n});\r\nmap.addControl(selectControl);\r\nselectControl.activate();\r\n-->\r\n</script>\r\n", - "enable_comments": false - } - }, - { "pk": 5, "model": "flatpages.flatpage", "fields": { diff --git a/sublab_project/settings.py b/sublab_project/settings.py index a1edc25..664a7d3 100644 --- a/sublab_project/settings.py +++ b/sublab_project/settings.py @@ -142,7 +142,8 @@ INSTALLED_APPS = ( 'sorl.thumbnail', 'preview_admin', 'sublab_monitor', - 'flatblocks' + 'flatblocks', + 'matekarte', ) # A sample logging configuration. The only tangible logging diff --git a/sublab_project/urls.py b/sublab_project/urls.py index 40c4822..f565939 100644 --- a/sublab_project/urls.py +++ b/sublab_project/urls.py @@ -18,6 +18,7 @@ urlpatterns = patterns('', url(r'^projekte/', include('projects.urls')), url(r'^news/', include('news.urls')), url(r'^termine/', include('calendarium.urls')), + url(r'^mate/', include('matekarte.urls')), url(r'^$', ListView.as_view( queryset=News.objects.all()[:5], template_name='home.html'), name='home'), |