Index: trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.i18n.php |
— | — | @@ -52,19 +52,17 @@ |
53 | 53 | 'articlefeedbackv5-form-helpful-label' => 'Is this feedback helpful?', |
54 | 54 | 'articlefeedbackv5-form-helpful-yes-label' => 'Yes', |
55 | 55 | 'articlefeedbackv5-form-helpful-no-label' => 'No', |
56 | | - 'articlefeedbackv5-form-helpful-votes' => '({{PLURAL:$1|1 response|$1 responses}}: {{PLURAL:$2|1 yes|$2 yes}} / {{PLURAL:$3|1 no|$3 no}})', |
| 56 | + 'articlefeedbackv5-form-helpful-votes' => '{{PLURAL:$1|1 yes|$1 yes}} / {{PLURAL:$2|1 no|$2 no}}', |
57 | 57 | 'articlefeedbackv5-special-add-feedback' => 'Add your feedback', |
58 | 58 | 'articlefeedbackv5-special-filter-all' => 'All ($1)', |
59 | 59 | 'articlefeedbackv5-special-filter-comment' => 'Comments only ($1)', |
60 | | - 'articlefeedbackv5-special-filter-abusive' => 'Abusive ($1)', |
| 60 | + 'articlefeedbackv5-special-filter-abusive' => 'Flagged as abuse ($1)', |
61 | 61 | 'articlefeedbackv5-special-filter-helpful' => 'Helpful ($1)', |
62 | 62 | 'articlefeedbackv5-special-filter-unhelpful' => 'Unhelpful ($1)', |
63 | 63 | 'articlefeedbackv5-special-filter-needsoversight' => 'Oversight requested ($1)', |
64 | | - 'articlefeedbackv5-special-filter-visible' => 'Visible ($1)', |
| 64 | + 'articlefeedbackv5-special-filter-visible' => 'All visible ($1)', |
65 | 65 | 'articlefeedbackv5-special-filter-invisible' => 'Hidden ($1)', |
66 | 66 | 'articlefeedbackv5-special-filter-deleted' => 'Deleted ($1)', |
67 | | - 'articlefeedbackv5-special-sort-asc' => '^', |
68 | | - 'articlefeedbackv5-special-sort-desc' => 'v', |
69 | 67 | 'articlefeedbackv5-special-sort-age' => 'Date', |
70 | 68 | 'articlefeedbackv5-special-sort-helpful' => 'Helpful', |
71 | 69 | 'articlefeedbackv5-special-sort-rating' => 'Rating', |
— | — | @@ -74,6 +72,7 @@ |
75 | 73 | 'articlefeedbackv5-special-filter-label-after' => '', |
76 | 74 | 'articlefeedbackv5-special-showing' => '{{PLURAL:$1|1 feedback post|$1 feedback posts }} on this article', |
77 | 75 | 'articlefeedbackv5-comment-link' => 'Permalink', |
| 76 | + 'articleFeedbackv5-comment-ago' => '$1 ago', |
78 | 77 | 'articlefeedbackv5-updates-since' => '{{PLURAL:$1|1 edit|$1 edits}} since post', |
79 | 78 | 'articlefeedbackv5-special-more' => 'Show more posts', |
80 | 79 | 'articlefeedbackv5-special-pagetitle' => 'Feedback: $1', |
— | — | @@ -102,8 +101,8 @@ |
103 | 102 | 'articlefeedbackv5-delete-saved' => 'Feedback deleted', |
104 | 103 | 'articlefeedbackv5-abuse-saved' => 'Flagged as abuse', |
105 | 104 | 'articlefeedbackv5-hide-saved' => 'Hide flag saved', |
106 | | - 'articlefeedbackv5-unhelpful-saved' => 'Marked as unhelpful', |
107 | | - 'articlefeedbackv5-helpful-saved' => 'Marked as helpful', |
| 105 | + 'articlefeedbackv5-unhelpful-saved' => 'No', |
| 106 | + 'articlefeedbackv5-helpful-saved' => 'Yes', |
108 | 107 | 'articlefeedbackv5-unhide-saved' => 'Feedback shown', |
109 | 108 | 'articlefeedbackv5-undelete-saved' => 'Feedback shown', |
110 | 109 | 'articlefeedbackv5-oversight-saved' => 'Marked for oversight', |
— | — | @@ -331,6 +330,13 @@ |
332 | 331 | 'articlefeedbackv5-special-filter-deleted' => '{{Identical|Deleted}}', |
333 | 332 | 'articlefeedbackv5-special-sort-age' => '{{Identical|Date}}', |
334 | 333 | 'articlefeedbackv5-special-sort-rating' => '{{Identical|Rating}}', |
| 334 | + 'articlefeedbackv5-special-sort-label-before' => 'Place to put a label before the sort options', |
| 335 | + 'articlefeedbackv5-special-sort-label-after' => 'Place to put a label after the sort options', |
| 336 | + 'articlefeedbackv5-special-filter-label-before' => 'Place to put a label before the filter select box', |
| 337 | + 'articlefeedbackv5-special-filter-label-after' => 'Place to put a label after the filter select box', |
| 338 | + 'articlefeedbackv5-special-showing' => 'Text to show how many feedback psots have been posted to this article. $1 is the number of posts (needs plural support)', |
| 339 | + 'articleFeedbackv5-comment-ago' => 'For posts less than 48 hours old, display a relative timestamp ("2 hours 19 minutes ago", eg). Formatting timestamp is in $1', |
| 340 | + 'articlefeedbackv5-updates-since' => 'Number of edits made to this article since this feedback was posted. $1 is the number of edits. Requires plural support', |
335 | 341 | 'articlefeedbackv5-special-more' => '{{Identical|More}}', |
336 | 342 | 'articlefeedbackv5-special-pagetitle' => 'Page title for [[Special:ArticleFeedbackv5]]. Parameters: |
337 | 343 | * $1 is the title of the article for which we show the feedback', |
Index: trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.special.css |
— | — | @@ -321,3 +321,8 @@ |
322 | 322 | .articleFeedbackv5-comment-full { |
323 | 323 | display: none; |
324 | 324 | } |
| 325 | + |
| 326 | +a.helpful-active { |
| 327 | + background: url(images/bg-button.png) !important; |
| 328 | + color: white !important; |
| 329 | +} |
Index: trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.special.js |
— | — | @@ -98,7 +98,6 @@ |
99 | 99 | |
100 | 100 | // Initial load |
101 | 101 | $.articleFeedbackv5special.loadFeedback( true ); |
102 | | - $.articleFeedbackv5special.drawSortArrow(); |
103 | 102 | }; |
104 | 103 | |
105 | 104 | // }}} |
— | — | @@ -142,14 +141,31 @@ |
143 | 142 | return false; |
144 | 143 | } ); |
145 | 144 | |
| 145 | + $( '.articleFeedbackv5-permalink' ).live( 'click', function( e ) { |
| 146 | + id = $.articleFeedbackv5special.stripID( this, 'articleFeedbackv5-permalink-' ); |
| 147 | + $.articleFeedbackv5special.filter = 'id'; |
| 148 | + $.articleFeedbackv5special.filterValue = id; |
| 149 | + $.articleFeedbackv5special.continue = null; |
| 150 | + $.articleFeedbackv5special.loadFeedback( true ); |
| 151 | + } ); |
| 152 | + |
146 | 153 | $( '.articleFeedbackv5-comment-toggle' ).live( 'click', function( e ) { |
147 | 154 | $.articleFeedbackv5special.toggleComment( $.articleFeedbackv5special.stripID( this, 'articleFeedbackv5-comment-toggle-' ) ); |
148 | 155 | return false; |
149 | 156 | } ); |
150 | 157 | |
151 | | - $.each( ['unhide', 'undelete', 'oversight', 'hide', 'abuse', 'delete', 'helpful', 'unhelpful', 'unoversight'], |
152 | | - function ( index, value ) { |
| 158 | + // Helpful and unhelpful have their own special logic, so break those out. |
| 159 | + $.each( ['helpful', 'unhelpful' ], function ( index, value ) { |
153 | 160 | $( '.articleFeedbackv5-' + value + '-link' ).live( 'click', function( e ) { |
| 161 | + id = $.articleFeedbackv5special.stripID( this, 'articleFeedbackv5-' + value + '-link-' ); |
| 162 | + $.articleFeedbackv5special.flagFeedback( id, value ); |
| 163 | + // add highlighted class |
| 164 | + $( this ).addClass( 'helpful-active' ); |
| 165 | + } ) |
| 166 | + } ); |
| 167 | + |
| 168 | + $.each( ['unhide', 'undelete', 'oversight', 'hide', 'abuse', 'delete', 'unoversight'], function ( index, value ) { |
| 169 | + $( '.articleFeedbackv5-' + value + '-link' ).live( 'click', function( e ) { |
154 | 170 | $.articleFeedbackv5special.flagFeedback( $.articleFeedbackv5special.stripID( this, 'articleFeedbackv5-' + value + '-link-' ), value ); |
155 | 171 | } ) |
156 | 172 | } ); |
Index: trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.php |
— | — | @@ -242,14 +242,14 @@ |
243 | 243 | $wgHooks['ArticleSaveComplete'][] = 'ArticleFeedbackv5Hooks::trackEditSuccess'; |
244 | 244 | |
245 | 245 | // API Registration |
246 | | -$wgAPIListModules['articlefeedbackv5-view-ratings'] = 'ApiViewRatingsArticleFeedbackv5'; |
247 | | -$wgAPIListModules['articlefeedbackv5-view-feedback'] = 'ApiViewFeedbackArticleFeedbackv5'; |
248 | | -$wgAPIModules['articlefeedbackv5-flag-feedback'] = 'ApiFlagFeedbackArticleFeedbackv5'; |
| 246 | +#$wgAPIListModules['articlefeedbackv5-view-ratings'] = 'ApiViewRatingsArticleFeedbackv5'; |
| 247 | +#$wgAPIListModules['articlefeedbackv5-view-feedback'] = 'ApiViewFeedbackArticleFeedbackv5'; |
| 248 | +#$wgAPIModules['articlefeedbackv5-flag-feedback'] = 'ApiFlagFeedbackArticleFeedbackv5'; |
249 | 249 | $wgAPIModules['articlefeedbackv5'] = 'ApiArticleFeedbackv5'; |
250 | 250 | |
251 | 251 | // Special Page |
252 | | -$wgSpecialPages['ArticleFeedbackv5'] = 'SpecialArticleFeedbackv5'; |
253 | | -$wgSpecialPageGroups['ArticleFeedbackv5'] = 'other'; |
| 252 | +#$wgSpecialPages['ArticleFeedbackv5'] = 'SpecialArticleFeedbackv5'; |
| 253 | +#$wgSpecialPageGroups['ArticleFeedbackv5'] = 'other'; |
254 | 254 | |
255 | 255 | $wgAvailableRights[] = 'aftv5-hide-feedback'; |
256 | 256 | $wgAvailableRights[] = 'aftv5-delete-feedback'; |
Index: trunk/extensions/ArticleFeedbackv5/api/ApiFlagFeedbackArticleFeedbackv5.php |
— | — | @@ -141,8 +141,7 @@ |
142 | 142 | $unhelpful = $record->af_unhelpful_count; |
143 | 143 | |
144 | 144 | $helpful = wfMessage( 'articlefeedbackv5-form-helpful-votes', |
145 | | - ( $helpful + $unhelpful ), |
146 | | - $helpful, $unhelpful |
| 145 | + $helpful, $unhelpful |
147 | 146 | )->escaped(); |
148 | 147 | } |
149 | 148 | } |
Index: trunk/extensions/ArticleFeedbackv5/api/ApiViewFeedbackArticleFeedbackv5.php |
— | — | @@ -112,7 +112,7 @@ |
113 | 113 | $where[] = 'af_id = aa_feedback_id'; |
114 | 114 | |
115 | 115 | if ( $continue !== null ) { |
116 | | - $where[] = "$continueSql $continue"; |
| 116 | + $where[] = $continueSql.' '.intVal( $continue ); |
117 | 117 | } |
118 | 118 | |
119 | 119 | /* I'd really love to do this in one big query, but MySQL |
— | — | @@ -269,7 +269,7 @@ |
270 | 270 | } |
271 | 271 | |
272 | 272 | protected function renderFeedback( $record ) { |
273 | | - global $wgArticlePath, $wgUser; |
| 273 | + global $wgArticlePath, $wgUser, $wgLang; |
274 | 274 | $id = $record[0]->af_id; |
275 | 275 | |
276 | 276 | switch( $record[0]->af_bucket_id ) { |
— | — | @@ -282,13 +282,27 @@ |
283 | 283 | default: $content .= $this->renderNoBucket( $record ); break; |
284 | 284 | } |
285 | 285 | |
286 | | - // These two are the same for now, but may now always be, |
| 286 | + // These two are the same for now, but may not always be, |
287 | 287 | // so set them each separately. |
288 | 288 | $can_flag = !$wgUser->isBlocked(); |
289 | 289 | $can_vote = !$wgUser->isBlocked(); |
290 | 290 | $can_hide = $wgUser->isAllowed( 'aftv5-hide-feedback' ); |
291 | 291 | $can_delete = $wgUser->isAllowed( 'aftv5-delete-feedback' ); |
292 | 292 | |
| 293 | + // Taken from the Moodbar extension. |
| 294 | + $now = wfTimestamp( TS_UNIX ); |
| 295 | + $timestamp = wfTimestamp( TS_UNIX, $record[0]->af_created ); |
| 296 | + // Relative dates for 48 hours, normal timestamps later. |
| 297 | + if( $timestamp > ( $now - ( 86400 * 2 ) ) ) { |
| 298 | + // TODO: relative dates. |
| 299 | + $time = $wgLang->formatTimePeriod( |
| 300 | + ( $now - $timestamp ), 'avoidseconds' |
| 301 | + ); |
| 302 | + $date = wfMessage( 'articleFeedbackv5-comment-ago', $time )->escaped(); |
| 303 | + } else { |
| 304 | + $date = $wgLang->timeanddate($record[0]->af_created ); |
| 305 | + } |
| 306 | + |
293 | 307 | $details = Html::openElement( 'div', array( |
294 | 308 | 'class' => 'articleFeedbackv5-comment-details' |
295 | 309 | ) ) |
— | — | @@ -296,32 +310,29 @@ |
297 | 311 | 'class' => 'articleFeedbackv5-comment-details-date' |
298 | 312 | ) ) |
299 | 313 | . Html::element( 'a', array( |
300 | | - 'href' => "#id=$id" |
301 | | - ), date( 'M j, Y H:i', strtotime( $record[0]->af_created ) ) ) |
| 314 | + 'class' => 'articleFeedbackv5-permalink', |
| 315 | + 'id' => "articleFeedbackv5-permalink-$id", |
| 316 | + 'href' => "#id=$id" |
| 317 | + ), $date ) |
302 | 318 | . Html::closeElement( 'div' ) |
303 | | -# Remove for now, pending feedback. |
304 | | -# . Html::openElement( 'div', array( |
305 | | -# 'class' => 'articleFeedbackv5-comment-details-permalink' |
306 | | -# ) ) |
307 | | -# .Html::element( 'a', array( |
308 | | -# 'href' => "#id=$id" |
309 | | -# ), wfMessage( 'articlefeedbackv5-comment-link' ) ) |
310 | | -# . Html::closeElement( 'div' ) |
311 | | - |
312 | 319 | . Html::openElement( 'div', array( |
313 | 320 | 'class' => 'articleFeedbackv5-comment-details-updates' |
314 | | - ) ) |
315 | | - . Linker::link( |
316 | | - Title::newFromText( $record[0]->page_title ), |
317 | | - wfMessage( 'articlefeedbackv5-updates-since', $record[0]->age ), |
318 | | - array(), |
319 | | - array( |
320 | | - 'action' => 'historysubmit', |
321 | | - 'diff' => $record[0]->page_latest, |
322 | | - 'oldid' => $record[0]->af_revision_id |
323 | | - ) |
324 | | - ) |
325 | | - . Html::closeElement( 'div' ) |
| 321 | + ) ); |
| 322 | + |
| 323 | + if( $record[0]->age > 0 ) { |
| 324 | + $details .= Linker::link( |
| 325 | + Title::newFromText( $record[0]->page_title ), |
| 326 | + wfMessage( 'articlefeedbackv5-updates-since', $record[0]->age ), |
| 327 | + array(), |
| 328 | + array( |
| 329 | + 'action' => 'historysubmit', |
| 330 | + 'diff' => $record[0]->page_latest, |
| 331 | + 'oldid' => $record[0]->af_revision_id |
| 332 | + ) |
| 333 | + ); |
| 334 | + } |
| 335 | + |
| 336 | + $details .= Html::closeElement( 'div' ) |
326 | 337 | . Html::closeElement( 'div' ); |
327 | 338 | ; |
328 | 339 | |
— | — | @@ -346,7 +357,7 @@ |
347 | 358 | $footer_links .= Html::element( 'span', array( |
348 | 359 | 'class' => 'articleFeedbackv5-helpful-votes', |
349 | 360 | 'id' => "articleFeedbackv5-helpful-votes-$id" |
350 | | - ), wfMessage( 'articlefeedbackv5-form-helpful-votes', ( $record[0]->af_helpful_count + $record[0]->af_unhelpful_count ), $record[0]->af_helpful_count, $record[0]->af_unhelpful_count ) ); |
| 361 | + ), wfMessage( 'articlefeedbackv5-form-helpful-votes', $record[0]->af_helpful_count, $record[0]->af_unhelpful_count ) ); |
351 | 362 | if ( $can_flag ) { |
352 | 363 | $footer_links .= Html::element( 'a', array( |
353 | 364 | 'id' => "articleFeedbackv5-abuse-link-$id", |
— | — | @@ -570,18 +581,18 @@ |
571 | 582 | } |
572 | 583 | |
573 | 584 | private function feedbackHead( $message, $class, $record, $extra = '' ) { |
574 | | - $gender = ''; # ? |
575 | 585 | $name = htmlspecialchars( $record->user_name ); |
576 | 586 | $link = $record->af_user_id ? "User:$name" : "Special:Contributions/$name"; |
| 587 | + $gender = $name; |
577 | 588 | |
578 | 589 | return Html::openElement( 'h3', array( |
579 | 590 | 'class' => $class |
580 | 591 | ) ) |
581 | 592 | . Linker::link( Title::newFromText( $link ), $name ) |
582 | 593 | . Html::element( 'span', array( 'class' => 'icon' ) ) |
583 | | - . Html::element( 'span', |
584 | | - array( 'class' => 'result' ), |
585 | | - wfMessage( $message, $gender, $extra )->escaped() |
| 594 | + . Html::element( 'span', |
| 595 | + array( 'class' => 'result' ), |
| 596 | + wfMessage( $message, $gender, $extra ) |
586 | 597 | ) |
587 | 598 | . Html::closeElement( 'h3' ); |
588 | 599 | } |
Index: trunk/extensions/ArticleFeedbackv5/SpecialArticleFeedbackv5.php |
— | — | @@ -18,7 +18,7 @@ |
19 | 19 | private $filters = array( |
20 | 20 | 'comment', |
21 | 21 | 'helpful', |
22 | | - 'all' |
| 22 | + 'visible' |
23 | 23 | ); |
24 | 24 | private $sorts = array( |
25 | 25 | 'age', |
— | — | @@ -41,8 +41,9 @@ |
42 | 42 | |
43 | 43 | if( $wgUser->isAllowed( 'aftv5-see-hidden-feedback' ) ) { |
44 | 44 | array_push( $this->filters, |
45 | | - 'invisible', 'unhelpful', 'abusive', 'needsoversight' |
| 45 | + 'unhelpful', 'abusive', 'invisible' |
46 | 46 | ); |
| 47 | + # removing the 'needsoversight' filter, per Fabrice |
47 | 48 | } |
48 | 49 | |
49 | 50 | if( $wgUser->isAllowed( 'aftv5-see-deleted-feedback' ) ) { |
Index: trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.hooks.php |
— | — | @@ -175,9 +175,6 @@ |
176 | 176 | 'articlefeedbackv5-undelete-saved', |
177 | 177 | 'articlefeedbackv5-oversight-saved', |
178 | 178 | 'articlefeedbackv5-unoversight-saved', |
179 | | - 'articlefeedbackv5-comment-link', |
180 | | - 'articlefeedbackv5-special-sort-asc', |
181 | | - 'articlefeedbackv5-special-sort-desc', |
182 | 179 | 'articlefeedbackv5-comment-more', |
183 | 180 | 'articlefeedbackv5-comment-less' |
184 | 181 | ), |