]> ToastFreeware Gitweb - philipp/winterrodeln/mediawiki_extensions/wrmap.git/blobdiff - wrmap.body.php
Include Polyfill for Internet Explorer directly instead of using a CDN.
[philipp/winterrodeln/mediawiki_extensions/wrmap.git] / wrmap.body.php
index 0d6020bf00f5a389f1f02977613dbce5108afd19..bff6ba34bad492bdfe12a10365e107cb4881cf0c 100644 (file)
@@ -244,7 +244,7 @@ class WrBaseMap {
                        $key_sledrun = $wgContLang->getNSText(NS_CATEGORY) . ':Rodelbahn';
                        if (array_key_exists($key_sledrun, $categories)) {
                                // for sledrun titles use the image from the rodelbahnbox
-                               $dbr = wfGetDB(DB_SLAVE);
+                               $dbr = wfGetDB(DB_REPLICA);
                                $res = $dbr->select('wrsledruncache', 'image', array('page_id' => $title->getArticleID()), __METHOD__);
                                $image = $dbr->fetchRow($res);
                                if ($image && !is_null($image['image'])) $file = wfFindFile($image['image']);
@@ -253,7 +253,7 @@ class WrBaseMap {
                        $key_inn = $wgContLang->getNSText(NS_CATEGORY) . ':Gasthaus';
                        if (array_key_exists($key_inn, $categories)) {
                                // for inn titles use the image from the gasthausbox
-                               $dbr = wfGetDB(DB_SLAVE);
+                               $dbr = wfGetDB(DB_REPLICA);
                                $res = $dbr->select('wrinncache', 'image', array('page_id' => $title->getArticleID()), __METHOD__);
                                $image = $dbr->fetchRow($res);
                                if ($image && !is_null($image['image'])) $file = wfFindFile($image['image']);
@@ -272,7 +272,7 @@ class WrBaseMap {
        // Returns an array of features
        public static function sledruns_to_json_features() {
                $json_features = array(); // result
-               $dbr = wfGetDB(DB_SLAVE);
+               $dbr = wfGetDB(DB_REPLICA);
                $res = $dbr->select(array('wrsledruncache', 'wrreportcache'), array('wrsledruncache.page_title', 'position_latitude', 'position_longitude', 'date_report', '`condition`'), array('show_in_overview', 'not under_construction'), __METHOD__, array(), array('wrreportcache' => array('left outer join', 'wrsledruncache.page_id=wrreportcache.page_id')));
                while ($sledrun = $dbr->fetchRow($res)) {
                        $lat = $sledrun['position_latitude'];
@@ -287,7 +287,7 @@ class WrBaseMap {
                        $image_url = WrBaseMap::wikipage_to_image($title, 150);
                        if (!is_null($image_url)) $properties['thumb_url'] = $image_url;
                        $json_feature = array(
-                               'type' => 'feature',
+                               'type' => 'Feature',
                                'geometry' => array(
                                        'type' => 'Point',
                                        'coordinates' => array($lon, $lat)
@@ -343,7 +343,7 @@ class WrBaseMap {
                                $coordinates = WrBaseMap::geo_to_coordinates($feature);
                                if (count($coordinates) != 1) throw new Exception(wfMessage('wrmap-error-coordinate-count', $feature->getName())->text());
                                $json_feature = array(
-                                       'type' => 'feature',
+                                       'type' => 'Feature',
                                        'geometry' => array(
                                                'type' => 'Point',
                                                'coordinates' => reset($coordinates)
@@ -371,7 +371,7 @@ class WrBaseMap {
                                        $properties['strokeWidth'] = $stroke_width;
                                }
                                $json_feature = array(
-                                       'type' => 'feature',
+                                       'type' => 'Feature',
                                        'geometry' => array(
                                                'type' => 'LineString',
                                                'coordinates' => WrBaseMap::geo_to_coordinates($feature)
@@ -399,7 +399,6 @@ class WrBaseMap {
                assert(in_array($tagname, array('wrmap', 'wrgmap')));
 
                $parserOutput = $parser->getOutput();
-               // $parserOutput->addHeadItem('<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=AIzaSyABu68dyE3dB_l-UfB_WuyoPAsSTthI4gc"></script>', 'googlemaps');
                $parserOutput->addModules('ext.wrmap');
 
                // append all sledruns as icon
@@ -437,18 +436,16 @@ class WrBaseMap {
                // Create <div/> element where the map is placed in
                global $wgExtensionAssetsPath;
                $doc = new WrMapDOMDocument();
-               $div = $doc->appendElement('div', array('class' => 'wrmap', 'style' => 'border-style:none;', 'data-ext-path' => "$wgExtensionAssetsPath/wrmap"));
+               $div_map = $doc->appendElement('div', array('class' => 'wrmap', 'style' => 'border-style:none;', 'data-ext-path' => "$wgExtensionAssetsPath/wrmap"));
                // progress message
-               $div->appendElement('div', array())->appendText(wfMessage('wrmap-loading')->text());
+               $div_map->appendElement('div', array())->appendText(wfMessage('wrmap-loading')->text());
                // data
-               $div->appendElement('div', array('style' => 'height: 0px; display:none;'))->appendText($json_string);
-               return array($doc->saveHTML($div), 'markerType' => 'nowiki');
-       }
-
-
-       public static function onEnableMobileModules($out, $mode) {
-               $out->addModules('ext.wrmap.mobile');
-               return true;
+               $div_map->appendElement('div', array('style' => 'height: 0px; display:none;'))->appendText($json_string);
+               // popup
+               $div_popup = $doc->appendElement('div', array('id' => 'popup', 'class' => 'ol-popup'));
+               $div_popup->appendElement('a', array('id' => 'popup-closer', 'href' => '#', 'class' => 'ol-popup-closer'));
+               $div_popup->appendElement('div', array('id' => 'popup-content'));
+               return array($doc->saveHTML($div_map) . $doc->saveHTML($div_popup), 'markerType' => 'nowiki');
        }
 }