Now an image is shown for sledruns at the overview page.
authorphilipp <philipp@7aebc617-e5e2-0310-91dc-80fb5f6d2477>
Mon, 4 Nov 2013 22:51:10 +0000 (22:51 +0000)
committerphilipp <philipp@7aebc617-e5e2-0310-91dc-80fb5f6d2477>
Mon, 4 Nov 2013 22:51:10 +0000 (22:51 +0000)
git-svn-id: http://www.winterrodeln.org/svn/servermediawiki/mediawiki_extensions/wrmap/trunk@1794 7aebc617-e5e2-0310-91dc-80fb5f6d2477

wrmap.body.php
wrmap.js

index 766b1881d0c4d2d230435949c977957b016828cc..2ce595d0300b94328e27c2e5ca28af7c17d8179f 100644 (file)
@@ -126,6 +126,8 @@ class WrBaseMap {
                        $properties = array('type' => 'sledrun', 'name' => $title->getText(), 'wiki' => $title->getLocalUrl());
                        if (!is_null($sledrun['date_report'])) $properties['date_report'] = $sledrun['date_report'];
                        if (!is_null($sledrun['condition'])) $properties['condition'] = intval($sledrun['condition']);
+                       $image_url = WrBaseMap::wikipage_to_image($title, 150);
+                       if (!is_null($image_url)) $properties['thumb_url'] = $image_url;
                        $json_feature = array(
                                'type' => 'feature',
                                'geometry' => array(
index 54d8ba4108dafe59f7e8d2ea8d0a9fa341fbafbc..7cb0b3a5603dc055cfe1efa40efd5f9c3c07b871 100644 (file)
--- a/wrmap.js
+++ b/wrmap.js
@@ -232,13 +232,15 @@ function init_wrmap(i, jq_map) {
                        var popup_div = createElement('div');
 
                        // name
-                       if (attr.name !== undefined && (attr.wiki !== undefined || attr.thumb_url !== undefined))
-                               popup_div.append(createElement('h2').text(attr.name));
+                       if (attr.name !== undefined && (attr.wiki !== undefined || attr.thumb_url !== undefined)) {
+                               var h2 = appendElement(popup_div, 'h2');
+                               if (attr.wiki === undefined) h2.text(attr.name);
+                               else appendElement(h2, 'a', {href: attr.wiki}).text(attr.name);
+                       }
 
                        // sledrun information
                        if (attr.type == 'sledrun') {
                                var ul = appendElement(popup_div, 'ul');
-                               ul.append(createElement('li').append(createElement('a', {href: attr.wiki}).text('Details zur Rodelbahn')));
                                var li = appendElement(ul, 'li').text('Rodelbahnzustand').append(createElement('br'));
                                if (attr.condition !== undefined) {
                                        var condition_text = {1: 'Sehr gut', 2: 'Gut', 3: 'Mittelmäßig', 4: 'Schlecht', 5: 'Geht nicht'};
@@ -252,10 +254,13 @@ function init_wrmap(i, jq_map) {
                        }
 
                        // wiki link
-                       if (attr.wiki !== undefined && attr.type !== 'sledrun') {
+                       if (attr.wiki !== undefined) {
                                var a = appendElement(appendElement(popup_div, 'p'), 'a', {href: attr.wiki});
-                               if (attr.thumb_url === undefined) a.text('Details');
-                               else a.append(createElement('img', {src: attr.thumb_url, alt: 'Details'}));
+                               var detail_text = 'Details';
+                               if (attr.type == 'sledrun') detail_text += ' zur Rodelbahn';
+                               if (attr.type == 'gasthaus') detail_text += ' zum Gasthaus';
+                               if (attr.thumb_url === undefined) a.text(detail_text);
+                               else a.append(createElement('img', {src: attr.thumb_url, alt: detail_text, title: detail_text}));
                        }
 
                        // no popup if we don't have anything to say