Index: trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.i18n.php |
— | — | @@ -77,7 +77,7 @@ |
78 | 78 | 'articlefeedbackv5-special-pagetitle' => 'Feedback: $1', |
79 | 79 | 'articlefeedbackv5-form-optionid' => 'Option $1', |
80 | 80 | 'articlefeedbackv5-hidden' => 'Hidden', |
81 | | - 'articlefeedbackv5-form-hide' => 'Hide this post ($1)', |
| 81 | + 'articlefeedbackv5-form-hide' => 'Hide this post', |
82 | 82 | 'articlefeedbackv5-form-unhide' => 'Show this post', |
83 | 83 | 'articlefeedbackv5-form-helpful' => 'Mark as helpful ($1)', |
84 | 84 | 'articlefeedbackv5-form-abuse' => 'Flag as abuse ($1)', |
— | — | @@ -99,10 +99,8 @@ |
100 | 100 | 'articlefeedbackv5-form-invalid' => 'Invalid feedback form ID.', |
101 | 101 | 'articlefeedbackv5-delete-saved' => 'Feedback deleted', |
102 | 102 | 'articlefeedbackv5-abuse-saved' => 'Flagged as abuse', |
103 | | - 'articlefeedbackv5-hide-saved' => 'Hide flag saved', |
104 | 103 | 'articlefeedbackv5-unhelpful-saved' => 'No', |
105 | 104 | 'articlefeedbackv5-helpful-saved' => 'Yes', |
106 | | - 'articlefeedbackv5-unhide-saved' => 'Feedback shown', |
107 | 105 | 'articlefeedbackv5-undelete-saved' => 'Feedback shown', |
108 | 106 | 'articlefeedbackv5-oversight-saved' => 'Marked for oversight', |
109 | 107 | 'articlefeedbackv5-unoversight-saved' => 'Oversight flag removed', |
Index: trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.special.css |
— | — | @@ -221,7 +221,8 @@ |
222 | 222 | margin: 0 15px 0 0; |
223 | 223 | } |
224 | 224 | #articleFeedbackv5-show-feedback .articleFeedbackv5-comment-foot .articleFeedbackv5-helpful-link, |
225 | | -#articleFeedbackv5-show-feedback .articleFeedbackv5-comment-foot .articleFeedbackv5-unhelpful-link { |
| 225 | +#articleFeedbackv5-show-feedback .articleFeedbackv5-comment-foot .articleFeedbackv5-unhelpful-link, |
| 226 | +#articleFeedbackv5-show-feedback .articleFeedbackv5-feedback-hidden .articleFeedbackv5-feedback-hidden-marker { |
226 | 227 | display: inline-block; |
227 | 228 | height: 22px; |
228 | 229 | line-height: 22px; |
— | — | @@ -255,7 +256,8 @@ |
256 | 257 | #articleFeedbackv5-show-feedback .articleFeedbackv5-comment-foot .articleFeedbackv5-helpful-link.active, |
257 | 258 | #articleFeedbackv5-show-feedback .articleFeedbackv5-comment-foot .articleFeedbackv5-unhelpful-link.active, |
258 | 259 | #articleFeedbackv5-show-feedback .articleFeedbackv5-comment-foot .articleFeedbackv5-helpful-link.active:hover, |
259 | | -#articleFeedbackv5-show-feedback .articleFeedbackv5-comment-foot .articleFeedbackv5-unhelpful-link.active:hover { |
| 260 | +#articleFeedbackv5-show-feedback .articleFeedbackv5-comment-foot .articleFeedbackv5-unhelpful-link.active:hover, |
| 261 | +#articleFeedbackv5-show-feedback .articleFeedbackv5-feedback-hidden .articleFeedbackv5-feedback-hidden-marker { |
260 | 262 | /* @embed */ |
261 | 263 | background: url(images/bg-button.png) repeat-x; |
262 | 264 | color: #fff; |
— | — | @@ -329,3 +331,11 @@ |
330 | 332 | background: url(images/bg-button.png) !important; |
331 | 333 | color: white !important; |
332 | 334 | } |
| 335 | +.articleFeedbackv5-feedback-hidden .articleFeedbackv5-comment-wrap { |
| 336 | + opacity : 0.4; |
| 337 | + filter: alpha(opacity=40); // msie |
| 338 | + background-color: #000; |
| 339 | +} |
| 340 | +#articleFeedbackv5-show-feedback .articleFeedbackv5-feedback-hidden .articleFeedbackv5-feedback-hidden-marker { |
| 341 | + margin-left: 20px; |
| 342 | +} |
Index: trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.special.js |
— | — | @@ -153,11 +153,14 @@ |
154 | 154 | return false; |
155 | 155 | } ); |
156 | 156 | |
157 | | - // Helpful and unhelpful have their own special logic, so break those out. |
| 157 | + // Helpful and unhelpful |
158 | 158 | $.each( ['helpful', 'unhelpful' ], function ( index, value ) { |
159 | 159 | $( '.articleFeedbackv5-' + value + '-link' ).live( 'click', function( e ) { |
160 | 160 | e.preventDefault(); |
161 | 161 | var $l = $( e.target ); |
| 162 | + if ( $l.closest( '.articleFeedbackv5-feedback' ).data( 'hidden' ) ) { |
| 163 | + return false; |
| 164 | + } |
162 | 165 | var id = $l.closest( '.articleFeedbackv5-feedback' ).attr( 'rel' ); |
163 | 166 | var activity = $.articleFeedbackv5special.getActivity( id ); |
164 | 167 | if ( activity[value] ) { |
— | — | @@ -175,9 +178,13 @@ |
176 | 179 | } ) |
177 | 180 | } ); |
178 | 181 | |
| 182 | + // Flag as abuse |
179 | 183 | $( '.articleFeedbackv5-abuse-link' ).live( 'click', function( e ) { |
180 | 184 | e.preventDefault(); |
181 | 185 | var $l = $( e.target ); |
| 186 | + if ( $l.closest( '.articleFeedbackv5-feedback' ).data( 'hidden' ) ) { |
| 187 | + return false; |
| 188 | + } |
182 | 189 | var id = $l.closest( '.articleFeedbackv5-feedback' ).attr( 'rel' ); |
183 | 190 | var activity = $.articleFeedbackv5special.getActivity( id ); |
184 | 191 | if ( activity.abuse ) { |
— | — | @@ -185,9 +192,22 @@ |
186 | 193 | } else { |
187 | 194 | $.articleFeedbackv5special.flagFeedback( id, 'abuse', 1 ); |
188 | 195 | } |
189 | | - } ) |
| 196 | + } ); |
190 | 197 | |
191 | | - $.each( ['unhide', 'undelete', 'oversight', 'hide', 'delete', 'unoversight'], function ( index, value ) { |
| 198 | + // Hide/Show this post |
| 199 | + $( '.articleFeedbackv5-hide-link' ).live( 'click', function( e ) { |
| 200 | + e.preventDefault(); |
| 201 | + var $l = $( e.target ); |
| 202 | + var id = $l.closest( '.articleFeedbackv5-feedback' ).attr( 'rel' ); |
| 203 | + var activity = $.articleFeedbackv5special.getActivity( id ); |
| 204 | + if ( activity.hide ) { |
| 205 | + $.articleFeedbackv5special.flagFeedback( id, 'hide', -1 ); |
| 206 | + } else { |
| 207 | + $.articleFeedbackv5special.flagFeedback( id, 'hide', 1 ); |
| 208 | + } |
| 209 | + } ); |
| 210 | + |
| 211 | + $.each( ['undelete', 'oversight', 'delete', 'unoversight'], function ( index, value ) { |
192 | 212 | $( '.articleFeedbackv5-' + value + '-link' ).live( 'click', function( e ) { |
193 | 213 | e.preventDefault(); |
194 | 214 | $.articleFeedbackv5special.flagFeedback( $.articleFeedbackv5special.stripID( this, 'articleFeedbackv5-' + value + '-link-' ), value, 1 ); |
— | — | @@ -350,8 +370,38 @@ |
351 | 371 | }; |
352 | 372 | |
353 | 373 | // }}} |
| 374 | + // {{{ markHidden |
354 | 375 | |
| 376 | + /** |
| 377 | + * Utility method: Marks a feedback row hidden |
| 378 | + * |
| 379 | + * @param $row element the feedback row |
| 380 | + */ |
| 381 | + $.articleFeedbackv5special.markHidden = function ( $row ) { |
| 382 | + $row.addClass( 'articleFeedbackv5-feedback-hidden' ) |
| 383 | + .data( 'hidden', true ); |
| 384 | + $( '<span class="articleFeedbackv5-feedback-hidden-marker"></span>' ) |
| 385 | + .text( mw.msg( 'articlefeedbackv5-hidden' ) ) |
| 386 | + .insertAfter( $row.find( '.articleFeedbackv5-comment-wrap h3 span.result' ) ); |
| 387 | + }; |
| 388 | + |
355 | 389 | // }}} |
| 390 | + // {{{ unmarkHidden |
| 391 | + |
| 392 | + /** |
| 393 | + * Utility method: Unmarks as hidden a feedback row |
| 394 | + * |
| 395 | + * @param $row element the feedback row |
| 396 | + */ |
| 397 | + $.articleFeedbackv5special.unmarkHidden = function ( $row ) { |
| 398 | + $row.removeClass( 'articleFeedbackv5-feedback-hidden' ) |
| 399 | + .data( 'hidden', false ); |
| 400 | + $row.find( '.articleFeedbackv5-feedback-hidden-marker' ).remove(); |
| 401 | + }; |
| 402 | + |
| 403 | + // }}} |
| 404 | + |
| 405 | + // }}} |
356 | 406 | // {{{ Process methods |
357 | 407 | |
358 | 408 | // {{{ flagFeedback |
— | — | @@ -404,9 +454,17 @@ |
405 | 455 | $l.removeClass( 'abusive' ); |
406 | 456 | } |
407 | 457 | if ( data['articlefeedbackv5-flag-feedback']['abuse-hidden'] ) { |
408 | | - // TODO: Grey it out and add a "hidden" flag somewhere (as per Fabrice) |
409 | | - // $l.closest( '.articleFeedbackv5-feedback' ).hide( 'slow' ); |
| 458 | + $.articleFeedbackv5special.markHidden( $l.closest( '.articleFeedbackv5-feedback' ) ); |
410 | 459 | } |
| 460 | + } else if ( 'hide' == type ) { |
| 461 | + var $l = $( '#articleFeedbackv5-hide-link-' + id ); |
| 462 | + if ( dir > 0 ) { |
| 463 | + $l.text( mw.msg( 'articlefeedbackv5-form-unhide' ) ); |
| 464 | + $.articleFeedbackv5special.markHidden( $l.closest( '.articleFeedbackv5-feedback' ) ); |
| 465 | + } else { |
| 466 | + $l.text( mw.msg( 'articlefeedbackv5-form-hide' ) ); |
| 467 | + $.articleFeedbackv5special.unmarkHidden( $l.closest( '.articleFeedbackv5-feedback' ) ); |
| 468 | + } |
411 | 469 | } else { |
412 | 470 | msg = 'articlefeedbackv5-' + type + '-saved'; |
413 | 471 | $( '#articleFeedbackv5-' + type + '-link-' + id ).text( mw.msg( msg ) ); |
— | — | @@ -481,6 +539,9 @@ |
482 | 540 | $l.text( mw.msg( 'articlefeedbackv5-abuse-saved' ) ); |
483 | 541 | } |
484 | 542 | } |
| 543 | + if ( $( this ).hasClass( 'articleFeedbackv5-feedback-hidden' ) ) { |
| 544 | + $.articleFeedbackv5special.markHidden( $( this ) ); |
| 545 | + } |
485 | 546 | } ); |
486 | 547 | $( '#articleFeedbackv5-show-feedback' ).append( $newList ); |
487 | 548 | $( '#articleFeedbackv5-feedback-count-total' ).text( data['articlefeedbackv5-view-feedback'].count ); |
Index: trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.php |
— | — | @@ -270,14 +270,14 @@ |
271 | 271 | $wgHooks['ArticleSaveComplete'][] = 'ArticleFeedbackv5Hooks::trackEditSuccess'; |
272 | 272 | |
273 | 273 | // API Registration |
274 | | -#$wgAPIListModules['articlefeedbackv5-view-ratings'] = 'ApiViewRatingsArticleFeedbackv5'; |
275 | | -#$wgAPIListModules['articlefeedbackv5-view-feedback'] = 'ApiViewFeedbackArticleFeedbackv5'; |
276 | | -#$wgAPIModules['articlefeedbackv5-flag-feedback'] = 'ApiFlagFeedbackArticleFeedbackv5'; |
| 274 | +$wgAPIListModules['articlefeedbackv5-view-ratings'] = 'ApiViewRatingsArticleFeedbackv5'; |
| 275 | +$wgAPIListModules['articlefeedbackv5-view-feedback'] = 'ApiViewFeedbackArticleFeedbackv5'; |
| 276 | +$wgAPIModules['articlefeedbackv5-flag-feedback'] = 'ApiFlagFeedbackArticleFeedbackv5'; |
277 | 277 | $wgAPIModules['articlefeedbackv5'] = 'ApiArticleFeedbackv5'; |
278 | 278 | |
279 | 279 | // Special Page |
280 | | -#$wgSpecialPages['ArticleFeedbackv5'] = 'SpecialArticleFeedbackv5'; |
281 | | -#$wgSpecialPageGroups['ArticleFeedbackv5'] = 'other'; |
| 280 | +$wgSpecialPages['ArticleFeedbackv5'] = 'SpecialArticleFeedbackv5'; |
| 281 | +$wgSpecialPageGroups['ArticleFeedbackv5'] = 'other'; |
282 | 282 | |
283 | 283 | $wgAvailableRights[] = 'aftv5-hide-feedback'; |
284 | 284 | $wgAvailableRights[] = 'aftv5-delete-feedback'; |
Index: trunk/extensions/ArticleFeedbackv5/api/ApiViewFeedbackArticleFeedbackv5.php |
— | — | @@ -73,8 +73,8 @@ |
74 | 74 | return $count ? $count : 0; |
75 | 75 | } |
76 | 76 | |
77 | | - public function fetchFeedback( $pageId, $filter = 'visible', |
78 | | - $filterValue = null, $sort = 'age', $sortOrder = 'desc', |
| 77 | + public function fetchFeedback( $pageId, $filter = 'visible', |
| 78 | + $filterValue = null, $sort = 'age', $sortOrder = 'desc', |
79 | 79 | $limit = 25, $continue = null ) { |
80 | 80 | $dbr = wfGetDB( DB_SLAVE ); |
81 | 81 | $ids = array(); |
— | — | @@ -139,7 +139,7 @@ |
140 | 140 | record until we fetch them, this is the only way to make |
141 | 141 | sure we get all answers for the exact IDs we want. */ |
142 | 142 | $id_query = $dbr->select( |
143 | | - array( |
| 143 | + array( |
144 | 144 | 'aft_article_feedback', |
145 | 145 | 'rating' => 'aft_article_answer', |
146 | 146 | 'comment' => 'aft_article_answer', |
— | — | @@ -156,13 +156,13 @@ |
157 | 157 | 'ORDER BY' => $order |
158 | 158 | ), |
159 | 159 | array( |
160 | | - 'rating' => array( |
161 | | - 'LEFT JOIN', |
162 | | - 'rating.aa_feedback_id = af_id AND rating.aa_field_id = '.intval( $ratingField ) |
| 160 | + 'rating' => array( |
| 161 | + 'LEFT JOIN', |
| 162 | + 'rating.aa_feedback_id = af_id AND rating.aa_field_id = '.intval( $ratingField ) |
163 | 163 | ), |
164 | | - 'comment' => array( |
165 | | - 'LEFT JOIN', |
166 | | - 'comment.aa_feedback_id = af_id AND comment.aa_field_id = '.intval( $commentField ) |
| 164 | + 'comment' => array( |
| 165 | + 'LEFT JOIN', |
| 166 | + 'comment.aa_feedback_id = af_id AND comment.aa_field_id = '.intval( $commentField ) |
167 | 167 | ) |
168 | 168 | ) |
169 | 169 | ); |
— | — | @@ -176,10 +176,10 @@ |
177 | 177 | } |
178 | 178 | |
179 | 179 | $rows = $dbr->select( |
180 | | - array( 'aft_article_feedback', |
| 180 | + array( 'aft_article_feedback', |
181 | 181 | 'rating' => 'aft_article_answer', |
182 | 182 | 'answer' => 'aft_article_answer', |
183 | | - 'aft_article_field', |
| 183 | + 'aft_article_field', |
184 | 184 | 'aft_article_field_option', 'user', 'page' |
185 | 185 | ), |
186 | 186 | array( 'af_id', 'af_bucket_id', 'afi_name', 'afo_name', |
— | — | @@ -198,10 +198,10 @@ |
199 | 199 | __METHOD__, |
200 | 200 | array( 'ORDER BY' => $order ), |
201 | 201 | array( |
202 | | - 'rating' => array( |
203 | | - 'LEFT JOIN', |
204 | | - 'rating.aa_feedback_id = af_id AND rating.aa_field_id = '.intval( $ratingField ) |
205 | | - ), |
| 202 | + 'rating' => array( |
| 203 | + 'LEFT JOIN', |
| 204 | + 'rating.aa_feedback_id = af_id AND rating.aa_field_id = '.intval( $ratingField ) |
| 205 | + ), |
206 | 206 | 'answer' => array( |
207 | 207 | 'LEFT JOIN', 'af_id = answer.aa_feedback_id' |
208 | 208 | ), |
— | — | @@ -423,18 +423,16 @@ |
424 | 424 | 'id' => 'articleFeedbackv5-feedback-tools-list-' . $id |
425 | 425 | ) ); |
426 | 426 | |
427 | | - |
428 | 427 | if ( $can_hide ) { |
429 | | - $link = 'hide'; |
430 | 428 | if ( $record[0]->af_is_hidden > 0 ) { |
431 | | - # unhide |
432 | | - $link = 'unhide'; |
433 | | - $tools .= Html::element( 'li', array(), wfMessage( 'articlefeedbackv5-hidden' ) ); |
| 429 | + $msg = 'unhide'; |
| 430 | + } else { |
| 431 | + $msg = 'hide'; |
434 | 432 | } |
435 | 433 | $tools .= Html::rawElement( 'li', array(), Html::element( 'a', array( |
436 | | - 'id' => "articleFeedbackv5-$link-link-$id", |
437 | | - 'class' => "articleFeedbackv5-$link-link" |
438 | | - ), wfMessage( "articlefeedbackv5-form-$link", $record[0]->af_is_hidden )->text() ) ); |
| 434 | + 'id' => "articleFeedbackv5-hide-link-$id", |
| 435 | + 'class' => "articleFeedbackv5-hide-link" |
| 436 | + ), wfMessage( "articlefeedbackv5-form-" . $msg )->text() ) ); |
439 | 437 | } |
440 | 438 | |
441 | 439 | if ( $can_delete ) { |
— | — | @@ -474,8 +472,12 @@ |
475 | 473 | . Html::closeElement( 'div' ); |
476 | 474 | } |
477 | 475 | |
| 476 | + $topClass = 'articleFeedbackv5-feedback'; |
| 477 | + if ( $record[0]->af_is_hidden ) { |
| 478 | + $topClass .= ' articleFeedbackv5-feedback-hidden'; |
| 479 | + } |
478 | 480 | return Html::openElement( 'div', array( |
479 | | - 'class' => 'articleFeedbackv5-feedback', |
| 481 | + 'class' => $topClass, |
480 | 482 | 'rel' => $id |
481 | 483 | ) ) |
482 | 484 | . Html::openElement( 'div', array( |
Index: trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.hooks.php |
— | — | @@ -167,12 +167,10 @@ |
168 | 168 | 'articlefeedbackv5-invalid-feedback-flag', |
169 | 169 | 'articlefeedbackv5-form-abuse', |
170 | 170 | 'articlefeedbackv5-abuse-saved', |
171 | | - 'articlefeedbackv5-hide-saved', |
| 171 | + 'articlefeedbackv5-form-hide', |
| 172 | + 'articlefeedbackv5-form-unhide', |
172 | 173 | 'articlefeedbackv5-hidden', |
173 | 174 | 'articlefeedbackv5-delete-saved', |
174 | | - 'articlefeedbackv5-helpful-saved', |
175 | | - 'articlefeedbackv5-unhelpful-saved', |
176 | | - 'articlefeedbackv5-unhide-saved', |
177 | 175 | 'articlefeedbackv5-undelete-saved', |
178 | 176 | 'articlefeedbackv5-oversight-saved', |
179 | 177 | 'articlefeedbackv5-unoversight-saved', |