r48120 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r48119‎ | r48120 | r48121 >
Date:06:19, 7 March 2009
Author:aaron
Status:ok
Tags:
Comment:
Remove more duplication
Modified paths:
  • /trunk/phase3/includes/specials/SpecialRevisiondelete.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialRevisiondelete.php
@@ -264,10 +264,7 @@
265265
266266 $wgOut->addHTML( "</ul>" );
267267 // Explanation text
268 - $wgOut->addWikiMsg( 'revdelete-text' );
269 - if( $wgUser->isAllowed( 'hiderevision' ) ) {
270 - $wgOut->addWikiMsg( 'revdelete-suppress-text' );
271 - }
 268+ $this->addUsageText();
272269
273270 // Normal sysops can always see what they did, but can't always change it
274271 if( !$UserAllowed ) return;
@@ -308,23 +305,6 @@
309306 Xml::closeElement( 'form' ) . "\n"
310307 );
311308 }
312 -
313 - /**
314 - * @param int $bitfields, aggregate bitfield of all the bitfields
315 - * @returns string HTML
316 - */
317 - private function buildCheckBoxes( $bitfields ) {
318 - $html = '';
319 - // FIXME: all items checked for just one rev are checked, even if not set for the others
320 - foreach( $this->checks as $item ) {
321 - list( $message, $name, $field ) = $item;
322 - $line = Xml::tags( 'div', null, Xml::checkLabel( wfMsg($message), $name, $name,
323 - $bitfields & $field ) );
324 - if( $field == Revision::DELETED_RESTRICTED ) $line = "<b>$line</b>";
325 - $html .= $line;
326 - }
327 - return $html;
328 - }
329309
330310 /**
331311 * This lets a user set restrictions for archived images
@@ -419,10 +399,7 @@
420400
421401 $wgOut->addHTML( "</ul>" );
422402 // Explanation text
423 - $wgOut->addWikiMsg('revdelete-text' );
424 - if( $wgUser->isAllowed( 'hiderevision' ) ) {
425 - $wgOut->addWikiMsg( 'revdelete-suppress-text' );
426 - }
 403+ $this->addUsageText();
427404 // Normal sysops can always see what they did, but can't always change it
428405 if( !$UserAllowed ) return;
429406
@@ -515,10 +492,7 @@
516493
517494 $wgOut->addHTML( "</ul>" );
518495 // Explanation text
519 - $wgOut->addWikiMsg( 'revdelete-text' );
520 - if( $wgUser->isAllowed( 'hiderevision' ) ) {
521 - $wgOut->addWikiMsg( 'revdelete-suppress-text' );
522 - }
 496+ $this->addUsageText();
523497 // Normal sysops can always see what they did, but can't always change it
524498 if( !$UserAllowed ) return;
525499
@@ -553,6 +527,31 @@
554528 Xml::closeElement( 'form' ) . "\n"
555529 );
556530 }
 531+
 532+ private function addUsageText() {
 533+ global $wgOut, $wgUser;
 534+ $wgOut->addWikiMsg( 'revdelete-text' );
 535+ if( $wgUser->isAllowed( 'hiderevision' ) ) {
 536+ $wgOut->addWikiMsg( 'revdelete-suppress-text' );
 537+ }
 538+ }
 539+
 540+ /**
 541+ * @param int $bitfields, aggregate bitfield of all the bitfields
 542+ * @returns string HTML
 543+ */
 544+ private function buildCheckBoxes( $bitfields ) {
 545+ $html = '';
 546+ // FIXME: all items checked for just one rev are checked, even if not set for the others
 547+ foreach( $this->checks as $item ) {
 548+ list( $message, $name, $field ) = $item;
 549+ $line = Xml::tags( 'div', null, Xml::checkLabel( wfMsg($message), $name, $name,
 550+ $bitfields & $field ) );
 551+ if( $field == Revision::DELETED_RESTRICTED ) $line = "<b>$line</b>";
 552+ $html .= $line;
 553+ }
 554+ return $html;
 555+ }
557556
558557 /**
559558 * @param Revision $rev

Status & tagging log