r81427 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r81426‎ | r81427 | r81428 >
Date:22:31, 2 February 2011
Author:reedy
Status:ok
Tags:
Comment:
Followup r67094, factor out code duplication in HistoryPage::getStartBody()
Modified paths:
  • /trunk/phase3/includes/HistoryPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/HistoryPage.php
@@ -401,44 +401,35 @@
402402 ) . "\n";
403403
404404 if ( $wgUser->isAllowed( 'deleterevision' ) ) {
405 - $this->preventClickjacking();
406 - $float = $wgContLang->alignEnd();
407 - # Note bug #20966, <button> is non-standard in IE<8
408 - $element = Html::element( 'button',
409 - array(
410 - 'type' => 'submit',
411 - 'name' => 'revisiondelete',
412 - 'value' => '1',
413 - 'style' => "float: $float;",
414 - 'class' => 'mw-history-revisiondelete-button',
415 - ),
416 - wfMsg( 'showhideselectedversions' )
417 - ) . "\n";
418 - $s .= $element;
419 - $this->buttons .= $element;
 405+ $s .= $this->getRevisionButton( 'revisiondelete', 'showhideselectedversions' );
420406 }
421407 if ( $wgUser->isAllowed( 'revisionmove' ) ) {
422 - $this->preventClickjacking();
423 - $float = $wgContLang->alignEnd();
424 - # Note bug #20966, <button> is non-standard in IE<8
425 - $element = Html::element( 'button',
426 - array(
427 - 'type' => 'submit',
428 - 'name' => 'revisionmove',
429 - 'value' => '1',
430 - 'style' => "float: $float;",
431 - 'class' => 'mw-history-revisionmove-button',
432 - ),
433 - wfMsg( 'revisionmoveselectedversions' )
434 - ) . "\n";
435 - $s .= $element;
436 - $this->buttons .= $element;
 408+ $s .= $this->getRevisionButton( 'revisionmove', 'revisionmoveselectedversions' );
437409 }
438410 $this->buttons .= '</div>';
439411 $s .= '</div><ul id="pagehistory">' . "\n";
440412 return $s;
441413 }
442414
 415+ private function getRevisionButton( $name, $msg ) {
 416+ global $wgContLang;
 417+ $this->preventClickjacking();
 418+ $float = $wgContLang->alignEnd();
 419+ # Note bug #20966, <button> is non-standard in IE<8
 420+ $element = Html::element( 'button',
 421+ array(
 422+ 'type' => 'submit',
 423+ 'name' => $name,
 424+ 'value' => '1',
 425+ 'style' => "float: $float;",
 426+ 'class' => "mw-history-$name-button",
 427+ ),
 428+ wfMsg( 'revisionmoveselectedversions' )
 429+ ) . "\n";
 430+ $this->buttons .= $element;
 431+ return $element;
 432+ }
 433+
443434 function getEndBody() {
444435 if ( $this->lastRow ) {
445436 $latest = $this->counter == 1 && $this->mIsFirst;

Follow-up revisions

RevisionCommit summaryAuthorDate
r81429Followup r81427, actually use the $msg variablereedy22:43, 2 February 2011
r86155Merge r81448 from REL1_17: reverting RevisionMove feature back out until some...demon23:28, 15 April 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r67094New feature RevisionMove (bug 21312). Introducing SpecialRevisionMove.php and...churchofemacs18:00, 30 May 2010

Status & tagging log