Index: trunk/extensions/FlaggedRevs/presentation/RevisionReviewFormUI.php |
— | — | @@ -144,29 +144,25 @@ |
145 | 145 | } |
146 | 146 | $form .= "<p>"; |
147 | 147 | if ( $u !== null ) { // page under review... |
148 | | - $form .= '<span class="fr-under-review">'; |
149 | 148 | if ( $u != $this->user->getName() ) { // by another user... |
| 149 | + $form .= '<span class="fr-under-review">'; |
150 | 150 | $msg = $priorRevId |
151 | 151 | ? 'revreview-poss-conflict-c' |
152 | 152 | : 'revreview-poss-conflict-p'; |
153 | 153 | $form .= wfMsgExt( $msg, 'parseinline', |
154 | 154 | $u, $wgLang->date( $ts, true ), $wgLang->time( $ts, true ) ); |
| 155 | + $form .= "</span>"; |
155 | 156 | } else { // by this user... |
| 157 | + $form .= '<span id="mw-fr-reviewing-status">'; // JS widget |
156 | 158 | $msg = $priorRevId |
157 | 159 | ? 'revreview-adv-reviewing-c' |
158 | 160 | : 'revreview-adv-reviewing-p'; |
159 | | - $form .= wfMsgHtml( $msg ); |
| 161 | + $form .= wfMsg( $msg ); // don't escape |
| 162 | + $form .= "</span>"; |
160 | 163 | } |
161 | | - $form .= "</span>"; |
162 | | - } else { // page not under review; add JS button |
| 164 | + } else { // page not under review; add JS widget |
163 | 165 | $form .= '<span id="mw-fr-reviewing-status" style="display:none;"></span>'; |
164 | 166 | } |
165 | | - # Let user toggle advertising that they are reviewing this |
166 | | - if ( $u === null || $u === $this->user->getName() ) { |
167 | | - $form .= '<span id="mw-fr-reviewing-toggle" style="display:none;">'; |
168 | | - $form .= ' (<a href="javascript:void()"></a>)'; // JS activated |
169 | | - $form .= '</span>'; |
170 | | - } |
171 | 167 | $form .= "</p>\n"; |
172 | 168 | |
173 | 169 | if ( $disabled ) { |
Index: trunk/extensions/FlaggedRevs/presentation/modules/review.js |
— | — | @@ -328,64 +328,47 @@ |
329 | 329 | 'enableAjaxReviewActivity': function() { |
330 | 330 | // User is already reviewing in another tab... |
331 | 331 | if ( $('#mw-fr-user-reviewing').val() == 1 ) { |
332 | | - var msgkey = $('#mw-fr-input-refid') |
333 | | - ? 'revreview-adv-reviewing-c' |
334 | | - : 'revreview-adv-reviewing-p'; |
335 | | - $('#mw-fr-reviewing-status').html( |
336 | | - mw.msg( msgkey, [mw.config.get('wgUserName')] ) // advertised notice |
337 | | - ); |
338 | | - $('#mw-fr-reviewing-toggle a').html( |
339 | | - mw.msg('revreview-advertise-stop') |
340 | | - ).click( FlaggedRevsReview.deadvertiseReviewing ); |
| 332 | + FlaggedRevsReview.isUserReviewing = 1; |
| 333 | + FlaggedRevsReview.advertiseReviewing( null, true ); |
341 | 334 | // User is not already reviewing this.... |
342 | 335 | } else { |
343 | | - var msgkey = $('#mw-fr-input-refid') |
344 | | - ? 'revreview-sadv-reviewing-c' |
345 | | - : 'revreview-sadv-reviewing-p'; |
346 | | - $('#mw-fr-reviewing-status').html( |
347 | | - mw.msg( msgkey, [mw.config.get('wgUserName')] ) // suggest to advertise |
348 | | - ); |
349 | | - |
350 | | - $('#mw-fr-reviewing-toggle a').html( |
351 | | - mw.msg('revreview-advertise-start') |
352 | | - ).click( FlaggedRevsReview.advertiseReviewing ); |
| 336 | + FlaggedRevsReview.deadvertiseReviewing( null, true ); |
353 | 337 | } |
354 | | - $('#mw-fr-reviewing-status').addClass('fr-under-review').show(); |
355 | | - $('#mw-fr-reviewing-toggle').show(); |
| 338 | + $('#mw-fr-reviewing-status').show(); |
356 | 339 | }, |
357 | 340 | |
358 | 341 | /* |
359 | 342 | * Flag users as "now reviewing" |
360 | 343 | */ |
361 | | - 'advertiseReviewing': function() { |
362 | | - FlaggedRevsReview.setReviewingStatus( 1 ); |
| 344 | + 'advertiseReviewing': function( e, isInitial ) { |
| 345 | + if ( isInitial !== true ) { // don't send if just setting up form |
| 346 | + if ( !FlaggedRevsReview.setReviewingStatus( 1 ) ) { |
| 347 | + return; // failed |
| 348 | + } |
| 349 | + } |
| 350 | + // Update notice to say that user is advertising... |
363 | 351 | var msgkey = $('#mw-fr-input-refid') |
364 | 352 | ? 'revreview-adv-reviewing-c' // diff |
365 | 353 | : 'revreview-adv-reviewing-p' // page |
366 | | - $('#mw-fr-reviewing-status').html( |
367 | | - mw.msg( msgkey, [mw.config.get('wgUserName')] ) |
368 | | - ); |
369 | | - // Invert toggle text/function... |
370 | | - $('#mw-fr-reviewing-toggle a').html( |
371 | | - mw.msg('revreview-advertise-stop') |
372 | | - ).unbind('click').click( FlaggedRevsReview.deadvertiseReviewing ); |
| 354 | + $('#mw-fr-reviewing-status').html( mw.msg( msgkey, [mw.config.get('wgUserName')] ) ); |
| 355 | + $('#mw-fr-reviewing-stop').click( FlaggedRevsReview.deadvertiseReviewing ); |
373 | 356 | }, |
374 | 357 | |
375 | 358 | /* |
376 | 359 | * Flag users as "no longer reviewing" |
377 | 360 | */ |
378 | | - 'deadvertiseReviewing': function() { |
379 | | - FlaggedRevsReview.setReviewingStatus( 0 ); |
| 361 | + 'deadvertiseReviewing': function( e, isInitial ) { |
| 362 | + if ( isInitial !== true ) { // don't send if just setting up form |
| 363 | + if ( !FlaggedRevsReview.setReviewingStatus( 0 ) ) { |
| 364 | + return; // failed |
| 365 | + } |
| 366 | + } |
| 367 | + // Update notice to say that user is not advertising... |
380 | 368 | var msgkey = $('#mw-fr-input-refid') |
381 | 369 | ? 'revreview-sadv-reviewing-c' // diff |
382 | 370 | : 'revreview-sadv-reviewing-p' // page |
383 | | - $('#mw-fr-reviewing-status').html( |
384 | | - mw.msg( msgkey, [mw.config.get('wgUserName')] ) |
385 | | - ); |
386 | | - // Invert toggle text/function... |
387 | | - $('#mw-fr-reviewing-toggle a').html( |
388 | | - mw.msg('revreview-advertise-start') |
389 | | - ).unbind('click').click( FlaggedRevsReview.advertiseReviewing ); |
| 371 | + $('#mw-fr-reviewing-status').html( mw.msg( msgkey, [mw.config.get('wgUserName')] ) ); |
| 372 | + $('#mw-fr-reviewing-start').click( FlaggedRevsReview.advertiseReviewing ); |
390 | 373 | }, |
391 | 374 | |
392 | 375 | /* |
— | — | @@ -412,8 +395,12 @@ |
413 | 396 | async : false |
414 | 397 | }); |
415 | 398 | } |
416 | | - FlaggedRevsReview.isUserReviewing = value; |
417 | | - return ( call.status == 200 ); |
| 399 | + if ( call.status == 200 ) { |
| 400 | + FlaggedRevsReview.isUserReviewing = value; |
| 401 | + return true; |
| 402 | + } else { |
| 403 | + return false; |
| 404 | + } |
418 | 405 | } |
419 | 406 | }; |
420 | 407 | |
Index: trunk/extensions/FlaggedRevs/presentation/language/RevisionReview.i18n.php |
— | — | @@ -65,10 +65,10 @@ |
66 | 66 | 'revreview-successful2' => '\'\'\'Revision of [[:$1|$1]] successfully unflagged.\'\'\'', |
67 | 67 | 'revreview-poss-conflict-p' => '\'\'\'Warning: [[User:$1|$1]] started reviewing this page on $2 at $3.\'\'\'', |
68 | 68 | 'revreview-poss-conflict-c' => '\'\'\'Warning: [[User:$1|$1]] started reviewing these changes on $2 at $3.\'\'\'', |
69 | | - 'revreview-adv-reviewing-p' => 'Notice: Other reviewers can see that you are reviewing this page.', |
70 | | - 'revreview-adv-reviewing-c' => 'Notice: Other reviewers can see that you are reviewing these changes.', |
71 | | - 'revreview-sadv-reviewing-p' => 'Notice: Please advertise yourself as reviewing this page.', |
72 | | - 'revreview-sadv-reviewing-c' => 'Notice: Please advertise yourself as reviewing these changes.', |
| 69 | + 'revreview-adv-reviewing-p' => '<span class="fr-under-review">Notice: Other reviewers can see that you are reviewing this page.</span> (<a id="mw-fr-reviewing-stop" href="javascript:void(0)">de-advertise</a>)', |
| 70 | + 'revreview-adv-reviewing-c' => '<span class="fr-under-review">Notice: Other reviewers can see that you are reviewing these changes.</span> (<a id="mw-fr-reviewing-stop" href="javascript:void(0)">de-advertise</a>)', |
| 71 | + 'revreview-sadv-reviewing-p' => 'You can <a id="mw-fr-reviewing-start" href="javascript:void(0)">advertise</a> yourself as reviewing this page to other users.', |
| 72 | + 'revreview-sadv-reviewing-c' => 'You can <a id="mw-fr-reviewing-start" href="javascript:void(0)">advertise</a> yourself as reviewing these changes to other users.', |
73 | 73 | 'revreview-advertise-start' => 'Advertise', |
74 | 74 | 'revreview-advertise-stop' => 'De-advertise', |
75 | 75 | 'revreview-toolow' => '\'\'\'You must rate each of the attributes higher than "inadequate" in order for a revision to be considered reviewed.\'\'\' |