r101589 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r101588‎ | r101589 | r101590 >
Date:07:36, 2 November 2011
Author:ning
Status:deferred
Tags:
Comment:
support smw 1.6
Modified paths:
  • /trunk/extensions/WikiObjectModel/includes/apis/WOM_OutputProcessor.php (modified) (history)
  • /trunk/extensions/WikiObjectModel/includes/models/WOM_OM_Property.php (modified) (history)

Diff [purge]

Index: trunk/extensions/WikiObjectModel/includes/models/WOM_OM_Property.php
@@ -37,7 +37,11 @@
3838 $value = "{$value}|{$caption}";
3939 $caption = '';
4040 } else {
41 - $smwdatavalue = SMWDataValueFactory::newPropertyObjectValue( $user_property, $value, $caption );
 41+ if ( version_compare ( SMW_VERSION, '1.6', '>=' ) ) {
 42+ $smwdatavalue = SMWDataValueFactory::newPropertyObjectValue( $user_property->getDataItem(), $value, $caption );
 43+ } else {
 44+ $smwdatavalue = SMWDataValueFactory::newPropertyObjectValue( $user_property, $value, $caption );
 45+ }
4246 }
4347
4448 $this->m_user_property = $user_property;
Index: trunk/extensions/WikiObjectModel/includes/apis/WOM_OutputProcessor.php
@@ -207,21 +207,38 @@
208208 // fill in semantic properties
209209 $properties = array();
210210 foreach ( $semdata->getProperties() as $property ) {
 211+ $label = '';
211212 if ( !$property->isShown() ) { // showing this is not desired, hide
212213 continue;
213214 } elseif ( $property->isUserDefined() ) { // user defined property
214 - $property->setCaption( preg_replace( '/[ ]/u', ' ', $property->getWikiValue(), 2 ) );
215 - // / NOTE: the preg_replace is a slight hack to ensure that the left column does not get too narrow
216 - $properties[$property->getWikiValue()] = array();
217 - } elseif ( $property->isVisible() ) { // predefined property
218 - $properties[$property->getWikiValue()] = array();
219 - } else { // predefined, internal property
220 - continue;
 215+ if ( version_compare ( SMW_VERSION, '1.6', '>=' ) ) {
 216+ $label = $property->getLabel();
 217+ } else {
 218+ $property->setCaption( preg_replace( '/[ ]/u', ' ', $property->getWikiValue(), 2 ) );
 219+ // / NOTE: the preg_replace is a slight hack to ensure that the left column does not get too narrow
 220+ $label = $property->getWikiValue();
 221+ }
 222+ } else {
 223+ if ( version_compare ( SMW_VERSION, '1.6', '>=' ) ) {
 224+ $label = $property->getLabel();
 225+ } else {
 226+ if ( $property->isVisible() ) { // predefined property
 227+ $label = $property->getWikiValue();
 228+ } else { // predefined, internal property
 229+ continue;
 230+ }
 231+ }
221232 }
 233+ $properties[$label] = array();
222234
223235 $propvalues = $semdata->getPropertyValues( $property );
224236 foreach ( $propvalues as $propvalue ) {
225 - $properties[$property->getWikiValue()][$propvalue->getWikiValue()] = false;
 237+ if ( version_compare ( SMW_VERSION, '1.6', '>=' ) ) {
 238+ if ( $propvalue->getDIType() == SMWDataItem::TYPE_ERROR ) continue;
 239+ $properties[$label][$propvalue->getSerialization()] = false;
 240+ } else {
 241+ $properties[$label][$propvalue->getWikiValue()] = false;
 242+ }
226243 }
227244 }
228245 $props = $wom->getObjectsByTypeID( WOM_TYPE_PROPERTY );

Status & tagging log