Browse files

patch for integration scenario

git-svn-id: http://halodev.ontoprise.com/svn/HaloSMWExtension/trunk@12106 f80b7aa0-dfcc-4e65-a0d9-74108174cbc8
  • Loading branch information...
1 parent 767f294 commit 76039848baa3cfafb1a316d5903296d9642dee68 kuehn committed Sep 7, 2011
Showing with 22 additions and 2 deletions.
  1. +22 −2 extensions/SMWHalo/patch_for_SMW1.6.1.txt
View
24 extensions/SMWHalo/patch_for_SMW1.6.1.txt
@@ -2,12 +2,32 @@ Index: extensions/SemanticMediaWiki/includes/SMW_DataValueFactory.php
===================================================================
--- extensions/SemanticMediaWiki/includes/SMW_DataValueFactory.php (revision 12092)
+++ extensions/SemanticMediaWiki/includes/SMW_DataValueFactory.php (working copy)
-@@ -271,7 +271,8 @@
+@@ -74,6 +74,8 @@
+ //SMWDataItem::TYPE_NOTYPE => '',
+ //SMWDataItem::TYPE_ERROR => '',
+ );
++
++ static private $mNewDataItemIds = array();
+
+ /**
+ * Create a value from a type id. If no $value is given, an empty container
+@@ -116,7 +118,9 @@
+ * @return SMWDataValue
+ */
+ static public function newDataItemValue( SMWDataItem $dataItem, $property, $caption = false ) {
+- if ( $property !== null ) {
++ if (array_key_exists($dataItem->getDiType(), self::$mNewDataItemIds)) {
++ $typeid = self::$mNewDataItemIds[$dataItem->getDiType()];
++ } else if ( $property !== null ) {
+ $typeid = $property->findPropertyTypeID();
+ } else {
+ $typeid = self::$mDefaultDataItemTypeIds[$dataItem->getDiType()];
+@@ -271,7 +275,8 @@
static public function registerDatatype( $id, $className, $dataItemId, $label = false ) {
self::$mTypeClasses[$id] = $className;
self::$mTypeDataItemIds[$id] = $dataItemId;
-
-+ self::$mDefaultDataItemTypeIds[$dataItemId] = $id;
++ self::$mNewDataItemIds[$dataItemId] = $id;
+
if ( $label != false ) {
self::$mTypeLabels[$id] = $label;

0 comments on commit 7603984

Please sign in to comment.