Index: branches/wmf/1.18wmf1/extensions/ArticleFeedback/SpecialArticleFeedback.php |
— | — | @@ -507,19 +507,11 @@ |
508 | 508 | } |
509 | 509 | |
510 | 510 | protected static function getCategories() { |
511 | | - global $wgArticleFeedbackRatings; |
| 511 | + global $wgArticleFeedbackRatingTypes; |
512 | 512 | |
513 | 513 | if ( !isset( self::$categories ) ) { |
514 | | - $dbr = wfGetDB( DB_SLAVE ); |
515 | | - $res = $dbr->select( |
516 | | - 'article_feedback_ratings', |
517 | | - array( 'aar_id', 'aar_rating' ), |
518 | | - array( 'aar_id' => $wgArticleFeedbackRatings ), |
519 | | - __METHOD__ |
520 | | - ); |
521 | | - self::$categories = array(); |
522 | | - foreach ( $res as $row ) { |
523 | | - self::$categories[$row->aar_id] = wfMsg( $row->aar_rating ); |
| 514 | + foreach ( $wgArticleFeedbackRatingTypes as $id => $rating ) { |
| 515 | + self::$categories[$id] = wfMsg( $rating ); |
524 | 516 | } |
525 | 517 | } |
526 | 518 | return self::$categories; |
Index: branches/wmf/1.18wmf1/extensions/ArticleFeedback/sql/AddRevisionsTable.sql |
— | — | @@ -4,7 +4,7 @@ |
5 | 5 | afr_page_id integer unsigned NOT NULL, |
6 | 6 | -- Revision that totals are relevant to |
7 | 7 | afr_revision integer unsigned NOT NULL, |
8 | | - -- Foreign key to article_feedback_ratings.aar_rating |
| 8 | + -- Rating ID, mapped to a name in $wgArticleFeedbackRatingTypes |
9 | 9 | afr_rating_id integer unsigned NOT NULL, |
10 | 10 | -- Sum (total) of all the ratings for this article revision |
11 | 11 | afr_total integer unsigned NOT NULL, |
Index: branches/wmf/1.18wmf1/extensions/ArticleFeedback/sql/ArticleFeedback.sql |
— | — | @@ -1,16 +1,3 @@ |
2 | | -CREATE TABLE IF NOT EXISTS /*_*/article_feedback_ratings ( |
3 | | - -- Rating Id |
4 | | - aar_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT, |
5 | | - -- Text (i18n key) for rating description |
6 | | - aar_rating varbinary(255) NOT NULL |
7 | | -) /*$wgDBTableOptions*/; |
8 | | - |
9 | | -INSERT INTO /*_*/article_feedback_ratings (aar_rating) VALUES |
10 | | -('articlefeedback-field-trustworthy-label'), ('articlefeedback-field-objective-label'), |
11 | | -('articlefeedback-field-complete-label'), ('articlefeedback-field-wellwritten-label'); |
12 | | - |
13 | 2 | -- Store article feedbacks (user rating per revision) |
14 | 3 | CREATE TABLE IF NOT EXISTS /*_*/article_feedback ( |
15 | 4 | -- Foreign key to page.page_id |
— | — | @@ -25,7 +12,7 @@ |
26 | 13 | aa_revision integer unsigned NOT NULL, |
27 | 14 | -- MW Timestamp |
28 | 15 | aa_timestamp binary(14) NOT NULL DEFAULT '', |
29 | | - -- Foreign key to article_feedback_ratings.aar_rating |
| 16 | + -- Rating ID, mapped to a name in $wgArticleFeedbackRatingTypes |
30 | 17 | aa_rating_id int unsigned NOT NULL, |
31 | 18 | -- Value of the rating (0 is "unrated", else 1-5) |
32 | 19 | aa_rating_value int unsigned NOT NULL, |
— | — | @@ -41,7 +28,7 @@ |
42 | 29 | CREATE TABLE IF NOT EXISTS /*_*/article_feedback_pages ( |
43 | 30 | -- Foreign key to page.page_id |
44 | 31 | aap_page_id integer unsigned NOT NULL, |
45 | | - -- Foreign key to article_feedback_ratings.aar_rating |
| 32 | + -- Rating ID, mapped to a name in $wgArticleFeedbackRatingTypes |
46 | 33 | aap_rating_id integer unsigned NOT NULL, |
47 | 34 | -- Sum (total) of all the ratings for this article revision |
48 | 35 | aap_total integer unsigned NOT NULL, |
— | — | @@ -57,7 +44,7 @@ |
58 | 45 | afr_page_id integer unsigned NOT NULL, |
59 | 46 | -- Revision that totals are relevant to |
60 | 47 | afr_revision integer unsigned NOT NULL, |
61 | | - -- Foreign key to article_feedback_ratings.aar_rating |
| 48 | + -- Rating ID, mapped to a name in $wgArticleFeedbackRatingTypes |
62 | 49 | afr_rating_id integer unsigned NOT NULL, |
63 | 50 | -- Sum (total) of all the ratings for this article revision |
64 | 51 | afr_total integer unsigned NOT NULL, |
Index: branches/wmf/1.18wmf1/extensions/ArticleFeedback/ArticleFeedback.hooks.php |
— | — | @@ -19,34 +19,6 @@ |
20 | 20 | 'scripts' => 'ext.articleFeedback/ext.articleFeedback.js', |
21 | 21 | 'styles' => 'ext.articleFeedback/ext.articleFeedback.css', |
22 | 22 | 'messages' => array( |
23 | | - 'articlefeedback-field-trustworthy-label', |
24 | | - 'articlefeedback-field-trustworthy-tip', |
25 | | - 'articlefeedback-field-trustworthy-tooltip-1', |
26 | | - 'articlefeedback-field-trustworthy-tooltip-2', |
27 | | - 'articlefeedback-field-trustworthy-tooltip-3', |
28 | | - 'articlefeedback-field-trustworthy-tooltip-4', |
29 | | - 'articlefeedback-field-trustworthy-tooltip-5', |
30 | | - 'articlefeedback-field-complete-label', |
31 | | - 'articlefeedback-field-complete-tip', |
32 | | - 'articlefeedback-field-complete-tooltip-1', |
33 | | - 'articlefeedback-field-complete-tooltip-2', |
34 | | - 'articlefeedback-field-complete-tooltip-3', |
35 | | - 'articlefeedback-field-complete-tooltip-4', |
36 | | - 'articlefeedback-field-complete-tooltip-5', |
37 | | - 'articlefeedback-field-objective-label', |
38 | | - 'articlefeedback-field-objective-tip', |
39 | | - 'articlefeedback-field-objective-tooltip-1', |
40 | | - 'articlefeedback-field-objective-tooltip-2', |
41 | | - 'articlefeedback-field-objective-tooltip-3', |
42 | | - 'articlefeedback-field-objective-tooltip-4', |
43 | | - 'articlefeedback-field-objective-tooltip-5', |
44 | | - 'articlefeedback-field-wellwritten-label', |
45 | | - 'articlefeedback-field-wellwritten-tip', |
46 | | - 'articlefeedback-field-wellwritten-tooltip-1', |
47 | | - 'articlefeedback-field-wellwritten-tooltip-2', |
48 | | - 'articlefeedback-field-wellwritten-tooltip-3', |
49 | | - 'articlefeedback-field-wellwritten-tooltip-4', |
50 | | - 'articlefeedback-field-wellwritten-tooltip-5', |
51 | 23 | 'articlefeedback-pitch-reject', |
52 | 24 | 'articlefeedback-pitch-or', |
53 | 25 | 'articlefeedback-pitch-thanks', |
— | — | @@ -71,8 +43,12 @@ |
72 | 44 | 'jquery.articleFeedback', |
73 | 45 | 'jquery.cookie', |
74 | 46 | 'jquery.clickTracking', |
| 47 | + 'ext.articleFeedback.ratingi18n', |
75 | 48 | ), |
76 | 49 | ), |
| 50 | + 'ext.articleFeedback.ratingi18n' => array( |
| 51 | + 'messages' => null, // Filled in by the resourceLoaderRegisterModules() hook function later |
| 52 | + ), |
77 | 53 | 'ext.articleFeedback.dashboard' => array( |
78 | 54 | 'scripts' => 'ext.articleFeedback/ext.articleFeedback.dashboard.js', |
79 | 55 | 'styles' => 'ext.articleFeedback/ext.articleFeedback.dashboard.css', |
— | — | @@ -269,7 +245,6 @@ |
270 | 246 | $tables[] = 'article_feedback'; |
271 | 247 | $tables[] = 'article_feedback_pages'; |
272 | 248 | $tables[] = 'article_feedback_revisions'; |
273 | | - $tables[] = 'article_feedback_ratings'; |
274 | 249 | $tables[] = 'article_feedback_properties'; |
275 | 250 | return true; |
276 | 251 | } |
— | — | @@ -289,6 +264,11 @@ |
290 | 265 | global $wgExtensionAssetsPath; |
291 | 266 | $localpath = dirname( __FILE__ ) . '/modules'; |
292 | 267 | $remotepath = "$wgExtensionAssetsPath/ArticleFeedback/modules"; |
| 268 | + |
| 269 | + if ( self::$modules['ext.articleFeedback.ratingi18n']['messages'] === null ) { |
| 270 | + self::$modules['ext.articleFeedback.ratingi18n']['messages'] = self::buildRatingMessagesArray(); |
| 271 | + } |
| 272 | + |
293 | 273 | foreach ( self::$modules as $name => $resources ) { |
294 | 274 | $resourceLoader->register( |
295 | 275 | $name, new ResourceLoaderFileModule( $resources, $localpath, $remotepath ) |
— | — | @@ -307,7 +287,8 @@ |
308 | 288 | $wgArticleFeedbackLotteryOdds, |
309 | 289 | $wgArticleFeedbackTracking, |
310 | 290 | $wgArticleFeedbackOptions, |
311 | | - $wgArticleFeedbackNamespaces; |
| 291 | + $wgArticleFeedbackNamespaces, |
| 292 | + $wgArticleFeedbackRatingTypes; |
312 | 293 | $vars['wgArticleFeedbackSMaxage'] = $wgArticleFeedbackSMaxage; |
313 | 294 | $vars['wgArticleFeedbackCategories'] = $wgArticleFeedbackCategories; |
314 | 295 | $vars['wgArticleFeedbackBlacklistCategories'] = $wgArticleFeedbackBlacklistCategories; |
— | — | @@ -315,6 +296,7 @@ |
316 | 297 | $vars['wgArticleFeedbackTracking'] = $wgArticleFeedbackTracking; |
317 | 298 | $vars['wgArticleFeedbackOptions'] = $wgArticleFeedbackOptions; |
318 | 299 | $vars['wgArticleFeedbackNamespaces'] = $wgArticleFeedbackNamespaces; |
| 300 | + $vars['wgArticleFeedbackRatingTypesFlipped'] = array_flip( $wgArticleFeedbackRatingTypes ); |
319 | 301 | return true; |
320 | 302 | } |
321 | 303 | |
— | — | @@ -331,4 +313,15 @@ |
332 | 314 | ); |
333 | 315 | return true; |
334 | 316 | } |
| 317 | + |
| 318 | + protected static function buildRatingMessagesArray() { |
| 319 | + global $wgArticleFeedbackRatingTypes; |
| 320 | + $messages = array(); |
| 321 | + foreach ( $wgArticleFeedbackRatingTypes as $key ) { |
| 322 | + foreach ( array( 'label', 'tip', 'tooltip-1', 'tooltip-2', 'tooltip-3', 'tooltip-4', 'tooltip-5' ) as $suffix ) { |
| 323 | + $messages[] = "articlefeedback-field-$key-$suffix"; |
| 324 | + } |
| 325 | + } |
| 326 | + return $messages; |
| 327 | + } |
335 | 328 | } |
Index: branches/wmf/1.18wmf1/extensions/ArticleFeedback/modules/jquery.articleFeedback/jquery.articleFeedback.js |
— | — | @@ -204,7 +204,7 @@ |
205 | 205 | // Build data from form values for 'action=articlefeedback' |
206 | 206 | var data = {}; |
207 | 207 | for ( var key in context.options.ratings ) { |
208 | | - var id = context.options.ratings[key].id; |
| 208 | + var id = context.options.ratings[key]; |
209 | 209 | data['r' + id] = context.$ui.find( 'input[name="r' + id + '"]' ).val(); |
210 | 210 | } |
211 | 211 | var expertise = []; |
— | — | @@ -410,8 +410,8 @@ |
411 | 411 | context.$ui.find( '.articleFeedback-rating' ).each( function() { |
412 | 412 | var name = $(this).attr( 'rel' ); |
413 | 413 | var rating = name in context.options.ratings |
414 | | - && context.options.ratings[name].id in ratings ? |
415 | | - ratings[context.options.ratings[name].id] : null; |
| 414 | + && context.options.ratings[name] in ratings ? |
| 415 | + ratings[context.options.ratings[name]] : null; |
416 | 416 | // Report |
417 | 417 | if ( |
418 | 418 | rating !== null |
— | — | @@ -489,12 +489,13 @@ |
490 | 490 | .find( '.articleFeedback-ratings' ) |
491 | 491 | .each( function() { |
492 | 492 | for ( var key in context.options.ratings ) { |
493 | | - var rating = context.options.ratings[key]; |
| 493 | + var tipMsg = 'articlefeedback-field-' + key + '-tip', |
| 494 | + labelMsg = 'articlefeedback-field-' + key + '-label'; |
494 | 495 | $( $.articleFeedback.tpl.rating ) |
495 | 496 | .attr( 'rel', key ) |
496 | 497 | .find( '.articleFeedback-label' ) |
497 | | - .attr( 'title', mw.msg( rating.tip ) ) |
498 | | - .text( mw.msg( rating.label ) ) |
| 498 | + .attr( 'title', mw.msg( tipMsg ) ) |
| 499 | + .text( mw.msg( labelMsg ) ) |
499 | 500 | .end() |
500 | 501 | .find( '.articleFeedback-rating-clear' ) |
501 | 502 | .attr( 'title', mw.msg( 'articlefeedback-form-panel-clear' ) ) |
— | — | @@ -709,8 +710,8 @@ |
710 | 711 | .end() |
711 | 712 | // Name the hidden fields |
712 | 713 | .find( '.articleFeedback-rating' ) |
713 | | - .each( function( rating ) { |
714 | | - $(this).find( 'input:hidden' ) .attr( 'name', 'r' + ( rating + 1 ) ); |
| 714 | + .each( function() { |
| 715 | + $(this).find( 'input:hidden' ) .attr( 'name', 'r' + context.options.ratings[$(this).attr( 'rel' )] ); |
715 | 716 | } ) |
716 | 717 | .end() |
717 | 718 | // Setup switch behavior |
— | — | @@ -838,9 +839,7 @@ |
839 | 840 | * } |
840 | 841 | * } ); |
841 | 842 | * |
842 | | - * Rating IDs need to match up to the contents of your article_feedback_ratings table, which is a |
843 | | - * lookup table containing rating IDs and message keys used for translating rating IDs into string; |
844 | | - * and be included in $wgArticleFeedbackRatings, which is an array of allowed IDs. |
| 843 | + * Rating IDs need to be included in $wgArticleFeedbackRatingTypes, which is an array mapping allowed IDs to rating names. |
845 | 844 | */ |
846 | 845 | $.fn.articleFeedback = function() { |
847 | 846 | var args = arguments; |
Index: branches/wmf/1.18wmf1/extensions/ArticleFeedback/modules/ext.articleFeedback/ext.articleFeedback.js |
— | — | @@ -199,28 +199,7 @@ |
200 | 200 | } )(); |
201 | 201 | |
202 | 202 | var config = { |
203 | | - 'ratings': { |
204 | | - 'trustworthy': { |
205 | | - 'id': '1', |
206 | | - 'label': 'articlefeedback-field-trustworthy-label', |
207 | | - 'tip': 'articlefeedback-field-trustworthy-tip' |
208 | | - }, |
209 | | - 'objective': { |
210 | | - 'id': '2', |
211 | | - 'label': 'articlefeedback-field-objective-label', |
212 | | - 'tip': 'articlefeedback-field-objective-tip' |
213 | | - }, |
214 | | - 'complete': { |
215 | | - 'id': '3', |
216 | | - 'label': 'articlefeedback-field-complete-label', |
217 | | - 'tip': 'articlefeedback-field-complete-tip' |
218 | | - }, |
219 | | - 'wellwritten': { |
220 | | - 'id': '4', |
221 | | - 'label': 'articlefeedback-field-wellwritten-label', |
222 | | - 'tip': 'articlefeedback-field-wellwritten-tip' |
223 | | - } |
224 | | - }, |
| 203 | + 'ratings': mw.config.get( 'wgArticleFeedbackRatingTypesFlipped' ), |
225 | 204 | 'pitches': { |
226 | 205 | 'survey': { |
227 | 206 | 'weight': 1, |
Index: branches/wmf/1.18wmf1/extensions/ArticleFeedback/populateAFRevisions.php |
— | — | @@ -28,7 +28,7 @@ |
29 | 29 | } |
30 | 30 | |
31 | 31 | public function execute() { |
32 | | - global $wgArticleFeedbackRatings; |
| 32 | + global $wgArticleFeedbackRatingTypes; |
33 | 33 | |
34 | 34 | $this->output( "Populating article_feedback_revisions table ...\n" ); |
35 | 35 | |
— | — | @@ -63,10 +63,10 @@ |
64 | 64 | ); |
65 | 65 | |
66 | 66 | // Initialize counts and sums for each rating |
67 | | - // If $wgArticleFeedbackRatings = array( 1, 2, 3, 4 ) this initializes them |
| 67 | + // If array_keys( $wgArticleFeedbackRatingTypes ) = array( 1, 2, 3, 4 ) this initializes them |
68 | 68 | // to array( 1 => 0, 2 => 0, 3 => 0, 4 => 0 ) |
69 | | - $counts = $sums = array_combine( $wgArticleFeedbackRatings, |
70 | | - array_fill( 0, count( $wgArticleFeedbackRatings ), 0 ) |
| 69 | + $counts = $sums = array_combine( array_keys( $wgArticleFeedbackRatingTypes ), |
| 70 | + array_fill( 0, count( $wgArticleFeedbackRatingTypes ), 0 ) |
71 | 71 | ); |
72 | 72 | |
73 | 73 | // Process each of the queried rows and update $data |
Index: branches/wmf/1.18wmf1/extensions/ArticleFeedback/api/ApiArticleFeedback.php |
— | — | @@ -5,7 +5,7 @@ |
6 | 6 | } |
7 | 7 | |
8 | 8 | public function execute() { |
9 | | - global $wgUser, $wgArticleFeedbackRatings, $wgArticleFeedbackSMaxage, |
| 9 | + global $wgUser, $wgArticleFeedbackRatingTypes, $wgArticleFeedbackSMaxage, |
10 | 10 | $wgArticleFeedbackNamespaces; |
11 | 11 | $params = $this->extractRequestParams(); |
12 | 12 | |
— | — | @@ -49,13 +49,13 @@ |
50 | 50 | 'aa_user_id' => $wgUser->getId(), |
51 | 51 | 'aa_user_text' => $wgUser->getName(), |
52 | 52 | 'aa_page_id' => $params['pageid'], |
53 | | - 'aa_rating_id' => $wgArticleFeedbackRatings, |
| 53 | + 'aa_rating_id' => array_keys( $wgArticleFeedbackRatingTypes ), |
54 | 54 | 'aa_user_anon_token' => $token, |
55 | 55 | ), |
56 | 56 | __METHOD__, |
57 | 57 | array( |
58 | 58 | 'ORDER BY' => 'aa_revision DESC', |
59 | | - 'LIMIT' => count( $wgArticleFeedbackRatings ), |
| 59 | + 'LIMIT' => count( $wgArticleFeedbackRatingTypes ), |
60 | 60 | ) |
61 | 61 | ); |
62 | 62 | |
— | — | @@ -69,7 +69,7 @@ |
70 | 70 | $pageId = $params['pageid']; |
71 | 71 | $revisionId = $params['revid']; |
72 | 72 | |
73 | | - foreach( $wgArticleFeedbackRatings as $rating ) { |
| 73 | + foreach( $wgArticleFeedbackRatingTypes as $rating => $unused ) { |
74 | 74 | $lastRating = false; |
75 | 75 | if ( isset( $lastRatings[$rating] ) ) { |
76 | 76 | $lastRating = intval( $lastRatings[$rating]['value'] ); |
— | — | @@ -396,7 +396,7 @@ |
397 | 397 | ), |
398 | 398 | ); |
399 | 399 | |
400 | | - foreach( $wgArticleFeedbackRatings as $rating ) { |
| 400 | + foreach( $wgArticleFeedbackRatingsTypes as $rating => $unused ) { |
401 | 401 | $ret["r{$rating}"] = array( |
402 | 402 | ApiBase::PARAM_TYPE => 'integer', |
403 | 403 | ApiBase::PARAM_REQUIRED => true, |
— | — | @@ -410,7 +410,7 @@ |
411 | 411 | } |
412 | 412 | |
413 | 413 | public function getParamDescription() { |
414 | | - global $wgArticleFeedbackRatings; |
| 414 | + global $wgArticleFeedbackRatingTypes; |
415 | 415 | $ret = array( |
416 | 416 | 'pageid' => 'Page ID to submit feedback for', |
417 | 417 | 'revid' => 'Revision ID to submit feedback for', |
— | — | @@ -418,7 +418,7 @@ |
419 | 419 | 'bucket' => 'Which rating widget was shown to the user', |
420 | 420 | 'expertise' => 'What kinds of expertise does the user claim to have', |
421 | 421 | ); |
422 | | - foreach( $wgArticleFeedbackRatings as $rating ) { |
| 422 | + foreach( $wgArticleFeedbackRatingTypes as $rating => $unused ) { |
423 | 423 | $ret["r{$rating}"] = "Rating {$rating}"; |
424 | 424 | } |
425 | 425 | return $ret; |
Property changes on: branches/wmf/1.18wmf1/extensions/ArticleFeedback/api/ApiArticleFeedback.php |
___________________________________________________________________ |
Modified: svn:mergeinfo |
426 | 426 | Merged /trunk/extensions/ArticleFeedback/api/ApiArticleFeedback.php:r100806 |
Index: branches/wmf/1.18wmf1/extensions/ArticleFeedback/api/ApiQueryArticleFeedback.php |
— | — | @@ -5,31 +5,24 @@ |
6 | 6 | } |
7 | 7 | |
8 | 8 | public function execute() { |
9 | | - global $wgArticleFeedbackRatings; |
| 9 | + global $wgArticleFeedbackRatingTypes; |
10 | 10 | |
11 | 11 | $params = $this->extractRequestParams(); |
12 | 12 | $result = $this->getResult(); |
13 | 13 | $revisionLimit = $this->getRevisionLimit( $params['pageid'] ); |
14 | 14 | |
15 | | - $this->addTables( array( 'article_feedback_revisions', 'article_feedback_ratings' ) ); |
| 15 | + $this->addTables( array( 'article_feedback_revisions' ) ); |
16 | 16 | $this->addFields( array( |
17 | 17 | 'MAX(afr_revision) as afr_revision', |
18 | 18 | 'SUM(afr_total) as afr_total', |
19 | 19 | 'SUM(afr_count) as afr_count', |
20 | 20 | 'afr_rating_id', |
21 | | - 'aar_rating', |
22 | 21 | ) ); |
23 | | - $this->addJoinConds( array( |
24 | | - 'article_feedback_ratings' => array( 'LEFT JOIN', array( |
25 | | - 'aar_id=afr_rating_id', |
26 | | - 'afr_rating_id' => $wgArticleFeedbackRatings, |
27 | | - ) |
28 | | - ), |
29 | | - ) ); |
30 | 22 | $this->addWhereFld( 'afr_page_id', $params['pageid'] ); |
31 | 23 | $this->addWhere( 'afr_revision >= ' . $revisionLimit ); |
| 24 | + $this->addWhereFld( 'afr_rating_id', array_keys( $wgArticleFeedbackRatingTypes ) ); |
32 | 25 | $this->addOption( 'GROUP BY', 'afr_rating_id' ); |
33 | | - $this->addOption( 'LIMIT', count( $wgArticleFeedbackRatings ) ); |
| 26 | + $this->addOption( 'LIMIT', count( $wgArticleFeedbackRatingTypes ) ); |
34 | 27 | |
35 | 28 | // Rating counts and totals |
36 | 29 | $res = $this->select( __METHOD__ ); |
— | — | @@ -44,7 +37,7 @@ |
45 | 38 | } |
46 | 39 | $ratings[$params['pageid']]['ratings'][] = array( |
47 | 40 | 'ratingid' => (int) $row->afr_rating_id, |
48 | | - 'ratingdesc' => $row->aar_rating, |
| 41 | + 'ratingdesc' => $wgArticleFeedbackRatingTypes[$row->afr_rating_id], |
49 | 42 | 'total' => (int) $row->afr_total, |
50 | 43 | 'count' => (int) $row->afr_count, |
51 | 44 | 'countall' => isset( $historicCounts[$row->afr_rating_id] ) |
— | — | @@ -122,7 +115,7 @@ |
123 | 116 | } |
124 | 117 | |
125 | 118 | protected function getHistoricCounts( $params ) { |
126 | | - global $wgArticleFeedbackRatings; |
| 119 | + global $wgArticleFeedbackRatingTypes; |
127 | 120 | |
128 | 121 | $res = $this->getDB()->select( |
129 | 122 | 'article_feedback_pages', |
— | — | @@ -132,7 +125,7 @@ |
133 | 126 | ), |
134 | 127 | array( |
135 | 128 | 'aap_page_id' => $params['pageid'], |
136 | | - 'aap_rating_id' => $wgArticleFeedbackRatings, |
| 129 | + 'aap_rating_id' => array_keys( $wgArticleFeedbackRatingTypes ), |
137 | 130 | ), |
138 | 131 | __METHOD__ |
139 | 132 | ); |
— | — | @@ -174,30 +167,26 @@ |
175 | 168 | } |
176 | 169 | |
177 | 170 | protected function getUserRatings( $params ) { |
178 | | - global $wgUser, $wgArticleFeedbackRatings; |
| 171 | + global $wgUser, $wgArticleFeedbackRatingTypes; |
179 | 172 | |
180 | 173 | $res = $this->getDB()->select( |
181 | | - array( 'article_feedback', 'article_feedback_ratings' ), |
| 174 | + array( 'article_feedback' ), |
182 | 175 | array( |
183 | 176 | 'aa_rating_id', |
184 | | - 'aar_rating', |
185 | 177 | 'aa_revision', |
186 | 178 | 'aa_rating_value', |
187 | 179 | ), |
188 | 180 | array( |
189 | 181 | 'aa_page_id' => $params['pageid'], |
190 | | - 'aa_rating_id' => $wgArticleFeedbackRatings, |
| 182 | + 'aa_rating_id' => array_keys( $wgArticleFeedbackRatingTypes ), |
191 | 183 | 'aa_user_id' => $wgUser->getId(), |
192 | 184 | 'aa_user_text' => $wgUser->getName(), |
193 | 185 | 'aa_user_anon_token' => $this->getAnonToken( $params ), |
194 | 186 | ), |
195 | 187 | __METHOD__, |
196 | 188 | array( |
197 | | - 'LIMIT' => count( $wgArticleFeedbackRatings ), |
| 189 | + 'LIMIT' => count( $wgArticleFeedbackRatingTypes ), |
198 | 190 | 'ORDER BY' => 'aa_revision DESC', |
199 | | - ), |
200 | | - array( |
201 | | - 'article_feedback_ratings' => array( 'LEFT JOIN', array( 'aar_id=aa_rating_id' ) ) |
202 | 191 | ) |
203 | 192 | ); |
204 | 193 | $ratings = array(); |
— | — | @@ -211,7 +200,7 @@ |
212 | 201 | $ratings[$row->aa_rating_id] = array( |
213 | 202 | 'value' => $row->aa_rating_value, |
214 | 203 | 'revision' => $row->aa_revision, |
215 | | - 'text' => $row->aar_rating, |
| 204 | + 'text' => $wgArticleFeedbackRatingTypes[$row->aa_rating_id], |
216 | 205 | ); |
217 | 206 | } |
218 | 207 | } |
Property changes on: branches/wmf/1.18wmf1/extensions/ArticleFeedback/api/ApiQueryArticleFeedback.php |
___________________________________________________________________ |
Modified: svn:mergeinfo |
219 | 208 | Merged /trunk/extensions/ArticleFeedback/api/ApiQueryArticleFeedback.php:r100806 |
Index: branches/wmf/1.18wmf1/extensions/ArticleFeedback/ArticleFeedback.php |
— | — | @@ -24,8 +24,8 @@ |
25 | 25 | // Number of revisions to keep a rating alive for |
26 | 26 | $wgArticleFeedbackRatingLifetime = 30; |
27 | 27 | |
28 | | -// Array of the "ratings" id's to store. Allows it to be a bit more dynamic |
29 | | -$wgArticleFeedbackRatings = array( 1, 2, 3, 4 ); |
| 28 | +// Array of rating types |
| 29 | +$wgArticleFeedbackRatingTypes = array( 1 => 'trustworthy', 2 => 'objective', 3 => 'complete', 4 => 'wellwritten' ); |
30 | 30 | |
31 | 31 | // Which categories the pages must belong to have the rating widget added (with _ in text) |
32 | 32 | // Extension is "disabled" if this field is an empty array (as per default configuration) |
Property changes on: branches/wmf/1.18wmf1/extensions/ArticleFeedback |
___________________________________________________________________ |
Modified: svn:mergeinfo |
33 | 33 | Merged /trunk/extensions/ArticleFeedback:r100806 |