Index: trunk/extensions/ArticleAssessmentPilot/ArticleAssessmentPilot.sql |
— | — | @@ -0,0 +1,31 @@ |
| 2 | + |
| 3 | +-- Store article assessments |
| 4 | +CREATE TABLE IF NOT EXISTS /*$wgDBprefix*/article_assessment ( |
| 5 | + -- Foreign key to page.page_id |
| 6 | + aa_page_id integer unsigned NOT NULL, |
| 7 | + -- unique user identifier |
| 8 | + aa_user varchar(255), |
| 9 | + -- Foreign key to revision.rev_id |
| 10 | + aa_revision integer unsigned NOT NULL, |
| 11 | + -- MW Timestamp |
| 12 | + aa_timestamp char(14) NOT NULL default '', |
| 13 | + -- Vote info |
| 14 | + aa_m1 integer unsigned, |
| 15 | + aa_m2 integer unsigned, |
| 16 | + aa_m3 integer unsigned, |
| 17 | + aa_m4 integer unsigned, |
| 18 | + -- 1 vote per user per revision |
| 19 | + PRIMARY KEY (aa_revision,aa_user) |
| 20 | +) /*$wgDBTableOptions*/; |
| 21 | + |
| 22 | +-- Store article assessments |
| 23 | +CREATE TABLE IF NOT EXISTS /*$wgDBprefix*/article_assessment_pages ( |
| 24 | + -- Foreign key to page.page_id |
| 25 | + aa_page_id integer unsigned NOT NULL, |
| 26 | + -- Foreign key to revision.rev_id |
| 27 | + aa_revision integer unsigned NOT NULL, |
| 28 | + aa_total integer unsigned NOT NULL, |
| 29 | + aa_count integer unsigned NOT NULL, |
| 30 | + aa_dimension integer unsigned NOT NULL, |
| 31 | + PRIMARY KEY (aa_page_id, aa_revision) |
| 32 | +) /*$wgDBTableOptions*/; |
\ No newline at end of file |
Property changes on: trunk/extensions/ArticleAssessmentPilot/ArticleAssessmentPilot.sql |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 33 | + native |
Index: trunk/extensions/ArticleAssessmentPilot/ApiArticleAssessmentPilot.php |
— | — | @@ -0,0 +1,65 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Extend the API for ArticleAssessment |
| 5 | + * |
| 6 | + * @file |
| 7 | + * @ingroup API |
| 8 | + */ |
| 9 | + |
| 10 | +class ApiArticleAssessment extends ApiBase { |
| 11 | + |
| 12 | + /** |
| 13 | + * runs when the API is called with "articleasessment" |
| 14 | + * @see includes/api/ApiBase#execute() |
| 15 | + */ |
| 16 | + public function execute() { |
| 17 | + $params = $this->extractRequestParams(); |
| 18 | + $this->validateParams( $params ); |
| 19 | + |
| 20 | + if(isset($params['getResults'])){ |
| 21 | + |
| 22 | + } |
| 23 | + } |
| 24 | + |
| 25 | + /** |
| 26 | + * Required parameter check |
| 27 | + * @param $params params extracted from the POST |
| 28 | + */ |
| 29 | + protected function validateParams( $params ) { |
| 30 | + $required = array( ); |
| 31 | + foreach ( $required as $arg ) { |
| 32 | + if ( !isset( $params[$arg] ) ) { |
| 33 | + $this->dieUsageMsg( array( 'missingparam', $arg ) ); |
| 34 | + } |
| 35 | + } |
| 36 | + } |
| 37 | + |
| 38 | + public function getParamDescription() { |
| 39 | + return array( |
| 40 | + 'getResults' => 'set if you want to get results', |
| 41 | + ); |
| 42 | + } |
| 43 | + |
| 44 | + public function getDescription() { |
| 45 | + return array( |
| 46 | + 'get and set article assessment data' |
| 47 | + ); |
| 48 | + } |
| 49 | + |
| 50 | + public function getPossibleErrors() { |
| 51 | + return array_merge( parent::getPossibleErrors(), array( |
| 52 | + array( 'missingparam', 'mode' ), |
| 53 | + ) ); |
| 54 | + } |
| 55 | + |
| 56 | + public function getAllowedParams() { |
| 57 | + return array( |
| 58 | + 'getResults' => null, |
| 59 | + ); |
| 60 | + } |
| 61 | + |
| 62 | + public function getVersion() { |
| 63 | + return __CLASS__ . ':0'; |
| 64 | + } |
| 65 | + |
| 66 | +} |
\ No newline at end of file |
Property changes on: trunk/extensions/ArticleAssessmentPilot/ApiArticleAssessmentPilot.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 67 | + native |
Index: trunk/extensions/ArticleAssessmentPilot/ArticleAssessmentPilot.i18n.php |
— | — | @@ -0,0 +1,10 @@ |
| 2 | +<?php |
| 3 | +$messages = array(); |
| 4 | + |
| 5 | +/** English |
| 6 | + * @author Nimish Gautam |
| 7 | + */ |
| 8 | +$messages['en'] = array( |
| 9 | + 'articleassessment-pilot' => 'Pilot for article assessment', |
| 10 | + 'articleassessment-pilot-desc' => 'Article Assessment Pilot version', |
| 11 | +); |
\ No newline at end of file |
Property changes on: trunk/extensions/ArticleAssessmentPilot/ArticleAssessmentPilot.i18n.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 12 | + native |
Index: trunk/extensions/ArticleAssessmentPilot/ArticleAssessmentPilot.php |
— | — | @@ -0,0 +1,35 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +//Auto-load files |
| 5 | +$dir = dirname( __FILE__ ) . '/'; |
| 6 | +$wgAutoloadClasses['ApiArticleAssessment'] = $dir . 'ApiArticleAssessment.php'; |
| 7 | +$wgAutoloadClasses['ArticleAssessmentPilotHooks'] = $dir . 'ArticleAssessmentPilot.hooks.php'; |
| 8 | + |
| 9 | + |
| 10 | +//Schema and tables |
| 11 | +$wgHooks['LoadExtensionSchemaUpdates'][] = 'ArticleAssessmentPilotHooks::schema'; |
| 12 | +$wgHooks['ParserTestTables'][] = 'ArticleAssessmentPilotHooks::parserTestTables'; |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | +//Hooks |
| 17 | +$wgHooks['SkinAfterContent'][] = 'ArticleAssessmentPilot::addCode'; |
| 18 | + |
| 19 | +//API modules |
| 20 | +$wgAPIModules['articleassessment'] = 'ApiArticleAssessment'; |
| 21 | + |
| 22 | + |
| 23 | +//i18n and aliases |
| 24 | +// Adds Internationalized Messages |
| 25 | +$wgExtensionMessagesFiles['ArticleAssessmentPilot'] = $dir . 'ArticleAssessmentPilot.i18n.php'; |
| 26 | + |
| 27 | + |
| 28 | +//Credits |
| 29 | +$wgExtensionCredits['other'][] = array( |
| 30 | + 'path' => __FILE__, |
| 31 | + 'name' => 'Article Assessment Pilot', |
| 32 | + 'author' => 'Nimish Gautam', |
| 33 | + 'version' => '0.1.0', |
| 34 | + 'descriptionmsg' => 'articleassessment-pilot-desc', |
| 35 | + 'url' => 'http://www.mediawiki.org/wiki/Extension:ArticleAsessmentPilot' |
| 36 | +); |
\ No newline at end of file |
Property changes on: trunk/extensions/ArticleAssessmentPilot/ArticleAssessmentPilot.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 37 | + native |
Index: trunk/extensions/ArticleAssessmentPilot/ArticleAssessmentPilot.hooks.php |
— | — | @@ -0,0 +1,43 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * Hooks for ArticleAssessmentPilot |
| 6 | + * |
| 7 | + * @file |
| 8 | + * @ingroup Extensions |
| 9 | + */ |
| 10 | + |
| 11 | +class ArticleAssessmentPilotHooks { |
| 12 | + |
| 13 | + /* Static Functions */ |
| 14 | + public static function schema() { |
| 15 | + global $wgExtNewTables; |
| 16 | + |
| 17 | + $wgExtNewTables[] = array( |
| 18 | + 'article_assessment', |
| 19 | + dirname( __FILE__ ) . '/ArticleAssessmentPilot.sql' |
| 20 | + ); |
| 21 | + |
| 22 | + return true; |
| 23 | + } //schema |
| 24 | + |
| 25 | + /** |
| 26 | + * Make sure the table exists for parser tests |
| 27 | + * @param $tables |
| 28 | + * @return unknown_type |
| 29 | + */ |
| 30 | + public static function parserTestTables( &$tables ) { |
| 31 | + $tables[] = 'article_assessment'; |
| 32 | + $tables[] = 'article_assessment_pages'; |
| 33 | + return true; |
| 34 | + } |
| 35 | + |
| 36 | + public static function addCode(){ |
| 37 | + //check if this page should have the form |
| 38 | + |
| 39 | + //write the form |
| 40 | + |
| 41 | + return true; |
| 42 | + } |
| 43 | + |
| 44 | +} |
\ No newline at end of file |
Property changes on: trunk/extensions/ArticleAssessmentPilot/ArticleAssessmentPilot.hooks.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 45 | + native |