http://www.mediawiki.org/wiki/Special:Code/MediaWiki/89265

Revision: 89265
Author:   yaron
Date:     2011-06-01 15:31:51 +0000 (Wed, 01 Jun 2011)
Log Message:
-----------
Simplfied registerInputType() - property-type labels no longer needed, for any 
version of SMW

Modified Paths:
--------------
    trunk/extensions/SemanticForms/includes/SF_FormPrinter.php

Modified: trunk/extensions/SemanticForms/includes/SF_FormPrinter.php
===================================================================
--- trunk/extensions/SemanticForms/includes/SF_FormPrinter.php  2011-06-01 
15:25:19 UTC (rev 89264)
+++ trunk/extensions/SemanticForms/includes/SF_FormPrinter.php  2011-06-01 
15:31:51 UTC (rev 89265)
@@ -62,43 +62,19 @@
         * Must be derived from SFFormInput.
         */
        public function registerInputType( $inputTypeClass ) {
-               global $smwgContLang;
- 
                $inputTypeName = call_user_func( array( $inputTypeClass, 
'getName' ) );
                $this->mInputTypeClasses[$inputTypeName] = $inputTypeClass;
                $this->setInputTypeHook( $inputTypeName, array( 
$inputTypeClass, 'getHTML' ), array() );
 
                $defaultProperties = call_user_func( array( $inputTypeClass, 
'getDefaultPropTypes' ) );
-               foreach ( $defaultProperties as $propertyTypeID => 
$additionalValues ) {
-                       if ( $smwgContLang != null ) {
-                               if ( class_exists( 'SMWDIProperty' ) ) {
-                                       // For SMW 1.6+, we use the ID of each
-                                       // property, instead of its label.
-                                       $propertyType = $propertyTypeID;
-                               } else {
-                                       $datatypeLabels = 
$smwgContLang->getDatatypeLabels();
-                                       $datatypeLabels['enumeration'] = 
'enumeration';
-                                       $propertyType = 
$datatypeLabels[$propertyTypeID];
-                               }
-                               $this->setSemanticTypeHook( $propertyType, 
false, array( $inputTypeClass, 'getHTML' ), $additionalValues );
-                       }
-                       $this->mDefaultInputForPropType[$propertyTypeID] = 
$inputTypeName;
+               foreach ( $defaultProperties as $propertyType => 
$additionalValues ) {
+                       $this->setSemanticTypeHook( $propertyType, false, 
array( $inputTypeClass, 'getHTML' ), $additionalValues );
+                       $this->mDefaultInputForPropType[$propertyType] = 
$inputTypeName;
                }
                $defaultPropertyLists = call_user_func( array( $inputTypeClass, 
'getDefaultPropTypeLists' ) );
-               foreach ( $defaultPropertyLists as $propertyTypeID => 
$additionalValues ) {
-                       if ( $smwgContLang != null ) {
-                               if ( class_exists( 'SMWDIProperty' ) ) {
-                                       // For SMW 1.6+, we use the ID of each
-                                       // property, instead of its label.
-                                       $propertyType = $propertyTypeID;
-                               } else {
-                                       $datatypeLabels = 
$smwgContLang->getDatatypeLabels();
-                                       $datatypeLabels['enumeration'] = 
'enumeration';
-                                       $propertyType = 
$datatypeLabels[$propertyTypeID];
-                               }
-                               $this->setSemanticTypeHook( $propertyType, 
true, array( $inputTypeClass, 'getHTML' ), $additionalValues );
-                       }
-                       $this->mDefaultInputForPropTypeList[$propertyTypeID] = 
$inputTypeName;
+               foreach ( $defaultPropertyLists as $propertyType => 
$additionalValues ) {
+                       $this->setSemanticTypeHook( $propertyType, true, array( 
$inputTypeClass, 'getHTML' ), $additionalValues );
+                       $this->mDefaultInputForPropTypeList[$propertyType] = 
$inputTypeName;
                }
 
                $otherProperties = call_user_func( array( $inputTypeClass, 
'getOtherPropTypesHandled' ) );


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to