http://www.mediawiki.org/wiki/Special:Code/MediaWiki/83613
Revision: 83613 Author: yaron Date: 2011-03-09 22:46:15 +0000 (Wed, 09 Mar 2011) Log Message: ----------- Another attempted fix for autocompletion Modified Paths: -------------- trunk/extensions/SemanticForms/includes/SF_FormInputs.php Modified: trunk/extensions/SemanticForms/includes/SF_FormInputs.php =================================================================== --- trunk/extensions/SemanticForms/includes/SF_FormInputs.php 2011-03-09 22:15:15 UTC (rev 83612) +++ trunk/extensions/SemanticForms/includes/SF_FormInputs.php 2011-03-09 22:46:15 UTC (rev 83613) @@ -777,23 +777,14 @@ } public static function getAutocompletionTypeAndSource( $field_args ) { - if ( array_key_exists( 'autocomplete field type', $field_args ) ) { - $autocompleteFieldType = $field_args['autocomplete field type']; - $autocompletionSource = $field_args['autocompletion source']; - } elseif ( array_key_exists( 'values from property', $field_args ) || - array_key_exists( 'semantic_property', $field_args ) ) { - if ( array_key_exists( 'values from property', $field_args ) ) { - $autocompletionSource = $field_args['values from property']; - } else { // if ( array_key_exists( 'semantic_property', $field_args ) ) { - $autocompletionSource = $field_args['semantic_property']; - } + if ( array_key_exists( 'values from property', $field_args ) ) { + $autocompletionSource = $field_args['values from property']; $propValue = SMWPropertyValue::makeUserProperty( $autocompletionSource ); if ( $propValue->getPropertyTypeID() == '_wpg' ) { $autocompleteFieldType = 'relation'; } else { $autocompleteFieldType = 'attribute'; } - } elseif ( array_key_exists( 'values from category', $field_args ) ) { $autocompleteFieldType = 'category'; $autocompletionSource = $field_args['values from category']; @@ -812,6 +803,17 @@ global $sfgFieldNum; $autocompleteFieldType = 'values'; $autocompletionSource = "values-$sfgFieldNum"; + } elseif ( array_key_exists( 'autocomplete field type', $field_args ) ) { + $autocompleteFieldType = $field_args['autocomplete field type']; + $autocompletionSource = $field_args['autocompletion source']; + } elseif ( array_key_exists( 'semantic_property', $field_args ) ) { + $autocompletionSource = $field_args['semantic_property']; + $propValue = SMWPropertyValue::makeUserProperty( $autocompletionSource ); + if ( $propValue->getPropertyTypeID() == '_wpg' ) { + $autocompleteFieldType = 'relation'; + } else { + $autocompleteFieldType = 'attribute'; + } } else { $autocompleteFieldType = null; $autocompletionSource = null; @@ -851,6 +853,7 @@ $field_args['remote autocompletion'] == true ) { $remoteDataType = $autocompleteFieldType; } elseif ( $autocompletionSource != '' ) { + // @TODO - that count() check shouldn't be necessary if ( array_key_exists( 'possible_values', $field_args ) && count( $field_args['possible_values'] ) > 0 ) { $autocompleteValues = $field_args['possible_values']; _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs