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

Revision: 76248
Author:   yaron
Date:     2010-11-07 14:46:55 +0000 (Sun, 07 Nov 2010)
Log Message:
-----------
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: trunk/extensions/SemanticForms/includes/SF_FormInputs.php
===================================================================
--- trunk/extensions/SemanticForms/includes/SF_FormInputs.php   2010-11-07 
14:33:57 UTC (rev 76247)
+++ trunk/extensions/SemanticForms/includes/SF_FormInputs.php   2010-11-07 
14:46:55 UTC (rev 76248)
@@ -175,7 +175,7 @@
       foreach ( $other_args['show on select'] as $div_id => $options ) {
         $options_str = implode( "', '", $options );
         $js_text = "showIfSelected('$input_id', ['$options_str'], '$div_id'); 
";
-        $sfgShowOnSelectCalls[] = "$('#$input_id').change( function() { 
$js_text } );";
+        $sfgShowOnSelectCalls[] = "jQuery('#$input_id').change( function() { 
$js_text } );";
         $sfgShowOnSelectCalls[] = $js_text;
       }
     }
@@ -286,7 +286,7 @@
         foreach ( $possible_values as $key => $possible_value ) {
           $cur_input_id = $enum_input_ids[$possible_value];
           if ( in_array( $possible_value, $options ) ) {
-            $sfgShowOnSelectCalls[] = "$('#$cur_input_id').click( function() { 
$js_text } );";
+            $sfgShowOnSelectCalls[] = "jQuery('#$cur_input_id').click( 
function() { $js_text } );";
           }
         }
       }
@@ -380,7 +380,7 @@
         foreach ( $possible_values as $key => $possible_value ) {
           $cur_input_id = $enum_input_ids[$possible_value];
           if ( in_array( $possible_value, $options ) ) {
-            $sfgShowOnSelectCalls[] = "$('#$cur_input_id').click( function() { 
$js_text } );";
+            $sfgShowOnSelectCalls[] = "jQuery('#$cur_input_id').click( 
function() { $js_text } );";
           }
         }
       }
@@ -911,7 +911,7 @@
           // radiobutton has to handle the change.
           foreach ( $enum_input_ids as $cur_input_id ) {
             if ( in_array( $possible_value, $options ) ) {
-              $sfgShowOnSelectCalls[] = "$('#$cur_input_id').click( function() 
{ $js_text } );";
+              $sfgShowOnSelectCalls[] = "jQuery('#$cur_input_id').click( 
function() { $js_text } );";
             }
           }
         }
@@ -922,7 +922,7 @@
   }
 
   static function checkboxHTML( $cur_value, $input_name, $is_mandatory, 
$is_disabled, $other_args ) {
-    global $sfgTabIndex, $sfgFieldNum;
+    global $sfgTabIndex, $sfgFieldNum, $sfgShowOnSelectCalls;
 
     $className = ( $is_mandatory ) ? "mandatoryField" : "createboxInput";
     if ( array_key_exists( 'class', $other_args ) )
@@ -933,7 +933,8 @@
     if ( array_key_exists( 'show on select', $other_args ) ) {
       $div_id = key( $other_args['show on select'] );
       $js_text = "showIfChecked(['$input_id'], '$div_id');";
-      $sfgShowOnSelectCalls[] = "$('#$input_id').click( function() { $js_text 
} );";
+      $sfgShowOnSelectCalls[] = $js_text;
+      $sfgShowOnSelectCalls[] = "jQuery('#$input_id').click( function() { 
$js_text } );";
     }
 
     // can show up here either as an array or a string, depending on


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

Reply via email to