Index: trunk/extensions/ArticleFeedbackv5/sql/ArticleFeedbackv5.sql |
— | — | @@ -39,7 +39,10 @@ |
40 | 40 | af_hide_count integer unsigned NOT NULL DEFAULT 0, |
41 | 41 | af_delete_count integer unsigned NOT NULL DEFAULT 0, |
42 | 42 | af_helpful_count integer unsigned NOT NULL DEFAULT 0, |
43 | | - af_unhelpful_count integer unsigned NOT NULL DEFAULT 0 |
| 43 | + af_unhelpful_count integer unsigned NOT NULL DEFAULT 0, |
| 44 | + -- Flag a message as requiring oversight |
| 45 | + af_needs_oversight boolean NOT NULL DEFAULT FALSE |
| 46 | + |
44 | 47 | ) /*$wgDBTableOptions*/; |
45 | 48 | CREATE INDEX /*i*/af_page_user_token_id ON /*_*/aft_article_feedback (af_page_id, af_user_id, af_user_anon_token, af_id); |
46 | 49 | CREATE INDEX /*i*/af_revision_id ON /*_*/aft_article_feedback (af_revision_id); |
Index: trunk/extensions/ArticleFeedbackv5/sql/alter.sql |
— | — | @@ -72,3 +72,8 @@ |
73 | 73 | |
74 | 74 | -- added 1/19 (greg) |
75 | 75 | ALTER TABLE aft_article_feedback ADD COLUMN af_unhelpful_count integer unsigned NOT NULL DEFAULT 0; |
| 76 | + |
| 77 | +-- added 1/24 (greg) |
| 78 | +INSERT INTO aft_article_filter_count(afc_page_id, afc_filter_name, afc_filter_count) SELECT af_page_id, 'deleted', COUNT(*) FROM aft_article_feedback WHERE af_delete_count > 0 GROUP BY af_page_id; |
| 79 | +INSERT INTO aft_article_filter_count(afc_page_id, afc_filter_name, afc_filter_count) SELECT af_page_id, 'unhelpful', COUNT(*) FROM aft_article_feedback WHERE af_helpful_count <= 0 GROUP BY af_page_id; |
| 80 | +ALTER TABLE aft_article_feedback ADD COLUMN af_needs_oversight boolean NOT NULL DEFAULT FALSE; |
Index: trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.i18n.php |
— | — | @@ -81,9 +81,12 @@ |
82 | 82 | |
83 | 83 | 'articlefeedbackv5-form-optionid' => 'Option $1', |
84 | 84 | 'articlefeedbackv5-form-hide' => 'Hide this post ($1)', |
| 85 | + 'articlefeedbackv5-form-unhide' => 'Show this post', |
85 | 86 | 'articlefeedbackv5-form-helpful' => 'Mark as helpful ($1)', |
86 | 87 | 'articlefeedbackv5-form-abuse' => 'Flag as abuse ($1)', |
87 | 88 | 'articlefeedbackv5-form-delete' => 'Delete', |
| 89 | + 'articlefeedbackv5-form-oversight' => 'Mark for oversight', |
| 90 | + 'articlefeedbackv5-form-undelete' => 'Show this post', |
88 | 91 | 'articlefeedbackv5-form-header' => 'Feedback #$1, at $2', |
89 | 92 | 'articlefeedbackv5-form1-header-found' => '{{GENDER:$1|$1}} found what they were looking for:', |
90 | 93 | 'articlefeedbackv5-form1-header-not-found' => '{{GENDER:$1|$1}} did not find what they were looking for:', |
— | — | @@ -101,6 +104,9 @@ |
102 | 105 | 'articlefeedbackv5-hide-saved' => 'Hide flag saved', |
103 | 106 | 'articlefeedbackv5-unhelpful-saved' => 'Marked as unhelpful', |
104 | 107 | 'articlefeedbackv5-helpful-saved' => 'Marked as helpful', |
| 108 | + 'articlefeedbackv5-unhide-saved' => 'Feedback shown', |
| 109 | + 'articlefeedbackv5-undelete-saved' => 'Feedback shown', |
| 110 | + 'articlefeedbackv5-oversight-saved' => 'Marked for oversight', |
105 | 111 | 'articlefeedbackv5-error-loading-feedback' => 'Error loading feedback', |
106 | 112 | 'articlefeedbackv5-invalid-feedback-id' => 'Invalid feedback ID', |
107 | 113 | 'articlefeedbackv5-invalid-feedback-flag' => 'Invalid feedback flag', |
Index: trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.special.js |
— | — | @@ -119,8 +119,8 @@ |
120 | 120 | oldId = $.articleFeedbackv5special.sort; |
121 | 121 | |
122 | 122 | // set direction = desc... |
123 | | - $.articleFeedbackv5special.sort = id; |
124 | | - $.articleFeedbackv5special.continue = null; |
| 123 | + $.articleFeedbackv5special.sort = id; |
| 124 | + $.articleFeedbackv5special.continue = null; |
125 | 125 | |
126 | 126 | // unless we're flipping the direction on the current sort. |
127 | 127 | if( id == oldId && $.articleFeedbackv5special.sortDirection == 'desc' ) { |
— | — | @@ -140,29 +140,12 @@ |
141 | 141 | return false; |
142 | 142 | } ); |
143 | 143 | |
144 | | - $( '.articleFeedbackv5-abuse-link' ).live( 'click', function( e ) { |
145 | | - $.articleFeedbackv5special.flagFeedback( $.articleFeedbackv5special.stripID( this, 'articleFeedbackv5-abuse-link-' ), 'abuse' ); |
146 | | - return false; |
147 | | - } ); |
148 | | - $( '.articleFeedbackv5-hide-link' ).live( 'click', function( e ) { |
149 | | - $.articleFeedbackv5special.flagFeedback( $.articleFeedbackv5special.stripID( this, 'articleFeedbackv5-hide-link-' ), 'hide' ); |
150 | | - return false; |
151 | | - } ); |
152 | | - $( '.articleFeedbackv5-delete-link' ).live( 'click', function( e ) { |
153 | | - $.articleFeedbackv5special.flagFeedback( $.articleFeedbackv5special.stripID( this, 'articleFeedbackv5-delete-link-' ), 'delete' ); |
154 | | - return false; |
155 | | - } ); |
156 | | - $( '.articleFeedbackv5-helpful-link' ).live( 'click', function( e ) { |
157 | | - $.articleFeedbackv5special.flagFeedback( $.articleFeedbackv5special.stripID( this, 'articleFeedbackv5-helpful-link-' ), 'helpful' ); |
158 | | - $(this).addClass('active'); |
159 | | - |
160 | | - return false; |
161 | | - } ); |
162 | | - $( '.articleFeedbackv5-unhelpful-link' ).live( 'click', function( e ) { |
163 | | - $.articleFeedbackv5special.flagFeedback( $.articleFeedbackv5special.stripID( this, 'articleFeedbackv5-unhelpful-link-' ), 'unhelpful' ); |
164 | | - $(this).addClass('active'); |
165 | | - return false; |
166 | | - } ); |
| 144 | + $.each( ['unhide', 'undelete', 'oversight', 'hide', 'abuse', 'delete', 'helpful', 'unhelpful'], |
| 145 | + function ( index, value ) { |
| 146 | + $( '.articleFeedbackv5-' + value + '-link' ).live( 'click', function( e ) { |
| 147 | + $.articleFeedbackv5special.flagFeedback( $.articleFeedbackv5special.stripID( this, 'articleFeedbackv5-' + value + '-link-' ), value ); |
| 148 | + }) |
| 149 | + }); |
167 | 150 | } |
168 | 151 | |
169 | 152 | // }}} |
Index: trunk/extensions/ArticleFeedbackv5/api/ApiFlagFeedbackArticleFeedbackv5.php |
— | — | @@ -39,6 +39,19 @@ |
40 | 40 | if ( !$record->af_id ) { |
41 | 41 | // no-op, because this is already broken |
42 | 42 | $error = 'articlefeedbackv5-invalid-feedback-id'; |
| 43 | + } elseif( $params['flagtype'] == 'unhide' ) { |
| 44 | + // remove the hidden status |
| 45 | + $update[] = 'af_hide_count = 0'; |
| 46 | + } elseif( $params['flagtype'] == 'unoversight' ) { |
| 47 | + // remove the oversight flag |
| 48 | + $update[] = 'af_needs_oversight = FALSE'; |
| 49 | + } elseif( $params['flagtype'] == 'undelete' ) { |
| 50 | + // remove the deleted status, and clear oversight flag |
| 51 | + $update[] = 'af_delete_count = 0'; |
| 52 | + $update[] = 'af_needs_oversight = FALSE'; |
| 53 | + } elseif( $params['flagtype'] == 'oversight' ) { |
| 54 | + // flag for oversight |
| 55 | + $update[] = 'af_oversight = TRUE'; |
43 | 56 | } elseif( in_array( $params['flagtype'], $flags ) ) { |
44 | 57 | // Probably this doesn't need validation, since the API |
45 | 58 | // will handle it, but if it's getting interpolated into |
— | — | @@ -169,7 +182,7 @@ |
170 | 183 | ApiBase::PARAM_REQUIRED => true, |
171 | 184 | ApiBase::PARAM_ISMULTI => false, |
172 | 185 | ApiBase::PARAM_TYPE => array( |
173 | | - 'abuse', 'hide', 'helpful', 'unhelpful', 'delete' ) |
| 186 | + 'abuse', 'hide', 'helpful', 'unhelpful', 'delete', 'undelete', 'unhide', 'oversight' ) |
174 | 187 | ), |
175 | 188 | ); |
176 | 189 | } |
Index: trunk/extensions/ArticleFeedbackv5/api/ApiViewFeedbackArticleFeedbackv5.php |
— | — | @@ -200,25 +200,24 @@ |
201 | 201 | global $wgUser; |
202 | 202 | $where = array(); |
203 | 203 | |
204 | | - // Permissions check |
| 204 | + // Permissions check: these filters are for admins only. |
205 | 205 | if( |
206 | 206 | ( $filter == 'invisible' |
207 | 207 | && !$wgUser->isAllowed( 'aftv5-see-hidden-feedback' ) ) |
208 | 208 | || |
209 | 209 | ( $filter == 'deleted' |
210 | | - && !$wgUser->isAllowed( 'aftv5-ssee-deleted-feedback' ) ) |
| 210 | + && !$wgUser->isAllowed( 'aftv5-see-deleted-feedback' ) ) |
211 | 211 | ) { |
212 | 212 | $filter = null; |
213 | 213 | } |
214 | 214 | |
215 | | - // Always limit this to non-hidden records, unless they |
216 | | - // specifically ask to see them. |
217 | | - if( in_array( $filter, array( 'invisible', 'all', 'almostall' ) ) ) { |
| 215 | + // Don't let non-allowed users see these. |
| 216 | + if( !$wgUser->isAllowed( 'aftv5-see-hidden-feedback' ) ) { |
218 | 217 | $where['af_hide_count'] = 0; |
219 | 218 | } |
220 | 219 | |
221 | | - // Same, but for deleted/supressed/oversight-only records. |
222 | | - if( in_array( $filter, array( 'deleted', 'all' ) ) ) { |
| 220 | + // Don't let non-allowed users see these. |
| 221 | + if( !$wgUser->isAllowed( 'aftv5-see-deleted-feedback' ) ) { |
223 | 222 | $where['af_delete_count'] = 0; |
224 | 223 | } |
225 | 224 | |
— | — | @@ -228,18 +227,16 @@ |
229 | 228 | $where[ 'af_id' ] = $filterValue; |
230 | 229 | break; |
231 | 230 | case 'all': |
| 231 | + # relies on the above to handler filtering, |
| 232 | + # because 'all' doesn't mean thhe same thing |
| 233 | + # at all access levels. |
232 | 234 | # oversight, real 'all' - no filtering done |
233 | | - break; |
234 | | - case 'almostall': |
235 | 235 | # non-oversight 'all' - no deleted feedback |
236 | | - $where['af_delete_count'] = 0; |
237 | | - break; |
238 | | - case 'notall': |
239 | 236 | # non-moderator 'all' - no hidden/deleted |
240 | | - $where['af_delete_count'] = 0; |
241 | | - $where['af_hide_count'] = 0; |
242 | 237 | break; |
243 | 238 | case 'visible': |
| 239 | + # For oversights/sysops to see what normal |
| 240 | + # people see. |
244 | 241 | $where['af_delete_count'] = 0; |
245 | 242 | $where['af_hide_count'] = 0; |
246 | 243 | break; |
— | — | @@ -352,6 +349,7 @@ |
353 | 350 | . Html::closeElement( 'p' ); |
354 | 351 | |
355 | 352 | // Don't render the toolbox if they can't do anything with it. |
| 353 | + $tools = null; |
356 | 354 | if( $can_hide || $can_delete ) { |
357 | 355 | $tools = Html::openElement( 'div', array( |
358 | 356 | 'class' => 'articleFeedbackv5-feedback-tools', |
— | — | @@ -362,18 +360,42 @@ |
363 | 361 | ), wfMessage( 'articlefeedbackv5-form-tools-label' )->text() ) |
364 | 362 | . Html::openElement( 'ul', array( |
365 | 363 | 'id' => 'articleFeedbackv5-feedback-tools-list-'.$id |
366 | | - ) ) |
367 | | - # TODO: unhide hidden posts |
368 | | - . ( $can_hide ? Html::rawElement( 'li', array(), Html::element( 'a', array( |
369 | | - 'id' => "articleFeedbackv5-hide-link-$id", |
370 | | - 'class' => 'articleFeedbackv5-hide-link' |
371 | | - ), wfMessage( 'articlefeedbackv5-form-hide', $record[0]->af_hide_count )->text() ) ) : '' ) |
372 | | - # TODO: nonoversight can mark for oversight, oversight can |
373 | | - # either delete or un-delete, based on deletion status |
374 | | - . ( $can_delete ? Html::rawElement( 'li', array(), Html::element( 'a', array( |
375 | | - 'id' => "articleFeedbackv5-delete-link-$id", |
376 | | - 'class' => 'articleFeedbackv5-delete-link' |
377 | | - ), wfMessage( 'articlefeedbackv5-form-delete' )->text() ) ) : '' ) |
| 364 | + ) ); |
| 365 | + |
| 366 | + |
| 367 | + if( $can_hide ) { |
| 368 | + $link = 'hide'; |
| 369 | + if( $record[0]->af_hide_count > 0 ) { |
| 370 | + # unhide |
| 371 | + $link = 'unhide'; |
| 372 | + } |
| 373 | + $tools .= Html::rawElement( 'li', array(), Html::element( 'a', array( |
| 374 | + 'id' => "articleFeedbackv5-$link-link-$id", |
| 375 | + 'class' => "articleFeedbackv5-$link-link" |
| 376 | + ), wfMessage( "articlefeedbackv5-form-$link", $record[0]->af_hide_count )->text() ) ); |
| 377 | + } |
| 378 | + |
| 379 | + # TODO: a third link, to remove oversight flag |
| 380 | + if( $can_delete ) { |
| 381 | + # delete |
| 382 | + $link = 'delete'; |
| 383 | + if( $record[0]->af_delete_count > 0 ) { |
| 384 | + # undelete |
| 385 | + $link = 'undelete'; |
| 386 | + } |
| 387 | +# } else { |
| 388 | +# if( $record[0]->af_needs_oversight ) { |
| 389 | +# # TODO: already flagged |
| 390 | +# $link = 'oversight'; |
| 391 | +# } |
| 392 | +# # flag for oversight |
| 393 | +# $link = 'oversight'; |
| 394 | + } |
| 395 | + |
| 396 | + $tools .= Html::rawElement( 'li', array(), Html::element( 'a', array( |
| 397 | + 'id' => "articleFeedbackv5-$link-link-$id", |
| 398 | + 'class' => "articleFeedbackv5-$link-link" |
| 399 | + ), wfMessage( "articlefeedbackv5-form-$link", $record[0]->af_delete_count )->text() ) ) |
378 | 400 | . Html::closeElement( 'ul' ) |
379 | 401 | . Html::closeElement( 'div' ); |
380 | 402 | } |
— | — | @@ -496,8 +518,8 @@ |
497 | 519 | return Html::openElement( 'h3', array( |
498 | 520 | 'class' => $class |
499 | 521 | ) ) |
| 522 | + . Linker::link( Title::newFromText( $link ), $name ) |
500 | 523 | . Html::element( 'span', array( 'class' => 'icon' ) ) |
501 | | - . Linker::link( Title::newFromText( $link ), $name ) |
502 | 524 | . Html::element( 'span', |
503 | 525 | array( 'class' => 'result' ), |
504 | 526 | wfMessage( $message, $gender, $extra )->escaped() |
— | — | @@ -533,7 +555,7 @@ |
534 | 556 | ApiBase::PARAM_REQUIRED => false, |
535 | 557 | ApiBase::PARAM_ISMULTI => false, |
536 | 558 | ApiBase::PARAM_TYPE => array( |
537 | | - 'all', 'invisible', 'visible', 'comment', 'id', 'helpful', 'unhelpful', 'abusive', 'almostall', 'notall' ) |
| 559 | + 'all', 'invisible', 'visible', 'comment', 'id', 'helpful', 'unhelpful', 'abusive', 'deleted' ) |
538 | 560 | ), |
539 | 561 | 'filtervalue' => array( |
540 | 562 | ApiBase::PARAM_REQUIRED => false, |
Index: trunk/extensions/ArticleFeedbackv5/SpecialArticleFeedbackv5.php |
— | — | @@ -17,7 +17,8 @@ |
18 | 18 | class SpecialArticleFeedbackv5 extends SpecialPage { |
19 | 19 | private $filters = array( |
20 | 20 | 'comment', |
21 | | - 'helpful' |
| 21 | + 'helpful', |
| 22 | + 'all' |
22 | 23 | ); |
23 | 24 | private $sorts = array( |
24 | 25 | 'age', |
— | — | @@ -32,6 +33,12 @@ |
33 | 34 | global $wgUser; |
34 | 35 | parent::__construct( 'ArticleFeedbackv5' ); |
35 | 36 | |
| 37 | + // NOTE: The 'all' option actually displays different things |
| 38 | + // based on the users role, which is handled in the filter: |
| 39 | + // - deleter-all is actually everything |
| 40 | + // - hidder-all is 'visible + hidden' |
| 41 | + // - regular non-admin all is just 'all visible' |
| 42 | + |
36 | 43 | if( $wgUser->isAllowed( 'aftv5-see-hidden-feedback' ) ) { |
37 | 44 | array_push( $this->filters, |
38 | 45 | 'invisible', 'unhelpful', 'abusive' |
— | — | @@ -39,23 +46,8 @@ |
40 | 47 | } |
41 | 48 | |
42 | 49 | if( $wgUser->isAllowed( 'aftv5-see-deleted-feedback' ) ) { |
43 | | - array_push( $this->filters, 'deleted', 'all' ); |
| 50 | + $this->filters[] = 'deleted'; |
44 | 51 | } |
45 | | - |
46 | | - // The 'all' option actually displays different things based |
47 | | - // on the users role, which is why we do this. |
48 | | - // - deleted-all is actually everything |
49 | | - // - hidden-all is 'visible + hidden' |
50 | | - // - regular non-admin all is just 'all visible' |
51 | | - if( !$wgUser->isAllowed( 'aftv5-see-deleted-feedback' ) |
52 | | - && $wgUser->isAllowed( 'aftv5-see-hidden-feedback' ) ) { |
53 | | - $this->filters[] = 'almostall'; |
54 | | - } |
55 | | - |
56 | | - if( !$wgUser->isAllowed( 'aftv5-see-deleted-feedback' ) |
57 | | - && !$wgUser->isAllowed( 'aftv5-see-hidden-feedback' ) ) { |
58 | | - $this->filters[] = 'notall'; |
59 | | - } |
60 | 52 | } |
61 | 53 | |
62 | 54 | /** |
Index: trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.hooks.php |
— | — | @@ -170,6 +170,9 @@ |
171 | 171 | 'articlefeedbackv5-delete-saved', |
172 | 172 | 'articlefeedbackv5-helpful-saved', |
173 | 173 | 'articlefeedbackv5-unhelpful-saved', |
| 174 | + 'articlefeedbackv5-unhide-saved', |
| 175 | + 'articlefeedbackv5-undelete-saved', |
| 176 | + 'articlefeedbackv5-oversight-saved', |
174 | 177 | 'articlefeedbackv5-comment-link', |
175 | 178 | 'articlefeedbackv5-special-sort-asc', |
176 | 179 | 'articlefeedbackv5-special-sort-desc' |