Index: trunk/extensions/ArticleAssessmentPilot/ArticleAssessmentPilot.sql |
— | — | @@ -4,8 +4,9 @@ |
5 | 5 | aar_rating varchar(255) binary NOT NULL |
6 | 6 | ) /*$wgDBTableOptions*/; |
7 | 7 | |
8 | | -INSERT INTO /*$wgDBprefix*/article_assessment_ratings(aar_rating) VALUES('articleassessment-rating-wellsourced'), |
9 | | -('articleassessment-rating-neutrality'), ('articleassessment-rating-completeness'), ('articleassessment-rating-readability'); |
| 8 | +INSERT INTO /*$wgDBprefix*/article_assessment_ratings (aar_rating) VALUES |
| 9 | +('articleassessment-rating-wellsourced'), ('articleassessment-rating-neutrality'), |
| 10 | +('articleassessment-rating-completeness'), ('articleassessment-rating-readability'); |
10 | 11 | |
11 | 12 | -- Store article assessments |
12 | 13 | CREATE TABLE IF NOT EXISTS /*$wgDBprefix*/article_assessment ( |
Index: trunk/extensions/ArticleAssessmentPilot/ArticleAssessmentPilot.i18n.php |
— | — | @@ -24,7 +24,7 @@ |
25 | 25 | 'articleassessment-error' => "We're sorry! An error has occurred. Please try again later.", |
26 | 26 | 'articleassessment-thanks' => 'Thanks! Your ratings have been saved.', |
27 | 27 | |
28 | | - # FIXME: Special page seems not exist. |
| 28 | + # This special page doesn't exist yet, but it will soon. |
29 | 29 | 'articleassessment-featurefeedback' => 'Give us [[Special:Article Assessment Feedback|feedback]] about this feature.', |
30 | 30 | 'articleassessment-noratings' => '$1 ($2 {{PLURAL:$2|rating|ratings}})', |
31 | 31 | 'articleassessment-stalemessage-revisioncount' => "This article has been ''revised'' '''$1 times''' since you last reviewed it. You may wish to re-rate it.", |
Index: trunk/extensions/ArticleAssessmentPilot/ArticleAssessmentPilot.php |
— | — | @@ -8,6 +8,9 @@ |
9 | 9 | // Number of "ratings" to store. Allows it to be a bit more dynamic |
10 | 10 | $wgArticleAssessmentRatingCount = 4; |
11 | 11 | |
| 12 | +//Category the pages are in (with _ in text) |
| 13 | +$wgArticleAssessmentCategory = ''; |
| 14 | + |
12 | 15 | // Auto-load files |
13 | 16 | $dir = dirname( __FILE__ ) . '/'; |
14 | 17 | $wgAutoloadClasses['ApiListArticleAssessment'] = $dir . 'api/ApiListArticleAssessment.php'; |
— | — | @@ -38,6 +41,3 @@ |
39 | 42 | 'descriptionmsg' => 'articleassessment-desc', |
40 | 43 | 'url' => 'http://www.mediawiki.org/wiki/Extension:ArticleAssessmentPilot' |
41 | 44 | ); |
42 | | - |
43 | | -//Category the pages are in (with _ in text) |
44 | | -$wgArticleAssessmentCategory = ''; |
\ No newline at end of file |
Index: trunk/extensions/ArticleAssessmentPilot/css/ArticleAssessment.css |
— | — | @@ -12,25 +12,25 @@ |
13 | 13 | * |
14 | 14 | */ |
15 | 15 | .article-assessment-wrapper .ui-stars-star { |
16 | | - float: left; |
17 | | - display: block; |
18 | | - overflow: hidden; |
19 | | - text-indent: -999em; |
20 | | - cursor: pointer; |
| 16 | + float: left; |
| 17 | + display: block; |
| 18 | + overflow: hidden; |
| 19 | + text-indent: -999em; |
| 20 | + cursor: pointer; |
21 | 21 | padding-right: 4px; |
22 | 22 | } |
23 | 23 | .article-assessment-wrapper .ui-stars-star a { |
24 | | - width: 21px; |
25 | | - height: 21px; |
26 | | - display: block; |
27 | | - background: url(../images/stars.gif) no-repeat 0 0; |
| 24 | + width: 21px; |
| 25 | + height: 21px; |
| 26 | + display: block; |
| 27 | + background: url(../images/stars.gif) no-repeat 0 0; |
28 | 28 | } |
29 | 29 | .article-assessment-wrapper .ui-stars-star a { |
30 | | - background-position: 0 0px; |
| 30 | + background-position: 0 0px; |
31 | 31 | } |
32 | 32 | |
33 | 33 | .article-assessment-wrapper .ui-stars-star-on a { |
34 | | - background-position: 0 -21px; |
| 34 | + background-position: 0 -21px; |
35 | 35 | } |
36 | 36 | .article-assessment-wrapper .ui-stars-star-rated a { |
37 | 37 | background-position: 0 -42px; |
— | — | @@ -39,11 +39,11 @@ |
40 | 40 | background-position: 0 -63px; |
41 | 41 | } |
42 | 42 | .article-assessment-wrapper .ui-stars-star-hover a { |
43 | | - background-position: 0 -21px; |
| 43 | + background-position: 0 -21px; |
44 | 44 | } |
45 | 45 | .article-assessment-wrapper .ui-stars-star-disabled, |
46 | 46 | .article-assessment-wrapper .ui-stars-star-disabled a { |
47 | | - cursor: default !important; |
| 47 | + cursor: default !important; |
48 | 48 | } |
49 | 49 | .article-assessment-wrapper .ui-stars-cancel { |
50 | 50 | display: none; |
Index: trunk/extensions/ArticleAssessmentPilot/ArticleAssessmentPilot.hooks.php |
— | — | @@ -34,7 +34,7 @@ |
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
38 | | - * Make sure the table exists for parser tests |
| 38 | + * Make sure the tables exist for parser tests |
39 | 39 | * @param $tables |
40 | 40 | * @return bool |
41 | 41 | */ |
— | — | @@ -69,7 +69,7 @@ |
70 | 70 | ); |
71 | 71 | } |
72 | 72 | |
73 | | - foreach(self::$styleFiles as $style) { |
| 73 | + foreach ( self::$styleFiles as $style ) { |
74 | 74 | $out->addExtensionStyle( $wgExtensionAssetsPath . |
75 | 75 | "/ArticleAssessmentPilot/{$style['src']}?{$style['version']}" |
76 | 76 | ); |
— | — | @@ -117,11 +117,11 @@ |
118 | 118 | return true; |
119 | 119 | } |
120 | 120 | |
121 | | - /* |
122 | | - * Returns whether an article is in the specific category |
| 121 | + /** |
| 122 | + * Returns whether an article is in the specified category |
123 | 123 | * |
124 | 124 | * @param $articleId Integer: Article ID |
125 | | - * @param $category String: The category name (without Category: Prefix) |
| 125 | + * @param $category String: The category name (without Category: prefix, with underscores) |
126 | 126 | * |
127 | 127 | * @return bool |
128 | 128 | */ |
— | — | @@ -154,4 +154,4 @@ |
155 | 155 | public static function addMessages( $messages ) { |
156 | 156 | self::$messages = array_merge( self::$messages, $messages ); |
157 | 157 | } |
158 | | -} |
\ No newline at end of file |
| 158 | +} |
Index: trunk/extensions/ArticleAssessmentPilot/api/ApiListArticleAssessment.php |
— | — | @@ -54,7 +54,7 @@ |
55 | 55 | |
56 | 56 | $this->addFields( array( 'aa_rating_value', 'aa_revision' ) ); |
57 | 57 | |
58 | | - if ( isset( $params['revid'] ) ){ |
| 58 | + if ( isset( $params['revid'] ) ) { |
59 | 59 | $this->addWhereFld( 'aa_revision', $params['revid'] ); |
60 | 60 | } |
61 | 61 | |
— | — | @@ -78,14 +78,14 @@ |
79 | 79 | 'pageid' => $pageId, |
80 | 80 | ); |
81 | 81 | |
82 | | - if ( isset( $params['revid'] ) || $params['userrating'] ){ |
| 82 | + if ( isset( $params['revid'] ) || $params['userrating'] ) { |
83 | 83 | $page['revid'] = $row->aa_revision; |
84 | 84 | } |
85 | 85 | |
86 | 86 | $ratings[$pageId] = $page; |
87 | 87 | } |
88 | 88 | |
89 | | - $thisRow = array( |
| 89 | + $thisRow = array( |
90 | 90 | 'ratingid' => $row->aap_rating_id, |
91 | 91 | 'ratingdesc' => $row->aar_rating, |
92 | 92 | 'total' => $row->aap_total, |
— | — | @@ -162,7 +162,7 @@ |
163 | 163 | return array( |
164 | 164 | 'pageid' => 'Page ID to get assessments for', |
165 | 165 | 'revid' => 'Specific revision to get (used in conjunction with userrating param, otherwise ignored)', |
166 | | - 'userrating' => 'Whether to get the current users ratings for the specific rev/article', |
| 166 | + 'userrating' => "Whether to get the current user's ratings for the specific rev/article", |
167 | 167 | 'anontoken' => 'Token for anonymous users', |
168 | 168 | 'limit' => 'Amount of pages to get the ratings for', |
169 | 169 | ); |
Index: trunk/extensions/ArticleAssessmentPilot/api/ApiArticleAssessment.php |
— | — | @@ -68,16 +68,15 @@ |
69 | 69 | $this->insertUserRatings( $pageId, $revisionId, $wgUser, $token, $i, $thisRating ); |
70 | 70 | } |
71 | 71 | |
72 | | - $r = array(); |
73 | | - $r['result'] = 'Success'; |
| 72 | + $r = array( 'result' => 'Success' ); |
74 | 73 | $this->getResult()->addValue( null, $this->getModuleName(), $r ); |
75 | 74 | } |
76 | 75 | |
77 | | - /* |
| 76 | + /** |
78 | 77 | * |
79 | 78 | * @param $pageId Integer: |
80 | 79 | * @param $ratingId Integer: |
81 | | - * @param $updateAddition Integer: Difference between users last rating (if applicable) |
| 80 | + * @param $updateAddition Integer: Difference between user's last rating (if applicable) |
82 | 81 | * @param $newRating Boolean: Whether this is a new rating (for update, whether this increases the count) |
83 | 82 | */ |
84 | 83 | private function insertPageRating( $pageId, $ratingId, $updateAddition, $newRating ) { |
— | — | @@ -109,7 +108,7 @@ |
110 | 109 | ); |
111 | 110 | } |
112 | 111 | |
113 | | - /* |
| 112 | + /** |
114 | 113 | * @param $pageId Integer: |
115 | 114 | * @param $revisionId Integer: |
116 | 115 | * @param $user User: |
— | — | @@ -193,7 +192,7 @@ |
194 | 193 | 'anontoken' => 'Token for anonymous users', |
195 | 194 | ); |
196 | 195 | for ( $i = 1; $i <= $wgArticleAssessmentRatingCount; $i++ ) { |
197 | | - $ret["r{$i}"] = "Rating {$i}"; |
| 196 | + $ret["r{$i}"] = "Rating {$i}"; |
198 | 197 | } |
199 | 198 | return $ret; |
200 | 199 | } |
Index: trunk/extensions/ArticleAssessmentPilot/js/ArticleAssessment.js |
— | — | @@ -10,10 +10,10 @@ |
11 | 11 | 'settings': { |
12 | 12 | 'endpoint': wgScriptPath + '/api.php?', |
13 | 13 | 'fieldMessages' : [ |
14 | | - 'wellsourced', |
15 | | - 'neutrality', |
16 | | - 'completeness', |
17 | | - 'readability' |
| 14 | + 'wellsourced', |
| 15 | + 'neutrality', |
| 16 | + 'completeness', |
| 17 | + 'readability' |
18 | 18 | ], |
19 | 19 | 'fieldHintSuffix': '-tooltip', |
20 | 20 | 'fieldPrefix': 'articleassessment-rating-', |
— | — | @@ -71,22 +71,22 @@ |
72 | 72 | function randomString( string_length ) { |
73 | 73 | var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz"; |
74 | 74 | var randomstring = ''; |
75 | | - for (var i=0; i<string_length; i++) { |
76 | | - var rnum = Math.floor(Math.random() * chars.length); |
77 | | - randomstring += chars.substring(rnum,rnum+1); |
| 75 | + for ( var i = 0; i < string_length; i++ ) { |
| 76 | + var rnum = Math.floor( Math.random() * chars.length ); |
| 77 | + randomstring += chars.substring( rnum, rnum + 1 ); |
78 | 78 | } |
79 | 79 | return randomstring; |
80 | 80 | } |
81 | 81 | userToken = randomString( 32 ); |
82 | 82 | $.cookie( 'mwArticleAssessmentUserToken', userToken ); |
83 | 83 | } |
84 | | - if ( ! wgUserName ) { |
| 84 | + if ( !wgUserName ) { |
85 | 85 | config.userID = userToken; |
86 | 86 | } |
87 | | - // setup our markup using the template varibales in settings |
| 87 | + // setup our markup using the template variables in settings |
88 | 88 | var $output = $( settings.structureHTML |
89 | | - .replace( /\{INSTRUCTIONS\}/g, $.ArticleAssessment.fn.getMsg('articleassessment-pleaserate') ) |
90 | | - .replace( /\{FEEDBACK\}/g, $.ArticleAssessment.fn.getMsg('articleassessment-featurefeedback') |
| 89 | + .replace( /\{INSTRUCTIONS\}/g, $.ArticleAssessment.fn.getMsg( 'articleassessment-pleaserate' ) ) |
| 90 | + .replace( /\{FEEDBACK\}/g, $.ArticleAssessment.fn.getMsg( 'articleassessment-featurefeedback' ) |
91 | 91 | .replace( /\[\[([^\|\]]*)\|([^\|\]]*)\]\]/, '<a href="' + wgArticlePath + '">$2</a>' ) ) |
92 | 92 | .replace( /\{YOURFEEDBACK\}/g, $.ArticleAssessment.fn.getMsg('articleassessment-yourfeedback') ) |
93 | 93 | .replace( /\{ARTICLERATING\}/g, $.ArticleAssessment.fn.getMsg('articleassessment-articlerating' ) ) |
— | — | @@ -94,7 +94,7 @@ |
95 | 95 | .replace( /\[\[\|([^\]]*)\]\]/, '<a href="#">$1</a>' ) ) |
96 | 96 | .replace( /\{RESULTSSHOW\}/g, $.ArticleAssessment.fn.getMsg('articleassessment-results-show' ) |
97 | 97 | .replace( /\[\[\|([^\]]*)\]\]/, '<a href="#">$1</a>' ) ) ); |
98 | | - for( var field in settings.fieldMessages ) { |
| 98 | + for ( var field in settings.fieldMessages ) { |
99 | 99 | $output.find( '.article-assessment-rating-fields' ) |
100 | 100 | .append( $( settings.fieldHTML |
101 | 101 | .replace( /\{LABEL\}/g, $.ArticleAssessment.fn.getMsg( settings.fieldPrefix + settings.fieldMessages[field] ) ) |
— | — | @@ -143,7 +143,7 @@ |
144 | 144 | $( '#catlinks' ).before( $output ); |
145 | 145 | |
146 | 146 | // set the height of our smaller fieldset to match the taller |
147 | | - if( $( '#article-assessment-rate' ).height() > $( '#article-assessment-ratings' ).height() ) { |
| 147 | + if ( $( '#article-assessment-rate' ).height() > $( '#article-assessment-ratings' ).height() ) { |
148 | 148 | $( '#article-assessment-ratings' ).css( 'minHeight', $( '#article-assessment-rate' ).height() ); |
149 | 149 | } else { |
150 | 150 | $( '#article-assessment-rate' ).css( 'minHeight', $( '#article-assessment-ratings' ).height() ); |
— | — | @@ -164,14 +164,14 @@ |
165 | 165 | $( this ) |
166 | 166 | .removeClass( 'ui-stars-star-stale' ) |
167 | 167 | .removeClass( 'ui-stars-star-rated' ); |
168 | | - // enable our submit button if it's still disabled |
169 | | - $( '#article-assessment input:disabled' ).removeAttr( "disabled" ); |
| 168 | + // enable our submit button if it's still disabled |
| 169 | + $( '#article-assessment input:disabled' ).removeAttr( 'disabled' ); |
170 | 170 | } ); |
171 | 171 | } |
172 | 172 | } ); |
173 | 173 | }); |
174 | 174 | // intialize the tooltips |
175 | | - $( '.field-wrapper label[original-title]' ).each(function() { |
| 175 | + $( '.field-wrapper label[original-title]' ).each( function() { |
176 | 176 | $( this ) |
177 | 177 | .after( $( '<span class="rating-field-hint" />' ) |
178 | 178 | .attr( 'original-title', $( this ).attr( 'original-title' ) ) |
— | — | @@ -195,7 +195,7 @@ |
196 | 196 | 'aauserrating': 1, |
197 | 197 | 'format': 'json' |
198 | 198 | } |
199 | | - if( config.userID.length == 32 ) { |
| 199 | + if ( config.userID.length == 32 ) { |
200 | 200 | requestData.aaanontoken = config.userID; |
201 | 201 | } |
202 | 202 | var request = $.ajax( { |
— | — | @@ -214,8 +214,8 @@ |
215 | 215 | 'afterGetRatingData' : function( data ) { |
216 | 216 | var settings = $( '#article-assessment' ).data( 'articleAssessment-context' ).settings; |
217 | 217 | // add the correct data to the markup |
218 | | - if( data.query.articleassessment && data.query.articleassessment.length > 0 ) { |
219 | | - for( rating in data.query.articleassessment[0].ratings) { |
| 218 | + if ( data.query.articleassessment && data.query.articleassessment.length > 0 ) { |
| 219 | + for ( rating in data.query.articleassessment[0].ratings) { |
220 | 220 | var rating = data.query.articleassessment[0].ratings[rating], |
221 | 221 | $rating = $( '#' + rating.ratingdesc ), |
222 | 222 | count = rating.count, |
— | — | @@ -251,7 +251,7 @@ |
252 | 252 | $( '.article-assessment-rating-field-value' ).each( function() { |
253 | 253 | $( this ) |
254 | 254 | .css( { |
255 | | - 'width': 120 - ( 120 * ( parseFloat( $( this ).text() ) / 5 ) ) + "px" |
| 255 | + 'width': 120 - ( 120 * ( parseFloat( $( this ).text() ) / 5 ) ) + 'px' |
256 | 256 | } ) |
257 | 257 | } ); |
258 | 258 | }, |
— | — | @@ -262,13 +262,13 @@ |
263 | 263 | |
264 | 264 | // lock the star inputs & submit |
265 | 265 | $( '.rating-field' ).stars( 'disable' ); |
266 | | - $( '#article-assessment input' ).attr( "disabled", "disabled" ); |
| 266 | + $( '#article-assessment input' ).attr( 'disabled', 'disabled' ); |
267 | 267 | // get our results for submitting |
268 | 268 | var results = {}; |
269 | 269 | $( '.rating-field input' ).each( function() { |
270 | 270 | // expects the hidden inputs to have names like 'rating[field-name]' which we use to |
271 | 271 | // be transparent about what values we're sending to the server |
272 | | - var fieldName = $( this ).attr('name').match(/\[([a-zA-Z0-9\-]*)\]/)[1]; |
| 272 | + var fieldName = $( this ).attr( 'name' ).match( /\[([a-zA-Z0-9\-]*)\]/ )[1]; |
273 | 273 | results[ fieldName ] = $( this ).val(); |
274 | 274 | } ); |
275 | 275 | var request = $.ajax( { |
— | — | @@ -292,7 +292,7 @@ |
293 | 293 | $( '.ui-stars-star-on' ).addClass( 'ui-stars-star-rated' ); |
294 | 294 | // unlock the stars & submit |
295 | 295 | $( '.rating-field' ).stars( 'enable' ); |
296 | | - $( '#article-assessment input:disabled' ).removeAttr( "disabled" ); |
| 296 | + $( '#article-assessment input:disabled' ).removeAttr( 'disabled' ); |
297 | 297 | // update the results |
298 | 298 | |
299 | 299 | // show the results |
— | — | @@ -344,7 +344,7 @@ |
345 | 345 | var msg = $.ArticleAssessment.messages[key]; |
346 | 346 | if ( typeof args == 'object' || typeof args == 'array' ) { |
347 | 347 | for ( var argKey in args ) { |
348 | | - msg = msg.replace( '\$' + (parseInt( argKey ) + 1), args[argKey] ); |
| 348 | + msg = msg.replace( '\$' + ( parseInt( argKey ) + 1 ), args[argKey] ); |
349 | 349 | } |
350 | 350 | } else if ( typeof args == 'string' || typeof args == 'number' ) { |
351 | 351 | msg = msg.replace( '$1', args ); |