MathiasLidal has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/89487


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 includes/queryprinters/SM_MapPrinter.php
2 files changed, 10 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SemanticMaps 
refs/changes/87/89487/1

diff --git a/SemanticMaps.i18n.php b/SemanticMaps.i18n.php
index 5fb6f42..cab6ec4 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'            => 'Add InlineLabel containing 
link to page for each map 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',
diff --git a/includes/queryprinters/SM_MapPrinter.php 
b/includes/queryprinters/SM_MapPrinter.php
index 10a12d4..4e0c99f 100644
--- a/includes/queryprinters/SM_MapPrinter.php
+++ b/includes/queryprinters/SM_MapPrinter.php
@@ -92,10 +92,14 @@
                        '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 +276,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: newchange
Gerrit-Change-Id: I8963b7337534fd8c1b84c6073da39bb7e07f4d8a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SemanticMaps
Gerrit-Branch: master
Gerrit-Owner: MathiasLidal <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to