r43611 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r43610‎ | r43611 | r43612 >
Date:17:28, 17 November 2008
Author:mkroetzsch
Status:deferred
Tags:
Comment:
Fix to print property labels correctly in query results (Bug 16304)
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Property.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/storage/SMW_Description.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_Description.php
@@ -39,6 +39,9 @@
4040 if ( ($mode == SMWPrintRequest::PRINT_CCAT) && ($outputformat === '') ) {
4141 $this->m_outputformat = 'x'; // changed default for Boolean case
4242 }
 43+ if ($this->m_data instanceof SMWDataValue) {
 44+ $this->m_data->setCaption($label);
 45+ }
4346 }
4447
4548 public function getMode() {
@@ -64,7 +67,7 @@
6568 case SMWPrintRequest::PRINT_CCAT:
6669 return $linker->makeLinkObj($this->m_data->getTitle(), htmlspecialchars($this->m_label));
6770 case SMWPrintRequest::PRINT_PROP:
68 - return $this->m_data->getLongHTMLText($linker);
 71+ return $this->m_data->getShortHTMLText($linker);
6972 case SMWPrintRequest::PRINT_THIS: default: return htmlspecialchars($this->m_label);
7073 }
7174
@@ -80,7 +83,7 @@
8184 switch ($this->m_mode) {
8285 case SMWPrintRequest::PRINT_CATS: return $this->m_label; // TODO: link to Special:Categories
8386 case SMWPrintRequest::PRINT_PROP:
84 - return $this->m_data->getLongWikiText($linked);
 87+ return $this->m_data->getShortWikiText($linked);
8588 case SMWPrintRequest::PRINT_CCAT:
8689 return '[[:' . $this->m_data->getPrefixedText() . '|' . $this->m_label . ']]';
8790 case SMWPrintRequest::PRINT_THIS: default: return $this->m_label;
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_DV_Property.php
@@ -131,6 +131,13 @@
132132 }
133133 }
134134
 135+ public function setCaption($caption) {
 136+ parent::setCaption($caption);
 137+ if ($this->m_wikipage instanceof SMWDataValue) { // pass caption to embedded datavalue (used for printout)
 138+ $this->m_wikipage->setCaption($caption);
 139+ }
 140+ }
 141+
135142 /**
136143 * Return TRUE if this is a usual wiki property that is defined by a wiki page, as
137144 * opposed to a property that is pre-defined in the wiki.

Status & tagging log