r19543 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r19542‎ | r19543 | r19544 >
Date:02:41, 21 January 2007
Author:brion
Status:old
Tags:
Comment:
* (bug 8131) Diff view for Special:Oversight
Patch by VoiceOfAll, http://bugzilla.wikimedia.org/attachment.cgi?id=3102&action=view
Modified paths:
  • /trunk/extensions/Oversight/HideRevision.i18n.php (modified) (history)
  • /trunk/extensions/Oversight/HideRevision.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Oversight/HideRevision.i18n.php
@@ -37,11 +37,19 @@
3838 'hiderevision-error-current' => 'Cannot delete the latest edit to a page. Revert this change first.',
3939 'hiderevision-error-delete' => 'Could not archive; was it previously deleted?',
4040 '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',
4144 // Logging
4245 'oversight-log-hiderev' => 'removed an edit from $1',
4346 // Oversight review page
4447 'oversight' => 'Oversight',
4548 '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.',
4654 ),
4755
4856 /* German (Raymond) */
@@ -108,11 +116,18 @@
109117 'hiderevision-error-current' => 'Ne peut supprimer la dernière révision dans une page. Faites une annulation d’édition auparavant.',
110118 'hiderevision-error-delete' => 'Ne peut être archivé ; la page a peut-être été supprimée ?',
111119 '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',
112123 // Logging
113124 'oversight-log-hiderev' => 'a supprimé une édition de $1',
114125 // Oversight review page
115126 'oversight' => 'Oversight',
116127 '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.',
117132 ),
118133
119134 /* Portuguese (Lugusto) */
Index: trunk/extensions/Oversight/HideRevision.php
@@ -56,10 +56,8 @@
5757 require_once( dirname( __FILE__ ) . '/HideRevision.i18n.php' );
5858 foreach( hrHideRevisionMessages() as $lang => $messages )
5959 $GLOBALS['wgMessageCache']->addMessages( $messages, $lang );
60 -
6160 }
6261
63 -
6462 /**
6563 * Hook for article view, giving us a chance to insert a removal
6664 * tab on old version views.
@@ -195,11 +193,11 @@
196194 'method' => 'post' ) ) .
197195
198196 // Visible fields
199 - wfInputLabel( wfMsg( 'hiderevision-prompt' ), 'revision[]', 'wpRevision', 10 ) .
 197+ wfInputLabel( wfMsgHTML( 'hiderevision-prompt' ), 'revision[]', 'wpRevision', 10 ) .
200198 "<br />" .
201 - wfInputLabel( wfMsg( 'hiderevision-reason' ), 'wpReason', 'wpReason', 60 ) .
 199+ wfInputLabel( wfMsgHTML( 'hiderevision-reason' ), 'wpReason', 'wpReason', 60 ) .
202200 "<br />" .
203 - wfSubmitButton( wfMsg( 'hiderevision-continue' ) ) .
 201+ wfSubmitButton( wfMsgHTML( 'hiderevision-continue' ) ) .
204202
205203 wfCloseElement( 'form' ) );
206204 }
@@ -224,9 +222,9 @@
225223
226224 // Visible fields
227225 "<br />" .
228 - wfInputLabel( wfMsg( 'hiderevision-reason' ), 'wpReason', 'wpReason', 60, $this->mReason ) .
 226+ wfInputLabel( wfMsgHTML( 'hiderevision-reason' ), 'wpReason', 'wpReason', 60, $this->mReason ) .
229227 "<br />" .
230 - wfSubmitButton( wfMsg( 'hiderevision-submit' ) ) .
 228+ wfSubmitButton( wfMsgHTML( 'hiderevision-submit' ) ) .
231229
232230 // Hidden fields
233231 $this->revisionFields() .
@@ -354,16 +352,16 @@
355353 function hrHideRevisions( $dbw, $title, $revisions, $timestamps, $reason ) {
356354 // Live revisions
357355 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 ) ) );
360358 }
361359
362360 // Archived revisions
363361 foreach( $timestamps as $timestamp ) {
364362 global $wgLang;
365 - $success[] = wfMsg( 'hiderevision-archive-status',
 363+ $success[] = wfMsgHTML( 'hiderevision-archive-status',
366364 $wgLang->timeanddate( $timestamp ),
367 - wfMsg( hrHideArchivedRevision( $dbw, $title,
 365+ wfMsgHTML( hrHideArchivedRevision( $dbw, $title,
368366 $timestamp, $reason ) ) );
369367 }
370368 return $success;
@@ -485,7 +483,9 @@
486484 function wfSpecialOversight( $par=null ) {
487485 global $wgRequest, $wgUser;
488486 $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 ) ) {
490490 sosShowList();
491491 } else {
492492 sosShowRevision( $revision );
@@ -500,6 +500,7 @@
501501 array( 'hidden_on_timestamp < ' . $dbr->addQuotes( $fromTime ) ) );
502502
503503 global $wgOut;
 504+ $wgOut->addWikiText( wfMsgNoTrans( 'oversight-header' ) );
504505 $wgOut->addHtml( '<ul>' );
505506 while( $row = $dbr->fetchObject( $result ) ) {
506507 $wgOut->addHtml( sosListRow( $row ) );
@@ -552,14 +553,18 @@
553554 $userPage = Title::makeTitle( NS_USER, $row->user_name );
554555 $victim = Title::makeTitle( $row->page_namespace, $row->page_title );
555556 return "<li>(" .
556 - $skin->makeLinkObj( $self, wfMsgHtml( 'oversight-view' ),
 557+ $skin->makeKnownLinkObj( $self, wfMsgHTML( 'oversight-view' ),
557558 'revision=' . $row->rev_id ) .
558559 ") " .
 560+ "(" .
 561+ $skin->makeKnownLinkObj( $self, wfMsgHTML( 'diff' ),
 562+ 'revision=' . $row->rev_id . '&diff=1') .
 563+ ") " .
559564 $wgLang->timeanddate( $row->hidden_on_timestamp ) .
560565 " " .
561566 $skin->makeLinkObj( $userPage, htmlspecialchars( $userPage->getText() ) ) .
562567 " " .
563 - wfMsgHtml( 'oversight-log-hiderev', $skin->makeLinkObj( $victim ) ) .
 568+ wfMsgHTML( 'oversight-log-hiderev', $skin->makeLinkObj( $victim ) ) .
564569 " " .
565570 $skin->commentBlock( $row->hidden_reason ) .
566571 "</li>\n";
@@ -575,12 +580,16 @@
576581 $info = sosListRow( $row );
577582 $list = sosRevisionInfo( $row );
578583 $rev = new Revision( $row );
579 -
 584+ $text = $rev->getText();
580585 $wgOut->addHtml(
581586 "<ul>" .
582587 $info .
583588 "</ul>\n" .
584 - $list .
 589+ $list );
 590+ if ( $text === false ) {
 591+ $wgOut->addWikiText(wfmsg('hiderevision-error-missing'));
 592+ } else {
 593+ $wgOut->addHtml(
585594 "<div>" .
586595 wfElement( 'textarea',
587596 array(
@@ -588,8 +597,9 @@
589598 'rows' => 25,
590599 'wrap' => 'virtual',
591600 'readonly' => 'readonly' ),
592 - strval( $rev->getText() ) ) .
593 - "</div>\n" );
 601+ $text) .
 602+ "</div>" );
 603+ }
594604 }
595605 $dbr->freeResult( $result );
596606 }
@@ -605,4 +615,52 @@
606616 return $out;
607617 }
608618
 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+}
609667 ?>