r104271 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r104270‎ | r104271 | r104272 >
Date:16:15, 26 November 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Modified paths:
  • /trunk/extensions/SemanticMaps/RELEASE-NOTES (modified) (history)
  • /trunk/extensions/SemanticMaps/includes/queryprinters/SM_QueryHandler.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMaps/RELEASE-NOTES
@@ -10,6 +10,7 @@
1111 === Semantic Maps 1.0.5 ===
1212 (201x-xx-xx)
1313
 14+* Allow properties of type string to be used as title. (bug 32632)
1415
1516 === Semantic Maps 1.0.4 ===
1617 (2011-10-15)
Index: trunk/extensions/SemanticMaps/includes/queryprinters/SM_QueryHandler.php
@@ -60,7 +60,7 @@
6161 *
6262 * @var boolean
6363 */
64 - public $titleLinkSeperate;
 64+ public $titleLinkSeparate;
6565
6666 /**
6767 * Should link targets be made absolute (instead of relative)?
@@ -115,13 +115,13 @@
116116 * @param SMWQueryResult $queryResult
117117 * @param integer $outputmode
118118 */
119 - public function __construct( SMWQueryResult $queryResult, $outputmode, $linkAbsolute = false, $pageLinkText = '$1', $titleLinkSeperate = false ) {
 119+ public function __construct( SMWQueryResult $queryResult, $outputmode, $linkAbsolute = false, $pageLinkText = '$1', $titleLinkSeparate = false ) {
120120 $this->queryResult = $queryResult;
121121 $this->outputmode = $outputmode;
122122
123123 $this->linkAbsolute = $linkAbsolute;
124124 $this->pageLinkText = $pageLinkText;
125 - $this->titleLinkSeperate = $titleLinkSeperate;
 125+ $this->titleLinkSeparate = $titleLinkSeparate;
126126 }
127127
128128 /**
@@ -269,10 +269,14 @@
270270 if ( $dataValue->getTypeID() == '_wpg' && $i == 0 ) {
271271 list( $title, $text ) = $this->handleResultSubject( $dataValue );
272272 }
273 - elseif ( $dataValue->getTypeID() != '_geo' && $i != 0 ) {
 273+ else if ( $dataValue->getTypeID() == '_str' && $i == 0 ) {
 274+ $title = $dataValue->getLongText( $this->outputmode, null );
 275+ $text = $dataValue->getLongText( $this->outputmode, $GLOBALS['wgUser']->getSkin() );
 276+ }
 277+ else if ( $dataValue->getTypeID() != '_geo' && $i != 0 ) {
274278 $properties[] = $this->handleResultProperty( $dataValue, $printRequest );
275279 }
276 - elseif ( $printRequest->getMode() == SMWPrintRequest::PRINT_PROP && $printRequest->getTypeID() == '_geo' ) {
 280+ else if ( $printRequest->getMode() == SMWPrintRequest::PRINT_PROP && $printRequest->getTypeID() == '_geo' ) {
277281 $dataItem = $dataValue->getDataItem();
278282
279283 $location = MapsLocation::newFromLatLon( $dataItem->getLatitude(), $dataItem->getLongitude() );
@@ -295,23 +299,23 @@
296300 }
297301
298302 /**
299 - * Handles a SMWDataValue subject value.
 303+ * Handles a SMWWikiPageValue subject value.
300304 * Gets the plain text title and creates the HTML text with headers and the like.
301305 *
302306 * @since 1.0
303307 *
304 - * @param SMWDataValue $object
 308+ * @param SMWWikiPageValue $object
305309 *
306310 * @return array with title and text
307311 */
308 - protected function handleResultSubject( SMWDataValue $object ) {
 312+ protected function handleResultSubject( SMWWikiPageValue $object ) {
309313 global $wgUser;
310314
311315 $title = $object->getLongText( $this->outputmode, null );
312316 $text = '';
313317
314318 if ( $this->showSubject ) {
315 - if ( !$this->titleLinkSeperate && $this->linkAbsolute ) {
 319+ if ( !$this->titleLinkSeparate && $this->linkAbsolute ) {
316320 $text = Html::element(
317321 'a',
318322 array( 'href' => $object->getTitle()->getFullUrl() ),
@@ -326,7 +330,7 @@
327331 $text = '<b>' . $text . '</b>';
328332 }
329333
330 - if ( $this->titleLinkSeperate ) {
 334+ if ( $this->titleLinkSeparate ) {
331335 $txt = $object->getTitle()->getText();
332336
333337 if ( $this->pageLinkText !== '' ) {