r82541 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r82540‎ | r82541 | r82542 >
Date:23:55, 20 February 2011
Author:aaron
Status:deferred
Tags:
Comment:
* Don't make a whole new bar for diff-on-draft ("flaggedrevsviewdiffs" preference); add diff to existing box/bar (bug 25975)
* Removed redundant revreview-pendingnotice msg by merging into the revreview-newest-* msgs (bug 25977)
* Reduced msg verbosity a bit for revreview-basic-* and revreview-quality-* msgs
* Fixed showDraftVersion() to fully respect $wgOut->isPrintable() as setPendingNotice/setReviewNotes shouldn't be shown in that case
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedArticleView.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/language/FlaggedRevs.i18n.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/language/FlaggedRevs.i18n.php
@@ -81,9 +81,9 @@
8282 'revreview-accuracy-4' => 'Featured',
8383 'revreview-auto' => '(automatic)',
8484 'revreview-basic' => 'This is the [[{{MediaWiki:Validationpage}}|stable version]], [{{fullurl:{{#Special:Log}}|type=review&page={{FULLPAGENAMEE}}}} checked] on <i>$2</i>.
85 -There {{PLURAL:$3|is|are}} [{{fullurl:{{FULLPAGENAMEE}}|oldid=$1&diff=cur&diffonly=0}} $3 pending {{PLURAL:$3|change|changes}}] awaiting review.',
 85+[{{fullurl:{{FULLPAGENAMEE}}|oldid=$1&diff=cur&diffonly=0}} $3 pending {{PLURAL:$3|change|changes}}] {{PLURAL:$3|awaits|await}} review.',
8686 'revreview-basic-i' => 'This is the [[{{MediaWiki:Validationpage}}|stable version]], [{{fullurl:{{#Special:Log}}|type=review&page={{FULLPAGENAMEE}}}} checked] on <i>$2</i>.
87 -There are [{{fullurl:{{FULLPAGENAMEE}}|oldid=$1&diff=cur&diffonly=0}} template/file changes] awaiting review.',
 87+[{{fullurl:{{FULLPAGENAMEE}}|oldid=$1&diff=cur&diffonly=0}} Template/file changes] await review.',
8888 'revreview-basic-old' => 'This is a [[{{MediaWiki:Validationpage}}|checked]] version ([{{fullurl:{{#Special:ReviewedVersions}}|page={{FULLPAGENAMEE}}}} list all]), [{{fullurl:{{#Special:Log}}|type=review&page={{FULLPAGENAMEE}}}} approved] on <i>$2</i>.
8989 New [{{fullurl:{{FULLPAGENAMEE}}|oldid=$1&diff=cur&diffonly=0}} changes] may have been made.',
9090 'revreview-basic-same' => 'This is the [[{{MediaWiki:Validationpage}}|stable version]], [{{fullurl:{{#Special:Log}}|type=review&page={{FULLPAGENAMEE}}}} checked] on <i>$2</i>.',
@@ -117,7 +117,6 @@
118118 'revreview-draft-title' => 'Pending changes are displayed on this page',
119119 'revreview-edit' => 'Edit',
120120 'revreview-editnotice' => '\'\'\'Your changes will be displayed to readers once an authorized user reviews them. ([[{{MediaWiki:Validationpage}}|help]])\'\'\'',
121 - 'revreview-pendingnotice' => "'''This is a [[{{MediaWiki:Validationpage}}|pending revision]] of this page. It may differ from the [{{fullurl:{{FULLPAGENAMEE}}|stable=1}} latest accepted revision], which was accepted on <i>$1</i>.'''",
122121 'revreview-check-flag-p' => 'Accept this version (includes $1 pending {{PLURAL:$1|change|changes}})',
123122 'revreview-check-flag-p-title' => 'Accept the result of the pending changes and the changes you made here. Use this only if you have already seen the entire pending changes diff.',
124123 'revreview-check-flag-u' => 'Accept this unreviewed page',
@@ -138,10 +137,14 @@
139138 'revreview-main' => 'You must select a particular revision of a content page in order to review.
140139
141140 See the [[Special:Unreviewedpages|list of unreviewed pages]].',
142 - 'revreview-newest-basic' => 'The [{{fullurl:{{FULLPAGENAMEE}}|stable=1}} stable version] was [{{fullurl:{{#Special:Log}}|type=review&page={{FULLPAGENAMEE}}}} checked] on <i>$2</i>. There {{PLURAL:$3|is|are}} [{{fullurl:{{FULLPAGENAMEE}}|oldid=$1&diff=cur&diffonly=0}} $3 pending {{PLURAL:$3|change|changes}}] awaiting review.',
143 - 'revreview-newest-basic-i' => 'The [{{fullurl:{{FULLPAGENAMEE}}|stable=1}} stable version] was [{{fullurl:{{#Special:Log}}|type=review&page={{FULLPAGENAMEE}}}} checked] on <i>$2</i>. There are [{{fullurl:{{FULLPAGENAMEE}}|oldid=$1&diff=cur&diffonly=0}} template/file changes] awaiting review.',
144 - 'revreview-newest-quality' => 'The [{{fullurl:{{FULLPAGENAMEE}}|stable=1}} stable version] was [{{fullurl:{{#Special:Log}}|type=review&page={{FULLPAGENAMEE}}}} approved] on <i>$2</i>. There {{PLURAL:$3|is|are}} [{{fullurl:{{FULLPAGENAMEE}}|oldid=$1&diff=cur&diffonly=0}} $3 pending {{PLURAL:$3|change|changes}}] awaiting review.',
145 - 'revreview-newest-quality-i' => 'The [{{fullurl:{{FULLPAGENAMEE}}|stable=1}} stable version] was [{{fullurl:{{#Special:Log}}|type=review&page={{FULLPAGENAMEE}}}} approved] on <i>$2</i>. There are [{{fullurl:{{FULLPAGENAMEE}}|oldid=$1&diff=cur&diffonly=0}} template/file changes] awaiting review.',
 141+ 'revreview-newest-basic' => '[{{fullurl:{{FULLPAGENAMEE}}|oldid=$1&diff=cur&diffonly=0}} $3 {{PLURAL:$3|change|changes}}] in this version {{PLURAL:$3|is|are}} [[{{MediaWiki:Validationpage}}|pending review]].
 142+ The [{{fullurl:{{FULLPAGENAMEE}}|stable=1}} stable version] was [{{fullurl:{{#Special:Log}}|type=review&page={{FULLPAGENAMEE}}}} checked] on <i>$2</i>.',
 143+ 'revreview-newest-basic-i' => '[{{fullurl:{{FULLPAGENAMEE}}|oldid=$1&diff=cur&diffonly=0}} Template/file changes] in this version are [[{{MediaWiki:Validationpage}}|pending review]].
 144+ The [{{fullurl:{{FULLPAGENAMEE}}|stable=1}} stable version] was [{{fullurl:{{#Special:Log}}|type=review&page={{FULLPAGENAMEE}}}} checked] on <i>$2</i>.',
 145+ 'revreview-newest-quality' => '[{{fullurl:{{FULLPAGENAMEE}}|oldid=$1&diff=cur&diffonly=0}} $3 {{PLURAL:$3|change|changes}}] in this version {{PLURAL:$3|is|are}} [[{{MediaWiki:Validationpage}}|pending review]].
 146+ The [{{fullurl:{{FULLPAGENAMEE}}|stable=1}} stable version] was [{{fullurl:{{#Special:Log}}|type=review&page={{FULLPAGENAMEE}}}} approved] on <i>$2</i>.',
 147+ 'revreview-newest-quality-i' => '[{{fullurl:{{FULLPAGENAMEE}}|oldid=$1&diff=cur&diffonly=0}} Template/file changes] in this version are [[{{MediaWiki:Validationpage}}|pending review]].
 148+ The [{{fullurl:{{FULLPAGENAMEE}}|stable=1}} stable version] was [{{fullurl:{{#Special:Log}}|type=review&page={{FULLPAGENAMEE}}}} approved] on <i>$2</i>.',
146149 'revreview-pending-basic' => 'The [{{fullurl:{{FULLPAGENAMEE}}|stable=1}} stable version] was [{{fullurl:{{#Special:Log}}|type=review&page={{FULLPAGENAMEE}}}} checked] on <i>$2</i>. There {{PLURAL:$3|is|are}} [{{fullurl:{{FULLPAGENAMEE}}|oldid=$1&diff=cur&diffonly=0}} $3 pending {{PLURAL:$3|change|changes}}] awaiting review.',
147150 'revreview-pending-quality' => 'The [{{fullurl:{{FULLPAGENAMEE}}|stable=1}} stable version] was [{{fullurl:{{#Special:Log}}|type=review&page={{FULLPAGENAMEE}}}} approved] on <i>$2</i>. There {{PLURAL:$3|is|are}} [{{fullurl:{{FULLPAGENAMEE}}|oldid=$1&diff=cur&diffonly=0}} $3 pending {{PLURAL:$3|change|changes}}] awaiting review.',
148151 'revreview-pending-nosection' => 'Try viewing the [{{fullurl:{{FULLPAGENAMEE}}|stable=0}} latest revision], which includes
@@ -151,9 +154,9 @@
152155 'revreview-notes' => 'Observations or notes to display:',
153156 'revreview-oldrating' => 'It was rated:',
154157 'revreview-quality' => 'This is the [[{{MediaWiki:Validationpage}}|stable version]], [{{fullurl:{{#Special:Log}}|type=review&page={{FULLPAGENAMEE}}}} approved] on <i>$2</i>.
155 -There {{PLURAL:$3|is|are}} [{{fullurl:{{FULLPAGENAMEE}}|oldid=$1&diff=cur&diffonly=0}} $3 pending {{PLURAL:$3|change|changes}}] awaiting review.',
 158+[{{fullurl:{{FULLPAGENAMEE}}|oldid=$1&diff=cur&diffonly=0}} $3 pending {{PLURAL:$3|change|changes}}] {{PLURAL:$3|awaits|awaits}} review.',
156159 'revreview-quality-i' => 'This is the [[{{MediaWiki:Validationpage}}|stable version]], [{{fullurl:{{#Special:Log}}|type=review&page={{FULLPAGENAMEE}}}} approved] on <i>$2</i>.
157 -There are [{{fullurl:{{FULLPAGENAMEE}}|oldid=$1&diff=cur&diffonly=0}} template/file changes] awaiting review.',
 160+[{{fullurl:{{FULLPAGENAMEE}}|oldid=$1&diff=cur&diffonly=0}} Template/file changes] await review.',
158161 'revreview-quality-old' => 'This is a [[{{MediaWiki:Validationpage}}|quality]] version ([{{fullurl:{{#Special:ReviewedVersions}}|page={{FULLPAGENAMEE}}}} list all]), [{{fullurl:{{#Special:Log}}|type=review&page={{FULLPAGENAMEE}}}} approved] on <i>$2</i>.
159162 New [{{fullurl:{{FULLPAGENAMEE}}|oldid=$1&diff=cur&diffonly=0}} changes] may have been made.',
160163 'revreview-quality-same' => 'This is the [[{{MediaWiki:Validationpage}}|stable version]], [{{fullurl:{{#Special:Log}}|type=review&page={{FULLPAGENAMEE}}}} approved] on <i>$2</i>.',
Index: trunk/extensions/FlaggedRevs/FlaggedArticleView.php
@@ -433,23 +433,29 @@
434434 protected function showDraftVersion( FlaggedRevision $srev, &$tag, $prot ) {
435435 global $wgUser, $wgOut, $wgLang, $wgRequest;
436436 $this->load();
 437+ if ( $wgOut->isPrintable() ) {
 438+ return; // all this function does is add notices; don't show them
 439+ }
437440 $flags = $srev->getTags();
438441 $time = $wgLang->date( $srev->getTimestamp(), true );
439442 # Get quality level
440443 $quality = FlaggedRevs::isQuality( $flags );
441444 # Get stable version sync status
442445 $synced = $this->article->stableVersionIsSynced();
443 - if ( $synced ) {
444 - $this->setReviewNotes( $srev ); // Still the same
445 - } else {
446 - # Make sure there is always a notice bar when viewing the draft
447 - if ( $this->useSimpleUI() ) { // already one for detailed UI
448 - $this->setPendingNotice( $srev );
 446+ if ( $synced ) { // draft == stable
 447+ $diffToggle = ''; // no diff to show
 448+ $this->setReviewNotes( $srev ); // same review notes apply
 449+ } else { // draft != stable
 450+ # The user may want the diff (via prefs)
 451+ $diffToggle = $this->getTopDiffToggle( $srev, $quality );
 452+ if ( $diffToggle != '' ) $diffToggle = " $diffToggle";
 453+ # Make sure there is always a notice bar when viewing the draft.
 454+ if ( $this->useSimpleUI() ) { // we already one for detailed UI
 455+ $this->setPendingNotice( $srev, $diffToggle );
449456 }
450 - $this->maybeShowTopDiff( $srev, $quality ); // user may want diff (via prefs)
451457 }
452 - # If they are synced, do special styling
453 - # Give notice to newer users if an unreviewed edit was completed...
 458+ # Give a "your edit is pending" notice to newer users if
 459+ # an unreviewed edit was completed...
454460 if ( $wgRequest->getVal( 'shownotice' )
455461 && $this->article->getUserText() == $wgUser->getName() // FIXME: rawUserText?
456462 && $this->article->revsArePending()
@@ -470,10 +476,10 @@
471477 # Notice should always use subtitle
472478 $this->reviewNotice = "<div id='mw-fr-reviewnotice' " .
473479 "class='flaggedrevs_preview plainlinks'>$pending</div>";
474 - # Construct some tagging for non-printable outputs. Note that the pending
475 - # notice has all this info already, so don't do this if we added that already.
 480+ # Otherwise, construct some tagging info for non-printable outputs.
476481 # Also, if low profile UI is enabled and the page is synced, skip the tag.
477 - } else if ( !$wgOut->isPrintable() && !( $this->article->lowProfileUI() && $synced ) ) {
 482+ # Note: the "your edit is pending" notice has all this info, so we never add both.
 483+ } else if ( !( $this->article->lowProfileUI() && $synced ) ) {
478484 $revsSince = $this->article->getPendingRevCount();
479485 // Simple icon-based UI
480486 if ( $this->useSimpleUI() ) {
@@ -523,7 +529,7 @@
524530 $icon = $synced
525531 ? FlaggedRevsXML::stableStatusIcon( $quality )
526532 : FlaggedRevsXML::draftStatusIcon();
527 - $tag .= $prot . $icon . $msgHTML;
 533+ $tag .= $prot . $icon . $msgHTML . $diffToggle;
528534 }
529535 }
530536 }
@@ -728,12 +734,12 @@
729735 }
730736
731737 /**
732 - * Add diff-to-stable to top of page views as needed
 738+ * Get collapsible diff-to-stable html to add to the review notice as needed
733739 * @param FlaggedRevision $srev, stable version
734740 * @param bool $quality, revision is quality
735 - * @returns bool, diff added to output
 741+ * @returns string, the html line (either "" or "<diff toggle><diff div>")
736742 */
737 - protected function maybeShowTopDiff( FlaggedRevision $srev, $quality ) {
 743+ protected function getTopDiffToggle( FlaggedRevision $srev, $quality ) {
738744 global $wgUser;
739745 $this->load();
740746 if ( !$wgUser->getBoolOption( 'flaggedrevsviewdiffs' ) ) {
@@ -771,25 +777,15 @@
772778 } else {
773779 $multiNotice = '';
774780 }
775 - $items = array();
776 - $diffHtml =
777 - FlaggedRevsXML::pendingEditNotice( $this->article, $srev, $revsSince ) .
778 - ' ' . FlaggedRevsXML::diffToggle() .
 781+ $diffEngine->showDiffStyle(); // add CSS
 782+ $this->isDiffFromStable = true; // alter default review form tags
 783+ return
 784+ FlaggedRevsXML::diffToggle() .
779785 "<div id='mw-fr-stablediff'>" .
780786 self::getFormattedDiff( $diffBody, $multiNotice, $leftNote, $rightNote ) .
781 - "</div>\n";
782 - $items[] = $diffHtml;
783 - $html = "<table class='flaggedrevs_viewnotice plainlinks'>";
784 - foreach ( $items as $item ) {
785 - $html .= '<tr><td>' . $item . '</td></tr>';
786 - }
787 - $html .= '</table>';
788 - $this->reviewNotice .= $html;
789 - $diffEngine->showDiffStyle(); // add CSS
790 - $this->isDiffFromStable = true; // alter default review form tags
791 - return true;
 787+ "</div>\n";;
792788 }
793 - return false;
 789+ return '';
794790 }
795791
796792 // $n number of in-between revs
@@ -1308,15 +1304,23 @@
13091305 /**
13101306 * Adds a notice saying that this revision is pending review
13111307 * @param FlaggedRevision $srev The stable version
 1308+ * @param string $diffToggle either "" or " <diff toggle><diff div>"
13121309 * @return void
13131310 */
1314 - public function setPendingNotice( FlaggedRevision $srev ) {
 1311+ public function setPendingNotice( FlaggedRevision $srev, $diffToggle = '' ) {
13151312 global $wgLang;
13161313 $this->load();
13171314 $time = $wgLang->date( $srev->getTimestamp(), true );
1318 - $pendingNotice = wfMsgExt( 'revreview-pendingnotice', 'parseinline', $time );
1319 - $this->reviewNotice .= "<div id='mw-fr-reviewnotice' class='flaggedrevs_preview plainlinks'>" .
1320 - $pendingNotice . "</div>";
 1315+ $revsSince = $this->article->getPendingRevCount();
 1316+ $msg = $srev->getQuality()
 1317+ ? 'revreview-newest-quality'
 1318+ : 'revreview-newest-basic';
 1319+ $msg .= ( $revsSince == 0 ) ? '-i' : '';
 1320+ # Add bar msg to the top of the page...
 1321+ $css = 'flaggedrevs_preview plainlinks';
 1322+ $msgHTML = wfMsgExt( $msg, 'parseinline', $srev->getRevId(), $time, $revsSince );
 1323+ $this->reviewNotice .= "<div id='mw-fr-reviewnotice' class='$css'>" .
 1324+ "$msgHTML$diffToggle</div>";
13211325 }
13221326
13231327 /**

Follow-up revisions

RevisionCommit summaryAuthorDate
r82542Follow-up r82541: never call setReviewNotes() for printable outputaaron00:11, 21 February 2011
r82549Rm tabs from messages in r82541.raymond14:07, 21 February 2011

Status & tagging log