Cleanup for r30216:

* Don't triple-escape HTML in drop-down lists :)
* Don't include empty attributes for missing optional parameters
* Use content language, not UI language, for loading predefined reasons
This commit is contained in:
Brion Vibber 2008-01-28 20:27:15 +00:00
parent 19358606a1
commit 1b72addea7
4 changed files with 19 additions and 6 deletions

View file

@ -2097,7 +2097,8 @@ class Article {
$watch = Xml::checkLabel( wfMsg( 'watchthis' ), 'wpWatch', 'wpWatch', $wgUser->getBoolOption( 'watchdeletion' ) || $this->mTitle->userIsWatching(), array( 'tabindex' => '2' ) );
$deletereasonother = Xml::label( wfMsg( 'deleteotherreason' ), 'wpReason' );
$reasonDropDown = Xml::listDropDown( 'wpDeleteReasonList', wfMsgHtml( 'deletereason-dropdown' ),
$reasonDropDown = Xml::listDropDown( 'wpDeleteReasonList',
wfMsgForContent( 'deletereason-dropdown' ),
wfMsgForContent( 'deletereasonotherlist' ), '', 'wpReasonDropDown', 1 );
$wgOut->addHTML( "

View file

@ -114,7 +114,8 @@ class FileDeleteForm {
$deletereasonother = Xml::label( wfMsg( 'filedelete-otherreason' ), 'wpReason' );
$delcom = Xml::label( wfMsg( 'filedelete-comment' ), 'wpDeleteReasonList' );
$reasonDropDown = Xml::listDropDown( 'wpDeleteReasonList', wfMsgHtml( 'filedelete-reason-dropdown' ),
$reasonDropDown = Xml::listDropDown( 'wpDeleteReasonList',
wfMsgForContent( 'filedelete-reason-dropdown' ),
wfMsgForContent( 'filedelete-reason-otherlist' ), '', 'wpReasonDropDown', 1 );
$form = Xml::openElement( 'form', array( 'method' => 'post', 'action' => $this->getAction() ) );

View file

@ -110,7 +110,8 @@ class IPBlockForm {
$blockExpiryFormOptions .= "<option value=\"$value\"$selected>$show</option>";
}
$reasonDropDown = Xml::listDropDown( 'wpBlockReasonList', wfMsgHtml( 'ipbreason-dropdown' ),
$reasonDropDown = Xml::listDropDown( 'wpBlockReasonList',
wfMsgForContent( 'ipbreason-dropdown' ),
wfMsgForContent( 'ipbreasonotherlist' ), '', 'wpBlockDropDown', 4 );
$token = $wgUser->editToken();

View file

@ -346,7 +346,7 @@ class Xml {
$options = self::option( $other, 'other', $selected === 'other' );
foreach ( explode( "\n", $list ) as $option) {
$value = trim( htmlspecialchars($option) );
$value = trim( $option );
if ( $value == '' ) {
continue;
} elseif ( substr( $value, 0, 1) == '*' && substr( $value, 1, 1) != '*' ) {
@ -368,8 +368,18 @@ class Xml {
}
if( $optgroup ) $options .= self::closeElement('optgroup');
return Xml::openElement( 'select', array( 'id' => $name, 'name' => $name,
'class' => $class, 'tabindex' => $tabindex ) )
$attribs = array();
if( $name ) {
$attribs['id'] = $name;
$attribs['name'] = $name;
}
if( $class ) {
$attribs['class'] = $class;
}
if( $tabindex ) {
$attribs['tabindex'] = $tabindex;
}
return Xml::openElement( 'select', $attribs )
. "\n"
. $options
. "\n"