jenkins-bot has submitted this change and it was merged. Change subject: Add parameter 'pagelabel' to map query ......................................................................
Add parameter 'pagelabel' to map query This commit adds the parameter 'pagelabel' to the map query. If set to true, it will add an InlineLabel containing a link to the result page to each marker label. For an example, see: http://ec2-46-137-28-172.eu-west-1.compute.amazonaws.com/wiki/index.php/Semantic_Maps_-_Labels Change-Id: I8963b7337534fd8c1b84c6073da39bb7e07f4d8a --- M SemanticMaps.i18n.php M src/queryprinters/SM_MapPrinter.php 2 files changed, 12 insertions(+), 1 deletion(-) Approvals: Siebrand: Looks good to me, approved jenkins-bot: Verified diff --git a/SemanticMaps.i18n.php b/SemanticMaps.i18n.php index 46b2dbf..c71827d 100644 --- a/SemanticMaps.i18n.php +++ b/SemanticMaps.i18n.php @@ -46,6 +46,7 @@ 'semanticmaps-par-template' => 'A template to use to format the info window contents.', 'semanticmaps-par-geocodecontrol' => 'Show the geocoding control.', 'semanticmaps-par-activeicon' => 'Icon to be displayed instead of default marker, when active page is equal to query result', + 'semanticmaps-par-pagelabel' => 'When set to "yes", all markers will have an "inlineLabel" with a link to the page containing the coordinates for the marker', 'semanticmaps-kml-text' => 'The text associated with each page. Overridden by the additional queried properties if any.', 'semanticmaps-kml-title' => 'The default title for results', @@ -106,6 +107,7 @@ 'semanticmaps-forminput-add' => '{{Identical|Add}}', 'semanticmaps-forminput-locations' => '{{Identical|Location}}', 'semanticmaps-par-activeicon' => 'See: {{msg-mw|Semanticmaps-par-activeicon}}', + 'semanticmaps-par-pagelabel' => 'Text explaning query parameter "pagelabel". When set to "yes", all markers will have an "inlineLabel" with a link to the page containing the coordinates for the marker', 'semanticmaps-kml-pagelinktext' => 'Used as description for "pagelinktext". <code>$1</code> is not a parameter. diff --git a/src/queryprinters/SM_MapPrinter.php b/src/queryprinters/SM_MapPrinter.php index 10a12d4..e7c4b62 100644 --- a/src/queryprinters/SM_MapPrinter.php +++ b/src/queryprinters/SM_MapPrinter.php @@ -92,10 +92,15 @@ 'default' => '', ); + $params['pagelabel'] = array ( + 'type' => 'boolean', + 'default' => false, + ); + // Messages: // semanticmaps-par-staticlocations, semanticmaps-par-forceshow, semanticmaps-par-showtitle, // semanticmaps-par-hidenamespace, semanticmaps-par-centre, semanticmaps-par-template, - // semanticmaps-par-geocodecontrol, semanticmaps-par-activeicon + // semanticmaps-par-geocodecontrol, semanticmaps-par-activeicon semanticmaps-par-markerlabel foreach ( $params as $name => &$data ) { if ( is_array( $data ) && !array_key_exists( 'message', $data ) ) { $data['message'] = 'semanticmaps-par-' . $name; @@ -272,6 +277,10 @@ $jsonObj['text'] = ( $hasTitleAndtext ? '<b>' . $jsonObj['title'] . '</b><hr />' : $jsonObj['title'] ) . $jsonObj['text']; $jsonObj['title'] = strip_tags( $jsonObj['title'] ); + if ( $params['pagelabel'] ) { + $jsonObj['inlineLabel'] = Linker::link( Title::newFromText( $jsonObj['title'] ) ); + } + return $jsonObj; } -- To view, visit https://gerrit.wikimedia.org/r/89487 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I8963b7337534fd8c1b84c6073da39bb7e07f4d8a Gerrit-PatchSet: 4 Gerrit-Project: mediawiki/extensions/SemanticMaps Gerrit-Branch: master Gerrit-Owner: MathiasLidal <[email protected]> Gerrit-Reviewer: Jeroen De Dauw <[email protected]> Gerrit-Reviewer: Siebrand <[email protected]> Gerrit-Reviewer: jenkins-bot _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
