From: Aaron Schulz Date: Sat, 7 Mar 2009 06:19:50 +0000 (+0000) Subject: Remove more duplication X-Git-Tag: 1.31.0-rc.0~42583 X-Git-Url: http://git.cyclocoop.org/data/%24self?a=commitdiff_plain;h=e05f1ea82d1b23afe0f94dab3fdf50d345209b00;p=lhc%2Fweb%2Fwiklou.git Remove more duplication --- diff --git a/includes/specials/SpecialRevisiondelete.php b/includes/specials/SpecialRevisiondelete.php index af193dcefd..b777b351d1 100644 --- a/includes/specials/SpecialRevisiondelete.php +++ b/includes/specials/SpecialRevisiondelete.php @@ -264,10 +264,7 @@ class RevisionDeleteForm { $wgOut->addHTML( "" ); // Explanation text - $wgOut->addWikiMsg( 'revdelete-text' ); - if( $wgUser->isAllowed( 'hiderevision' ) ) { - $wgOut->addWikiMsg( 'revdelete-suppress-text' ); - } + $this->addUsageText(); // Normal sysops can always see what they did, but can't always change it if( !$UserAllowed ) return; @@ -308,23 +305,6 @@ class RevisionDeleteForm { Xml::closeElement( 'form' ) . "\n" ); } - - /** - * @param int $bitfields, aggregate bitfield of all the bitfields - * @returns string HTML - */ - private function buildCheckBoxes( $bitfields ) { - $html = ''; - // FIXME: all items checked for just one rev are checked, even if not set for the others - foreach( $this->checks as $item ) { - list( $message, $name, $field ) = $item; - $line = Xml::tags( 'div', null, Xml::checkLabel( wfMsg($message), $name, $name, - $bitfields & $field ) ); - if( $field == Revision::DELETED_RESTRICTED ) $line = "$line"; - $html .= $line; - } - return $html; - } /** * This lets a user set restrictions for archived images @@ -419,10 +399,7 @@ class RevisionDeleteForm { $wgOut->addHTML( "" ); // Explanation text - $wgOut->addWikiMsg('revdelete-text' ); - if( $wgUser->isAllowed( 'hiderevision' ) ) { - $wgOut->addWikiMsg( 'revdelete-suppress-text' ); - } + $this->addUsageText(); // Normal sysops can always see what they did, but can't always change it if( !$UserAllowed ) return; @@ -515,10 +492,7 @@ class RevisionDeleteForm { $wgOut->addHTML( "" ); // Explanation text - $wgOut->addWikiMsg( 'revdelete-text' ); - if( $wgUser->isAllowed( 'hiderevision' ) ) { - $wgOut->addWikiMsg( 'revdelete-suppress-text' ); - } + $this->addUsageText(); // Normal sysops can always see what they did, but can't always change it if( !$UserAllowed ) return; @@ -553,6 +527,31 @@ class RevisionDeleteForm { Xml::closeElement( 'form' ) . "\n" ); } + + private function addUsageText() { + global $wgOut, $wgUser; + $wgOut->addWikiMsg( 'revdelete-text' ); + if( $wgUser->isAllowed( 'hiderevision' ) ) { + $wgOut->addWikiMsg( 'revdelete-suppress-text' ); + } + } + + /** + * @param int $bitfields, aggregate bitfield of all the bitfields + * @returns string HTML + */ + private function buildCheckBoxes( $bitfields ) { + $html = ''; + // FIXME: all items checked for just one rev are checked, even if not set for the others + foreach( $this->checks as $item ) { + list( $message, $name, $field ) = $item; + $line = Xml::tags( 'div', null, Xml::checkLabel( wfMsg($message), $name, $name, + $bitfields & $field ) ); + if( $field == Revision::DELETED_RESTRICTED ) $line = "$line"; + $html .= $line; + } + return $html; + } /** * @param Revision $rev