r31842 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r31841‎ | r31842 | r31843 >
Date:05:17, 12 March 2008
Author:aaron
Status:old
Tags:
Comment:
*Remove tag hack
*UI cleanup, add extra notice on edit
*CSS tweaks
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedArticle.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevsPage.i18n.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/flaggedrevs.css (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php
@@ -14,7 +14,7 @@
1515 $wgExtensionCredits['specialpage'][] = array(
1616 'name' => 'Flagged Revisions',
1717 'author' => array( 'Aaron Schulz', 'Joerg Baach' ),
18 - 'version' => '1.013',
 18+ 'version' => '1.014',
1919 'url' => 'http://www.mediawiki.org/wiki/Extension:FlaggedRevs',
2020 'descriptionmsg' => 'flaggedrevs-desc',
2121 );
@@ -147,7 +147,7 @@
148148 #########
149149
150150 # Bump this number every time you change flaggedrevs.css/flaggedrevs.js
151 -$wgFlaggedRevStyleVersion = 3;
 151+$wgFlaggedRevStyleVersion = 4;
152152
153153 $wgExtensionFunctions[] = 'efLoadFlaggedRevs';
154154
@@ -210,7 +210,6 @@
211211 # Set image version
212212 $wgHooks['ArticleFromTitle'][] = 'FlaggedRevs::setImageVersion';
213213 # Add page notice
214 - $wgHooks['SiteNoticeAfter'][] = array( $wgFlaggedArticle, 'displayReviewTag' );
215214 $wgHooks['SkinTemplateBuildNavUrlsNav_urlsAfterPermalink'][] = array( $wgFlaggedArticle, 'setPermaLink' );
216215 # Add tags do edit view
217216 $wgHooks['EditPage::showEditForm:initial'][] = array( $wgFlaggedArticle, 'addToEditView' );
Index: trunk/extensions/FlaggedRevs/flaggedrevs.css
@@ -1,32 +1,32 @@
22 /* Every time you change this CSS please bump $wgFlaggedRevStyleVersion in FlaggedRevs.php */
33 /* Standard UI */
4 -.flaggedrevs_tag1,
5 -.flaggedrevs_tag2,
6 -.flaggedrevs_tag3,
 4+.flaggedrevs_basic,
 5+.flaggedrevs_quality,
 6+.flaggedrevs_pristine,
77 .flaggedrevs_notice,
8 -.flaggedrevs_warning {
 8+.flaggedrevs_warning,
 9+.flaggedrevs_preview {
910 border: 1px solid #aaa;
10 - padding: 3px;
 11+ padding: 7px;
1112 font-size: 80%;
1213 font-weight: normal;
13 - margin-top: 6px;
14 - margin-left: 0px;
15 - margin-right: 0px;
16 - margin-bottom: 0px;
 14+ margin: .5em 1em 0em 0em;
1715 text-align: center;
 16+ float: center;
 17+ clear: both;
1818 }
1919
2020 .flaggedrevs_toggle {
2121 color: blue;
2222 }
2323
24 -.flaggedrevs_tag1 {
 24+.flaggedrevs_basic {
2525 background-color: #f0f8ff;
2626 }
27 -.flaggedrevs_tag2 {
 27+.flaggedrevs_quality {
2828 background-color: #f0fff0;
2929 }
30 -.flaggedrevs_tag3 {
 30+.flaggedrevs_pristine {
3131 background-color: #fffff0;
3232 }
3333 .flaggedrevs_notice {
@@ -34,8 +34,11 @@
3535 }
3636 .flaggedrevs_warning {
3737 background-color: #fffff0;
38 - margin-top: 0px;
3938 }
 39+.flaggedrevs_preview {
 40+ background-color: #f9f9f9;
 41+ color: darkred;
 42+}
4043
4144 .flaggedrevs_notes {
4245 border: 1px solid #aaa;
@@ -54,7 +57,6 @@
5558
5659 .fr-checkbox {
5760 padding: 0px;
58 - margin: .25em;
5961 width: 16px;
6062 height: 16px;
6163 position: relative;
@@ -102,43 +104,37 @@
103105 .flaggedrevs_short {
104106 border: 1px solid #aaa;
105107 background-color: #f9f9f9;
106 - padding: 3px;
 108+ padding: 5px;
107109 font-size: 80%;
108110 font-weight: normal;
109 - margin: 8px;
110 - text-align: left;
 111+ margin: 0em 0em 0em .5em;
111112 float: right;
 113+ text-align: left;
112114 max-width: 350px;
113 - clear: both;
 115+ line-height: 18px;
114116 }
115 -/* IE 7 only */
116 -*+html .flaggedrevs_short {
117 - margin: 9px;
118 -}
119117
120 -
121 -.fr-tab_current,
122 -.fr-tab_stable,
123 -.fr-tab_quality {
 118+.fr-icon-current,
 119+.fr-icon-stable,
 120+.fr-icon-quality {
124121 padding: 0px;
125122 margin: 0px;
126123 width: 20px;
127 - height: 18px;;
 124+ height: 18px;
128125 position: relative;
129126 float: left;
130 - top: -3px;
131 - right: 0px;
 127+ vertical-align: middle;
132128 background-repeat: no-repeat;
133129 background-position: 0px 0px;
134130 }
135131
136 -.fr-tab_current {
 132+.fr-icon-current {
137133 background-image: url(../FlaggedRevs/img/1.png);
138134 }
139 -.fr-tab_stable {
 135+.fr-icon-stable {
140136 background-image: url(../FlaggedRevs/img/2.png);
141137 }
142 -.fr-tab_quality {
 138+.fr-icon-quality {
143139 background-image: url(../FlaggedRevs/img/3.png);
144140 }
145141
Index: trunk/extensions/FlaggedRevs/FlaggedArticle.php
@@ -77,13 +77,21 @@
7878
7979 return FlaggedRevs::isPageReviewable( $wgTitle );
8080 }
81 -
82 - /**
83 - * Adds the review notic tag by the title
 81+
 82+ /**
 83+ * Is this article reviewable?
8484 */
85 - public function displayReviewTag( $notice ) {
86 - $notice .= $this->reviewNotice;
87 -
 85+ private function displayTag() {
 86+ global $wgOut;
 87+
 88+ if( !$this->reviewNotice ) {
 89+ return false;
 90+ }
 91+ if( FlaggedRevs::useSimpleUI() ) {
 92+ $wgOut->mBodytext = $this->reviewNotice . $wgOut->mBodytext;
 93+ } else {
 94+ $wgOut->setSubtitle( $this->reviewNotice );
 95+ }
8896 return true;
8997 }
9098
@@ -126,7 +134,6 @@
127135 $revid = $article->mRevision ? $article->mRevision->mId : $article->getLatest();
128136 if( !$revid )
129137 return true;
130 -
131138 $tag = $notes = '';
132139 # Check the newest stable version...
133140 $tfrev = $this->getStableRev( true );
@@ -146,28 +153,41 @@
147154 $revs_since = FlaggedRevs::getRevCountSince( $article, $tfrev->getRevId() );
148155
149156 $synced = FlaggedRevs::flaggedRevIsSynced( $tfrev, $article, null, null );
 157+ # Give notice to newewer users if unreviewed edit completed...
 158+ if( $wgRequest->getVal('shownotice') && !$synced && !$wgUser->isAllowed('review') ) {
 159+ $pending = '<div id="mw-reviewnotice" class="flaggedrevs_preview plainlinks">' .
 160+ wfMsgExt('revreview-edited',array('parseinline')) . '</div>';
 161+ # Notice should always use subtitle
 162+ if( FlaggedRevs::useSimpleUI() ) {
 163+ $wgOut->setSubtitle( $pending );
 164+ } else {
 165+ $this->reviewNotice = $pending;
 166+ }
 167+ }
150168 # If they are synced, do special styling
151169 $simpleTag = !$synced;
152170 # Construct some tagging
153171 if( !$wgOut->isPrintable() ) {
 172+ $css = 'fr-icon-current';
154173 if( FlaggedRevs::useSimpleUI() ) {
155174 if( $synced ) {
156175 $msg = $quality ? 'revreview-quick-quality-same' : 'revreview-quick-basic-same';
157 - $css = $quality ? 'fr-tab_quality' : 'fr-tab_stable';
 176+ $css = $quality ? 'fr-icon-quality' : 'fr-icon-stable';
158177 } else {
159178 $msg = $quality ? 'revreview-quick-see-quality' : 'revreview-quick-see-basic';
160 - $css = 'fr-tab_current';
161179 }
162 - $tag .= "<span class='{$css} plainlinks'></span>" .
 180+ $tag .= "<span class='{$css}'></span>" .
163181 wfMsgExt( $msg, array('parseinline'), $tfrev->getRevId(), $revs_since );
164 - $tag .= $this->prettyRatingBox( $tfrev, $flags, $revs_since, false, $synced );
 182+ $tag .= $this->prettyRatingBox( $tfrev, $flags, $revs_since, $synced, $synced );
165183 } else {
166184 if( $synced ) {
167185 $msg = $quality ? 'revreview-quality-same' : 'revreview-basic-same';
 186+ $css = $quality ? 'fr-icon-quality' : 'fr-icon-stable';
168187 } else {
169188 $msg = $quality ? 'revreview-newest-quality' : 'revreview-newest-basic';
170189 }
171 - $tag .= wfMsgExt( $msg, array('parseinline'), $tfrev->getRevId(), $time, $revs_since );
 190+ $tag .= "<span class='{$css}'></span>" .
 191+ wfMsgExt( $msg, array('parseinline'), $tfrev->getRevId(), $time, $revs_since );
172192 # Hide clutter
173193 if( !empty($flags) ) {
174194 $tag .= " <span id='mw-revisiontoggle' class='flaggedrevs_toggle' style='display:none; cursor:pointer;'" .
@@ -200,23 +220,24 @@
201221 $synced = FlaggedRevs::flaggedRevIsSynced( $tfrev, $article, $parserOut, null );
202222 # Construct some tagging
203223 if( !$wgOut->isPrintable() ) {
 224+ $css = $quality ? 'fr-icon-quality' : 'fr-icon-stable';
204225 if( FlaggedRevs::useSimpleUI() ) {
205226 $msg = $quality ? 'revreview-quick-quality' : 'revreview-quick-basic';
206227 $msg = $synced ? $msg . '-same' : $msg;
207 - $css = $quality ? 'fr-tab_quality' : 'fr-tab_stable';
208228
209 - $tag = "<span class='{$css} plainlinks'></span>" .
 229+ $tag = "<span class='{$css}'></span>" .
210230 wfMsgExt( $msg, array('parseinline'), $tfrev->getRevId(), $revs_since );
211231 $tag .= $this->prettyRatingBox( $tfrev, $flags, $revs_since, true, $synced );
212232 } else {
213233 $msg = $quality ? 'revreview-quality' : 'revreview-basic';
214234 $msg = $synced ? $msg . '-same' : $msg;
215235
216 - $tag = wfMsgExt( $msg, array('parseinline'), $tfrev->getRevId(), $time, $revs_since );
 236+ $tag = "<span class='{$css} plainlinks'></span>" .
 237+ wfMsgExt( $msg, array('parseinline'), $tfrev->getRevId(), $time, $revs_since );
217238 if( !empty($flags) ) {
218239 $tag .= " <span id='mw-revisiontoggle' class='flaggedrevs_toggle' style='display:none; cursor:pointer;'" .
219240 " onclick='toggleRevRatings()'>" . wfMsg('revreview-toggle') . "</span>";
220 - $tag .= "<span id='mw-revisionratings' style='display:block;'>" .
 241+ $tag .= "<span id='mw-revisionratings' style='display:block;'>" .
221242 $this->addTagRatings( $flags ) . '</span>';
222243 }
223244 }
@@ -234,34 +255,35 @@
235256 else if( $simpleTag )
236257 $tagClass = 'flaggedrevs_notice';
237258 else if( $pristine )
238 - $tagClass = 'flaggedrevs_tag3';
 259+ $tagClass = 'flaggedrevs_pristine';
239260 else if( $quality )
240 - $tagClass = 'flaggedrevs_tag2';
 261+ $tagClass = 'flaggedrevs_quality';
241262 else
242 - $tagClass = 'flaggedrevs_tag1';
 263+ $tagClass = 'flaggedrevs_basic';
243264 # Wrap tag contents in a div
244265 if( $tag !='' )
245 - $tag = '<div id="mw-revisiontag" class="'.$tagClass.' plainlinks">'.$tag.'</div>';
 266+ $tag = '<div id="mw-revisiontag" style="overflow: visible;" class="'.$tagClass.' plainlinks">'.$tag.'</div>';
246267 # Set the new body HTML, place a tag on top
247268 if( FlaggedRevs::useSimpleUI() ) {
248 - $this->reviewNotice = $tag;
 269+ $this->reviewNotice .= $tag;
249270 } else {
250 - $this->reviewNotice = $tag;
 271+ $this->reviewNotice .= $tag;
251272 }
252273 $wgOut->mBodytext = $wgOut->mBodytext . $notes;
253274 // Add "no reviewed version" tag, but not for main page
254275 } else if( !$wgOut->isPrintable() && !FlaggedRevs::isMainPage( $article->getTitle() ) ) {
255276 if( FlaggedRevs::useSimpleUI() ) {
256 - $tag .= "<span class='fr-tab_current plainlinks'></span>" .
 277+ $tag .= "<span class='fr-icon-current plainlinks'></span>" .
257278 wfMsgExt('revreview-quick-none',array('parseinline'));
258279 $tag = '<div id="mw-revisiontag" class="flaggedrevs_short plainlinks">'.$tag.'</div>';
259 - $this->reviewNotice = $tag;
 280+ $this->reviewNotice .= $tag;
260281 } else {
261282 $tag = '<div id="mw-revisiontag" class="flaggedrevs_notice plainlinks">' .
262283 wfMsgExt('revreview-noflagged', array('parseinline')) . '</div>';
263 - $this->reviewNotice = $tag;
 284+ $this->reviewNotice .= $tag;
264285 }
265286 }
 287+ $this->displayTag();
266288
267289 return true;
268290 }
@@ -284,7 +306,7 @@
285307 if( !$revid )
286308 return true;
287309 # Set new body html text as that of now
288 - $tag = '';
 310+ $tag = $warning = '';
289311 # Check the newest stable version
290312 $tfrev = $this->getStableRev();
291313 if( !is_null($tfrev) ) {
@@ -295,18 +317,31 @@
296318 $revs_since = FlaggedRevs::getRevCountSince( $editform->mArticle, $tfrev->getRevId() );
297319 # Construct some tagging
298320 $quality = FlaggedRevs::isQuality( $flags );
299 - # Hide clutter
 321+ # If this will be autoreviewed, notify the user...
 322+ if( $wgFlaggedRevsAutoReview && $wgUser->isAllowed('review') && $tfrev->getRevId()==$editform->mArticle->getLatest() ) {
 323+ # Check if user is allowed to renew the stable version.
 324+ # If it has been reviewed too highly for this user, abort.
 325+ foreach( $flags as $quality => $level ) {
 326+ if( !Revisionreview::userCan($quality,$level) ) {
 327+ return true;
 328+ }
 329+ }
 330+ $msg = ($revid==$tfrev->getRevId()) ? 'revreview-auto-w' : 'revreview-auto-w-old';
 331+ $warning = '<div id="mw-autoreviewtag" class="flaggedrevs_warning plainlinks">' .
 332+ wfMsgExt($msg,array('parseinline')) . '</div>';
 333+ }
 334+ # Streamlined UI
300335 if( FlaggedRevs::useSimpleUI() ) {
301 - $msg = $quality ? 'revreview-quick-see-quality' : 'revreview-quick-see-basic';
302 - $tag = "<span class='fr-tab_current plainlinks'></span>" .
303 - wfMsgExt( $msg,array('parseinline'), $tfrev->getRevId(), $revs_since );
304 - $tag .= $this->prettyRatingBox( $tfrev, $flags, $revs_since, false );
305 - $tag = '<div id="mw-revisiontag" class="flaggedrevs_short plainlinks">'.$tag.'</div>';
306 -
307 - $this->reviewNotice = $tag;
 336+ $msg = $quality ? 'revreview-newest-quality' : 'revreview-newest-basic';
 337+ $tag = "<span class='fr-checkbox'></span>" .
 338+ wfMsgExt( $msg, array('parseinline'), $tfrev->getRevId(), $time, $revs_since );
 339+ $tag = '<div id="mw-revisiontag" class="flaggedrevs_notice plainlinks">' . $tag . '</div>';
 340+ $wgOut->setSubtitle( $tag . $warning );
 341+ # Standard UI
308342 } else {
309343 $msg = $quality ? 'revreview-newest-quality' : 'revreview-newest-basic';
310 - $tag = wfMsgExt( $msg, array('parseinline'), $tfrev->getRevId(), $time, $revs_since );
 344+ $tag = "<span class='fr-checkbox'></span>" .
 345+ wfMsgExt( $msg, array('parseinline'), $tfrev->getRevId(), $time, $revs_since );
311346 # Hide clutter
312347 if( !empty($flags) ) {
313348 $tag .= ' <span id="mw-revisiontoggle" class="flaggedrevs_toggle" style="display:none; cursor:pointer;"' .
@@ -316,31 +351,9 @@
317352 }
318353 $tag = '<div id="mw-revisiontag" class="flaggedrevs_notice plainlinks">' . $tag . '</div>';
319354
320 - $this->reviewNotice = $tag;
 355+ $this->reviewNotice .= $tag . $warning;
321356 }
322 -
323 - if( !empty($flags) ) {
324 - $tag = ' <span id="mw-revisiontoggle" class="flaggedrevs_toggle" style="display:none; cursor:pointer;"' .
325 - ' onclick="toggleRevRatings()">' . wfMsg( 'revreview-toggle' ) . '</span>';
326 - $tag .= '<span id="mw-revisionratings" style="display:block;">' .
327 - wfMsg('revreview-oldrating') . $this->addTagRatings( $flags ) .
328 - '</span>';
329 - }
330 - # If this will be autoreviewed, notify the user...
331 - if( !$wgFlaggedRevsAutoReview )
332 - return true;
333 - if( $wgUser->isAllowed('review') && $tfrev->getRevId()==$editform->mArticle->getLatest() ) {
334 - # Check if user is allowed to renew the stable version.
335 - # If it has been reviewed too highly for this user, abort.
336 - foreach( $flags as $quality => $level ) {
337 - if( !Revisionreview::userCan($quality,$level) ) {
338 - return true;
339 - }
340 - }
341 - $msg = ($revid==$tfrev->getRevId()) ? 'revreview-auto-w' : 'revreview-auto-w-old';
342 - $wgOut->addHTML( '<div id="mw-autoreviewtag" class="flaggedrevs_warning plainlinks">' .
343 - '<span class="fr-checkbox"></span>' . wfMsgExt($msg,array('parseinline')) . '</div>' );
344 - }
 357+ $this->displayTag();
345358 }
346359 return true;
347360 }
@@ -876,6 +889,9 @@
877890 } else {
878891 if( $frev ){
879892 $extraq .= "stable=0";
 893+ if( !$wgUser->isAllowed('review') && $this->showStableByDefault() ) {
 894+ $extraq .= "&shownotice=1";
 895+ }
880896 }
881897 }
882898
Index: trunk/extensions/FlaggedRevs/FlaggedRevsPage.i18n.php
@@ -1,4 +1,4 @@
2 -<?php
 2+<?php
33 /**
44 * Internationalisation file for extension FlaggedRevs (group FlaggedRevsPage).
55 *
@@ -32,16 +32,18 @@
3333 'revreview-noflagged' => 'There are no reviewed revisions of this page, so it may \'\'\'not\'\'\' have been [[{{MediaWiki:Validationpage}}|checked]] for quality.',
3434 'stabilization-tab' => 'vet',
3535 'tooltip-ca-default' => 'Quality assurance settings',
 36+
 37+ 'revreview-edited' => "'''New edits will be incorporated into the [[{{MediaWiki:Validationpage}}|stable version]] once an established user reviews them. The ''draft'' is shown below. Thanks!'''",
3638
3739 'validationpage' => '{{ns:help}}:Article validation',
3840
3941 'revreview-quick-none' => '\'\'\'[[{{MediaWiki:Validationpage}}|Current revision]]\'\'\' (unreviewed)',
40 - 'revreview-quick-see-quality' => '\'\'\'Draft\'\'\' [[{{fullurl:{{FULLPAGENAMEE}}|stable=1}} view stable page]] ([{{fullurl:{{FULLPAGENAMEE}}|oldid=$1&diff=cur}} compare])',
41 - 'revreview-quick-see-basic' => '\'\'\'Draft\'\'\' [[{{fullurl:{{FULLPAGENAMEE}}|stable=1}} view stable page]] ([{{fullurl:{{FULLPAGENAMEE}}|oldid=$1&diff=cur}} compare])',
42 - 'revreview-quick-basic' => '\'\'\'[[{{MediaWiki:Validationpage}}|Sighted]]\'\'\' [[{{fullurl:{{FULLPAGENAMEE}}|stable=0}} view draft]] ([{{fullurl:{{FULLPAGENAMEE}}|oldid=$1&diff=cur}} compare])',
43 - 'revreview-quick-quality' => '\'\'\'[[{{MediaWiki:Validationpage}}|Quality]]\'\'\' [[{{fullurl:{{FULLPAGENAMEE}}|stable=0}} view draft]] ([{{fullurl:{{FULLPAGENAMEE}}|oldid=$1&diff=cur}} compare])',
44 - 'revreview-quick-basic-same' => '\'\'\'[[{{MediaWiki:Validationpage}}|Sighted]]\'\'\' (no draft)',
45 - 'revreview-quick-quality-same' => '\'\'\'[[{{MediaWiki:Validationpage}}|Quality]]\'\'\' (no draft)',
 42+ 'revreview-quick-see-quality' => '\'\'\'Draft\'\'\' [[{{fullurl:{{FULLPAGENAMEE}}|stable=1}} view article]] ([{{fullurl:{{FULLPAGENAMEE}}|oldid=$1&diff=cur}} compare])',
 43+ 'revreview-quick-see-basic' => '\'\'\'Draft\'\'\' [[{{fullurl:{{FULLPAGENAMEE}}|stable=1}} view article]] ([{{fullurl:{{FULLPAGENAMEE}}|oldid=$1&diff=cur}} compare])',
 44+ 'revreview-quick-basic' => '\'\'\'[[{{MediaWiki:Validationpage}}|Sighted article]]\'\'\' [[{{fullurl:{{FULLPAGENAMEE}}|stable=0}} view draft]] ([{{fullurl:{{FULLPAGENAMEE}}|oldid=$1&diff=cur}} compare])',
 45+ 'revreview-quick-quality' => '\'\'\'[[{{MediaWiki:Validationpage}}|Quality article]]\'\'\' [[{{fullurl:{{FULLPAGENAMEE}}|stable=0}} view draft]] ([{{fullurl:{{FULLPAGENAMEE}}|oldid=$1&diff=cur}} compare])',
 46+ 'revreview-quick-basic-same' => '\'\'\'[[{{MediaWiki:Validationpage}}|Sighted article]]\'\'\'',
 47+ 'revreview-quick-quality-same' => '\'\'\'[[{{MediaWiki:Validationpage}}|Quality article]]\'\'\'',
4648
4749 'revreview-newest-basic' => 'The [{{fullurl:{{FULLPAGENAMEE}}|stable=1}} latest sighted revision] ([{{fullurl:Special:Stableversions|page={{FULLPAGENAMEE}}}} list all]) was [{{fullurl:Special:Log|type=review&page={{FULLPAGENAMEE}}}} approved] on <i>$2</i>. [{{fullurl:{{FULLPAGENAMEE}}|oldid=$1&diff=cur}} $3 {{plural:$3|change|changes}}] {{plural:$3|needs|need}} review.',
4850 'revreview-newest-quality' => 'The [{{fullurl:{{FULLPAGENAMEE}}|stable=1}} latest quality revision] ([{{fullurl:Special:Stableversions|page={{FULLPAGENAMEE}}}} list all]) was [{{fullurl:Special:Log|type=review&page={{FULLPAGENAMEE}}}} approved] on <i>$2</i>. [{{fullurl:{{FULLPAGENAMEE}}|oldid=$1&diff=cur}} $3 {{plural:$3|change|changes}}] {{plural:$3|needs|need}} review.',

Status & tagging log