http://www.mediawiki.org/wiki/Special:Code/MediaWiki/97860
Revision: 97860
Author: brion
Date: 2011-09-22 22:10:41 +0000 (Thu, 22 Sep 2011)
Log Message:
-----------
* (bug 31089) Fix regression in Special:Block reasons list
(MediaWiki:Ipbreason-dropdown parsing)
Followup to r83298: makes HTMLSelectAndOtherField backwards-compatible with
Xml::listDropDown as it was apparently intended to be.
Also fixed double-escaping in the options for HTMLSelectAndOtherField.
Followup to r83795: fixes regression in Special:Block by fixing
HTMLSelectAndOtherField which got used in place of Xml::listDropDown, but
wasn't compatible.
Note that this removes the clever thing that lets you have separate values and
texts in your dropdown; since Xml::listDropDown had no such feature and actual
usage includes texts containing links and other stuch where the pipe character
is a legit part of the content.
Modified Paths:
--------------
trunk/phase3/includes/HTMLForm.php
Modified: trunk/phase3/includes/HTMLForm.php
===================================================================
--- trunk/phase3/includes/HTMLForm.php 2011-09-22 21:39:28 UTC (rev 97859)
+++ trunk/phase3/includes/HTMLForm.php 2011-09-22 22:10:41 UTC (rev 97860)
@@ -1572,8 +1572,7 @@
/**
* Double field with a dropdown list constructed from a system message in the
format
* * Optgroup header
- * ** <option value>|<option name>
- * ** <option value == option name>
+ * ** <option value>
* * New Optgroup header
* Plus a text field underneath for an additional reason. The 'value' of the
field is
* ""<select>: <extra reason>"", or "<extra reason>" if nothing has been
selected in the
@@ -1585,7 +1584,7 @@
function __construct( $params ) {
if ( array_key_exists( 'other', $params ) ) {
} elseif( array_key_exists( 'other-message', $params ) ){
- $params['other'] = wfMessage( $params['other-message']
)->escaped();
+ $params['other'] = wfMessage( $params['other-message']
)->plain();
} else {
$params['other'] = null;
}
@@ -1595,7 +1594,7 @@
} elseif( array_key_exists( 'options-message', $params ) ){
# Generate options array from a system message
$params['options'] = self::parseMessage(
- wfMessage( $params['options-message']
)->inContentLanguage()->escaped(),
+ wfMessage( $params['options-message']
)->inContentLanguage()->plain(),
$params['other']
);
} else {
@@ -1616,7 +1615,7 @@
*/
public static function parseMessage( $string, $otherName=null ) {
if( $otherName === null ){
- $otherName = wfMessage( 'htmlform-selectorother-other'
)->escaped();
+ $otherName = wfMessage( 'htmlform-selectorother-other'
)->plain();
}
$optgroup = false;
@@ -1633,23 +1632,15 @@
} elseif ( substr( $value, 0, 2) == '**' ) {
# groupmember
$opt = trim( substr( $value, 2 ) );
- $parts = array_map( 'trim', explode( '|', $opt,
2 ) );
- if( count( $parts ) === 1 ){
- $parts[1] = $parts[0];
- }
if( $optgroup === false ){
- $options[$parts[1]] = $parts[0];
+ $options[$opt] = $opt;
} else {
- $options[$optgroup][$parts[1]] =
$parts[0];
+ $options[$optgroup][$opt] = $opt;
}
} else {
# groupless reason list
$optgroup = false;
- $parts = array_map( 'trim', explode( '|',
$option, 2 ) );
- if( count( $parts ) === 1 ){
- $parts[1] = $parts[0];
- }
- $options[$parts[1]] = $parts[0];
+ $options[$option] = $option;
}
}
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs