r47025 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r47024‎ | r47025 | r47026 >
Date:07:42, 9 February 2009
Author:aaron
Status:resolved (Comments)
Tags:
Comment:
* Tweaks for bug 17052:
** Made radio button default selection fallback to the next one for deleted revs
** Use deleted diff message rather than showing an ambiguous "empty diff"
* Code style tweaks
Modified paths:
  • /trunk/phase3/includes/PageHistory.php (modified) (history)
  • /trunk/phase3/includes/diff/DifferenceEngine.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/diff/DifferenceEngine.php
@@ -219,11 +219,10 @@
220220 $oldminor = '';
221221 $newminor = '';
222222
223 - if ($this->mOldRev->mMinorEdit == 1) {
 223+ if( $this->mOldRev->isMinor() ) {
224224 $oldminor = Xml::span( wfMsg( 'minoreditletter' ), 'minor' ) . ' ';
225225 }
226 -
227 - if ($this->mNewRev->mMinorEdit == 1) {
 226+ if( $this->mNewRev->isMinor() ) {
228227 $newminor = Xml::span( wfMsg( 'minoreditletter' ), 'minor' ) . ' ';
229228 }
230229
@@ -263,16 +262,22 @@
264263 '<div id="mw-diff-ntitle3">' . $newminor . $sk->revComment( $this->mNewRev, !$diffOnly, true ) . $rdel . "</div>" .
265264 '<div id="mw-diff-ntitle4">' . $nextlink . $patrol . '</div>';
266265
267 - if( $wgEnableHtmlDiff && $this->htmldiff) {
 266+ # Output the diff
 267+ if( !$this->mOldRev->userCan(Revision::DELETED_TEXT) || !$this->mNewRev->userCan(Revision::DELETED_TEXT) ) {
 268+ $this->showDiffStyle();
268269 $multi = $this->getMultiNotice();
 270+ $wgOut->addHTML( $this->addHeader( '', $oldHeader, $newHeader, $multi ) );
 271+ $wgOut->addWikiMsg( 'rev-deleted-no-diff' );
 272+ } else if( $wgEnableHtmlDiff && $this->htmldiff ) {
 273+ $multi = $this->getMultiNotice();
269274 $wgOut->addHTML('<div class="diff-switchtype">'.$sk->makeKnownLinkObj( $this->mTitle, wfMsgHtml( 'wikicodecomparison' ),
270 - 'diff='.$this->mNewid.'&oldid='.$this->mOldid.'&htmldiff=0', '', '', 'id="differences-switchtype"' ).'</div>');
 275+ 'diff='.$this->mNewid.'&oldid='.$this->mOldid.'&htmldiff=0', '', '', 'id="differences-switchtype"' ).'</div>');
271276 $wgOut->addHTML( $this->addHeader( '', $oldHeader, $newHeader, $multi ) );
272277 $this->renderHtmlDiff();
273278 } else {
274 - if($wgEnableHtmlDiff){
 279+ if( $wgEnableHtmlDiff ) {
275280 $wgOut->addHTML('<div class="diff-switchtype">'.$sk->makeKnownLinkObj( $this->mTitle, wfMsgHtml( 'visualcomparison' ),
276 - 'diff='.$this->mNewid.'&oldid='.$this->mOldid.'&htmldiff=1', '', '', 'id="differences-switchtype"' ).'</div>');
 281+ 'diff='.$this->mNewid.'&oldid='.$this->mOldid.'&htmldiff=1', '', '', 'id="differences-switchtype"' ).'</div>');
277282 }
278283 $this->showDiff( $oldHeader, $newHeader );
279284 if( !$diffOnly ) {
@@ -290,7 +295,7 @@
291296 wfProfileIn( __METHOD__ );
292297
293298 $wgOut->addHTML( "<hr /><h2>{$this->mPagetitle}</h2>\n" );
294 - #add deleted rev tag if needed
 299+ # Add deleted rev tag if needed
295300 if( !$this->mNewRev->userCan(Revision::DELETED_TEXT) ) {
296301 $wgOut->addWikiMsg( 'rev-deleted-text-permission' );
297302 } else if( $this->mNewRev->isDeleted(Revision::DELETED_TEXT) ) {
@@ -306,9 +311,8 @@
307312 $wgOut->setRevisionId( $this->mNewRev->getId() );
308313 }
309314
310 - if ($this->mTitle->isCssJsSubpage() || $this->mTitle->isCssOrJsPage()) {
 315+ if( $this->mTitle->isCssJsSubpage() || $this->mTitle->isCssOrJsPage() ) {
311316 // Stolen from Article::view --AG 2007-10-11
312 -
313317 // Give hooks a chance to customise the output
314318 if( wfRunHooks( 'ShowRawCssJs', array( $this->mNewtext, $this->mTitle, $wgOut ) ) ) {
315319 // Wrap the whole lot in a <pre> and don't parse
@@ -318,8 +322,9 @@
319323 $wgOut->addHTML( htmlspecialchars( $this->mNewtext ) );
320324 $wgOut->addHTML( "\n</pre>\n" );
321325 }
322 - } else
323 - $wgOut->addWikiTextTidy( $this->mNewtext );
 326+ } else {
 327+ $wgOut->addWikiTextTidy( $this->mNewtext );
 328+ }
324329
325330 if( !$this->mNewRev->isCurrent() ) {
326331 $wgOut->parserOptions()->setEditSection( $oldEditSectionSetting );
Index: trunk/phase3/includes/PageHistory.php
@@ -23,6 +23,8 @@
2424 var $lastdate;
2525 var $linesonpage;
2626 var $mLatestId = null;
 27+
 28+ private $mOldIdChecked = 0;
2729
2830 /**
2931 * Construct a new PageHistory.
@@ -442,40 +444,29 @@
443445 * @return string HTML output for the radio buttons
444446 */
445447 function diffButtons( $rev, $firstInList, $counter ) {
446 - if( $this->linesonpage > 1) {
447 - $radio = array(
448 - 'type' => 'radio',
449 - 'value' => $rev->getId(),
450 - );
451 -
452 - if( !$rev->userCan( Revision::DELETED_TEXT ) ) {
453 - $radio['disabled'] = 'disabled';
454 - }
455 -
 448+ if( $this->linesonpage > 1 ) {
 449+ $radio = array( 'type' => 'radio', 'value' => $rev->getId() );
456450 /** @todo: move title texts to javascript */
457451 if( $firstInList ) {
458 - $first = Xml::element( 'input', array_merge(
459 - $radio,
460 - array(
461 - 'style' => 'visibility:hidden',
462 - 'name' => 'oldid' ) ) );
 452+ $first = Xml::element( 'input',
 453+ array_merge( $radio, array( 'style' => 'visibility:hidden', 'name' => 'oldid' ) )
 454+ );
463455 $checkmark = array( 'checked' => 'checked' );
464456 } else {
465 - if( $counter == 2 ) {
 457+ # Check visibility of old revisions
 458+ if( !$rev->userCan( Revision::DELETED_TEXT ) ) {
 459+ $radio['disabled'] = 'disabled';
 460+ $checkmark = array(); // We will check the next possible one
 461+ } else if( $counter == 2 || !$this->mOldIdChecked ) {
466462 $checkmark = array( 'checked' => 'checked' );
 463+ $this->mOldIdChecked = $rev->getId();
467464 } else {
468465 $checkmark = array();
469466 }
470 - $first = Xml::element( 'input', array_merge(
471 - $radio,
472 - $checkmark,
473 - array( 'name' => 'oldid' ) ) );
 467+ $first = Xml::element( 'input', array_merge( $radio, $checkmark, array( 'name' => 'oldid' ) ) );
474468 $checkmark = array();
475469 }
476 - $second = Xml::element( 'input', array_merge(
477 - $radio,
478 - $checkmark,
479 - array( 'name' => 'diff' ) ) );
 470+ $second = Xml::element( 'input', array_merge( $radio, $checkmark, array( 'name' => 'diff' ) ) );
480471 return $first . $second;
481472 } else {
482473 return '';
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -1291,6 +1291,8 @@
12921292 This page revision has been removed from the public archives.
12931293 As an administrator on {{SITENAME}} you can view it;
12941294 there may be details in the [{{fullurl:Special:Log/delete|page={{FULLPAGENAMEE}}}} deletion log].</div>',
 1295+'rev-deleted-no-diff' => '<div class="mw-warning plainlinks">You cannot view this diff because one of the revisions has been removed from the public archives.
 1296+There may be details in the [{{fullurl:Special:Log/delete|page={{FULLPAGENAMEE}}}} deletion log].</div>',
12951297 'rev-delundel' => 'show/hide',
12961298 'revisiondelete' => 'Delete/undelete revisions',
12971299 'revdelete-nooldid-title' => 'Invalid target revision',

Follow-up revisions

RevisionCommit summaryAuthorDate
r47033Follow up r47025: Add new messageraymond12:39, 9 February 2009

Comments

#Comment by Raymond (talk | contribs)   12:42, 9 February 2009

Follow up in r47033: New message added to messages.inc

Status & tagging log