Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php |
— | — | @@ -347,7 +347,8 @@ |
348 | 348 | $wgDefaultUserOptions['flaggedrevsviewdiffs'] = false; |
349 | 349 | |
350 | 350 | # JS/CSS modules and message bundles used by JS scripts |
351 | | -$dir = dirname( __FILE__ ) . '/client/'; |
| 351 | +$localModulePath = dirname( __FILE__ ) . '/modules/'; |
| 352 | +$remoteModulePath = 'FlaggedRevs/modules'; |
352 | 353 | $wgResourceModules['ext.flaggedRevs.basic'] = array( |
353 | 354 | 'styles' => array( 'flaggedrevs.css' ), |
354 | 355 | 'scripts' => array( 'flaggedrevs.js' ), |
— | — | @@ -357,9 +358,9 @@ |
358 | 359 | 'revreview-log-toggle-show', 'revreview-log-toggle-hide', |
359 | 360 | 'revreview-log-details-show', 'revreview-log-details-hide' |
360 | 361 | ), |
361 | | - 'dependencies' => array( 'jquery', 'mediawiki.util' ), |
362 | | - 'localBasePath' => $dir, |
363 | | - 'remoteExtPath' => 'FlaggedRevs/client' |
| 362 | + 'dependencies' => array( 'mediawiki.util' ), |
| 363 | + 'localBasePath' => $localModulePath, |
| 364 | + 'remoteExtPath' => $remoteModulePath, |
364 | 365 | ); |
365 | 366 | $wgResourceModules['ext.flaggedRevs.review'] = array( |
366 | 367 | 'scripts' => array( 'review.js' ), |
— | — | @@ -370,9 +371,9 @@ |
371 | 372 | 'revreview-submit-reviewed', 'revreview-submit-unreviewed', |
372 | 373 | 'revreview-submitting', 'actioncomplete', 'actionfailed' |
373 | 374 | ), |
374 | | - 'dependencies' => array( 'jquery', 'mediawiki.util' ), |
375 | | - 'localBasePath' => $dir, |
376 | | - 'remoteExtPath' => 'FlaggedRevs/client' |
| 375 | + 'dependencies' => array( 'mediawiki.util' ), |
| 376 | + 'localBasePath' => $localModulePath, |
| 377 | + 'remoteExtPath' => $remoteModulePath, |
377 | 378 | ); |
378 | 379 | |
379 | 380 | # ####### HOOK TRIGGERED FUNCTIONS ######### |
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.class.php |
— | — | @@ -375,12 +375,12 @@ |
376 | 376 | } |
377 | 377 | |
378 | 378 | /** |
379 | | - * Get the URL path to /client (has JS, CSS, & icons) |
| 379 | + * Get the URL path to where the client side resources are (JS, CSS, images..) |
380 | 380 | * @return string |
381 | 381 | */ |
382 | 382 | public static function styleUrlPath() { |
383 | 383 | global $wgExtensionAssetsPath; |
384 | | - return "$wgExtensionAssetsPath/FlaggedRevs/client"; |
| 384 | + return "$wgExtensionAssetsPath/FlaggedRevs/modules"; |
385 | 385 | } |
386 | 386 | |
387 | 387 | # ################ Permission functions ################# |
— | — | @@ -1273,7 +1273,7 @@ |
1274 | 1274 | ) ); |
1275 | 1275 | $flaggedRevision->insertOn( $auto ); |
1276 | 1276 | # Update the article review log |
1277 | | - FlaggedRevsLogs::updateReviewLog( $title, |
| 1277 | + FlaggedRevsLogs::updateLog( $title, |
1278 | 1278 | $flags, array(), '', $rev->getId(), $oldSvId, true, $auto ); |
1279 | 1279 | |
1280 | 1280 | # Update page and tracking tables and clear cache |
Index: trunk/extensions/FlaggedRevs/modules/flaggedrevs.css |
— | — | @@ -0,0 +1,368 @@ |
| 2 | +/** |
| 3 | + * FlaggedRevs Stylesheet |
| 4 | + * @author Aaron Schulz |
| 5 | + */ |
| 6 | + |
| 7 | +/* Standard User Interface */ |
| 8 | +div.flaggedrevs_basic, |
| 9 | +div.flaggedrevs_quality, |
| 10 | +div.flaggedrevs_pristine, |
| 11 | +div.flaggedrevs_notice { |
| 12 | + border: 1px solid #aaa; |
| 13 | + padding: 5px; |
| 14 | + font-weight: normal; |
| 15 | + line-height: 1.5em; |
| 16 | + margin: .5em 1em 0em 0em; |
| 17 | + text-align: center; |
| 18 | + clear: both; |
| 19 | +} |
| 20 | +div.flaggedrevs_short_basic img { |
| 21 | + vertical-align: text-bottom; |
| 22 | +} |
| 23 | +div.flaggedrevs_basic { |
| 24 | + background-color: #f0f8ff; |
| 25 | +} |
| 26 | +div.flaggedrevs_quality { |
| 27 | + background-color: #f0fff0; |
| 28 | +} |
| 29 | +div.flaggedrevs_pristine { |
| 30 | + background-color: #fffff0; |
| 31 | +} |
| 32 | +div.flaggedrevs_notice { |
| 33 | + background-color: #f9f9f9; |
| 34 | +} |
| 35 | + |
| 36 | +table.flaggedrevs_editnotice, |
| 37 | +table.flaggedrevs_viewnotice { |
| 38 | + padding: 3px; |
| 39 | + border: 2px solid #6cc8f3; |
| 40 | + background-color: #f9f9f9; |
| 41 | + text-align: left; |
| 42 | + width: 100%; |
| 43 | + clear: both; |
| 44 | +} |
| 45 | + |
| 46 | +div.flaggedrevs_diffnotice, |
| 47 | +div.flaggedrevs_preview { |
| 48 | + border: 1px solid #a7d7f9; |
| 49 | + padding: 5px; |
| 50 | + text-align: center; |
| 51 | + clear: both; |
| 52 | +} |
| 53 | +div.flaggedrevs_diffnotice { |
| 54 | + font-size: 85%; |
| 55 | + background-color: #f9f9f9; |
| 56 | +} |
| 57 | +div.flaggedrevs_preview { |
| 58 | + background-color: #eaf2fd; |
| 59 | + color: black; |
| 60 | +} |
| 61 | + |
| 62 | +span.flaggedrevs_important { |
| 63 | + font-size: 115%; |
| 64 | + font-weight: bold; |
| 65 | +} |
| 66 | + |
| 67 | +div.flaggedrevs_notes { |
| 68 | + border: 1px solid #aaa; |
| 69 | + background-color: #f9f9f9; |
| 70 | + padding: 5px; |
| 71 | + font-size: 85%; |
| 72 | + margin-left: 50px; |
| 73 | + margin-right: 50px; |
| 74 | + text-align: center; |
| 75 | +} |
| 76 | + |
| 77 | +.fr-text-value { |
| 78 | + width: 100px; |
| 79 | +} |
| 80 | + |
| 81 | +.fr-marker-20, |
| 82 | +.fr-marker-40, |
| 83 | +.fr-marker-60, |
| 84 | +.fr-marker-80, |
| 85 | +.fr-marker-100 { |
| 86 | + background-position: bottom left; |
| 87 | + background-repeat: no-repeat; |
| 88 | + padding-bottom: 3px; |
| 89 | +} |
| 90 | + |
| 91 | +.fr-marker-20 { |
| 92 | + /* @embed */ |
| 93 | + background-image: url('img/bar_20.png'); |
| 94 | +} |
| 95 | +.fr-marker-40 { |
| 96 | + /* @embed */ |
| 97 | + background-image: url('img/bar_40.png'); |
| 98 | +} |
| 99 | +.fr-marker-60 { |
| 100 | + /* @embed */ |
| 101 | + background-image: url('img/bar_60.png'); |
| 102 | +} |
| 103 | +.fr-marker-80 { |
| 104 | + /* @embed */ |
| 105 | + background-image: url('img/bar_80.png'); |
| 106 | +} |
| 107 | +.fr-marker-100 { |
| 108 | + /* @embed */ |
| 109 | + background-image: url('img/bar_100.png'); |
| 110 | +} |
| 111 | + |
| 112 | +/* Short User Interface */ |
| 113 | +div.flaggedrevs_short { |
| 114 | + border: 1px solid #ccc; |
| 115 | + background-color: #ffffff; |
| 116 | + font-size: 95%; |
| 117 | + font-weight: normal; |
| 118 | + margin: 0 0 0 1em; |
| 119 | + line-height: 16px; |
| 120 | + padding: 2px; |
| 121 | + float: right; |
| 122 | +} |
| 123 | + |
| 124 | +/* @noflip */ |
| 125 | +.rtl div.flaggedrevs_short { |
| 126 | + float: left; |
| 127 | + margin: 0 1em 0 0; |
| 128 | +} |
| 129 | + |
| 130 | +div.flaggedrevs_short_basic { |
| 131 | + white-space: nowrap; |
| 132 | +} |
| 133 | + |
| 134 | +div.flaggedrevs_short_details { |
| 135 | + border: 1px solid #aaa; |
| 136 | + background-color: #ffffff; |
| 137 | + padding: 5px; |
| 138 | + position: absolute; |
| 139 | + top: 0; |
| 140 | + right: -2px; |
| 141 | + width: 25em; |
| 142 | +} |
| 143 | + |
| 144 | +/* @noflip */ |
| 145 | +.rtl div.flaggedrevs_short_details { |
| 146 | + right: auto; |
| 147 | + left: -2px; |
| 148 | +} |
| 149 | + |
| 150 | +.fr-text { |
| 151 | + height: 1em; |
| 152 | + line-height: 1em; |
| 153 | + margin: 0px 7px 0px 0px; |
| 154 | + padding: 0px; |
| 155 | + font-weight: bold; |
| 156 | + width: 80px; |
| 157 | +} |
| 158 | + |
| 159 | +.fr-value20, |
| 160 | +.fr-value40, |
| 161 | +.fr-value60, |
| 162 | +.fr-value80, |
| 163 | +.fr-value100 { |
| 164 | + height: 1em; |
| 165 | + line-height: 1em; |
| 166 | + width: 95px; |
| 167 | + float: left; |
| 168 | + background-repeat: no-repeat; |
| 169 | + background-position: 50% 50%; |
| 170 | + text-align: center; |
| 171 | +} |
| 172 | + |
| 173 | +.fr-value20 { |
| 174 | + /* @embed */ |
| 175 | + background-image: url('img/fr-marker-20.png'); |
| 176 | +} |
| 177 | +.fr-value40 { |
| 178 | + /* @embed */ |
| 179 | + background-image: url('img/fr-marker-40.png'); |
| 180 | +} |
| 181 | +.fr-value60 { |
| 182 | + /* @embed */ |
| 183 | + background-image: url('img/fr-marker-60.png'); |
| 184 | +} |
| 185 | +.fr-value80 { |
| 186 | + /* @embed */ |
| 187 | + background-image: url('img/fr-marker-80.png'); |
| 188 | +} |
| 189 | +.fr-value100 { |
| 190 | + /* @embed */ |
| 191 | + background-image: url('img/fr-marker-100.png'); |
| 192 | +} |
| 193 | + |
| 194 | +/* Both User Interfaces */ |
| 195 | +.flaggedrevs-color-0 { |
| 196 | + background-color: #f9f9f9; |
| 197 | +} |
| 198 | +.flaggedrevs-color-1 { |
| 199 | + background-color: #f0f8ff; |
| 200 | +} |
| 201 | +.flaggedrevs-color-2 { |
| 202 | + background-color: #f0fff0; |
| 203 | +} |
| 204 | +.flaggedrevs-color-3 { |
| 205 | + background-color: #fffff0; |
| 206 | +} |
| 207 | + |
| 208 | +.flaggedrevs-pending { |
| 209 | + background-color: #ffeeaa; |
| 210 | +} |
| 211 | +.flaggedrevs-unreviewed { |
| 212 | + background-color: #faebd7; |
| 213 | +} |
| 214 | + |
| 215 | +a.fr-toggle-symbol { |
| 216 | + color: blue; |
| 217 | + white-space: nowrap; |
| 218 | + font-family: monospace; |
| 219 | + font-weight: bold; |
| 220 | + cursor: pointer; |
| 221 | + margin: 0 .3em 0 .3em; |
| 222 | +} |
| 223 | + |
| 224 | +a.fr-toggle-text { |
| 225 | + color: blue; |
| 226 | + font-weight: bold; |
| 227 | + cursor: pointer; |
| 228 | +} |
| 229 | + |
| 230 | +img.fr-toggle-arrow { |
| 231 | + cursor: pointer; |
| 232 | +} |
| 233 | + |
| 234 | +li.fr-hist-stable-margin { |
| 235 | + margin-top: 2em; |
| 236 | +} |
| 237 | + |
| 238 | +img.flaggedrevs-icon { |
| 239 | + margin-right: .2em; |
| 240 | + margin-left: .2em; |
| 241 | +} |
| 242 | + |
| 243 | +.fr-diff-ratings { |
| 244 | + font-size: 90%; |
| 245 | + font-weight: bold; |
| 246 | + line-height: 1em; |
| 247 | + width: 100%; |
| 248 | +} |
| 249 | + |
| 250 | +.fr-diff-to-stable { |
| 251 | + line-height: 1em; |
| 252 | +} |
| 253 | + |
| 254 | +.fr-hist-basic-user, |
| 255 | +.fr-hist-quality-user, |
| 256 | +.fr-hist-basic-auto, |
| 257 | +.fr-hist-quality-auto { |
| 258 | + font-weight: bold; |
| 259 | +} |
| 260 | + |
| 261 | +/* RC pending changes notice */ |
| 262 | +.fr-watchlist-pending-notice { |
| 263 | + padding: 3px; |
| 264 | + margin: 5px; |
| 265 | + border: 1px solid #990000; |
| 266 | + background-color: #FEECD7; |
| 267 | +} |
| 268 | + |
| 269 | +/* Special pages */ |
| 270 | +.fr-pending-long { |
| 271 | + background-color: #f5ecec; |
| 272 | +} |
| 273 | +.fr-pending-long2 { |
| 274 | + background-color: #f5dddd; |
| 275 | +} |
| 276 | +.fr-pending-long3 { |
| 277 | + background-color: #e2caca; |
| 278 | +} |
| 279 | + |
| 280 | +.fr-unreviewed-unwatched { |
| 281 | + background-color: #faebd7; |
| 282 | +} |
| 283 | + |
| 284 | +span.fr-under-review { |
| 285 | + background-color: yellow; |
| 286 | + font-weight: bold; |
| 287 | +} |
| 288 | + |
| 289 | +.mw-fr-reviewlink { |
| 290 | + font-weight: bold; |
| 291 | +} |
| 292 | + |
| 293 | +/* Review form */ |
| 294 | +.flaggedrevs_reviewform { |
| 295 | + background-color: #f9f9f9; |
| 296 | + font-size: 90%; |
| 297 | + clear: both; |
| 298 | +} |
| 299 | + |
| 300 | +.fr-rating-controls, |
| 301 | +.fr-rating-controls-disabled { |
| 302 | + vertical-align: middle; |
| 303 | +} |
| 304 | + |
| 305 | +.fr-rating-controls-disabled { |
| 306 | + color: GrayText; |
| 307 | +} |
| 308 | + |
| 309 | +.fr-rating-options { |
| 310 | + margin-right: 1.5em; |
| 311 | +} |
| 312 | + |
| 313 | +.fr-rating-option-0 { |
| 314 | + background-color: #f5ecec; |
| 315 | +} |
| 316 | +.fr-rating-option-1 { |
| 317 | + background-color: #f0f8ff; |
| 318 | +} |
| 319 | +.fr-rating-option-2 { |
| 320 | + background-color: #f0fff0; |
| 321 | +} |
| 322 | +.fr-rating-option-3 { |
| 323 | + background-color: #fef0db; |
| 324 | +} |
| 325 | +.fr-rating-option-4 { |
| 326 | + background-color: #fffff0; |
| 327 | +} |
| 328 | + |
| 329 | +.fr-diff-patrollink { |
| 330 | + text-align: center; |
| 331 | +} |
| 332 | + |
| 333 | +.fr-notes-box { |
| 334 | + width: 95%; |
| 335 | + margin: 0em 1em 0em .5em; |
| 336 | +} |
| 337 | + |
| 338 | +.fr-comment-box { |
| 339 | + margin-top: .25em; |
| 340 | +} |
| 341 | + |
| 342 | +.fr-rating-dave { |
| 343 | + background-color: #E0ECF8; |
| 344 | +} |
| 345 | + |
| 346 | +.fr-rating-rave { |
| 347 | + background-color: #E0F8EC; |
| 348 | +} |
| 349 | + |
| 350 | +.fr-hiddenform { |
| 351 | + display: none; |
| 352 | +} |
| 353 | + |
| 354 | +.loading { display: block; |
| 355 | + color: #666666; padding-left: 40px; |
| 356 | + height: 32px; |
| 357 | +} |
| 358 | +.spinner { |
| 359 | + background-position: left center; |
| 360 | + margin-left: 1em; |
| 361 | + margin-top: -1.3em; |
| 362 | + float: left; |
| 363 | +} |
| 364 | + |
| 365 | +div.langlinks { |
| 366 | + margin-top: 1em; |
| 367 | + padding: 5px; |
| 368 | + border: 1px solid #aaa; |
| 369 | +} |
\ No newline at end of file |
Property changes on: trunk/extensions/FlaggedRevs/modules/flaggedrevs.css |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 370 | + native |
Index: trunk/extensions/FlaggedRevs/modules/flaggedrevs.js |
— | — | @@ -0,0 +1,271 @@ |
| 2 | +/** |
| 3 | + * FlaggedRevs Stylesheet |
| 4 | + * @author Aaron Schulz |
| 5 | + * @author Krinkle <krinklemail@gmail.com> 2011 |
| 6 | + */ |
| 7 | + |
| 8 | +window.FlaggedRevs = { |
| 9 | + /* Dropdown collapse timer */ |
| 10 | + 'boxCollapseTimer': null, |
| 11 | + |
| 12 | + /* Enables rating/diff clutter via show/hide */ |
| 13 | + 'enableShowhide': function() { |
| 14 | + // Rating detail box |
| 15 | + var toggle = document.getElementById('mw-fr-revisiontoggle'); |
| 16 | + if ( toggle ) { |
| 17 | + toggle.style.display = 'inline'; /* show toggle control */ |
| 18 | + this.hideBoxDetails(); /* hide the initially displayed ratings */ |
| 19 | + } |
| 20 | + // Diff detail box |
| 21 | + toggle = document.getElementById('mw-fr-difftoggle'); |
| 22 | + if ( toggle ) { |
| 23 | + toggle.style.display = 'inline'; /* show toggle control */ |
| 24 | + var diff = document.getElementById('mw-fr-stablediff'); |
| 25 | + if ( diff ) { |
| 26 | + diff.style.display = 'none'; |
| 27 | + } |
| 28 | + } |
| 29 | + // Log detail box |
| 30 | + toggle = document.getElementById('mw-fr-logtoggle'); |
| 31 | + if ( toggle ) { |
| 32 | + toggle.style.display = 'inline'; /* show toggle control */ |
| 33 | + var log = document.getElementById('mw-fr-logexcerpt'); |
| 34 | + if ( log ) { |
| 35 | + log.style.display = 'none'; |
| 36 | + } |
| 37 | + } |
| 38 | + }, |
| 39 | + |
| 40 | + /* Expands flag info box details */ |
| 41 | + 'showBoxDetails': function() { |
| 42 | + var ratings = document.getElementById('mw-fr-revisiondetails'); |
| 43 | + if ( ratings ) { |
| 44 | + ratings.style.display = 'block'; |
| 45 | + } |
| 46 | + }, |
| 47 | + |
| 48 | + /* Collapses flag info box details */ |
| 49 | + 'hideBoxDetails': function( event ) { |
| 50 | + var ratings = document.getElementById('mw-fr-revisiondetails'); |
| 51 | + if ( ratings ) { |
| 52 | + ratings.style.display = 'none'; |
| 53 | + } |
| 54 | + }, |
| 55 | + |
| 56 | + /* Toggles flag info box details for (+/-) control */ |
| 57 | + 'toggleBoxDetails': function() { |
| 58 | + var toggle = document.getElementById('mw-fr-revisiontoggle'); |
| 59 | + if ( !toggle ) { |
| 60 | + return; |
| 61 | + } |
| 62 | + var ratings = document.getElementById('mw-fr-revisiondetails'); |
| 63 | + if ( !ratings ) { |
| 64 | + return; |
| 65 | + } |
| 66 | + // Collapsed -> expand |
| 67 | + if ( ratings.style.display == 'none' ) { |
| 68 | + this.showBoxDetails(); |
| 69 | + toggle.innerHTML = mw.msg('revreview-toggle-hide'); |
| 70 | + // Expanded -> collapse |
| 71 | + } else { |
| 72 | + this.hideBoxDetails(); |
| 73 | + toggle.innerHTML = mw.msg('revreview-toggle-show'); |
| 74 | + } |
| 75 | + }, |
| 76 | + |
| 77 | + /* Expands flag info box details on mouseOver */ |
| 78 | + 'onBoxMouseOver': function( event ) { |
| 79 | + window.clearTimeout( this.boxCollapseTimer ); |
| 80 | + this.boxCollapseTimer = null; |
| 81 | + this.showBoxDetails(); |
| 82 | + }, |
| 83 | + |
| 84 | + /* Hides flag info box details on mouseOut *except* for event bubbling */ |
| 85 | + 'onBoxMouseOut': function( event ) { |
| 86 | + if ( !this.isMouseOutBubble( event, 'mw-fr-revisiontag' ) ) { |
| 87 | + this.boxCollapseTimer = window.setTimeout( this.hideBoxDetails, 150 ); |
| 88 | + } |
| 89 | + }, |
| 90 | + |
| 91 | + /* Checks is mouseOut event is for a child of parentId */ |
| 92 | + 'isMouseOutBubble': function( event, parentId ) { |
| 93 | + var toNode = null; |
| 94 | + if ( event.relatedTarget !== undefined ) { |
| 95 | + toNode = event.relatedTarget; // FF/Opera/Safari |
| 96 | + } else { |
| 97 | + toNode = event.toElement; // IE |
| 98 | + } |
| 99 | + if ( toNode ) { |
| 100 | + var nextParent = toNode.parentNode; |
| 101 | + while ( nextParent ) { |
| 102 | + if ( nextParent.id == parentId ) { |
| 103 | + return true; // event bubbling |
| 104 | + } |
| 105 | + nextParent = nextParent.parentNode; // next up |
| 106 | + } |
| 107 | + } |
| 108 | + return false; |
| 109 | + }, |
| 110 | + |
| 111 | + /* Toggles diffs */ |
| 112 | + 'toggleDiff': function() { |
| 113 | + var diff = document.getElementById('mw-fr-stablediff'); |
| 114 | + if ( !diff ) { |
| 115 | + return; |
| 116 | + } |
| 117 | + var toggle = document.getElementById('mw-fr-difftoggle'); |
| 118 | + if ( !toggle ) { |
| 119 | + return; |
| 120 | + } |
| 121 | + if ( diff.style.display == 'none' ) { |
| 122 | + diff.style.display = 'block'; |
| 123 | + toggle.getElementsByTagName('a')[0].innerHTML = |
| 124 | + mw.msg('revreview-diff-toggle-hide'); |
| 125 | + } else { |
| 126 | + diff.style.display = 'none'; |
| 127 | + toggle.getElementsByTagName('a')[0].innerHTML = |
| 128 | + mw.msg('revreview-diff-toggle-show'); |
| 129 | + } |
| 130 | + }, |
| 131 | + |
| 132 | + /* Toggles log excerpts */ |
| 133 | + 'toggleLog': function() { |
| 134 | + var log = document.getElementById('mw-fr-logexcerpt'); |
| 135 | + if ( !log ) { |
| 136 | + return; |
| 137 | + } |
| 138 | + var toggle = document.getElementById('mw-fr-logtoggle'); |
| 139 | + if ( !toggle ) { |
| 140 | + return; |
| 141 | + } |
| 142 | + if ( log.style.display == 'none' ) { |
| 143 | + log.style.display = 'block'; |
| 144 | + toggle.getElementsByTagName('a')[0].innerHTML = |
| 145 | + mw.msg('revreview-log-toggle-hide'); |
| 146 | + } else { |
| 147 | + log.style.display = 'none'; |
| 148 | + toggle.getElementsByTagName('a')[0].innerHTML = |
| 149 | + mw.msg('revreview-log-toggle-show'); |
| 150 | + } |
| 151 | + }, |
| 152 | + |
| 153 | + /* Toggles log excerpts */ |
| 154 | + 'toggleLogDetails': function() { |
| 155 | + var log = document.getElementById('mw-fr-logexcerpt'); |
| 156 | + if ( !log ) { |
| 157 | + return; |
| 158 | + } |
| 159 | + var toggle = document.getElementById('mw-fr-logtoggle'); |
| 160 | + if ( !toggle ) { |
| 161 | + return; |
| 162 | + } |
| 163 | + if ( log.style.display == 'none' ) { |
| 164 | + log.style.display = 'block'; |
| 165 | + toggle.getElementsByTagName('a')[0].innerHTML = mw.msg('revreview-log-details-hide'); |
| 166 | + } else { |
| 167 | + log.style.display = 'none'; |
| 168 | + toggle.getElementsByTagName('a')[0].innerHTML = mw.msg('revreview-log-details-show'); |
| 169 | + } |
| 170 | + }, |
| 171 | + |
| 172 | + /* Enables changing of save button when "review this" checkbox changes */ |
| 173 | + 'setCheckTrigger': function() { |
| 174 | + var checkbox = document.getElementById('wpReviewEdit'); |
| 175 | + if ( checkbox ) { |
| 176 | + checkbox.onclick = FlaggedRevs.updateSaveButton; |
| 177 | + } |
| 178 | + }, |
| 179 | + |
| 180 | + /* Update save button when "review this" checkbox changes */ |
| 181 | + 'updateSaveButton': function() { |
| 182 | + var checkbox = document.getElementById('wpReviewEdit'); |
| 183 | + var save = document.getElementById('wpSave'); |
| 184 | + if ( checkbox && save ) { |
| 185 | + // Review pending changes |
| 186 | + if ( checkbox.checked ) { |
| 187 | + save.value = mw.msg('savearticle'); |
| 188 | + save.title = mw.msg('tooltip-save') + |
| 189 | + ' [' + mw.msg('accesskey-save') + ']'; |
| 190 | + // Submit for review |
| 191 | + } else { |
| 192 | + save.value = mw.msg('revreview-submitedit'); |
| 193 | + save.title = mw.msg('revreview-submitedit-title') |
| 194 | + + ' [' + mw.msg('accesskey-save') + ']'; |
| 195 | + } |
| 196 | + } |
| 197 | + mw.util.updateTooltipAccessKeys( [ save ] ); // update accesskey in save.title |
| 198 | + } |
| 199 | +}; |
| 200 | + |
| 201 | + |
| 202 | +// Get the revisioncontents div and replace it with actual parsed article contents via an API call |
| 203 | +FlaggedRevs.getRevisionContents = function() { |
| 204 | + var revContent = mw.config.get( 'wgRevContents' ); |
| 205 | + var $frRevContents = $( '#mw-fr-revisioncontents' ); |
| 206 | + var $prevLink = $( '#differences-prevlink' ); |
| 207 | + var $nextLink = $( '#differences-nextlink' ); |
| 208 | + |
| 209 | + if ( $frRevContents.size() ) { |
| 210 | + var diffUIParams = document.getElementById( 'mw-fr-diff-dataform' ); |
| 211 | + var oldRevId = diffUIParams.getElementsByTagName( 'input' )[1].value; |
| 212 | + var origContents = $frRevContents.html(); |
| 213 | + $frRevContents.html( '<span class="loading mw-small-spinner spinner"></span>' |
| 214 | + + '<span class="loading">' + mw.html.escape( revContent.waiting ) + '</span>' ); |
| 215 | + var queryParams = { |
| 216 | + format: 'json', |
| 217 | + action: 'parse', |
| 218 | + prop: 'text|categorieshtml|languageshtml|headitems' |
| 219 | + }; |
| 220 | + if ( mw.config.get( 'wgCurRevisionId' ) == oldRevId && mw.config.exists( 'wgPageName' ) ) { |
| 221 | + queryParams.page = mw.config.get( 'wgPageName' ); |
| 222 | + } else { |
| 223 | + queryParams.oldid = oldRevId; |
| 224 | + } |
| 225 | + |
| 226 | + var call = $.ajax({ |
| 227 | + url: mw.config.get( 'wgScriptPath' ) + '/api.php', |
| 228 | + data: queryParams, |
| 229 | + dataType: 'json', |
| 230 | + success: function( result ) { |
| 231 | + if ( !result || !result.parse ) { |
| 232 | + return; |
| 233 | + } |
| 234 | + // Get data |
| 235 | + var parse = result.parse, |
| 236 | + text = parse.text, |
| 237 | + languageshtml = parse.languageshtml, |
| 238 | + categoryhtml = parse.categorieshtml; |
| 239 | + // Insert data into page |
| 240 | + if ( text && text['*'] ) { |
| 241 | + $frRevContents.empty().append( text['*'] ); |
| 242 | + } else { |
| 243 | + $frRevContents.empty().append( revContent.error + ' ' + origContents ); |
| 244 | + } |
| 245 | + if ( languageshtml && languageshtml['*'] ) { |
| 246 | + $frRevContents.append( '<div class="langlinks" >' + languageshtml['*'] + '</div>' ); |
| 247 | + } |
| 248 | + if ( categoryhtml && categoryhtml['*'] ) { |
| 249 | + $('#catlinks').replaceWith( $(categoryhtml['*']) ); |
| 250 | + } |
| 251 | + }, |
| 252 | + error: function(xhttp, status, error) { |
| 253 | + $frRevContents.html( revContent.error + ' ' + origContents ); |
| 254 | + } |
| 255 | + }); |
| 256 | + } |
| 257 | + $prevLink.click( function() { |
| 258 | + if ( call ) { |
| 259 | + call.abort(); |
| 260 | + } |
| 261 | + } ); |
| 262 | + $nextLink.click( function() { |
| 263 | + if ( call ) { |
| 264 | + call.abort(); |
| 265 | + } |
| 266 | + } ); |
| 267 | +}; |
| 268 | + |
| 269 | +// Perform some onload (which is when this script is included) events: |
| 270 | +FlaggedRevs.enableShowhide(); |
| 271 | +FlaggedRevs.setCheckTrigger(); |
| 272 | +FlaggedRevs.getRevisionContents(); |
\ No newline at end of file |
Property changes on: trunk/extensions/FlaggedRevs/modules/flaggedrevs.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 273 | + native |
Index: trunk/extensions/FlaggedRevs/modules/img/doc-magnify.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/FlaggedRevs/modules/img/doc-magnify.png |
___________________________________________________________________ |
Added: svn:mime-type |
2 | 274 | + image/png |
Index: trunk/extensions/FlaggedRevs/modules/img/lock-closed.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/FlaggedRevs/modules/img/lock-closed.png |
___________________________________________________________________ |
Added: svn:mime-type |
3 | 275 | + image/png |
Index: trunk/extensions/FlaggedRevs/modules/img/arrow-down.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/FlaggedRevs/modules/img/arrow-down.png |
___________________________________________________________________ |
Added: svn:mime-type |
4 | 276 | + image/png |
Index: trunk/extensions/FlaggedRevs/modules/img/1.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/FlaggedRevs/modules/img/1.png |
___________________________________________________________________ |
Added: svn:mime-type |
5 | 277 | + image/png |
Index: trunk/extensions/FlaggedRevs/modules/img/2.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/FlaggedRevs/modules/img/2.png |
___________________________________________________________________ |
Added: svn:mime-type |
6 | 278 | + image/png |
Index: trunk/extensions/FlaggedRevs/modules/img/checkmark-orange.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/FlaggedRevs/modules/img/checkmark-orange.png |
___________________________________________________________________ |
Added: svn:mime-type |
7 | 279 | + image/png |
Index: trunk/extensions/FlaggedRevs/modules/img/3.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/FlaggedRevs/modules/img/3.png |
___________________________________________________________________ |
Added: svn:mime-type |
8 | 280 | + image/png |
Index: trunk/extensions/FlaggedRevs/modules/img/bar_20.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/FlaggedRevs/modules/img/bar_20.png |
___________________________________________________________________ |
Added: svn:mime-type |
9 | 281 | + image/png |
Index: trunk/extensions/FlaggedRevs/modules/img/fr-marker-20.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/FlaggedRevs/modules/img/fr-marker-20.png |
___________________________________________________________________ |
Added: svn:mime-type |
10 | 282 | + image/png |
Index: trunk/extensions/FlaggedRevs/modules/img/fr-marker-40.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/FlaggedRevs/modules/img/fr-marker-40.png |
___________________________________________________________________ |
Added: svn:mime-type |
11 | 283 | + image/png |
Index: trunk/extensions/FlaggedRevs/modules/img/bar_40.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/FlaggedRevs/modules/img/bar_40.png |
___________________________________________________________________ |
Added: svn:mime-type |
12 | 284 | + image/png |
Index: trunk/extensions/FlaggedRevs/modules/img/fr-marker-60.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/FlaggedRevs/modules/img/fr-marker-60.png |
___________________________________________________________________ |
Added: svn:mime-type |
13 | 285 | + image/png |
Index: trunk/extensions/FlaggedRevs/modules/img/bar_60.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/FlaggedRevs/modules/img/bar_60.png |
___________________________________________________________________ |
Added: svn:mime-type |
14 | 286 | + image/png |
Index: trunk/extensions/FlaggedRevs/modules/img/fr-marker-80.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/FlaggedRevs/modules/img/fr-marker-80.png |
___________________________________________________________________ |
Added: svn:mime-type |
15 | 287 | + image/png |
Index: trunk/extensions/FlaggedRevs/modules/img/bar_80.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/FlaggedRevs/modules/img/bar_80.png |
___________________________________________________________________ |
Added: svn:mime-type |
16 | 288 | + image/png |
Index: trunk/extensions/FlaggedRevs/modules/img/arrow-up.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/FlaggedRevs/modules/img/arrow-up.png |
___________________________________________________________________ |
Added: svn:mime-type |
17 | 289 | + image/png |
Index: trunk/extensions/FlaggedRevs/modules/img/license.txt |
— | — | @@ -0,0 +1,5 @@ |
| 2 | +All images in this folder are available under the |
| 3 | +GNU Free Documentation license (1.2+). |
| 4 | + |
| 5 | +All the images are to be credited to Joerg Baach, except for lock-open.png and lock-closed.png, |
| 6 | +which where created by "Jasu" (http://commons.wikimedia.org/wiki/User:Jasu), under the same license. |
\ No newline at end of file |
Property changes on: trunk/extensions/FlaggedRevs/modules/img/license.txt |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 7 | + native |
Index: trunk/extensions/FlaggedRevs/modules/img/doc-check.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/FlaggedRevs/modules/img/doc-check.png |
___________________________________________________________________ |
Added: svn:mime-type |
2 | 8 | + image/png |
Index: trunk/extensions/FlaggedRevs/modules/img/fr-marker-100.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/FlaggedRevs/modules/img/fr-marker-100.png |
___________________________________________________________________ |
Added: svn:mime-type |
3 | 9 | + image/png |
Index: trunk/extensions/FlaggedRevs/modules/img/bar_100.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/FlaggedRevs/modules/img/bar_100.png |
___________________________________________________________________ |
Added: svn:mime-type |
4 | 10 | + image/png |
Index: trunk/extensions/FlaggedRevs/modules/img/checkmark-green.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/FlaggedRevs/modules/img/checkmark-green.png |
___________________________________________________________________ |
Added: svn:mime-type |
5 | 11 | + image/png |
Index: trunk/extensions/FlaggedRevs/modules/img/lock-open.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/FlaggedRevs/modules/img/lock-open.png |
___________________________________________________________________ |
Added: svn:mime-type |
6 | 12 | + image/png |
Index: trunk/extensions/FlaggedRevs/modules/review.js |
— | — | @@ -0,0 +1,321 @@ |
| 2 | +/** |
| 3 | + * FlaggedRevs Stylesheet |
| 4 | + * @author Aaron Schulz |
| 5 | + * @author Daniel Arnold 2008 |
| 6 | + */ |
| 7 | + |
| 8 | +window.FlaggedRevsReview = { |
| 9 | + /* |
| 10 | + * Updates for radios/checkboxes on patch by Daniel Arnold (bug 13744). |
| 11 | + * Visually update the revision rating form on change. |
| 12 | + * - Disable submit in case of invalid input. |
| 13 | + * - Update colors when select changes (Opera already does this). |
| 14 | + * - Also remove comment box clutter in case of invalid input. |
| 15 | + * NOTE: all buttons should exist (perhaps hidden though) |
| 16 | + */ |
| 17 | + 'updateRatingForm': function() { |
| 18 | + var ratingform = document.getElementById('mw-fr-ratingselects'); |
| 19 | + if( !ratingform ) return; |
| 20 | + var disabled = document.getElementById('fr-rating-controls-disabled'); |
| 21 | + if( disabled ) return; |
| 22 | + |
| 23 | + var quality = true; |
| 24 | + var somezero = false; |
| 25 | + |
| 26 | + // Determine if this is a "quality" or "incomplete" review |
| 27 | + for( tag in wgFlaggedRevsParams.tags ) { |
| 28 | + var controlName = "wp" + tag; |
| 29 | + var levels = document.getElementsByName(controlName); |
| 30 | + if( !levels.length ) continue; |
| 31 | + |
| 32 | + var selectedlevel = 0; // default |
| 33 | + if( levels[0].nodeName == 'SELECT' ) { |
| 34 | + selectedlevel = levels[0].selectedIndex; |
| 35 | + } else if( levels[0].type == 'radio' ) { |
| 36 | + for( i = 0; i < levels.length; i++ ) { |
| 37 | + if( levels[i].checked ) { |
| 38 | + selectedlevel = i; |
| 39 | + break; |
| 40 | + } |
| 41 | + } |
| 42 | + } else if( levels[0].type == 'checkbox' ) { |
| 43 | + selectedlevel = (levels[0].checked) ? 1: 0; |
| 44 | + } else { |
| 45 | + return; // error: should not happen |
| 46 | + } |
| 47 | + |
| 48 | + // Get quality level for this tag |
| 49 | + qualityLevel = wgFlaggedRevsParams.tags[tag]['quality']; |
| 50 | + |
| 51 | + if( selectedlevel < qualityLevel ) { |
| 52 | + quality = false; // not a quality review |
| 53 | + } |
| 54 | + if( selectedlevel <= 0 ) { |
| 55 | + somezero = true; |
| 56 | + } |
| 57 | + } |
| 58 | + |
| 59 | + // (a) If only a few levels are zero ("incomplete") then disable submission. |
| 60 | + // (b) Re-enable submission for already accepted revs when ratings change. |
| 61 | + var asubmit = document.getElementById('mw-fr-submit-accept'); |
| 62 | + if( asubmit ) { |
| 63 | + asubmit.disabled = somezero ? 'disabled' : ''; |
| 64 | + asubmit.value = mediaWiki.msg('revreview-submit-review'); // reset to "Accept" |
| 65 | + } |
| 66 | + |
| 67 | + // Update colors of <select> |
| 68 | + FlaggedRevsReview.updateRatingFormColors( ratingform ); |
| 69 | + }, |
| 70 | + |
| 71 | + /* |
| 72 | + * Update <select> color for the selected item |
| 73 | + */ |
| 74 | + 'updateRatingFormColors': function() { |
| 75 | + for( tag in wgFlaggedRevsParams.tags ) { |
| 76 | + var controlName = "wp" + tag; |
| 77 | + var levels = document.getElementsByName(controlName); |
| 78 | + if( levels.length && levels[0].nodeName == 'SELECT' ) { |
| 79 | + selectedlevel = levels[0].selectedIndex; |
| 80 | + value = levels[0].getElementsByTagName('option')[selectedlevel].value; |
| 81 | + levels[0].className = 'fr-rating-option-' + value; |
| 82 | + } |
| 83 | + } |
| 84 | + }, |
| 85 | + |
| 86 | + /* |
| 87 | + * Disable 'accept' button if the revision was already reviewed |
| 88 | + * NOTE: this is used so that they can be re-enabled if a rating changes |
| 89 | + */ |
| 90 | + 'maybeDisableAcceptButton': function() { |
| 91 | + if( typeof(jsReviewNeedsChange) != 'undefined' && jsReviewNeedsChange == 1 ) { |
| 92 | + var asubmit = document.getElementById('mw-fr-submit-accept'); |
| 93 | + if( asubmit ) { |
| 94 | + asubmit.disabled = 'disabled'; |
| 95 | + } |
| 96 | + } |
| 97 | + }, |
| 98 | + |
| 99 | + /* |
| 100 | + * Enable AJAX-based submit functionality to the review form on this page |
| 101 | + */ |
| 102 | + 'enableAjaxReview': function() { |
| 103 | + var asubmit = document.getElementById("mw-fr-submit-accept"); |
| 104 | + if( asubmit ) { |
| 105 | + asubmit.onclick = FlaggedRevsReview.submitRevisionReview; |
| 106 | + } |
| 107 | + var usubmit = document.getElementById("mw-fr-submit-unaccept"); |
| 108 | + if( usubmit ) { |
| 109 | + usubmit.onclick = FlaggedRevsReview.submitRevisionReview; |
| 110 | + } |
| 111 | + }, |
| 112 | + |
| 113 | + /* |
| 114 | + * Lock review form from submissions (using during AJAX requests) |
| 115 | + */ |
| 116 | + 'lockReviewForm': function( form ) { |
| 117 | + var inputs = form.getElementsByTagName("input"); |
| 118 | + for( var i=0; i < inputs.length; i++) { |
| 119 | + inputs[i].disabled = "disabled"; |
| 120 | + } |
| 121 | + var textareas = document.getElementsByTagName("textarea"); |
| 122 | + for( var i=0; i < textareas.length; i++) { |
| 123 | + textareas[i].disabled = "disabled"; |
| 124 | + } |
| 125 | + var selects = form.getElementsByTagName("select"); |
| 126 | + for( var i=0; i < selects.length; i++) { |
| 127 | + selects[i].disabled = "disabled"; |
| 128 | + } |
| 129 | + }, |
| 130 | + |
| 131 | + /* |
| 132 | + * Unlock review form from submissions (using after AJAX requests) |
| 133 | + */ |
| 134 | + 'unlockReviewForm': function( form ) { |
| 135 | + var inputs = form.getElementsByTagName("input"); |
| 136 | + for( var i=0; i < inputs.length; i++) { |
| 137 | + if( inputs[i].type != 'submit' ) { // not all buttons can be enabled |
| 138 | + inputs[i].disabled = ""; |
| 139 | + } else { |
| 140 | + inputs[i].blur(); // focus off element (bug 24013) |
| 141 | + } |
| 142 | + } |
| 143 | + var textareas = document.getElementsByTagName("textarea"); |
| 144 | + for( var i=0; i < textareas.length; i++) { |
| 145 | + textareas[i].disabled = ""; |
| 146 | + } |
| 147 | + var selects = form.getElementsByTagName("select"); |
| 148 | + for( var i=0; i < selects.length; i++) { |
| 149 | + selects[i].disabled = ""; |
| 150 | + } |
| 151 | + }, |
| 152 | + |
| 153 | + /* |
| 154 | + * Submit a revision review via AJAX and update form elements. |
| 155 | + * |
| 156 | + * Note: requestArgs build-up from radios/checkboxes |
| 157 | + * based on patch by Daniel Arnold (bug 13744) |
| 158 | + */ |
| 159 | + 'submitRevisionReview': function() { |
| 160 | + var form = document.getElementById("mw-fr-reviewform"); |
| 161 | + if( !form ) { |
| 162 | + return true; // do normal behavoir (shouldn't happen) |
| 163 | + } |
| 164 | + FlaggedRevsReview.lockReviewForm( form ); // disallow submissions |
| 165 | + |
| 166 | + var notes = document.getElementById("wpNotes"); |
| 167 | + // Build up arguments array and update submit button text... |
| 168 | + var requestArgs = []; // array of strings of the format <"pname|pval">. |
| 169 | + var inputs = form.getElementsByTagName("input"); |
| 170 | + for( var i=0; i < inputs.length; i++) { |
| 171 | + // Different input types may occur depending on tags... |
| 172 | + if( inputs[i].name == "title" || inputs[i].name == "action" ) { |
| 173 | + continue; // No need to send these... |
| 174 | + } else if( inputs[i].type == "submit" ) { |
| 175 | + if( inputs[i].id == this.id ) { |
| 176 | + requestArgs.push( inputs[i].name + "|1" ); |
| 177 | + // Show that we are submitting via this button |
| 178 | + inputs[i].value = mediaWiki.msg('revreview-submitting'); |
| 179 | + } |
| 180 | + } else if( inputs[i].type == "checkbox" ) { |
| 181 | + requestArgs.push( inputs[i].name + "|" + |
| 182 | + (inputs[i].checked ? inputs[i].value : 0) ); |
| 183 | + } else if( inputs[i].type == "radio" ) { |
| 184 | + if( inputs[i].checked ) { // must be checked |
| 185 | + requestArgs.push( inputs[i].name + "|" + inputs[i].value ); |
| 186 | + } |
| 187 | + } else { |
| 188 | + requestArgs.push( inputs[i].name + "|" + inputs[i].value ); // text/hiddens... |
| 189 | + } |
| 190 | + } |
| 191 | + if( notes ) { |
| 192 | + requestArgs.push( notes.name + "|" + notes.value ); |
| 193 | + } |
| 194 | + var selects = form.getElementsByTagName("select"); |
| 195 | + for( var i=0; i < selects.length; i++) { |
| 196 | + // Get the selected tag level... |
| 197 | + if( selects[i].selectedIndex >= 0 ) { |
| 198 | + var soption = selects[i].getElementsByTagName("option")[selects[i].selectedIndex]; |
| 199 | + requestArgs.push( selects[i].name + "|" + soption.value ); |
| 200 | + } |
| 201 | + } |
| 202 | + // Send encoded function plus all arguments... |
| 203 | + post_data = 'action=ajax&rs=RevisionReview::AjaxReview'; |
| 204 | + for( var i=0; i<requestArgs.length; i++ ) { |
| 205 | + post_data += '&rsargs[]=' + encodeURIComponent( requestArgs[i] ); |
| 206 | + } |
| 207 | + // Send POST request via AJAX! |
| 208 | + var call = jQuery.ajax({ |
| 209 | + url : wgScriptPath + '/index.php', |
| 210 | + type : "POST", |
| 211 | + data : post_data, |
| 212 | + dataType: "html", // response type |
| 213 | + success : function( response ) { |
| 214 | + FlaggedRevsReview.updateReviewForm( form, response ); }, |
| 215 | + error : function( response ) { |
| 216 | + FlaggedRevsReview.unlockReviewForm( form ); } |
| 217 | + }); |
| 218 | + return false; // don't do normal non-AJAX submit |
| 219 | + }, |
| 220 | + |
| 221 | + 'updateReviewForm': function( form, response ) { |
| 222 | + var msg = response.substr(6); // remove <err#> or <suc#> |
| 223 | + // Read new "last change time" timestamp for conflict handling |
| 224 | + var m = msg.match(/^<lct#(\d*)>(.+)/m); |
| 225 | + if( m ) msg = m[2]; // remove tag from msg |
| 226 | + var changeTime = m ? m[1] : null; // MW TS |
| 227 | + // Some form elements... |
| 228 | + var asubmit = document.getElementById('mw-fr-submit-accept'); |
| 229 | + var usubmit = document.getElementById('mw-fr-submit-unaccept'); |
| 230 | + var legend = document.getElementById('mw-fr-reviewformlegend'); |
| 231 | + var diffNotice = document.getElementById('mw-fr-difftostable'); |
| 232 | + var tagBox = document.getElementById('mw-fr-revisiontag'); |
| 233 | + // On success... |
| 234 | + if( response.indexOf('<suc#>') == 0 ) { |
| 235 | + // (a) Update document title and form buttons... |
| 236 | + document.title = mediaWiki.msg('actioncomplete'); |
| 237 | + if( asubmit && usubmit ) { |
| 238 | + // Revision was flagged |
| 239 | + if( asubmit.value == mediaWiki.msg('revreview-submitting') ) { |
| 240 | + asubmit.value = mediaWiki.msg('revreview-submit-reviewed'); // done! |
| 241 | + asubmit.style.fontWeight = 'bold'; |
| 242 | + // Unlock and reset *unflag* button |
| 243 | + usubmit.value = mediaWiki.msg('revreview-submit-unreview'); |
| 244 | + usubmit.removeAttribute( 'style' ); // back to normal |
| 245 | + usubmit.disabled = ''; |
| 246 | + // Revision was unflagged |
| 247 | + } else if( usubmit.value == mediaWiki.msg('revreview-submitting') ) { |
| 248 | + usubmit.value = mediaWiki.msg('revreview-submit-unreviewed'); // done! |
| 249 | + usubmit.style.fontWeight = 'bold'; |
| 250 | + // Unlock and reset *flag* button |
| 251 | + asubmit.value = mediaWiki.msg('revreview-submit-review'); |
| 252 | + asubmit.removeAttribute( 'style' ); // back to normal |
| 253 | + asubmit.disabled = ''; |
| 254 | + } |
| 255 | + } |
| 256 | + // (b) Remove review tag from drafts |
| 257 | + if( tagBox ) tagBox.style.display = 'none'; |
| 258 | + // (c) Update diff-related items... |
| 259 | + var diffUIParams = document.getElementById('mw-fr-diff-dataform'); |
| 260 | + if( diffUIParams ) { |
| 261 | + // Hide "review this" box on diffs |
| 262 | + if( diffNotice ) diffNotice.style.display = 'none'; |
| 263 | + // Update the contents of the mw-fr-diff-headeritems div |
| 264 | + var requestArgs = []; // <oldid, newid> |
| 265 | + requestArgs.push( diffUIParams.getElementsByTagName('input')[0].value ); |
| 266 | + requestArgs.push( diffUIParams.getElementsByTagName('input')[1].value ); |
| 267 | + // Send encoded function plus all arguments... |
| 268 | + url_pars = '?action=ajax&rs=FlaggedArticleView::AjaxBuildDiffHeaderItems'; |
| 269 | + for( var i=0; i<requestArgs.length; i++ ) { |
| 270 | + url_pars += '&rsargs[]=' + encodeURIComponent(requestArgs[i]); |
| 271 | + } |
| 272 | + // Send GET request via AJAX! |
| 273 | + var call = jQuery.ajax({ |
| 274 | + url : wgScriptPath + '/index.php' + url_pars, |
| 275 | + type : "GET", |
| 276 | + dataType: "html", // response type |
| 277 | + success : FlaggedRevsReview.processDiffHeaderItemsResult |
| 278 | + }); |
| 279 | + } |
| 280 | + // On failure... |
| 281 | + } else { |
| 282 | + // (a) Update document title and form buttons... |
| 283 | + document.title = mediaWiki.msg('actionfailed'); |
| 284 | + if( asubmit && usubmit ) { |
| 285 | + // Revision was flagged |
| 286 | + if( asubmit.value == mediaWiki.msg('revreview-submitting') ) { |
| 287 | + asubmit.value = mediaWiki.msg('revreview-submit-review'); // back to normal |
| 288 | + asubmit.disabled = ''; // unlock flag button |
| 289 | + // Revision was unflagged |
| 290 | + } else if( usubmit.value == mediaWiki.msg('revreview-submitting') ) { |
| 291 | + usubmit.value = mediaWiki.msg('revreview-submit-unreview'); // back to normal |
| 292 | + usubmit.disabled = ''; // unlock |
| 293 | + } |
| 294 | + } |
| 295 | + // (b) Output any error response message |
| 296 | + if( response.indexOf('<err#>') == 0 ) { |
| 297 | + mediaWiki.util.jsMessage( msg, 'review' ); // failure notice |
| 298 | + } else { |
| 299 | + mediaWiki.util.jsMessage( response, 'review' ); // fatal notice |
| 300 | + } |
| 301 | + window.scroll(0,0); // scroll up to notice |
| 302 | + } |
| 303 | + // Update changetime for conflict handling |
| 304 | + if( changeTime != null ) { |
| 305 | + document.getElementById('mw-fr-input-changetime').value = changeTime; |
| 306 | + } |
| 307 | + FlaggedRevsReview.unlockReviewForm( form ); |
| 308 | + }, |
| 309 | + |
| 310 | + // update the contents of the mw-fr-diff-headeritems div |
| 311 | + 'processDiffHeaderItemsResult': function( response ) { |
| 312 | + var diffHeaderItems = document.getElementById("mw-fr-diff-headeritems"); |
| 313 | + if( diffHeaderItems && response != '' ) { |
| 314 | + diffHeaderItems.innerHTML = response; |
| 315 | + } |
| 316 | + } |
| 317 | +}; |
| 318 | + |
| 319 | +// Perform some onload (which is when this script is included) events: |
| 320 | +FlaggedRevsReview.maybeDisableAcceptButton(); |
| 321 | +FlaggedRevsReview.updateRatingFormColors(); |
| 322 | +FlaggedRevsReview.enableAjaxReview(); |
\ No newline at end of file |
Property changes on: trunk/extensions/FlaggedRevs/modules/review.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 323 | + native |