Index: trunk/extensions/ArticleFeedback/modules/jquery.articleFeedback/jquery.articleFeedback.css |
— | — | @@ -202,6 +202,11 @@ |
203 | 203 | background-image: url(images/star-full.png); |
204 | 204 | } |
205 | 205 | |
| 206 | +.articleFeedback-expired .articleFeedback-rating-labels label.articleFeedback-rating-label-full { |
| 207 | + /* @embed */ |
| 208 | + background-image: url(images/star-full-expired.png); |
| 209 | +} |
| 210 | + |
206 | 211 | .articleFeedback-rating-new .articleFeedback-rating-labels label.articleFeedback-rating-label-full, |
207 | 212 | .articleFeedback-rating .articleFeedback-rating-labels label.articleFeedback-rating-label-hover-tail { |
208 | 213 | /* @embed */ |
— | — | @@ -319,6 +324,7 @@ |
320 | 325 | .articleFeedback-success { |
321 | 326 | float: right; |
322 | 327 | } |
| 328 | + |
323 | 329 | .articleFeedback-success span { |
324 | 330 | display: none; |
325 | 331 | /* @embed */ |
— | — | @@ -333,3 +339,22 @@ |
334 | 340 | font-size: 0.8em; |
335 | 341 | line-height: 3.6em; |
336 | 342 | } |
| 343 | + |
| 344 | +.articleFeedback-expiry { |
| 345 | + display: none; |
| 346 | + border: solid 1px orange; |
| 347 | + background-color: white; |
| 348 | + padding: 0.5em; |
| 349 | +} |
| 350 | +.articleFeedback-expiry-title { |
| 351 | + font-size: 1.2em; |
| 352 | + padding-left: 28px; |
| 353 | + /* @embed */ |
| 354 | + background-image: url(images/alert.png); |
| 355 | + background-repeat: no-repeat; |
| 356 | + background-position: center left; |
| 357 | +} |
| 358 | +.articleFeedback-expiry-message { |
| 359 | + padding-left: 28px; |
| 360 | + color: #777777; |
| 361 | +} |
Index: trunk/extensions/ArticleFeedback/modules/jquery.articleFeedback/jquery.articleFeedback.js |
— | — | @@ -33,6 +33,10 @@ |
34 | 34 | <button class="articleFeedback-submit articleFeedback-visibleWith-form" type="submit" disabled><html:msg key="form-panel-submit" /></button>\ |
35 | 35 | <div class="articleFeedback-success articleFeedback-visibleWith-form"><span><html:msg key="form-panel-success" /></span></div>\ |
36 | 36 | <div style="clear:both;"></div>\ |
| 37 | + <div class="articleFeedback-expiry articleFeedback-visibleWith-form">\ |
| 38 | + <div class="articleFeedback-expiry-title"><html:msg key="form-panel-expiry-title" /></div>\ |
| 39 | + <div class="articleFeedback-expiry-message"><html:msg key="form-panel-expiry-message" /></div>\ |
| 40 | + </div>\ |
37 | 41 | </div>\ |
38 | 42 | <div class="articleFeedback-error"><div class="articleFeedback-error-message"><html:msg key="error" /></div></div>\ |
39 | 43 | <div class="articleFeedback-pitches"></div>\ |
— | — | @@ -212,6 +216,7 @@ |
213 | 217 | .show(); |
214 | 218 | } |
215 | 219 | } |
| 220 | + var expired = false; |
216 | 221 | context.$ui.find( '.articleFeedback-rating' ).each( function() { |
217 | 222 | var ratingData; |
218 | 223 | // Try to get data provided for this rating |
— | — | @@ -219,13 +224,20 @@ |
220 | 225 | data.query.articlefeedback.length && |
221 | 226 | typeof data.query.articlefeedback[0].ratings !== 'undefined' |
222 | 227 | ) { |
223 | | - var ratingsData = data.query.articlefeedback[0].ratings; |
224 | | - var id = context.options.ratings[$(this).attr( 'rel' )].id; |
225 | | - for ( var i = 0; i < ratingsData.length; i++ ) { |
226 | | - if ( ratingsData[i].ratingid == id ) { |
227 | | - ratingData = ratingsData[i]; |
| 228 | + if ( 'expired' in data.query.articlefeedback[0] ) { |
| 229 | + if ( data.query.articlefeedback[0].expired == true ) { |
| 230 | + expired = true; |
228 | 231 | } |
229 | 232 | } |
| 233 | + if ( 'ratings' in data.query.articlefeedback[0] ) { |
| 234 | + var ratingsData = data.query.articlefeedback[0].ratings; |
| 235 | + var id = context.options.ratings[$(this).attr( 'rel' )].id; |
| 236 | + for ( var i = 0; i < ratingsData.length; i++ ) { |
| 237 | + if ( ratingsData[i].ratingid == id ) { |
| 238 | + ratingData = ratingsData[i]; |
| 239 | + } |
| 240 | + } |
| 241 | + } |
230 | 242 | } |
231 | 243 | if ( typeof ratingData === 'undefined' || ratingData.total == 0 ) { |
232 | 244 | // Setup in "no ratings" mode |
— | — | @@ -264,6 +276,17 @@ |
265 | 277 | } |
266 | 278 | $.articleFeedback.fn.updateRating.call( $(this) ); |
267 | 279 | } ); |
| 280 | + if ( expired ) { |
| 281 | + context.$ui |
| 282 | + .addClass( 'articleFeedback-expired' ) |
| 283 | + .find( '.articleFeedback-expiry' ) |
| 284 | + .slideDown( 'fast' ); |
| 285 | + } else { |
| 286 | + context.$ui |
| 287 | + .removeClass( 'articleFeedback-expired' ) |
| 288 | + .find( '.articleFeedback-expiry' ) |
| 289 | + .slideUp( 'fast' ); |
| 290 | + } |
268 | 291 | // If being called just after a submit, we need to un-new the rating controls |
269 | 292 | context.$ui.find( '.articleFeedback-rating-new' ) |
270 | 293 | .removeClass( 'articleFeedback-rating-new' ); |
— | — | @@ -504,6 +527,13 @@ |
505 | 528 | ) |
506 | 529 | .mousedown( function() { |
507 | 530 | $.articleFeedback.fn.enableSubmission.call( context, true ); |
| 531 | + if ( context.$ui.hasClass( 'articleFeedback-expired' ) ) { |
| 532 | + // Changing one means the rest will get submitted too |
| 533 | + context.$ui |
| 534 | + .removeClass( 'articleFeedback-expired' ) |
| 535 | + .find( '.articleFeedback-rating' ) |
| 536 | + .addClass( 'articleFeedback-rating-new' ); |
| 537 | + } |
508 | 538 | context.$ui |
509 | 539 | .find( '.articleFeedback-expertise' ) |
510 | 540 | .each( function() { |
Index: trunk/extensions/ArticleFeedback/modules/jquery.articleFeedback/images/alert.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Index: trunk/extensions/ArticleFeedback/modules/jquery.articleFeedback/images/star-full-expired.png |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: trunk/extensions/ArticleFeedback/modules/jquery.articleFeedback/images/star-full-expired.png |
___________________________________________________________________ |
Added: svn:mime-type |
511 | 541 | + application/octet-stream |
Index: trunk/extensions/ArticleFeedback/modules/jquery.articleFeedback/images.psd |
Cannot display: file marked as a binary type. |
svn:mime-type = image/psd |
Index: trunk/extensions/ArticleFeedback/api/ApiQueryArticleFeedback.php |
— | — | @@ -103,11 +103,11 @@ |
104 | 104 | $ratings[$pageId]['ratings'][] = $thisRow; |
105 | 105 | } |
106 | 106 | |
107 | | - //Only can actually be "stale" if the user has rated the article before |
| 107 | + // Ratings can only be expired if the user has rated before |
108 | 108 | if ( $params['userrating'] && $userRatedArticle ) { |
109 | 109 | $dbr = wfGetDb( DB_SLAVE ); |
110 | 110 | |
111 | | - global $wgArticleFeedbackStaleCount; |
| 111 | + global $wgArticleFeedbackRatingLifetime; |
112 | 112 | |
113 | 113 | $res = $dbr->select( |
114 | 114 | 'revision', |
— | — | @@ -120,12 +120,12 @@ |
121 | 121 | array ( 'LIMIT', $wgArticleFeedbackStaleCount + 1 ) |
122 | 122 | ); |
123 | 123 | |
124 | | - if ( $res && $dbr->numRows( $res ) > $wgArticleFeedbackStaleCount ) { |
125 | | - //it's stale! |
126 | | - $ratings[$params['pageid']]['stale'] = ''; |
| 124 | + if ( $res && $dbr->numRows( $res ) > $wgArticleFeedbackRatingLifetime ) { |
| 125 | + // Include expired flag |
| 126 | + $ratings[$params['pageid']]['expired'] = true; |
127 | 127 | } |
128 | 128 | } |
129 | | - |
| 129 | + |
130 | 130 | foreach ( $ratings as $rat ) { |
131 | 131 | $result->setIndexedTagName( $rat['ratings'], 'r' ); |
132 | 132 | $result->addValue( array( 'query', $this->getModuleName() ), null, $rat ); |
Index: trunk/extensions/ArticleFeedback/ArticleFeedback.i18n.php |
— | — | @@ -37,6 +37,8 @@ |
38 | 38 | 'articlefeedback-form-panel-expertise-other' => 'The source of my knowledge is not listed here', |
39 | 39 | 'articlefeedback-form-panel-submit' => 'Submit ratings', |
40 | 40 | 'articlefeedback-form-panel-success' => 'Saved successfully', |
| 41 | + 'articlefeedback-form-panel-expiry-title' => 'Your ratings have expired', |
| 42 | + 'articlefeedback-form-panel-expiry-message' => 'Please reevaluate this page and submit new ratings.', |
41 | 43 | 'articlefeedback-report-switch-label' => 'View page ratings', |
42 | 44 | 'articlefeedback-report-panel-title' => 'Page ratings', |
43 | 45 | 'articlefeedback-report-panel-description' => 'Current average ratings.', |
Index: trunk/extensions/ArticleFeedback/ArticleFeedback.php |
— | — | @@ -15,9 +15,8 @@ |
16 | 16 | |
17 | 17 | /* Configuration */ |
18 | 18 | |
19 | | -// If the number of page revisions (since users last rating) is greater than this then consider the |
20 | | -// last rating "stale" |
21 | | -$wgArticleFeedbackStaleCount = 5; |
| 19 | +// Number of revisions to keep a rating alive for |
| 20 | +$wgArticleFeedbackRatingLifetime = 30; |
22 | 21 | |
23 | 22 | // Array of the "ratings" id's to store. Allows it to be a bit more dynamic |
24 | 23 | $wgArticleFeedbackRatings = array( 1, 2, 3, 4 ); |
Index: trunk/extensions/ArticleFeedback/ArticleFeedback.hooks.php |
— | — | @@ -67,6 +67,8 @@ |
68 | 68 | 'articlefeedback-form-panel-expertise-other', |
69 | 69 | 'articlefeedback-form-panel-submit', |
70 | 70 | 'articlefeedback-form-panel-success', |
| 71 | + 'articlefeedback-form-panel-expiry-title', |
| 72 | + 'articlefeedback-form-panel-expiry-message', |
71 | 73 | 'articlefeedback-report-switch-label', |
72 | 74 | 'articlefeedback-report-panel-title', |
73 | 75 | 'articlefeedback-report-panel-description', |