The popup info now shows information about other points with wiki link as well.
authorphilipp <philipp@7aebc617-e5e2-0310-91dc-80fb5f6d2477>
Sun, 11 Aug 2013 21:00:43 +0000 (21:00 +0000)
committerphilipp <philipp@7aebc617-e5e2-0310-91dc-80fb5f6d2477>
Sun, 11 Aug 2013 21:00:43 +0000 (21:00 +0000)
git-svn-id: http://www.winterrodeln.org/svn/servermediawiki/mediawiki_extensions/wrmap/trunk@1510 7aebc617-e5e2-0310-91dc-80fb5f6d2477

wrmap.js

index 2c6d472e232fba6d584cf5003657b1bf911b6c57..2850541a00354ce92a8d81caefee89c3a70d2858 100644 (file)
--- a/wrmap.js
+++ b/wrmap.js
@@ -198,23 +198,28 @@ function init_wrmap(i, jq_map) {
                autoActivate: true,
                toggle: true,
                onSelect: function(feature) {
-                       if (feature.attributes.type != 'sledrun') return;
+                       var popup_text = '';
+                       if (feature.attributes.type == 'sledrun') {
+                               popup_text += "<h2>" + feature.attributes.name + '</h2>\n' +
+                               '<ul>\n' +
+                               '<li><a href="' + feature.attributes.wiki + '">Details zur Rodelbahn</a></li>\n' + 
+                               '<li>Rodelbahnzustand<br/>';
+                               if (feature.attributes.condition !== undefined) {
+                                       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.wiki + '#Eintr.C3.A4ge">' + condition_text[feature.attributes.condition] + '</a> ' + 
+                                       '<small>' + year_month_day[2] + '.' + year_month_day[1] + '.</small> ' +
+                                       '<em><a href="' + feature.attributes.wiki + '#Eintragen">Neu</a></em>';
+                               } else {
+                                       popup_text += '<em><a href="' + feature.attributes.wiki + '#Eintragen">Bitte eintragen</a></em>';
+                               }
+                               popup_text += '</li>\n</ul>\n';
+                       } else if (feature.attributes.wiki !== undefined) {
+                               if (feature.attributes.name != undefined) popup_text += '<h2>' + feature.attributes.name + '</h2>\n';
+                               popup_text += '<p><a href="' + feature.attributes.wiki + '">Details</a></p>\n';
+                       } else return;
 
                        // Open popup
-                       var popup_text = "<h2>" + feature.attributes.name + '</h2>\n' +
-                       '<ul>\n' +
-                       '<li><a href="' + feature.attributes.wiki + '">Details zur Rodelbahn</a></li>\n' + 
-                       '<li>Rodelbahnzustand<br/>';
-                       if (feature.attributes.condition !== undefined) {
-                               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.wiki + '#Eintr.C3.A4ge">' + condition_text[feature.attributes.condition] + '</a> ' + 
-                               '<small>' + year_month_day[2] + '.' + year_month_day[1] + '.</small> ' +
-                               '<em><a href="' + feature.attributes.wiki + '#Eintragen">Neu</a></em>';
-                       } else {
-                               popup_text += '<em><a href="' + feature.attributes.wiki + '#Eintragen">Bitte eintragen</a></em>';
-                       }
-                       popup_text += '</li>\n</ul>\n';
                        var selectFeatureControl = this;
                        var popup = new OpenLayers.Popup.FramedCloud('sledruninfopopup_' + feature.attributes.wiki, 
                        feature.geometry.getBounds().getCenterLonLat(),