r60676 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r60675‎ | r60676 | r60677 >
Date:17:56, 5 January 2010
Author:aaron
Status:resolved (Comments)
Tags:
Comment:
* Edit view UI:
**Fixed quality level CSS
**Removed checkbox icon
**Merged boxes into one
**Made diffs collapsible
* Messsage wording cleanups
* Removed code duplication in pendingEditBox()
* A few minor cleanups ($wgAjaxReview/history box CSS)
* Changed mw -> mw-fr for IDs to avoid collisions
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedArticleView.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevsXML.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/client/flaggedrevs.css (modified) (history)
  • /trunk/extensions/FlaggedRevs/client/flaggedrevs.js (modified) (history)
  • /trunk/extensions/FlaggedRevs/language/FlaggedRevs.i18n.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php
@@ -286,7 +286,7 @@
287287 $wgAvailableRights[] = 'stablesettings';
288288
289289 # Bump this number every time you change flaggedrevs.css/flaggedrevs.js
290 -$wgFlaggedRevStyleVersion = 63;
 290+$wgFlaggedRevStyleVersion = 64;
291291
292292 $wgExtensionFunctions[] = 'efLoadFlaggedRevs';
293293
Index: trunk/extensions/FlaggedRevs/language/FlaggedRevs.i18n.php
@@ -47,6 +47,10 @@
4848 'hist-stable' => 'sighted revision',
4949 'hist-stable-user' => '[{{fullurl:$1|stableid=$2}} sighted] by [[User:$3|$3]]',
5050 'hist-autoreviewed' => '[{{fullurl:$1|stableid=$2}} automatically sighted]',
 51+ 'review-edit-diff' => '\'\'\'NOTICE: Some pending changes to the published version are incorporated into the edit form below.\'\'\'',
 52+ 'revreview-diff-toggle-show' => '(show changes)',
 53+ 'revreview-diff-toggle-hide' => '(hide changes)',
 54+ 'revreview-diff-toggle-title' => 'Toggle display of changes between draft and the published version',
5155 'review-diff2stable' => 'View changes between stable and current revisions',
5256 'review-logentry-app' => 'reviewed a version of [[$1]]',
5357 'review-logentry-dis' => 'deprecated a version of [[$1]]',
@@ -67,7 +71,7 @@
6872 'revreview-approved' => 'Approved',
6973 'revreview-auto' => '(automatic)',
7074 'revreview-basic' => 'This is the [[{{MediaWiki:Validationpage}}|stable version]], [{{fullurl:{{#Special:Log}}|type=review&page={{FULLPAGENAMEE}}}} sighted] on <i>$2</i>.
71 -The [{{fullurl:{{FULLPAGENAMEE}}|stable=0}} draft] contains [{{fullurl:{{FULLPAGENAMEE}}|oldid=$1&diff=cur&diffonly=0}} $3 suggested {{PLURAL:$3|change|changes}}].',
 75+The [{{fullurl:{{FULLPAGENAMEE}}|stable=0}} draft] contains [{{fullurl:{{FULLPAGENAMEE}}|oldid=$1&diff=cur&diffonly=0}} $3 pending {{PLURAL:$3|change|changes}}].',
7276 'revreview-basic-i' => 'This is the [[{{MediaWiki:Validationpage}}|stable version]], [{{fullurl:{{#Special:Log}}|type=review&page={{FULLPAGENAMEE}}}} sighted] on <i>$2</i>.
7377 The [{{fullurl:{{FULLPAGENAMEE}}|stable=0}} draft] contains [{{fullurl:{{FULLPAGENAMEE}}|oldid=$1&diff=cur&diffonly=0}} template/file changes] awaiting review.',
7478 'revreview-basic-old' => 'This is a [[{{MediaWiki:Validationpage}}|sighted]] revision ([{{fullurl:{{#Special:ReviewedVersions}}|page={{FULLPAGENAMEE}}}} list all]), [{{fullurl:{{#Special:Log}}|type=review&page={{FULLPAGENAMEE}}}} approved] on <i>$2</i>.
@@ -93,7 +97,7 @@
9498 'revreview-editnotice' => '\'\'\'Your changes will be [[{{MediaWiki:Validationpage}}|published]] once an authorised user [[{{MediaWiki:Validationpage}}|reviews]] them.\'\'\'',
9599 'revreview-check-flag' => 'Mark pending edits reviewed',
96100 'revreview-edited' => '\'\'\'Changes will be [[{{MediaWiki:Validationpage}}|published]] once an authorised user [[{{MediaWiki:Validationpage}}|reviews]] them.\'\'\'
97 -The \'\'draft\'\', shown below, contains [{{fullurl:{{FULLPAGENAMEE}}|oldid=$1&diff=cur&diffonly=0}} $2 suggested {{PLURAL:$2|change|changes}}].',
 101+The \'\'draft\'\', shown below, contains [{{fullurl:{{FULLPAGENAMEE}}|oldid=$1&diff=cur&diffonly=0}} $2 pending {{PLURAL:$2|change|changes}}].',
98102 'revreview-flag' => 'Review this revision',
99103 'revreview-unflag' => 'Unreview this revision',
100104 'revreview-invalid' => '\'\'\'Invalid target:\'\'\' no [[{{MediaWiki:Validationpage}}|reviewed]] revision corresponds to the given ID.',
@@ -103,11 +107,11 @@
104108
105109 See the [[Special:Unreviewedpages|list of unreviewed pages]].',
106110 'revreview-newest-basic' => 'The [{{fullurl:{{FULLPAGENAMEE}}|stable=1}} stable version] was [{{fullurl:{{#Special:Log}}|type=review&page={{FULLPAGENAMEE}}}} sighted] on <i>$2</i>. The draft contains
107 -[{{fullurl:{{FULLPAGENAMEE}}|oldid=$1&diff=cur&diffonly=0}} $3 suggested {{PLURAL:$3|change|changes}}].',
 111+[{{fullurl:{{FULLPAGENAMEE}}|oldid=$1&diff=cur&diffonly=0}} $3 pending {{PLURAL:$3|change|changes}}].',
108112 'revreview-newest-basic-i' => 'The [{{fullurl:{{FULLPAGENAMEE}}|stable=1}} stable version] was [{{fullurl:{{#Special:Log}}|type=review&page={{FULLPAGENAMEE}}}} sighted] on <i>$2</i>. The draft contains
109113 [{{fullurl:{{FULLPAGENAMEE}}|oldid=$1&diff=cur&diffonly=0}} Template/file changes] await review.',
110114 'revreview-newest-quality' => 'The [{{fullurl:{{FULLPAGENAMEE}}|stable=1}} stable version] was [{{fullurl:{{#Special:Log}}|type=review&page={{FULLPAGENAMEE}}}} approved] on <i>$2</i>. The draft contains
111 -[{{fullurl:{{FULLPAGENAMEE}}|oldid=$1&diff=cur&diffonly=0}} $3 suggested {{PLURAL:$3|change|changes}}].',
 115+[{{fullurl:{{FULLPAGENAMEE}}|oldid=$1&diff=cur&diffonly=0}} $3 pending {{PLURAL:$3|change|changes}}].',
112116 'revreview-newest-quality-i' => 'The [{{fullurl:{{FULLPAGENAMEE}}|stable=1}} stable version] was [{{fullurl:{{#Special:Log}}|type=review&page={{FULLPAGENAMEE}}}} approved] on <i>$2</i>. The draft contains
113117 [{{fullurl:{{FULLPAGENAMEE}}|oldid=$1&diff=cur&diffonly=0}} Template/file changes] await review.',
114118 'revreview-noflagged' => 'There are no reviewed revisions of this page, so it may \'\'\'not\'\'\' have been [[{{MediaWiki:Validationpage}}|checked]] for quality.',
@@ -118,7 +122,7 @@
119123 'revreview-patrol-title' => 'Mark as patrolled',
120124 'revreview-patrolled' => 'The selected revision of [[:$1|$1]] has been marked as patrolled.',
121125 'revreview-quality' => 'This is the [[{{MediaWiki:Validationpage}}|stable version]], [{{fullurl:{{#Special:Log}}|type=review&page={{FULLPAGENAMEE}}}} approved] on <i>$2</i>.
122 -The [{{fullurl:{{FULLPAGENAMEE}}|stable=0}} draft] contains [{{fullurl:{{FULLPAGENAMEE}}|oldid=$1&diff=cur&diffonly=0}} $3 suggested {{PLURAL:$3|change|changes}}] awaiting review.',
 126+The [{{fullurl:{{FULLPAGENAMEE}}|stable=0}} draft] contains [{{fullurl:{{FULLPAGENAMEE}}|oldid=$1&diff=cur&diffonly=0}} $3 pending {{PLURAL:$3|change|changes}}] awaiting review.',
123127 'revreview-quality-i' => 'This is the [[{{MediaWiki:Validationpage}}|stable version]], [{{fullurl:{{#Special:Log}}|type=review&page={{FULLPAGENAMEE}}}} approved] on <i>$2</i>.
124128 The [{{fullurl:{{FULLPAGENAMEE}}|stable=0}} draft] has [{{fullurl:{{FULLPAGENAMEE}}|oldid=$1&diff=cur&diffonly=0}} template/file changes] awaiting review.',
125129 'revreview-quality-old' => 'This is a [[{{MediaWiki:Validationpage}}|quality]] revision ([{{fullurl:{{#Special:ReviewedVersions}}|page={{FULLPAGENAMEE}}}} list all]), [{{fullurl:{{#Special:Log}}|type=review&page={{FULLPAGENAMEE}}}} approved] on <i>$2</i>.
@@ -215,10 +219,10 @@
216220 'flaggedrevs-protect-none' => 'Allow all users',
217221 'flaggedrevs-protect-basic' => 'Default settings',
218222
219 - 'revreview-locked-title' => 'Edits must be reviewed before being displayed on this page.',
220 - 'revreview-unlocked-title' => 'Edits do not require review before being displayed on this page.',
221 - 'revreview-locked' => 'Edits must be [[{{MediaWiki:Validationpage}}|reviewed]] before being displayed on this page.',
222 - 'revreview-unlocked' => 'Edits do not require [[{{MediaWiki:Validationpage}}|review]] before being displayed on this page.',
 223+ 'revreview-locked-title' => 'Edits must be reviewed before being published on this page.',
 224+ 'revreview-unlocked-title' => 'Edits do not require review before being published on this page.',
 225+ 'revreview-locked' => '\'\'\'Edits must be [[{{MediaWiki:Validationpage}}|reviewed]] before being published on this page.\'\'\'',
 226+ 'revreview-unlocked' => 'Edits do not require [[{{MediaWiki:Validationpage}}|review]] before being published on this page.',
223227
224228 'revreview-ak-review' => 's', # do not translate or duplicate this message to other languages
225229 'accesskey-ca-current' => 'v', # do not translate or duplicate this message to other languages
Index: trunk/extensions/FlaggedRevs/FlaggedRevsXML.php
@@ -145,7 +145,7 @@
146146 public static function addTagRatings( $flags, $prettyBox = false, $css='' ) {
147147 $tag = '';
148148 if( $prettyBox ) {
149 - $tag .= "<table id='mw-revisionratings-box' align='center' class='$css' cellpadding='0'>";
 149+ $tag .= "<table id='mw-fr-revisionratings-box' align='center' class='$css' cellpadding='0'>";
150150 }
151151 foreach( FlaggedRevs::getDimensions() as $quality => $x ) {
152152 $level = isset( $flags[$quality] ) ? $flags[$quality] : 0;
@@ -230,7 +230,7 @@
231231 $box = "<table style='background: none; border-spacing: 0px;'>";
232232 $box .= "<tr style='white-space:nowrap;'><td>$shtml&nbsp;&nbsp;</td>";
233233 $box .= "<td style='text-align:right;'>" . self::ratingToggle() . "</td></tr>\n";
234 - $box .= "<tr><td id='mw-revisionratings'>$html<br />";
 234+ $box .= "<tr><td id='mw-fr-revisionratings'>$html<br />";
235235 # Add ratings if there are any...
236236 if( $stable && !empty($flags) ) {
237237 $box .= self::addTagRatings( $flags, true, $color );
@@ -244,13 +244,24 @@
245245 * Generates (+/-) JS toggle HTML
246246 */
247247 public static function ratingToggle() {
248 - return "<a id='mw-revisiontoggle' class='flaggedrevs_toggle' style='display:none;'" .
 248+ return "<a id='mw-fr-revisiontoggle' class='flaggedrevs_toggle' style='display:none;'" .
249249 " onclick='FlaggedRevs.toggleRevRatings()' title='" .
250250 wfMsgHtml('revreview-toggle-title') . "' >" .
251251 wfMsg( 'revreview-toggle' ) . "</a>";
252252 }
253253
254254 /**
 255+ * @returns string
 256+ * Generates (+/-) JS toggle HTML
 257+ */
 258+ public static function diffToggle() {
 259+ return "<a id='mw-fr-difftoggle' class='flaggedrevs_toggle' style='display:none;'" .
 260+ " onclick='FlaggedRevs.toggleDiff()' title='" .
 261+ wfMsgHtml('revreview-diff-toggle-title') . "' >" .
 262+ wfMsg( 'revreview-diff-toggle-show' ) . "</a>";
 263+ }
 264+
 265+ /**
255266 * @param array $flags, selected flags
256267 * @param array $config, page config
257268 * @param bool $disabled, form disabled
@@ -271,7 +282,7 @@
272283 if( FlaggedRevs::binaryFlagging() ) {
273284 $inputName = empty($tags) ? 'wpApprove' : "wp{$tags[0]}";
274285 return Xml::hidden( $inputName, $reviewed ? 0 : 1,
275 - array('id' => 'mw-reviewstate') );
 286+ array('id' => 'mw-fr-reviewstate') );
276287 }
277288 $items = array();
278289 # Build rating form...
@@ -388,36 +399,26 @@
389400 * @returns string
390401 * Creates "there are x pending edits" message in a div
391402 */
392 - public static function pendingEditBox( $flaggedArticle, $frev, $revsSince ) {
 403+ public static function pendingEditNotice( $flaggedArticle, $frev, $revsSince ) {
393404 global $wgLang;
394405 $flags = $frev->getTags();
395406 $quality = FlaggedRevs::isQuality( $flags );
396407 $time = $wgLang->date( $frev->getTimestamp(), true );
397 - // Is the page config altered?
398 - $prot = self::lockStatusIcon( $flaggedArticle );
399 - # Streamlined UI
400 - if( FlaggedRevs::useSimpleUI() ) {
401 - $msg = $quality ? 'revreview-newest-quality' : 'revreview-newest-basic';
402 - $msg .= ($revsSince == 0) ? '-i' : '';
403 - $tag = "{$prot}<span class='fr-checkbox'></span>" .
404 - wfMsgExt( $msg, array('parseinline'), $frev->getRevId(), $time, $revsSince );
405 - $tag = "<div id='mw-revisiontag-edit' class='flaggedrevs_editnotice plainlinks'>" .
406 - "$tag</div>";
 408+ # Add message text for pending edits
 409+ $msg = $quality
 410+ ? 'revreview-newest-quality'
 411+ : 'revreview-newest-basic';
 412+ $msg .= ($revsSince == 0) ? '-i' : '';
 413+ $tag = wfMsgExt( $msg, array('parseinline'), $frev->getRevId(), $time, $revsSince );
407414 # Standard UI
408 - } else {
409 - $msg = $quality ? 'revreview-newest-quality' : 'revreview-newest-basic';
410 - $msg .= ($revsSince == 0) ? '-i' : '';
411 - $tag = "{$prot}<span class='fr-checkbox'></span>" .
412 - wfMsgExt( $msg, array('parseinline'), $frev->getRevId(), $time, $revsSince );
 415+ if( !FlaggedRevs::useSimpleUI() ) {
413416 # Hide clutter
414417 if( !empty($flags) ) {
415418 $tag .= " " . FlaggedRevsXML::ratingToggle();
416 - $tag .= '<span id="mw-revisionratings" style="display:block;"><br />' .
 419+ $tag .= '<span id="mw-fr-revisionratings" style="display:block;"><br />' .
417420 wfMsg('revreview-oldrating') . FlaggedRevsXML::addTagRatings( $flags ) .
418421 '</span>';
419422 }
420 - $tag = "<div id='mw-revisiontag-edit' class='flaggedrevs_editnotice plainlinks'>" .
421 - "$tag</div>";
422423 }
423424 return $tag;
424425 }
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php
@@ -30,6 +30,13 @@
3131 $encJsFile = htmlspecialchars( "$stylePath/review.js?$wgFlaggedRevStyleVersion" );
3232 $head .= "\n<script type=\"{$wgJsMimeType}\" src=\"{$encJsFile}\"></script>";
3333 }
 34+ # Set basic messages
 35+ $msgs = (object) array(
 36+ 'revreviewDiffToggleShow' => wfMsgHtml('revreview-diff-toggle-show'),
 37+ 'revreviewDiffToggleHide' => wfMsgHtml('revreview-diff-toggle-hide')
 38+ );
 39+ $head .= "\n<script type=\"{$wgJsMimeType}\">" .
 40+ "FlaggedRevs.messages = ".Xml::encodeJsVar($msgs).";</script>";
3441 $wgOut->addHeadItem( 'FlaggedRevs', $head );
3542 return true;
3643 }
@@ -46,19 +53,19 @@
4754 # Get page-specific meta-data
4855 $frev = $fa->getStableRev();
4956 $stableId = $frev ? $frev->getRevId() : 0;
50 - $ajaxReview = (object) array(
51 - 'sendMsg' => wfMsgHtml('revreview-submit'),
52 - 'flagMsg' => wfMsgHtml('revreview-submit-review'),
53 - 'unflagMsg' => wfMsgHtml('revreview-submit-unreview'),
54 - 'flagLegMsg' => wfMsgHtml('revreview-flag'),
55 - 'unflagLegMsg' => wfMsgHtml('revreview-unflag'),
56 - 'sendingMsg' => wfMsgHtml('revreview-submitting'),
57 - 'actioncomplete' => wfMsgHtml('actioncomplete'),
58 - 'actionfailed' => wfMsgHtml('actionfailed')
59 - );
6057 $globalVars['wgFlaggedRevsParams'] = $rTags;
6158 $globalVars['wgStableRevisionId'] = $stableId;
6259 if( $wgUser->isAllowed('review') ) {
 60+ $ajaxReview = (object) array(
 61+ 'sendMsg' => wfMsgHtml('revreview-submit'),
 62+ 'flagMsg' => wfMsgHtml('revreview-submit-review'),
 63+ 'unflagMsg' => wfMsgHtml('revreview-submit-unreview'),
 64+ 'flagLegMsg' => wfMsgHtml('revreview-flag'),
 65+ 'unflagLegMsg' => wfMsgHtml('revreview-unflag'),
 66+ 'sendingMsg' => wfMsgHtml('revreview-submitting'),
 67+ 'actioncomplete' => wfMsgHtml('actioncomplete'),
 68+ 'actionfailed' => wfMsgHtml('actionfailed')
 69+ );
6370 $globalVars['wgAjaxReview'] = $ajaxReview; // language for AJAX form
6471 }
6572 return true;
@@ -1820,7 +1827,7 @@
18211828 );
18221829 # Give a notice if pages on the wachlist are outdated
18231830 if( $watchedOutdated ) {
1824 - $notice .= "<div id='mw-oldreviewed-notice' class='plainlinks fr-watchlist-old-notice'>" .
 1831+ $notice .= "<div id='mw-fr-oldreviewed-notice' class='plainlinks fr-watchlist-old-notice'>" .
18251832 wfMsgExt('flaggedrevs-watched-pending',array('parseinline')) . "</div>";
18261833 # Otherwise, give a notice if there is a large backlog in general
18271834 } else {
@@ -1837,7 +1844,7 @@
18381845 'fp_pending_since IS NOT NULL', __METHOD__ );
18391846 }
18401847 if( $unreviewed > .02*$pages ) {
1841 - $notice .= "<div id='mw-oldreviewed-notice' class='plainlinks fr-backlognotice'>" .
 1848+ $notice .= "<div id='mw-fr-oldreviewed-notice' class='plainlinks fr-backlognotice'>" .
18421849 wfMsgExt('flaggedrevs-backlog',array('parseinline')) . "</div>";
18431850 }
18441851 }
Index: trunk/extensions/FlaggedRevs/client/flaggedrevs.css
@@ -43,6 +43,8 @@
4444 .flaggedrevs_editnotice {
4545 font-size: 85%;
4646 background-color: #f9f9f9;
 47+ text-align: left;
 48+ width: 100%;
4749 }
4850 .flaggedrevs_diffnotice {
4951 font-size: 85%;
Index: trunk/extensions/FlaggedRevs/client/flaggedrevs.js
@@ -3,25 +3,57 @@
44 /* Every time you change this JS please bump $wgFlaggedRevStyleVersion in FlaggedRevs.php */
55
66 var FlaggedRevs = {
7 - /* Hide rating clutter */
 7+ 'messages': {
 8+ 'revreviewDiffToggleShow': '(show)',
 9+ 'revreviewDiffToggleHide': '(hide)'
 10+ },
 11+ /* Hide rating/diff clutter */
812 'enableShowhide': function() {
9 - var toggle = document.getElementById('mw-revisiontoggle');
10 - if( !toggle ) return;
11 - toggle.style.display = 'inline';
12 - var ratings = document.getElementById('mw-revisionratings');
13 - if( !ratings ) return;
14 - ratings.style.display = 'none';
 13+ var toggle = document.getElementById('mw-fr-revisiontoggle');
 14+ if( toggle ) {
 15+ toggle.style.display = 'inline';
 16+ var ratings = document.getElementById('mw-fr-revisionratings');
 17+ if( ratings ) {
 18+ ratings.style.display = 'none';
 19+ }
 20+ }
 21+ toggle = document.getElementById('mw-fr-difftoggle');
 22+ if( toggle ) {
 23+ toggle.style.display = 'inline';
 24+ var diff = document.getElementById('mw-fr-stablediff');
 25+ if( diff ) {
 26+ diff.style.display = 'none';
 27+ }
 28+ }
1529 },
1630
1731 /* Toggles ratings */
1832 'toggleRevRatings': function() {
19 - var ratings = document.getElementById('mw-revisionratings');
 33+ var ratings = document.getElementById('mw-fr-revisionratings');
2034 if( !ratings ) return;
2135 if( ratings.style.display == 'none' ) {
2236 ratings.style.display = 'inline';
2337 } else {
2438 ratings.style.display = 'none';
2539 }
 40+ },
 41+
 42+ /* Toggles diffs */
 43+ 'toggleDiff': function() {
 44+ var diff = document.getElementById('mw-fr-stablediff');
 45+ if( !diff ) return;
 46+ var toggle = document.getElementById('mw-fr-difftoggle');
 47+ if( diff.style.display == 'none' ) {
 48+ diff.style.display = 'inline';
 49+ if( toggle ) {
 50+ toggle.innerHTML = this.messages.revreviewDiffToggleHide;
 51+ }
 52+ } else {
 53+ diff.style.display = 'none';
 54+ if( toggle ) {
 55+ toggle.innerHTML = this.messages.revreviewDiffToggleShow;
 56+ }
 57+ }
2658 }
2759 };
2860
Index: trunk/extensions/FlaggedRevs/FlaggedArticleView.php
@@ -151,12 +151,12 @@
152152 # Hide clutter
153153 if( !FlaggedRevs::useSimpleUI() && !empty($flags) ) {
154154 $tag .= " " . FlaggedRevsXML::ratingToggle() .
155 - "<span id='mw-revisionratings' style='display:block;'><br />" .
 155+ "<span id='mw-fr-revisionratings' style='display:block;'><br />" .
156156 wfMsgHtml('revreview-oldrating') .
157157 FlaggedRevsXML::addTagRatings( $flags ) . '</span>';
158158 }
159159 $css = 'flaggedrevs_notice plainlinks noprint';
160 - $tag = "<div id='mw-revisiontag-old' class='$css'>$tag</div>";
 160+ $tag = "<div id='mw-fr-revisiontag-old' class='$css'>$tag</div>";
161161 $wgOut->addHTML( $tag );
162162 }
163163 return true;
@@ -271,7 +271,7 @@
272272 # Wrap tag contents in a div
273273 if( $tag != '' ) {
274274 $rtl = $wgContLang->isRTL() ? " rtl" : ""; // RTL langauges
275 - $tag = "<div id='mw-revisiontag' class='{$tagClass}{$rtl} plainlinks noprint'>" .
 275+ $tag = "<div id='mw-fr-revisiontag' class='{$tagClass}{$rtl} plainlinks noprint'>" .
276276 "$tag</div>";
277277 $this->reviewNotice .= $tag;
278278 }
@@ -297,13 +297,13 @@
298298 $msg = 'revreview-quick-none';
299299 $tag .= "{$prot}<span class='fr-icon-current plainlinks'></span>" .
300300 wfMsgExt($msg,array('parseinline'));
301 - $tag = "<div id='mw-revisiontag' class='flaggedrevs_short{$rtl} plainlinks noprint'>" .
 301+ $tag = "<div id='mw-fr-revisiontag' class='flaggedrevs_short{$rtl} plainlinks noprint'>" .
302302 "$tag</div>";
303303 $this->reviewNotice .= $tag;
304304 // Standard UI
305305 } else {
306306 $msg = 'revreview-noflagged';
307 - $tag = "<div id='mw-revisiontag' class='flaggedrevs_notice plainlinks noprint'>" .
 307+ $tag = "<div id='mw-fr-revisiontag' class='flaggedrevs_notice plainlinks noprint'>" .
308308 "{$prot}<span class='fr-icon-current plainlinks'></span>" .
309309 wfMsgExt($msg, array('parseinline')) . "</div>";
310310 $this->reviewNotice .= $tag;
@@ -340,7 +340,7 @@
341341 $tooltip = wfMsgHtml('revreview-draft-title');
342342 $pending = "{$prot}<span class='fr-icon-current' title=\"{$tooltip}\"></span>" .
343343 wfMsgExt('revreview-edited',array('parseinline'),$srev->getRevId(),$revsSince);
344 - $pending = "<div id='mw-reviewnotice' class='flaggedrevs_preview plainlinks'>" .
 344+ $pending = "<div id='mw-fr-reviewnotice' class='flaggedrevs_preview plainlinks'>" .
345345 "$pending</div>";
346346 # Notice should always use subtitle
347347 $this->reviewNotice = $pending;
@@ -397,7 +397,7 @@
398398 # Hide clutter
399399 if( !empty($flags) ) {
400400 $tag .= " " . FlaggedRevsXML::ratingToggle();
401 - $tag .= "<span id='mw-revisionratings' style='display:block;'><br />" .
 401+ $tag .= "<span id='mw-fr-revisionratings' style='display:block;'><br />" .
402402 wfMsgHtml('revreview-oldrating') .
403403 FlaggedRevsXML::addTagRatings( $flags ) . '</span>';
404404 }
@@ -457,7 +457,7 @@
458458 # Hide clutter
459459 if( !empty($flags) ) {
460460 $tag .= " " . FlaggedRevsXML::ratingToggle();
461 - $tag .= "<span id='mw-revisionratings' style='display:block;'><br />" .
 461+ $tag .= "<span id='mw-fr-revisionratings' style='display:block;'><br />" .
462462 wfMsgHtml('revreview-oldrating') .
463463 FlaggedRevsXML::addTagRatings( $flags ) . '</span>';
464464 }
@@ -531,7 +531,7 @@
532532 wfMsgExt( $msg, array('parseinline'), $srev->getRevId(), $time, $revsSince );
533533 if( !empty($flags) ) {
534534 $tag .= " " . FlaggedRevsXML::ratingToggle();
535 - $tag .= "<span id='mw-revisionratings' style='display:block;'><br />" .
 535+ $tag .= "<span id='mw-fr-revisionratings' style='display:block;'><br />" .
536536 FlaggedRevsXML::addTagRatings( $flags ) . '</span>';
537537 }
538538 }
@@ -673,16 +673,19 @@
674674 * Adds stable version tags to page when viewing history
675675 */
676676 public function addToHistView() {
677 - global $wgOut, $wgLang;
 677+ global $wgOut;
678678 $this->load();
679679 # Must be reviewable. UI may be limited to unobtrusive patrolling system.
680 - if( !$this->article->isReviewable() || $this->article->limitedUI() )
 680+ if( !$this->article->isReviewable() || $this->article->limitedUI() ) {
681681 return true;
 682+ }
682683 # Add a notice if there are pending edits...
683684 $frev = $this->article->getStableRev();
684685 if( $frev && $frev->getRevId() < $this->article->getLatest() ) {
685686 $revsSince = FlaggedRevs::getRevCountSince( $this->article, $frev->getRevId() );
686 - $tag = FlaggedRevsXML::pendingEditBox( $this->article, $frev, $revsSince );
 687+ $tag = "<div id='mw-fr-revisiontag-edit' class='flaggedrevs_notice plainlinks'>" .
 688+ FlaggedRevsXML::lockStatusIcon( $this->article ) . # flag protection icon as needed
 689+ FlaggedRevsXML::pendingEditNotice( $this->article, $frev, $revsSince ) . "</div>";
687690 $wgOut->addHTML( $tag );
688691 }
689692 return true;
@@ -695,40 +698,38 @@
696699 global $wgRequest, $wgOut, $wgLang, $wgUser;
697700 $this->load();
698701 # Must be reviewable. UI may be limited to unobtrusive patrolling system.
699 - if( !$this->article->isReviewable() || $this->article->limitedUI() )
 702+ if( !$this->article->isReviewable() || $this->article->limitedUI() ) {
700703 return true;
 704+ }
 705+ $items = array();
 706+ $tag = $warning = $prot = '';
701707 # Show stabilization log
702 - $this->showStabilityLog();
703 - $tag = $warning = $prot = '';
 708+ $log = $this->stabilityLogExcerpt();
 709+ if( $log ) $items[] = $log;
704710 # Check the newest stable version
705711 $quality = 0;
706712 $frev = $this->article->getStableRev();
707713 if( $frev ) {
 714+ $quality = $frev->getQuality();
708715 # Find out revision id of base version
709716 $latestId = $this->article->getLatest();
710717 $revId = $editPage->oldid ? $editPage->oldid : $latestId;
711718 $isOld = ($revId != $latestId); // not the current rev?
712 - # Let new users know about review procedure a tag
713 - if( !$wgUser->getId() && $this->article->showStableByDefault() ) {
714 - $css = 'flaggedrevs_editnotice plainlinks';
715 - $warning = "<div id='mw-editwarningtag' class='$css'>" .
716 - wfMsgExt('revreview-editnotice',array('parseinline')) . "</div>";
 719+ # Let new users know about review procedure a tag.
 720+ # If the log excerpt was shown this is redundant.
 721+ if( !$log && !$wgUser->getId() && $this->article->showStableByDefault() ) {
 722+ $items[] = wfMsgExt( 'revreview-editnotice', array('parseinline') );
717723 }
718724 # Add a notice if there are pending edits...
719725 if( $frev->getRevId() != $revId ) {
720726 $revsSince = FlaggedRevs::getRevCountSince( $this->article, $frev->getRevId() );
721 - $tag = FlaggedRevsXML::pendingEditBox( $this->article, $frev, $revsSince );
 727+ $items[] = FlaggedRevsXML::pendingEditNotice( $this->article, $frev, $revsSince );
722728 }
723 - # Output notice and warning for editors
724 - if( $tag || $warning ) {
725 - $wgOut->addHTML( $warning . $tag );
726 - }
727 -
728729 # Show diff to stable, to make things less confusing...
729730 # This can be disabled via user preferences
730731 if( $frev->getRevId() < $revId // changes were made
731732 && $this->showDiffOnEditUser() // stable default and user cannot review
732 - && $wgUser->getBoolOption('flaggedrevseditdiffs') // not disable via prefs
 733+ && $wgUser->getBoolOption( 'flaggedrevseditdiffs' ) // not disable via prefs
733734 ) {
734735 # Don't show for old revisions, diff, preview, or undo
735736 if( $isOld || $editPage->section === "new"
@@ -738,7 +739,9 @@
739740 }
740741
741742 # Conditions are met to show diff...
742 - $leftNote = $quality ? 'revreview-quality-rev' : 'revreview-sighted-rev';
 743+ $leftNote = $quality
 744+ ? 'revreview-quality-rev'
 745+ : 'revreview-sighted-rev';
743746 $rClass = FlaggedRevsXML::getQualityColor( false );
744747 $lClass = FlaggedRevsXML::getQualityColor( (int)$quality );
745748 $rightNote = "<span class='$rClass'>[".wfMsgHtml('revreview-draft-rev')."]</span>";
@@ -752,8 +755,10 @@
753756 if( $text !== false && strcmp($text,$editPage->textbox1) !== 0 ) {
754757 $diffEngine = new DifferenceEngine();
755758 $diffEngine->showDiffStyle();
756 - $wgOut->addHTML(
757 - "<div>" .
 759+ $diffHtml =
 760+ wfMsgExt( 'review-edit-diff', 'parseinline' ) . ' ' .
 761+ FlaggedRevsXML::diffToggle() .
 762+ "<div id='mw-fr-stablediff'>" .
758763 "<table border='0' width='98%' cellpadding='0' cellspacing='4' class='diff'>" .
759764 "<col class='diff-marker' />" .
760765 "<col class='diff-content' />" .
@@ -767,33 +772,42 @@
768773 "</tr>" .
769774 $diffEngine->generateDiffBody( $text, $editPage->textbox1 ) .
770775 "</table>" .
771 - "</div>\n"
772 - );
 776+ "</div>\n";
 777+ $items[] = $diffHtml;
773778 }
774779 }
 780+ # Output items
 781+ if( count($items) ) {
 782+ $html = "<table class='flaggedrevs_editnotice plainlinks'>";
 783+ foreach( $items as $item ) {
 784+ $html .= '<tr><td>'.$item.'</td></tr>';
 785+ }
 786+ $html .= '</table>';
 787+ $wgOut->addHTML( $html );
 788+ }
775789 }
776790 return true;
777791 }
778792
779 - protected function showStabilityLog() {
780 - global $wgOut;
 793+ protected function stabilityLogExcerpt() {
781794 $this->load();
 795+ $s = '';
782796 # Only for pages manually made to be stable...
783797 if( $this->article->isPageLocked() ) {
784 - $wgOut->addHTML( "<div class='mw-warning-with-logexcerpt'>" );
785 - $wgOut->addWikiMsg( 'revreview-locked' );
786 - LogEventsList::showLogExtract( $wgOut, 'stable',
 798+ $s = wfMsgExt( 'revreview-locked', 'parseinline' );
 799+ $logHtml = '';
 800+ LogEventsList::showLogExtract( $logHtml, 'stable',
787801 $this->article->getTitle()->getPrefixedText(), '', array('lim'=>1) );
788 - $wgOut->addHTML( "</div>" );
 802+ $s .= $logHtml;
789803 # ...or unstable
790804 } elseif( $this->article->isPageUnlocked() ) {
791 - $wgOut->addHTML( "<div class='mw-warning-with-logexcerpt'>" );
792 - $wgOut->addWikiMsg( 'revreview-unlocked' );
793 - LogEventsList::showLogExtract( $wgOut, 'stable',
 805+ $s = wfMsgExt( 'revreview-unlocked', 'parseinline' );
 806+ $logHtml = '';
 807+ LogEventsList::showLogExtract( $logHtml, 'stable',
794808 $this->article->getTitle()->getPrefixedText(), '', array('lim' => 1) );
795 - $wgOut->addHTML( "</div>" );
 809+ $s .= $logHtml;
796810 }
797 - return true;
 811+ return $s;
798812 }
799813
800814 /**
@@ -816,7 +830,7 @@
817831 wfMsgHtml('oldreviewedpages'), 'category=' . urlencode($category) );
818832
819833 $wgOut->appendSubtitle(
820 - "<span id='mw-category-oldreviewed'>$unreviewedLink / $oldreviewedLink</span>"
 834+ "<span id='mw-fr-category-oldreviewed'>$unreviewedLink / $oldreviewedLink</span>"
821835 );
822836 return true;
823837 }
@@ -1156,16 +1170,16 @@
11571171 # If the user is allowed to review, prompt them!
11581172 $css = 'flaggedrevs_diffnotice plainlinks';
11591173 if( empty($changeList) && $wgUser->isAllowed('review') ) {
1160 - $wgOut->addHTML( "<div id='mw-difftostable' class='$css'>" .
 1174+ $wgOut->addHTML( "<div id='mw-fr-difftostable' class='$css'>" .
11611175 wfMsgExt('revreview-update-none', array('parseinline')).$notice.'</div>' );
11621176 } elseif( !empty($changeList) && $wgUser->isAllowed('review') ) {
11631177 $changeList = implode(', ',$changeList);
1164 - $wgOut->addHTML( "<div id='mw-difftostable' class='$css'>" .
 1178+ $wgOut->addHTML( "<div id='mw-fr-difftostable' class='$css'>" .
11651179 wfMsgExt('revreview-update', array('parseinline')).'&nbsp;'.
11661180 $changeList.$notice.'</div>' );
11671181 } elseif( !empty($changeList) ) {
11681182 $changeList = implode(', ',$changeList);
1169 - $wgOut->addHTML( "<div id='mw-difftostable' class='$css'>" .
 1183+ $wgOut->addHTML( "<div id='mw-fr-difftostable' class='$css'>" .
11701184 wfMsgExt('revreview-update-includes', array('parseinline')).'&nbsp;'.
11711185 $changeList.$notice.'</div>' );
11721186 }
@@ -1417,7 +1431,7 @@
14181432 # Begin form...
14191433 $reviewTitle = SpecialPage::getTitleFor( 'RevisionReview' );
14201434 $action = $reviewTitle->getLocalUrl( 'action=submit' );
1421 - $params = array( 'method' => 'post', 'action' => $action, 'id' => 'mw-reviewform' );
 1435+ $params = array( 'method' => 'post', 'action' => $action, 'id' => 'mw-fr-reviewform' );
14221436 if( $hide ) {
14231437 $params['class'] = 'fr-hiddenform';
14241438 }
@@ -1428,7 +1442,7 @@
14291443 $legendMsg = ( FlaggedRevs::binaryFlagging() && $frev )
14301444 ? 'revreview-unflag'
14311445 : 'revreview-flag';
1432 - $form .= Xml::openElement( 'legend', array('id' => 'mw-reviewformlegend') );
 1446+ $form .= Xml::openElement( 'legend', array('id' => 'mw-fr-reviewformlegend') );
14331447 $form .= "<strong>" . wfMsgHtml( $legendMsg ) . "</strong>";
14341448 $form .= Xml::closeElement( 'legend' ) . "\n";
14351449 # Show explanatory text
@@ -1451,12 +1465,12 @@
14521466 }
14531467
14541468 # Add main checkboxes/selects
1455 - $form .= Xml::openElement( 'span', array('id' => 'mw-ratingselects') );
 1469+ $form .= Xml::openElement( 'span', array('id' => 'mw-fr-ratingselects') );
14561470 $form .= FlaggedRevsXML::ratingInputs( $flags, $config, $disabled, (bool)$frev );
14571471 $form .= Xml::closeElement( 'span' );
14581472 # Add review notes input
14591473 if( FlaggedRevs::allowComments() && $wgUser->isAllowed( 'validate' ) ) {
1460 - $form .= "<div id='mw-notebox'>\n";
 1474+ $form .= "<div id='mw-fr-notebox'>\n";
14611475 $form .= "<p>".wfMsgHtml( 'revreview-notes' ) . "</p>\n";
14621476 $form .= Xml::openElement( 'textarea', array('name' => 'wpNotes', 'id' => 'wpNotes',
14631477 'class' => 'fr-notes-box', 'rows' => '2', 'cols' => '80') ) .
@@ -1496,7 +1510,7 @@
14971511 if( !$disabled ) {
14981512 if( count(FlaggedRevs::getDimensions()) > 1 )
14991513 $form .= "<br />"; // Don't put too much on one line
1500 - $form .= "<span id='mw-commentbox' style='clear:both'>" .
 1514+ $form .= "<span id='mw-fr-commentbox' style='clear:both'>" .
15011515 Xml::inputLabel( wfMsg('revreview-log'), 'wpReason', 'wpReason', 40, '',
15021516 array('class' => 'fr-comment-box') ) . "&nbsp;&nbsp;&nbsp;</span>";
15031517 }
@@ -1510,7 +1524,7 @@
15111525 }
15121526 $form .= Xml::submitButton( wfMsg($submitMsg),
15131527 array(
1514 - 'id' => 'mw-submitreview', 'accesskey' => wfMsg('revreview-ak-review'),
 1528+ 'id' => 'mw-fr-submitreview', 'accesskey' => wfMsg('revreview-ak-review'),
15151529 'title' => wfMsg('revreview-tt-review').' ['.wfMsg('revreview-ak-review').']'
15161530 ) + $toggle
15171531 );

Comments

#Comment by Aaron Schulz (talk | contribs)   01:56, 8 January 2010

JS fix in r60817

#Comment by Tim Starling (talk | contribs)   05:52, 20 January 2010
+			" onclick='FlaggedRevs.toggleDiff()' title='" .
+			wfMsgHtml('revreview-diff-toggle-title') . "' >" .

wfMsgHtml() does not escape single quotes, so this is technically arbitrary script injection. I don't know how you manage to use single quotes so often and only hit one of these once every few months, it's quite impressive. But all the same, maybe you should make a habit of using double quotes only when you construct HTML, that's what I do.

Of course, there's plenty of places where you have HTML-formatted messages, so it's not really a security vulnerability, it's just sloppy and wrong.

+        	$tag .= "<table id='mw-fr-revisionratings-box' align='center' class='$css' cellpadding='0'>";

Could you please escape things like $css on the output side? I have better things to do than tracking back data through your code to find out where these variables come from.

#Comment by Aaron Schulz (talk | contribs)   07:01, 21 January 2010

Changes in r61305

Status & tagging log