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äß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äß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(),