From ab1946175eeff3c7c7923a84f6ece1f8d3a4d27d Mon Sep 17 00:00:00 2001 From: Raimond Spekking Date: Thu, 3 Apr 2008 15:43:37 +0000 Subject: [PATCH] * Use existent CSS classes for form labels und input fields * Fix tabindex sequence * Use XML functions consistently --- includes/SpecialBlockip.php | 104 +++++++++++++++++++----------------- 1 file changed, 54 insertions(+), 50 deletions(-) diff --git a/includes/SpecialBlockip.php b/includes/SpecialBlockip.php index aa48968ef9..1041ff6afd 100644 --- a/includes/SpecialBlockip.php +++ b/includes/SpecialBlockip.php @@ -67,7 +67,7 @@ class IPBlockForm { } function showForm( $err ) { - global $wgOut, $wgUser, $wgSysopUserBans, $wgContLang; + global $wgOut, $wgUser, $wgSysopUserBans; $wgOut->setPagetitle( wfMsg( 'blockip' ) ); $wgOut->addWikiMsg( 'blockiptext' ); @@ -79,17 +79,14 @@ class IPBlockForm { } $mIpbexpiry = Xml::label( wfMsg( 'ipbexpiry' ), 'wpBlockExpiry' ); $mIpbother = Xml::label( wfMsg( 'ipbother' ), 'mw-bi-other' ); - $mIpbothertime = wfMsgHtml( 'ipbotheroption' ); $mIpbreasonother = Xml::label( wfMsg( 'ipbreason' ), 'wpBlockReasonList' ); $mIpbreason = Xml::label( wfMsg( 'ipbotherreason' ), 'mw-bi-reason' ); $titleObj = SpecialPage::getTitleFor( 'Blockip' ); - $action = $titleObj->escapeLocalURL( "action=submit" ); - $alignRight = $wgContLang->isRtl() ? 'left' : 'right'; if ( "" != $err ) { $wgOut->setSubtitle( wfMsgHtml( 'formerror' ) ); - $wgOut->addHTML( "

{$err}

\n" ); + $wgOut->addHTML( Xml::tags( 'p', array( 'class' => 'error' ), $err ) ); } $scBlockExpiryOptions = wfMsgForContent( 'ipboptions' ); @@ -98,35 +95,31 @@ class IPBlockForm { if (!$showblockoptions) $mIpbother = $mIpbexpiry; - $blockExpiryFormOptions = ""; + $blockExpiryFormOptions = Xml::option( wfMsg( 'ipbotheroption' ), 'other' ); foreach (explode(',', $scBlockExpiryOptions) as $option) { if ( strpos($option, ":") === false ) $option = "$option:$option"; list($show, $value) = explode(":", $option); $show = htmlspecialchars($show); $value = htmlspecialchars($value); - $selected = ""; - if ($this->BlockExpiry === $value) - $selected = ' selected="selected"'; - $blockExpiryFormOptions .= ""; + $blockExpiryFormOptions .= Xml::option( $show, $value, $this->BlockExpiry === $value ? true : false ) . "\n"; } $reasonDropDown = Xml::listDropDown( 'wpBlockReasonList', wfMsgForContent( 'ipbreason-dropdown' ), wfMsgForContent( 'ipbreasonotherlist' ), '', 'wpBlockDropDown', 4 ); - $token = $wgUser->editToken(); - global $wgStylePath, $wgStyleVersion; - $wgOut->addHTML( " - -
" . + $wgOut->addHTML( + Xml::tags( 'script', array( 'type' => 'text/javascript', 'src' => "$wgStylePath/common/block.js?$wgStyleVersion" ), '' ) . + Xml::openElement( 'form', array( 'method' => 'post', 'action' => $titleObj->getLocalURL( "action=submit" ), 'id' => 'blockip' ) ) . Xml::openElement( 'fieldset' ) . Xml::element( 'legend', null, wfMsg( 'blockip-legend' ) ) . Xml::openElement( 'table', array ( 'border' => '0', 'id' => 'mw-blockip-table' ) ) . " - {$mIpaddress} - " . + + {$mIpaddress} + + " . Xml::input( 'wpBlockAddress', 45, $this->BlockAddress, array( 'tabindex' => '1', @@ -138,56 +131,68 @@ class IPBlockForm { ); if ( $showblockoptions ) { $wgOut->addHTML(" - {$mIpbexpiry} - - - " + + {$mIpbexpiry} + + " . + Xml::tags( 'select', + array( + 'id' => 'wpBlockExpiry', + 'name' => 'wpBlockExpiry', + 'onchange' => 'considerChangingExpiryFocus()', + 'tabindex' => '2' ), + $blockExpiryFormOptions ) . + "" ); } $wgOut->addHTML(" - {$mIpbother} - " . + + {$mIpbother} + + " . Xml::input( 'wpBlockOther', 45, $this->BlockOther, array( 'tabindex' => '3', 'id' => 'mw-bi-other' ) ) . " - {$mIpbreasonother} - - $reasonDropDown + + {$mIpbreasonother} + + + {$reasonDropDown} - {$mIpbreason} - " . + + {$mIpbreason} + + " . Xml::input( 'wpBlockReason', 45, $this->BlockReason, array( 'tabindex' => '5', 'id' => 'mw-bi-reason', 'maxlength'=> '200' ) ) . "   - " . - wfCheckLabel( wfMsgHtml( 'ipbanononly' ), + " . + Xml::checkLabel( wfMsg( 'ipbanononly' ), 'wpAnonOnly', 'wpAnonOnly', $this->BlockAnonOnly, array( 'tabindex' => '6' ) ) . "   - " . - wfCheckLabel( wfMsgHtml( 'ipbcreateaccount' ), + " . + Xml::checkLabel( wfMsg( 'ipbcreateaccount' ), 'wpCreateAccount', 'wpCreateAccount', $this->BlockCreateAccount, array( 'tabindex' => '7' ) ) . "   - " . - wfCheckLabel( wfMsgHtml( 'ipbenableautoblock' ), + " . + Xml::checkLabel( wfMsg( 'ipbenableautoblock' ), 'wpEnableAutoblock', 'wpEnableAutoblock', $this->BlockEnableAutoblock, array( 'tabindex' => '8' ) ) . " @@ -198,11 +203,11 @@ class IPBlockForm { if ( $wgSysopEmailBans && $wgUser->isAllowed( 'blockemail' ) ) { $wgOut->addHTML(" -   - " . - wfCheckLabel( wfMsgHtml( 'ipbemailban' ), +   + " . + Xml::checkLabel( wfMsg( 'ipbemailban' ), 'wpEmailBan', 'wpEmailBan', $this->BlockEmail, - array( 'tabindex' => '10' )) . " + array( 'tabindex' => '9' )) . " " ); @@ -212,11 +217,11 @@ class IPBlockForm { if ( $wgUser->isAllowed( 'hideuser' ) ) { $wgOut->addHTML(" -   - " . - wfCheckLabel( wfMsgHtml( 'ipbhidename' ), +   + " . + Xml::checkLabel( wfMsg( 'ipbhidename' ), 'wpHideName', 'wpHideName', $this->BlockHideName, - array( 'tabindex' => '9' ) ) . " + array( 'tabindex' => '10' ) ) . " " ); @@ -225,17 +230,16 @@ class IPBlockForm { $wgOut->addHTML("   - " . + " . Xml::submitButton( wfMsg( 'ipbsubmit' ), array( 'name' => 'wpBlock', 'tabindex' => '11' ) ) . " " . Xml::closeElement( 'table' ) . - Xml::hidden( 'wpEditToken', $token ) . + Xml::hidden( 'wpEditToken', $wgUser->editToken() ) . Xml::closeElement( 'fieldset' ) . -"
- -\n" + Xml::closeElement( 'form' ) . + Xml::tags( 'script', array( 'type' => 'text/javascript' ), 'updateBlockOptions()' ) . "\n" ); $wgOut->addHtml( $this->getConvenienceLinks() ); -- 2.20.1