Cleanup for r30216:
authorBrion Vibber <brion@users.mediawiki.org>
Mon, 28 Jan 2008 20:27:15 +0000 (20:27 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Mon, 28 Jan 2008 20:27:15 +0000 (20:27 +0000)
* 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

includes/Article.php
includes/FileDeleteForm.php
includes/SpecialBlockip.php
includes/Xml.php

index 009bdcf..5840afa 100644 (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( "
index 5f0b74c..7c97d46 100644 (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() ) );
index 6b26a35..b9d21fc 100644 (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();
index 2262df8..6689a4a 100644 (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"