Index: trunk/extensions/Oversight/HideRevision.i18n.php |
— | — | @@ -37,11 +37,19 @@ |
38 | 38 | 'hiderevision-error-current' => 'Cannot delete the latest edit to a page. Revert this change first.', |
39 | 39 | 'hiderevision-error-delete' => 'Could not archive; was it previously deleted?', |
40 | 40 | 'hiderevision-archive-status' => 'Deleted revision from $1: $2', |
| 41 | +'oversight-nodiff' => 'Unable to track changes as there is currently no previous revision for the page. Either: |
| 42 | +*The page was deleted |
| 43 | +*This hidden revision was the first revision', |
41 | 44 | // Logging |
42 | 45 | 'oversight-log-hiderev' => 'removed an edit from $1', |
43 | 46 | // Oversight review page |
44 | 47 | 'oversight' => 'Oversight', |
45 | 48 | 'oversight-view' => 'details', |
| 49 | +'oversight-difference' => '(Difference from previous remaining revision)', |
| 50 | +'oversight-prev' => 'Last previous revision', |
| 51 | +'oversight-hidden' => 'Hidden revision', |
| 52 | +'oversight-header' => 'Below is a list of revisions permanantly hidden from public view. |
| 53 | +Releasing this information can result in permanent loss of Oversight priviledges.', |
46 | 54 | ), |
47 | 55 | |
48 | 56 | /* German (Raymond) */ |
— | — | @@ -108,11 +116,18 @@ |
109 | 117 | 'hiderevision-error-current' => 'Ne peut supprimer la dernière révision dans une page. Faites une annulation d’édition auparavant.', |
110 | 118 | 'hiderevision-error-delete' => 'Ne peut être archivé ; la page a peut-être été supprimée ?', |
111 | 119 | 'hiderevision-archive-status' => 'Modification supprimée de $1 : $2', |
| 120 | +'oversight-nodiff' => 'Incapable de dépister des changements en tant que là n\'est actuellement aucune révision précédente pour la page. L\'un ou l\'autre: |
| 121 | +*La page a été supprimée |
| 122 | +*Cette révision cachée était la première révision de la page', |
112 | 123 | // Logging |
113 | 124 | 'oversight-log-hiderev' => 'a supprimé une édition de $1', |
114 | 125 | // Oversight review page |
115 | 126 | 'oversight' => 'Oversight', |
116 | 127 | 'oversight-view' => 'détails', |
| 128 | +'oversight-difference' => '(Différence de révision restante précédente)', |
| 129 | +'oversight-prev' => 'Dernière révision précédente', |
| 130 | +'oversight-hidden' => 'Révision cachée', |
| 131 | +'oversight-header' => 'Au-dessous de est une liste de révisions cachées de manière permanente de la vue publique. Libérer cette information peut avoir comme conséquence la perte permanente de priviledges d\'Oversight.', |
117 | 132 | ), |
118 | 133 | |
119 | 134 | /* Portuguese (Lugusto) */ |
Index: trunk/extensions/Oversight/HideRevision.php |
— | — | @@ -56,10 +56,8 @@ |
57 | 57 | require_once( dirname( __FILE__ ) . '/HideRevision.i18n.php' ); |
58 | 58 | foreach( hrHideRevisionMessages() as $lang => $messages ) |
59 | 59 | $GLOBALS['wgMessageCache']->addMessages( $messages, $lang ); |
60 | | - |
61 | 60 | } |
62 | 61 | |
63 | | - |
64 | 62 | /** |
65 | 63 | * Hook for article view, giving us a chance to insert a removal |
66 | 64 | * tab on old version views. |
— | — | @@ -195,11 +193,11 @@ |
196 | 194 | 'method' => 'post' ) ) . |
197 | 195 | |
198 | 196 | // Visible fields |
199 | | - wfInputLabel( wfMsg( 'hiderevision-prompt' ), 'revision[]', 'wpRevision', 10 ) . |
| 197 | + wfInputLabel( wfMsgHTML( 'hiderevision-prompt' ), 'revision[]', 'wpRevision', 10 ) . |
200 | 198 | "<br />" . |
201 | | - wfInputLabel( wfMsg( 'hiderevision-reason' ), 'wpReason', 'wpReason', 60 ) . |
| 199 | + wfInputLabel( wfMsgHTML( 'hiderevision-reason' ), 'wpReason', 'wpReason', 60 ) . |
202 | 200 | "<br />" . |
203 | | - wfSubmitButton( wfMsg( 'hiderevision-continue' ) ) . |
| 201 | + wfSubmitButton( wfMsgHTML( 'hiderevision-continue' ) ) . |
204 | 202 | |
205 | 203 | wfCloseElement( 'form' ) ); |
206 | 204 | } |
— | — | @@ -224,9 +222,9 @@ |
225 | 223 | |
226 | 224 | // Visible fields |
227 | 225 | "<br />" . |
228 | | - wfInputLabel( wfMsg( 'hiderevision-reason' ), 'wpReason', 'wpReason', 60, $this->mReason ) . |
| 226 | + wfInputLabel( wfMsgHTML( 'hiderevision-reason' ), 'wpReason', 'wpReason', 60, $this->mReason ) . |
229 | 227 | "<br />" . |
230 | | - wfSubmitButton( wfMsg( 'hiderevision-submit' ) ) . |
| 228 | + wfSubmitButton( wfMsgHTML( 'hiderevision-submit' ) ) . |
231 | 229 | |
232 | 230 | // Hidden fields |
233 | 231 | $this->revisionFields() . |
— | — | @@ -354,16 +352,16 @@ |
355 | 353 | function hrHideRevisions( $dbw, $title, $revisions, $timestamps, $reason ) { |
356 | 354 | // Live revisions |
357 | 355 | foreach( $revisions as $id ) { |
358 | | - $success[] = wfMsg( 'hiderevision-status', $id, |
359 | | - wfMsg( hrHideRevision( $dbw, $id, $reason ) ) ); |
| 356 | + $success[] = wfMsgHTML( 'hiderevision-status', $id, |
| 357 | + wfMsgHTML (hrHideRevision( $dbw, $id, $reason ) ) ); |
360 | 358 | } |
361 | 359 | |
362 | 360 | // Archived revisions |
363 | 361 | foreach( $timestamps as $timestamp ) { |
364 | 362 | global $wgLang; |
365 | | - $success[] = wfMsg( 'hiderevision-archive-status', |
| 363 | + $success[] = wfMsgHTML( 'hiderevision-archive-status', |
366 | 364 | $wgLang->timeanddate( $timestamp ), |
367 | | - wfMsg( hrHideArchivedRevision( $dbw, $title, |
| 365 | + wfMsgHTML( hrHideArchivedRevision( $dbw, $title, |
368 | 366 | $timestamp, $reason ) ) ); |
369 | 367 | } |
370 | 368 | return $success; |
— | — | @@ -485,7 +483,9 @@ |
486 | 484 | function wfSpecialOversight( $par=null ) { |
487 | 485 | global $wgRequest, $wgUser; |
488 | 486 | $revision = $wgRequest->getIntOrNull( 'revision' ); |
489 | | - if( is_null( $revision ) ) { |
| 487 | + if ( $wgRequest->getCheck( 'diff' ) && !is_null( $revision )) { |
| 488 | + sosShowDiff( $revision); |
| 489 | + } else if( is_null( $revision ) ) { |
490 | 490 | sosShowList(); |
491 | 491 | } else { |
492 | 492 | sosShowRevision( $revision ); |
— | — | @@ -500,6 +500,7 @@ |
501 | 501 | array( 'hidden_on_timestamp < ' . $dbr->addQuotes( $fromTime ) ) ); |
502 | 502 | |
503 | 503 | global $wgOut; |
| 504 | + $wgOut->addWikiText( wfMsgNoTrans( 'oversight-header' ) ); |
504 | 505 | $wgOut->addHtml( '<ul>' ); |
505 | 506 | while( $row = $dbr->fetchObject( $result ) ) { |
506 | 507 | $wgOut->addHtml( sosListRow( $row ) ); |
— | — | @@ -552,14 +553,18 @@ |
553 | 554 | $userPage = Title::makeTitle( NS_USER, $row->user_name ); |
554 | 555 | $victim = Title::makeTitle( $row->page_namespace, $row->page_title ); |
555 | 556 | return "<li>(" . |
556 | | - $skin->makeLinkObj( $self, wfMsgHtml( 'oversight-view' ), |
| 557 | + $skin->makeKnownLinkObj( $self, wfMsgHTML( 'oversight-view' ), |
557 | 558 | 'revision=' . $row->rev_id ) . |
558 | 559 | ") " . |
| 560 | + "(" . |
| 561 | + $skin->makeKnownLinkObj( $self, wfMsgHTML( 'diff' ), |
| 562 | + 'revision=' . $row->rev_id . '&diff=1') . |
| 563 | + ") " . |
559 | 564 | $wgLang->timeanddate( $row->hidden_on_timestamp ) . |
560 | 565 | " " . |
561 | 566 | $skin->makeLinkObj( $userPage, htmlspecialchars( $userPage->getText() ) ) . |
562 | 567 | " " . |
563 | | - wfMsgHtml( 'oversight-log-hiderev', $skin->makeLinkObj( $victim ) ) . |
| 568 | + wfMsgHTML( 'oversight-log-hiderev', $skin->makeLinkObj( $victim ) ) . |
564 | 569 | " " . |
565 | 570 | $skin->commentBlock( $row->hidden_reason ) . |
566 | 571 | "</li>\n"; |
— | — | @@ -575,12 +580,16 @@ |
576 | 581 | $info = sosListRow( $row ); |
577 | 582 | $list = sosRevisionInfo( $row ); |
578 | 583 | $rev = new Revision( $row ); |
579 | | - |
| 584 | + $text = $rev->getText(); |
580 | 585 | $wgOut->addHtml( |
581 | 586 | "<ul>" . |
582 | 587 | $info . |
583 | 588 | "</ul>\n" . |
584 | | - $list . |
| 589 | + $list ); |
| 590 | + if ( $text === false ) { |
| 591 | + $wgOut->addWikiText(wfmsg('hiderevision-error-missing')); |
| 592 | + } else { |
| 593 | + $wgOut->addHtml( |
585 | 594 | "<div>" . |
586 | 595 | wfElement( 'textarea', |
587 | 596 | array( |
— | — | @@ -588,8 +597,9 @@ |
589 | 598 | 'rows' => 25, |
590 | 599 | 'wrap' => 'virtual', |
591 | 600 | 'readonly' => 'readonly' ), |
592 | | - strval( $rev->getText() ) ) . |
593 | | - "</div>\n" ); |
| 601 | + $text) . |
| 602 | + "</div>" ); |
| 603 | + } |
594 | 604 | } |
595 | 605 | $dbr->freeResult( $result ); |
596 | 606 | } |
— | — | @@ -605,4 +615,52 @@ |
606 | 616 | return $out; |
607 | 617 | } |
608 | 618 | |
| 619 | +function sosShowDiff( $revision ) |
| 620 | +{ |
| 621 | + global $wgOut; |
| 622 | + |
| 623 | + $dbr = wfGetDB( DB_SLAVE ); |
| 624 | + $result = sosGetRevisions( $dbr, array( 'hidden_rev_id' => $revision ) ); |
| 625 | + |
| 626 | + while( $row = $dbr->fetchObject( $result ) ) { |
| 627 | + $info = sosListRow( $row ); |
| 628 | + $list = sosRevisionInfo( $row ); |
| 629 | + $rev = new Revision( $row ); |
| 630 | + $rev->mTitle = Title::makeTitle( $row->page_namespace, $row->page_title ); |
| 631 | + $prevId = $rev->mTitle->getPreviousRevisionID( $row->rev_id ); |
| 632 | + if ( $prevId ) { |
| 633 | + $prev = Revision::newFromTitle( $rev->mTitle, $prevId ); |
| 634 | + $otext = strval( $prev->getText()); |
| 635 | + } else { |
| 636 | + $wgOut->addHtml( |
| 637 | + "<ul>" . |
| 638 | + $info . |
| 639 | + "</ul>\n" . |
| 640 | + $list ); |
| 641 | + $wgOut->addWikiText( wfMsgNoTrans( 'oversight-nodiff' ) ); |
| 642 | + return; |
| 643 | + } |
| 644 | + $ntext = strval( $rev->getText()); |
| 645 | + |
| 646 | + $wgOut->addHtml( |
| 647 | + "<ul>" . |
| 648 | + $info . |
| 649 | + "</ul>\n" . |
| 650 | + $list . |
| 651 | + "<p><strong>" . |
| 652 | + wfMsgHTML('oversight-difference') . |
| 653 | + "</strong>" . |
| 654 | + "</p>" . |
| 655 | + "<div>" . |
| 656 | + "<table border='0' width='98%' cellpadding='0' cellspacing='4' class='diff'>" . |
| 657 | + "<tr>" . |
| 658 | + "<td colspan='2' width='50%' align='center' class='diff-otitle'>" . wfMsgHTML('oversight-prev') . " (#$prevId)" . "</td>" . |
| 659 | + "<td colspan='2' width='50%' align='center' class='diff-ntitle'>" . wfMsgHTML('oversight-hidden') . "</td>" . |
| 660 | + "</tr>" . |
| 661 | + DifferenceEngine::generateDiffBody( $otext, $ntext ) . |
| 662 | + "</table>" . |
| 663 | + "</div>\n" ); |
| 664 | + } |
| 665 | + $dbr->freeResult( $result ); |
| 666 | +} |
609 | 667 | ?> |