r61084 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r61083‎ | r61084 | r61085 >
Date:14:29, 15 January 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Changes for 0.5.2. Added support for showtitle= parameter to the result printers and improved template handling.
Modified paths:
  • /trunk/extensions/SemanticMaps/QueryPrinters/SM_MapPrinter.php (modified) (history)
  • /trunk/extensions/SemanticMaps/QueryPrinters/SM_QueryPrinters.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMaps/QueryPrinters/SM_QueryPrinters.php
@@ -76,7 +76,13 @@
7777 'not_empty' => array()
7878 ),
7979 'default' => false,
80 - ),
 80+ ),
 81+ 'showtitle' => array(
 82+ 'type' => 'boolean',
 83+ 'aliases' => array('show title'),
 84+ 'default' => true,
 85+ 'output-type' => 'boolean'
 86+ ),
8187 // SMW #Ask: parameters
8288 'limit' => array(
8389 'type' => 'integer',
Index: trunk/extensions/SemanticMaps/QueryPrinters/SM_MapPrinter.php
@@ -174,6 +174,7 @@
175175 $skin = $wgUser->getSkin();
176176
177177 $title = '';
 178+ $titleForTemplate = '';
178179 $text = '';
179180 $lat = '';
180181 $lon = '';
@@ -188,7 +189,8 @@
189190 // Loop throught all the parts of the field value
190191 while ( ($object = $field->getNextObject()) !== false ) {
191192 if ($object->getTypeID() == '_wpg' && $i == 0) {
192 - $title = $object->getLongText($outputmode, $skin);
 193+ if($this->showtitle) $title = $object->getLongText($outputmode, $skin);
 194+ if($this->template) $titleForTemplate = $object->getLongText($outputmode, NULL);
193195 }
194196
195197 if ($object->getTypeID() != '_geo' && $i != 0) {
@@ -206,17 +208,19 @@
207209 }
208210 }
209211
210 - if ($this->template) {
211 - global $wgParser;
212 - $text = $wgParser->recursiveTagParse('{{' . $this->template . '|' . implode('|', $label) . '}}');
213 - }
214 -
215212 foreach ($coords as $coord) {
216213 if (count($coord) == 2) {
217214 list($lat, $lon) = $coord;
218215
219216 if (strlen($lat) > 0 && strlen($lon) > 0) {
220217 $icon = $this->getLocationIcon($row);
 218+
 219+ if ($this->template) {
 220+ global $wgParser;
 221+ $segments = array_merge(array($this->template, $titleForTemplate, $lat, $lon), $label);
 222+ $text = $wgParser->recursiveTagParse('{{' . implode('|', $segments) . '}}');
 223+ }
 224+
221225 $this->m_locations[] = array($lat, $lon, $title, $text, $icon);
222226 }
223227

Follow-up revisions

RevisionCommit summaryAuthorDate
r61128Followup r61083,r61084: add RELEASE-NOTES entrydemon15:35, 16 January 2010

Status & tagging log