r76248 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r76247‎ | r76248 | r76249 >
Date:14:46, 7 November 2010
Author:yaron
Status:deferred
Tags:
Comment:
Fix for major bug with 'show on select' and MW <= 1.16; also got 'show on select' working again with the 'checkbox' input for all MW versions
Modified paths:
  • /trunk/extensions/SemanticForms/includes/SF_FormInputs.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/includes/SF_FormInputs.php
@@ -175,7 +175,7 @@
176176 foreach ( $other_args['show on select'] as $div_id => $options ) {
177177 $options_str = implode( "', '", $options );
178178 $js_text = "showIfSelected('$input_id', ['$options_str'], '$div_id'); ";
179 - $sfgShowOnSelectCalls[] = "$('#$input_id').change( function() { $js_text } );";
 179+ $sfgShowOnSelectCalls[] = "jQuery('#$input_id').change( function() { $js_text } );";
180180 $sfgShowOnSelectCalls[] = $js_text;
181181 }
182182 }
@@ -286,7 +286,7 @@
287287 foreach ( $possible_values as $key => $possible_value ) {
288288 $cur_input_id = $enum_input_ids[$possible_value];
289289 if ( in_array( $possible_value, $options ) ) {
290 - $sfgShowOnSelectCalls[] = "$('#$cur_input_id').click( function() { $js_text } );";
 290+ $sfgShowOnSelectCalls[] = "jQuery('#$cur_input_id').click( function() { $js_text } );";
291291 }
292292 }
293293 }
@@ -380,7 +380,7 @@
381381 foreach ( $possible_values as $key => $possible_value ) {
382382 $cur_input_id = $enum_input_ids[$possible_value];
383383 if ( in_array( $possible_value, $options ) ) {
384 - $sfgShowOnSelectCalls[] = "$('#$cur_input_id').click( function() { $js_text } );";
 384+ $sfgShowOnSelectCalls[] = "jQuery('#$cur_input_id').click( function() { $js_text } );";
385385 }
386386 }
387387 }
@@ -911,7 +911,7 @@
912912 // radiobutton has to handle the change.
913913 foreach ( $enum_input_ids as $cur_input_id ) {
914914 if ( in_array( $possible_value, $options ) ) {
915 - $sfgShowOnSelectCalls[] = "$('#$cur_input_id').click( function() { $js_text } );";
 915+ $sfgShowOnSelectCalls[] = "jQuery('#$cur_input_id').click( function() { $js_text } );";
916916 }
917917 }
918918 }
@@ -922,7 +922,7 @@
923923 }
924924
925925 static function checkboxHTML( $cur_value, $input_name, $is_mandatory, $is_disabled, $other_args ) {
926 - global $sfgTabIndex, $sfgFieldNum;
 926+ global $sfgTabIndex, $sfgFieldNum, $sfgShowOnSelectCalls;
927927
928928 $className = ( $is_mandatory ) ? "mandatoryField" : "createboxInput";
929929 if ( array_key_exists( 'class', $other_args ) )
@@ -933,7 +933,8 @@
934934 if ( array_key_exists( 'show on select', $other_args ) ) {
935935 $div_id = key( $other_args['show on select'] );
936936 $js_text = "showIfChecked(['$input_id'], '$div_id');";
937 - $sfgShowOnSelectCalls[] = "$('#$input_id').click( function() { $js_text } );";
 937+ $sfgShowOnSelectCalls[] = $js_text;
 938+ $sfgShowOnSelectCalls[] = "jQuery('#$input_id').click( function() { $js_text } );";
938939 }
939940
940941 // can show up here either as an array or a string, depending on

Status & tagging log