The sledrun icon is now dependent on the sledrun condition.
authorphilipp <philipp@7aebc617-e5e2-0310-91dc-80fb5f6d2477>
Wed, 19 Dec 2012 22:33:43 +0000 (22:33 +0000)
committerphilipp <philipp@7aebc617-e5e2-0310-91dc-80fb5f6d2477>
Wed, 19 Dec 2012 22:33:43 +0000 (22:33 +0000)
git-svn-id: http://www.winterrodeln.org/svn/servermediawiki/mediawiki_extensions/wrmap/trunk@1253 7aebc617-e5e2-0310-91dc-80fb5f6d2477

wrmap.js

index b02e7f7e4029e71d6d9cc78ddf2b5f47e31972d8..d8a0c6574a91a7bd0334eb2ef792a8234c4a16dd 100644 (file)
--- a/wrmap.js
+++ b/wrmap.js
@@ -35,7 +35,7 @@ function init_wrmap(i, jq_map) {
        var layer_sledruns = new OpenLayers.Layer.Vector("Rodelbahnen", {
                styleMap: new OpenLayers.StyleMap({
                        "default": new OpenLayers.Style({
-                               externalGraphic: "/vorlagen/gmap_rodelbahn_c.png",
+                               externalGraphic: "/vorlagen/bahnzustand${condition}_0.png",
                                graphicWidth: 17,
                                graphicHeight: 17,
                                graphicXOffset: -8,
@@ -66,8 +66,9 @@ function init_wrmap(i, jq_map) {
                layer_sledruns.addFeatures([new OpenLayers.Feature.Vector(point, {
                        label: jq_sledrun.attr('data-title'),
                        url: jq_sledrun.attr('data-url'),
-                       date_report: jq_sledrun.attr('data-date_report'),
-                       condition: jq_sledrun.attr('data-condition')
+                       has_report: jq_sledrun.attr('data-date_report') !== undefined,
+                       date_report: jq_sledrun.attr('data-date_report') === undefined ? null : jq_sledrun.attr('data-date_report'),
+                       condition: jq_sledrun.attr('data-condition') === undefined ? '0' : jq_sledrun.attr('data-condition')
                })]);
        });
 
@@ -93,7 +94,7 @@ function init_wrmap(i, jq_map) {
                        '<ul>\n' +
                        '<li><a href="' + feature.attributes['url'] + '">Details zur Rodelbahn</a></li>\n' + 
                        '<li>Rodelbahnzustand<br/>';
-                       if ('date_report' in feature.attributes && 'condition' in feature.attributes) {
+                       if (feature.attributes['has_report']) {
                                var condition_text = {1: 'Sehr gut', 2: 'Gut', 3: 'Mittelm&auml;&szlig;ig', 4: 'Schlecht', 5: 'Geht nicht'};
                                var year_month_day = feature.attributes['date_report'].split('-');
                                popup_text += '<a href="' + feature.attributes['url'] + '#Eintr.C3.A4ge">' + condition_text[feature.attributes['condition']] + '</a> ' +