Skip to content

Commit

Permalink
Fix shapes in map result format
Browse files Browse the repository at this point in the history
  • Loading branch information
JeroenDeDauw committed Nov 26, 2018
1 parent edde223 commit 15d70f4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
6 changes: 5 additions & 1 deletion RELEASE-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 6 additions & 9 deletions src/SemanticMW/ResultPrinters/MapPrinter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'] );

Expand Down Expand Up @@ -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 ? '<b>' . $jsonObj['title'] . '</b><hr />' : $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'] ) );
Expand Down

0 comments on commit 15d70f4

Please sign in to comment.