Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php |
— | — | @@ -14,7 +14,7 @@ |
15 | 15 | $wgExtensionCredits['specialpage'][] = array( |
16 | 16 | 'name' => 'Flagged Revisions', |
17 | 17 | 'author' => array( 'Aaron Schulz', 'Joerg Baach' ), |
18 | | - 'version' => '1.019', |
| 18 | + 'version' => '1.02', |
19 | 19 | 'url' => 'http://www.mediawiki.org/wiki/Extension:FlaggedRevs', |
20 | 20 | 'descriptionmsg' => 'flaggedrevs-desc', |
21 | 21 | ); |
Index: trunk/extensions/FlaggedRevs/FlaggedArticle.php |
— | — | @@ -133,7 +133,6 @@ |
134 | 134 | } |
135 | 135 | $simpleTag = $old = $stable = false; |
136 | 136 | $tag = $notes = $pending = ''; |
137 | | - $same = true; |
138 | 137 | # Check the newest stable version. |
139 | 138 | $frev = $this->getStableRev( true ); |
140 | 139 | $stableId = $frev ? $frev->getRevId() : 0; |
— | — | @@ -158,12 +157,58 @@ |
159 | 158 | # Get quality level |
160 | 159 | $quality = FlaggedRevs::isQuality( $flags ); |
161 | 160 | $pristine = FlaggedRevs::isPristine( $flags ); |
162 | | - // Looking at some specific old rev or if flagged revs are not |
| 161 | + // Looking at some specific old stable revision ("&stableid=x") |
163 | 162 | // set to override given the relevant conditions. If the user is |
164 | 163 | // requesting the stable revision ("&stableid=x"), defer to override |
165 | 164 | // behavior below, since it is the same as ("&stable=1"). |
166 | | - if( !$stable && !$this->pageOverride() ) { |
| 165 | + if( $old ) { |
167 | 166 | $revs_since = FlaggedRevs::getRevCountSince( $article, $frev->getRevId() ); |
| 167 | + global $wgUseStableTemplates; |
| 168 | + if( $wgUseStableTemplates ) { |
| 169 | + $rev = Revision::newFromId( $frev->getRevId() ); |
| 170 | + $text = $rev->getText(); |
| 171 | + } else { |
| 172 | + $text = $frev->getText(); |
| 173 | + } |
| 174 | + $parserOut = FlaggedRevs::parseStableText( $article, $text, $frev->getRevId() ); |
| 175 | + # Construct some tagging for non-printable outputs. Note that the pending |
| 176 | + # notice has all this info already, so don't do this if we added that already. |
| 177 | + if( !$wgOut->isPrintable() ) { |
| 178 | + $css = 'fr-icon-current'; // default |
| 179 | + // Simple icon-based UI |
| 180 | + if( FlaggedRevs::useSimpleUI() ) { |
| 181 | + $msg = $quality ? 'revreview-quick-quality-old' : 'revreview-quick-basic-old'; |
| 182 | + $css = $quality ? 'fr-icon-quality' : 'fr-icon-stable'; |
| 183 | + $tag .= "<span class='{$css}'></span>" . |
| 184 | + wfMsgExt( $msg, array('parseinline'), $frev->getRevId(), $time ) . |
| 185 | + $this->prettyRatingBox( $frev, $revs_since, true, $synced, $old ); |
| 186 | + // Standard UI |
| 187 | + } else { |
| 188 | + $msg = $quality ? 'revreview-quality-old' : 'revreview-basic-old'; |
| 189 | + $css = $quality ? 'fr-icon-quality' : 'fr-icon-stable'; |
| 190 | + $tag .= "<span class='{$css}'></span>" . |
| 191 | + wfMsgExt( $msg, array('parseinline'), $frev->getRevId(), $time ); |
| 192 | + # Hide clutter |
| 193 | + if( !empty($flags) ) { |
| 194 | + $tag .= " <span id='mw-revisiontoggle' class='flaggedrevs_toggle' style='display:none; cursor:pointer;'" . |
| 195 | + " onclick='toggleRevRatings()'>" . wfMsg( 'revreview-toggle' ) . "</span>"; |
| 196 | + $tag .= "<span id='mw-revisionratings' style='display:block;'>" . |
| 197 | + wfMsgHtml('revreview-oldrating') . $this->addTagRatings( $flags ) . '</span>'; |
| 198 | + } |
| 199 | + } |
| 200 | + } |
| 201 | + # Output HTML |
| 202 | + $wgOut->addParserOutput( $parserOut ); |
| 203 | + $notes = $this->ReviewNotes( $frev ); |
| 204 | + # Tell MW that parser output is done |
| 205 | + $outputDone = true; |
| 206 | + $pcache = false; |
| 207 | + // Looking at some specific old revision or if FlaggedRevs is not |
| 208 | + // set to override given the relevant conditions. If the user is |
| 209 | + // requesting the stable revision ("&stableid=x"), defer to override |
| 210 | + // behavior below, since it is the same as ("&stable=1"). |
| 211 | + } else if( !$stable && !$this->pageOverride() ) { |
| 212 | + $revs_since = FlaggedRevs::getRevCountSince( $article, $frev->getRevId() ); |
168 | 213 | $synced = FlaggedRevs::flaggedRevIsSynced( $frev, $article, null, null ); |
169 | 214 | # Give notice to newewer users if an unreviewed edit was completed... |
170 | 215 | if( $wgRequest->getVal('shownotice') && !$synced && !$wgUser->isAllowed('review') ) { |
— | — | @@ -175,7 +220,7 @@ |
176 | 221 | $this->reviewNotice = $pending; |
177 | 222 | } |
178 | 223 | # If they are synced, do special styling |
179 | | - $simpleTag = !$synced && !$old; |
| 224 | + $simpleTag = !$synced; |
180 | 225 | # Construct some tagging for non-printable outputs. Note that the pending |
181 | 226 | # notice has all this info already, so don't do this if we added that already. |
182 | 227 | if( !$wgOut->isPrintable() && !$pending ) { |
— | — | @@ -186,26 +231,18 @@ |
187 | 232 | $msg = $quality ? 'revreview-quick-quality-same' : 'revreview-quick-basic-same'; |
188 | 233 | $css = $quality ? 'fr-icon-quality' : 'fr-icon-stable'; |
189 | 234 | $msgHTML = wfMsgExt( $msg, array('parseinline'), $frev->getRevId(), $revs_since ); |
190 | | - } else if( $old ) { |
191 | | - $msg = $quality ? 'revreview-quick-quality-old' : 'revreview-quick-basic-old'; |
192 | | - $css = $quality ? 'fr-icon-quality' : 'fr-icon-stable'; |
193 | | - $msgHTML = wfMsgExt( $msg, array('parseinline'), $frev->getRevId(), $time ); |
194 | 235 | } else { |
195 | 236 | $msg = $quality ? 'revreview-quick-see-quality' : 'revreview-quick-see-basic'; |
196 | 237 | $msgHTML = wfMsgExt( $msg, array('parseinline'), $frev->getRevId(), $revs_since ); |
197 | 238 | } |
198 | 239 | $tag .= "<span class='{$css}'></span>" . $msgHTML . |
199 | | - $this->prettyRatingBox( $frev, $revs_since, $synced || $old, $synced, $old ); |
| 240 | + $this->prettyRatingBox( $frev, $revs_since, $synced, $synced, $old ); |
200 | 241 | // Standard UI |
201 | 242 | } else { |
202 | 243 | if( $synced ) { |
203 | 244 | $msg = $quality ? 'revreview-quality-same' : 'revreview-basic-same'; |
204 | 245 | $css = $quality ? 'fr-icon-quality' : 'fr-icon-stable'; |
205 | 246 | $msgHTML = wfMsgExt( $msg, array('parseinline'), $frev->getRevId(), $time, $revs_since ); |
206 | | - } else if( $old ) { |
207 | | - $msg = $quality ? 'revreview-quality-old' : 'revreview-basic-old'; |
208 | | - $css = $quality ? 'fr-icon-quality' : 'fr-icon-stable'; |
209 | | - $msgHTML = wfMsgExt( $msg, array('parseinline'), $frev->getRevId(), $time ); |
210 | 247 | } else { |
211 | 248 | $msg = $quality ? 'revreview-newest-quality' : 'revreview-newest-basic'; |
212 | 249 | $msgHTML = wfMsgExt( $msg, array('parseinline'), $frev->getRevId(), $time, $revs_since ); |
— | — | @@ -220,7 +257,7 @@ |
221 | 258 | } |
222 | 259 | } |
223 | 260 | } |
224 | | - // Viewing the page normally: override the page |
| 261 | + // The relevant conditions are met to override the page with the stable version. |
225 | 262 | } else { |
226 | 263 | # We will be looking at the reviewed revision... |
227 | 264 | $revs_since = FlaggedRevs::getRevCountSince( $article, $frev->getRevId() ); |
— | — | @@ -245,7 +282,7 @@ |
246 | 283 | // Simple icon-based UI |
247 | 284 | if( FlaggedRevs::useSimpleUI() ) { |
248 | 285 | $msg = $quality ? 'revreview-quick-quality' : 'revreview-quick-basic'; |
249 | | - $msg = $synced ? $msg . '-same' : $msg; |
| 286 | + $msg = $synced ? "{$msg}-same" : $msg; |
250 | 287 | |
251 | 288 | $tag = "<span class='{$css}'></span>" . |
252 | 289 | wfMsgExt( $msg, array('parseinline'), $frev->getRevId(), $revs_since ); |
— | — | @@ -253,7 +290,7 @@ |
254 | 291 | // Standard UI |
255 | 292 | } else { |
256 | 293 | $msg = $quality ? 'revreview-quality' : 'revreview-basic'; |
257 | | - $msg = $synced ? $msg . '-same' : $msg; |
| 294 | + $msg = $synced ? "{$msg}-same" : $msg; |
258 | 295 | |
259 | 296 | $tag = "<span class='{$css} plainlinks'></span>" . |
260 | 297 | wfMsgExt( $msg, array('parseinline'), $frev->getRevId(), $time, $revs_since ); |