From 15d70f425328741b2b2cd131e8f187d590abb9e8 Mon Sep 17 00:00:00 2001 From: Jeroen De Dauw Date: Mon, 26 Nov 2018 05:18:34 +0100 Subject: [PATCH] Fix shapes in map result format --- RELEASE-NOTES.md | 6 +++++- src/SemanticMW/ResultPrinters/MapPrinter.php | 15 ++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index aad83ced8..7a2b5fd61 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -3,10 +3,14 @@ different releases and which versions of PHP and MediaWiki they support, see the [platform compatibility tables](INSTALL.md#platform-compatibility-and-release-status). -## Maps 6.2.1 +## Maps 6.3.0 Under development +* Fixed `lines` parameter for Ask queries (it is no longer ignored) +* Fixed `polygons` parameter for Ask queries (it is no longer ignored) +* Fixed `circles` parameter for Ask queries (it is no longer ignored) +* Fixed `rectangles` parameter for Ask queries (it is no longer ignored) * Fixed Google Maps 'kml' parameter. It now again works with just the file name rather than the full path ## Maps 6.2.0 diff --git a/src/SemanticMW/ResultPrinters/MapPrinter.php b/src/SemanticMW/ResultPrinters/MapPrinter.php index 9aabbb3b5..32f202683 100644 --- a/src/SemanticMW/ResultPrinters/MapPrinter.php +++ b/src/SemanticMW/ResultPrinters/MapPrinter.php @@ -123,6 +123,9 @@ public final function getResultText( SMWQueryResult $res, $outputMode ) { $this->handleMarkerData( $params, $queryHandler ); $params['lines'] = $this->elementsToJson( $params['lines'] ); + $params['polygons'] = $this->elementsToJson( $params['polygons'] ); + $params['circles'] = $this->elementsToJson( $params['circles'] ); + $params['rectangles'] = $this->elementsToJson( $params['rectangles'] ); $params['ajaxquery'] = urlencode( $params['ajaxquery'] ); @@ -240,23 +243,17 @@ private function getJsonForStaticLocations( array $staticLocations, array $param $location, $params, $iconUrl, - $visitedIconUrl, - clone $GLOBALS['wgParser'] + $visitedIconUrl ); } return $locationsJson; } - private function getJsonForStaticLocation( Location $location, array $params, $iconUrl, $visitedIconUrl, Parser $parser ) { + private function getJsonForStaticLocation( Location $location, array $params, $iconUrl, $visitedIconUrl ) { $jsonObj = $location->getJSONObject( $params['title'], $params['label'], $iconUrl, '', '', $visitedIconUrl ); - $jsonObj['title'] = $parser->parse( $jsonObj['title'], $parser->getTitle(), new ParserOptions() )->getText(); - $jsonObj['text'] = $parser->parse( $jsonObj['text'], $parser->getTitle(), new ParserOptions() )->getText(); - - $hasTitleAndtext = $jsonObj['title'] !== '' && $jsonObj['text'] !== ''; - $jsonObj['text'] = ( $hasTitleAndtext ? '' . $jsonObj['title'] . '
' : $jsonObj['title'] ) . $jsonObj['text']; - $jsonObj['title'] = strip_tags( $jsonObj['title'] ); + $this->elementSerializer->titleAndText( $jsonObj ); if ( $params['pagelabel'] ) { $jsonObj['inlineLabel'] = Linker::link( Title::newFromText( $jsonObj['title'] ) );