http://www.mediawiki.org/wiki/Special:Code/MediaWiki/89910
Revision: 89910 Author: yaron Date: 2011-06-12 02:35:52 +0000 (Sun, 12 Jun 2011) Log Message: ----------- Boolean properties can now also be handled by 'dropdown' and 'radiobutton', not just 'checkbox' 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-06-12 02:33:36 UTC (rev 89909) +++ trunk/extensions/SemanticForms/includes/SF_FormInputs.php 2011-06-12 02:35:52 UTC (rev 89910) @@ -90,7 +90,7 @@ */ class SFEnumInput extends SFFormInput { public static function getOtherPropTypesHandled() { - return array( 'enumeration' ); + return array( 'enumeration', '_boo' ); } public static function getValuesParameters() { @@ -451,7 +451,7 @@ } public static function getOtherPropTypesHandled() { - return array(); + return array( '_boo' ); } public static function getHTML( $cur_value, $input_name, $is_mandatory, $is_disabled, $other_args ) { @@ -481,7 +481,16 @@ $innerDropdown .= " <option value=\"\"></option>\n"; } if ( ( $possible_values = $other_args['possible_values'] ) == null ) { - $possible_values = array(); + // If it's a Boolean property, display 'Yes' and 'No' + // as the values. + if ( $other_args['property_type'] == '_boo' ) { + $possible_values = array( + SFUtils::getWordForYesOrNo( true ), + SFUtils::getWordForYesOrNo( false ), + ); + } else { + $possible_values = array(); + } } foreach ( $possible_values as $possible_value ) { $optionAttrs = array( 'value' => $possible_value ); @@ -523,8 +532,18 @@ public static function getHTML( $cur_value, $input_name, $is_mandatory, $is_disabled, $other_args ) { global $sfgTabIndex, $sfgFieldNum, $sfgShowOnSelect; - if ( ( $possible_values = $other_args['possible_values'] ) == null ) - $possible_values = array(); + if ( ( $possible_values = $other_args['possible_values'] ) == null ) { + // If it's a Boolean property, display 'Yes' and 'No' + // as the values. + if ( $other_args['property_type'] == '_boo' ) { + $possible_values = array( + SFUtils::getWordForYesOrNo( true ), + SFUtils::getWordForYesOrNo( false ), + ); + } else { + $possible_values = array(); + } + } // Add a "None" value at the beginning, unless this is a // mandatory field and there's a current value in place (either _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs