Index: trunk/phase3/includes/diff/DifferenceEngine.php |
— | — | @@ -219,11 +219,10 @@ |
220 | 220 | $oldminor = ''; |
221 | 221 | $newminor = ''; |
222 | 222 | |
223 | | - if ($this->mOldRev->mMinorEdit == 1) { |
| 223 | + if( $this->mOldRev->isMinor() ) { |
224 | 224 | $oldminor = Xml::span( wfMsg( 'minoreditletter' ), 'minor' ) . ' '; |
225 | 225 | } |
226 | | - |
227 | | - if ($this->mNewRev->mMinorEdit == 1) { |
| 226 | + if( $this->mNewRev->isMinor() ) { |
228 | 227 | $newminor = Xml::span( wfMsg( 'minoreditletter' ), 'minor' ) . ' '; |
229 | 228 | } |
230 | 229 | |
— | — | @@ -263,16 +262,22 @@ |
264 | 263 | '<div id="mw-diff-ntitle3">' . $newminor . $sk->revComment( $this->mNewRev, !$diffOnly, true ) . $rdel . "</div>" . |
265 | 264 | '<div id="mw-diff-ntitle4">' . $nextlink . $patrol . '</div>'; |
266 | 265 | |
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(); |
268 | 269 | $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(); |
269 | 274 | $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>'); |
271 | 276 | $wgOut->addHTML( $this->addHeader( '', $oldHeader, $newHeader, $multi ) ); |
272 | 277 | $this->renderHtmlDiff(); |
273 | 278 | } else { |
274 | | - if($wgEnableHtmlDiff){ |
| 279 | + if( $wgEnableHtmlDiff ) { |
275 | 280 | $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>'); |
277 | 282 | } |
278 | 283 | $this->showDiff( $oldHeader, $newHeader ); |
279 | 284 | if( !$diffOnly ) { |
— | — | @@ -290,7 +295,7 @@ |
291 | 296 | wfProfileIn( __METHOD__ ); |
292 | 297 | |
293 | 298 | $wgOut->addHTML( "<hr /><h2>{$this->mPagetitle}</h2>\n" ); |
294 | | - #add deleted rev tag if needed |
| 299 | + # Add deleted rev tag if needed |
295 | 300 | if( !$this->mNewRev->userCan(Revision::DELETED_TEXT) ) { |
296 | 301 | $wgOut->addWikiMsg( 'rev-deleted-text-permission' ); |
297 | 302 | } else if( $this->mNewRev->isDeleted(Revision::DELETED_TEXT) ) { |
— | — | @@ -306,9 +311,8 @@ |
307 | 312 | $wgOut->setRevisionId( $this->mNewRev->getId() ); |
308 | 313 | } |
309 | 314 | |
310 | | - if ($this->mTitle->isCssJsSubpage() || $this->mTitle->isCssOrJsPage()) { |
| 315 | + if( $this->mTitle->isCssJsSubpage() || $this->mTitle->isCssOrJsPage() ) { |
311 | 316 | // Stolen from Article::view --AG 2007-10-11 |
312 | | - |
313 | 317 | // Give hooks a chance to customise the output |
314 | 318 | if( wfRunHooks( 'ShowRawCssJs', array( $this->mNewtext, $this->mTitle, $wgOut ) ) ) { |
315 | 319 | // Wrap the whole lot in a <pre> and don't parse |
— | — | @@ -318,8 +322,9 @@ |
319 | 323 | $wgOut->addHTML( htmlspecialchars( $this->mNewtext ) ); |
320 | 324 | $wgOut->addHTML( "\n</pre>\n" ); |
321 | 325 | } |
322 | | - } else |
323 | | - $wgOut->addWikiTextTidy( $this->mNewtext ); |
| 326 | + } else { |
| 327 | + $wgOut->addWikiTextTidy( $this->mNewtext ); |
| 328 | + } |
324 | 329 | |
325 | 330 | if( !$this->mNewRev->isCurrent() ) { |
326 | 331 | $wgOut->parserOptions()->setEditSection( $oldEditSectionSetting ); |
Index: trunk/phase3/includes/PageHistory.php |
— | — | @@ -23,6 +23,8 @@ |
24 | 24 | var $lastdate; |
25 | 25 | var $linesonpage; |
26 | 26 | var $mLatestId = null; |
| 27 | + |
| 28 | + private $mOldIdChecked = 0; |
27 | 29 | |
28 | 30 | /** |
29 | 31 | * Construct a new PageHistory. |
— | — | @@ -442,40 +444,29 @@ |
443 | 445 | * @return string HTML output for the radio buttons |
444 | 446 | */ |
445 | 447 | 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() ); |
456 | 450 | /** @todo: move title texts to javascript */ |
457 | 451 | 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 | + ); |
463 | 455 | $checkmark = array( 'checked' => 'checked' ); |
464 | 456 | } 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 ) { |
466 | 462 | $checkmark = array( 'checked' => 'checked' ); |
| 463 | + $this->mOldIdChecked = $rev->getId(); |
467 | 464 | } else { |
468 | 465 | $checkmark = array(); |
469 | 466 | } |
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' ) ) ); |
474 | 468 | $checkmark = array(); |
475 | 469 | } |
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' ) ) ); |
480 | 471 | return $first . $second; |
481 | 472 | } else { |
482 | 473 | return ''; |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -1291,6 +1291,8 @@ |
1292 | 1292 | This page revision has been removed from the public archives. |
1293 | 1293 | As an administrator on {{SITENAME}} you can view it; |
1294 | 1294 | 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>', |
1295 | 1297 | 'rev-delundel' => 'show/hide', |
1296 | 1298 | 'revisiondelete' => 'Delete/undelete revisions', |
1297 | 1299 | 'revdelete-nooldid-title' => 'Invalid target revision', |