| Index: trunk/extensions/ArticleAssessmentPilot/ArticleAssessmentPilot.sql |
| — | — | @@ -1,42 +1,49 @@ |
| 2 | 2 | -- Store mapping of i18n key of "rating" to an ID |
| 3 | 3 | CREATE TABLE IF NOT EXISTS /*$wgDBprefix*/article_assessment_ratings ( |
| | 4 | + --Rating Id |
| 4 | 5 | aar_id int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT, |
| | 6 | + --Text (i18n key) for rating description |
| 5 | 7 | aar_rating varchar(255) binary NOT NULL |
| 6 | 8 | ) /*$wgDBTableOptions*/; |
| 7 | 9 | |
| | 10 | +--Default article assessment ratings for the pilot |
| 8 | 11 | INSERT INTO /*$wgDBprefix*/article_assessment_ratings (aar_rating) VALUES |
| 9 | 12 | ('articleassessment-rating-wellsourced'), ('articleassessment-rating-neutrality'), |
| 10 | 13 | ('articleassessment-rating-completeness'), ('articleassessment-rating-readability'); |
| 11 | 14 | |
| | 15 | +-- Store article assessments (user rating per revision) |
| 12 | 16 | CREATE TABLE IF NOT EXISTS /*$wgDBprefix*/article_assessment ( |
| 13 | 17 | -- Foreign key to page.page_id |
| 14 | 18 | aa_page_id integer unsigned NOT NULL, |
| | 19 | + -- User Id (0 if anon) |
| 15 | 20 | aa_user_id integer NOT NULL, |
| 16 | | - -- unique user identifier |
| | 21 | + -- Username or IP address |
| 17 | 22 | aa_user_text varchar(255) binary NOT NULL, |
| | 23 | + -- Unique token for anonymous users (to facilitate ratings from multiple users on the same IP) |
| 18 | 24 | aa_user_anon_token binary(32) DEFAULT '', |
| 19 | 25 | -- Foreign key to revision.rev_id |
| 20 | 26 | aa_revision integer unsigned NOT NULL, |
| 21 | 27 | -- MW Timestamp |
| 22 | 28 | aa_timestamp binary(14) NOT NULL DEFAULT '', |
| 23 | | - -- Rating info |
| | 29 | + -- Foreign key to article_assessment_ratings.aar_rating |
| 24 | 30 | aa_rating_id int unsigned NOT NULL, |
| | 31 | + -- Value of the rating (0 is "unrated", else 1-5) |
| 25 | 32 | aa_rating_value int unsigned NOT NULL, |
| 26 | 33 | -- 1 vote per user per revision |
| 27 | 34 | PRIMARY KEY (aa_revision, aa_user_text, aa_rating_id, aa_user_anon_token) |
| 28 | 35 | ) /*$wgDBTableOptions*/; |
| 29 | 36 | CREATE INDEX /*i*/aa_user_page_revision ON /*_*/article_assessment (aa_user_id, aa_page_id, aa_revision); |
| 30 | 37 | |
| | 38 | +-- Aggregate rating table for a page |
| 31 | 39 | CREATE TABLE IF NOT EXISTS /*$wgDBprefix*/article_assessment_pages ( |
| 32 | 40 | -- Foreign key to page.page_id |
| 33 | 41 | aap_page_id integer unsigned NOT NULL, |
| 34 | | - -- Which "rating" |
| | 42 | + -- Foreign key to article_assessment_ratings.aar_rating |
| 35 | 43 | aap_rating_id integer unsigned NOT NULL, |
| 36 | 44 | -- Sum (total) of all the ratings for this article revision |
| 37 | 45 | aap_total integer unsigned NOT NULL, |
| 38 | 46 | -- Number of ratings |
| 39 | 47 | aap_count integer unsigned NOT NULL, |
| | 48 | + -- One rating row per page |
| 40 | 49 | PRIMARY KEY (aap_page_id, aap_rating_id) |
| 41 | 50 | ) /*$wgDBTableOptions*/; |
| \ No newline at end of file |
| Index: trunk/extensions/ArticleAssessmentPilot/ArticleAssessmentPilot.php |
| — | — | @@ -1,14 +1,14 @@ |
| 2 | 2 | <?php |
| 3 | 3 | |
| 4 | | -// settings |
| 5 | | - |
| 6 | | -// number of new revisions to mark the last rating as old |
| | 4 | +// If the number of page revisions (since users last rating) is greater than this |
| | 5 | +// then consider the last rating "stale" |
| 7 | 6 | $wgArticleAssessmentStaleCount = 5; |
| 8 | 7 | |
| 9 | 8 | // Number of "ratings" to store. Allows it to be a bit more dynamic |
| 10 | 9 | $wgArticleAssessmentRatingCount = 4; |
| 11 | 10 | |
| 12 | | -//Category the pages are in (with _ in text) |
| | 11 | +// Which category the pages must belong to have the rating widget added (with _ in text) |
| | 12 | +// Extension is "disabled" if this field is an empty string (as per default configuration) |
| 13 | 13 | $wgArticleAssessmentCategory = ''; |
| 14 | 14 | |
| 15 | 15 | // Auto-load files |
| — | — | @@ -36,7 +36,7 @@ |
| 37 | 37 | $wgExtensionCredits['other'][] = array( |
| 38 | 38 | 'path' => __FILE__, |
| 39 | 39 | 'name' => 'Article Assessment Pilot', |
| 40 | | - 'author' => array( 'Nimish Gautam', 'Sam Reed' ), |
| | 40 | + 'author' => array( 'Nimish Gautam', 'Sam Reed', 'Adam Miller' ), |
| 41 | 41 | 'version' => '0.1.0', |
| 42 | 42 | 'descriptionmsg' => 'articleassessment-desc', |
| 43 | 43 | 'url' => 'http://www.mediawiki.org/wiki/Extension:ArticleAssessmentPilot' |
| Index: trunk/extensions/ArticleAssessmentPilot/ArticleAssessmentPilot.hooks.php |
| — | — | @@ -135,23 +135,4 @@ |
| 136 | 136 | __METHOD__ |
| 137 | 137 | ); |
| 138 | 138 | } |
| 139 | | - |
| 140 | | - /** |
| 141 | | - * Adds a reference to a javascript file to the head of the document |
| 142 | | - * @param string $src Path to the file relative to this extension's folder |
| 143 | | - * @param object $version Version number of the file |
| 144 | | - */ |
| 145 | | - public static function addScript( $src, $version = '' ) { |
| 146 | | - // The key is Andrew's snarky 20-character way of stopping multiple inclusion of the same file. |
| 147 | | - self::$scripts["$src?$version"] = array( 'src' => $src, 'version' => $version ); |
| 148 | | - } |
| 149 | | - |
| 150 | | - /** |
| 151 | | - * Adds internationalized message definitions to the document for access |
| 152 | | - * via javascript using the mw.usability.getMsg() function |
| 153 | | - * @param array $messages Key names of messages to load |
| 154 | | - */ |
| 155 | | - public static function addMessages( $messages ) { |
| 156 | | - self::$messages = array_merge( self::$messages, $messages ); |
| 157 | | - } |
| 158 | 139 | } |
| Index: trunk/extensions/ArticleAssessmentPilot/api/ApiQueryArticleAssessment.php |
| — | — | @@ -1,10 +1,4 @@ |
| 2 | 2 | <?php |
| 3 | | -/** |
| 4 | | - * |
| 5 | | - * |
| 6 | | - * @file |
| 7 | | - * @ingroup API |
| 8 | | - */ |
| 9 | 3 | class ApiListArticleAssessment extends ApiQueryBase { |
| 10 | 4 | public function __construct( $query, $moduleName ) { |
| 11 | 5 | parent::__construct( $query, $moduleName, 'aa' ); |