r71550 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r71549‎ | r71550 | r71551 >
Date:12:44, 24 August 2010
Author:yaron
Status:deferred
Tags:
Comment:
Added fix for handling lowercased values in category inputs (when appropriate)
Modified paths:
  • /trunk/extensions/SemanticForms/includes/SF_FormInputs.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/includes/SF_FormInputs.php
@@ -1040,6 +1040,14 @@
10411041 global $wgCategoryTreeMaxDepth;
10421042 $wgCategoryTreeMaxDepth = 10;
10431043 $tree = efCategoryTreeParserHook( $top_category, array( 'mode' => 'categories', 'depth' => 10 ) );
 1044+
 1045+ // capitalize the first letter, if first letters always get capitalized
 1046+ global $wgCapitalLinks;
 1047+ if ( $wgCapitalLinks ) {
 1048+ global $wgContLang;
 1049+ $cur_value = $wgContLang->ucfirst( $cur_value );
 1050+ }
 1051+
10441052 $tree = preg_replace( '/(<a class="CategoryTreeLabel.*>)(.*)(<\/a>)/', '<input id="' . $input_id . '" tabindex="' . $sfgTabIndex . '" name="' . $input_name . '" value="$2" type="radio"> $1$2$3', $tree );
10451053 $tree = str_replace( "value=\"$cur_value\"", "value=\"$cur_value\" checked=\"checked\"", $tree );
10461054 // if it's disabled, set all to disabled
@@ -1061,7 +1069,7 @@
10621070 if ( ! function_exists( 'efCategoryTreeParserHook' ) )
10631071 return array( null, null );
10641072
1065 - global $sfgTabIndex, $sfgFieldNum;
 1073+ global $sfgTabIndex, $sfgFieldNum, $wgCapitalLinks;
10661074
10671075 $className = ( $is_mandatory ) ? "mandatoryField" : "createboxInput";
10681076 if ( array_key_exists( 'class', $other_args ) )
@@ -1108,6 +1116,12 @@
11091117 }
11101118 // set all checkboxes matching $cur_values to checked
11111119 foreach ( $cur_values as $value ) {
 1120+ // capitalize the first letter, if first letters always get capitalized
 1121+ if ( $wgCapitalLinks ) {
 1122+ global $wgContLang;
 1123+ $value = $wgContLang->ucfirst( $value );
 1124+ }
 1125+
11121126 $tree = str_replace( "value=\"$value\"", "value=\"$value\" checked=\"checked\"", $tree );
11131127 }
11141128 // if it's disabled, set all to disabled

Status & tagging log