r71745 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r71744‎ | r71745 | r71746 >
Date:20:36, 26 August 2010
Author:reedy
Status:deferred
Tags:
Comment:
Stylize SimpleSurvey, ArticleAssessmentPilot
Modified paths:
  • /trunk/extensions/ArticleAssessmentPilot/ArticleAssessmentPilot.hooks.php (modified) (history)
  • /trunk/extensions/ArticleAssessmentPilot/ArticleAssessmentPilot.php (modified) (history)
  • /trunk/extensions/ArticleAssessmentPilot/api/ApiArticleAssessment.php (modified) (history)
  • /trunk/extensions/ArticleAssessmentPilot/api/ApiListArticleAssessment.php (modified) (history)
  • /trunk/extensions/SimpleSurvey/SimpleSurvey.classes.php (modified) (history)
  • /trunk/extensions/SimpleSurvey/SimpleSurvey.i18n.php (modified) (history)
  • /trunk/extensions/SimpleSurvey/SimpleSurvey.php (modified) (history)
  • /trunk/extensions/SimpleSurvey/SpecialSimpleSurvey.php (modified) (history)
  • /trunk/extensions/SimpleSurvey/Surveys.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SimpleSurvey/Surveys.php
@@ -42,7 +42,7 @@
4343 'business' => 'vitals-07-2010-answer-nonprof-business',
4444 'nothink' => 'vitals-07-2010-answer-nonprof-think',
4545 ),
46 - ),
 46+ ),
4747 'wikimediafoundation' => array(
4848 'question' => 'vitals-07-2010-question-wikimedia',
4949 'type' => 'select',
Index: trunk/extensions/SimpleSurvey/SimpleSurvey.classes.php
@@ -1,25 +1,25 @@
2 -<?php
 2+<?php
33 class SimpleSurvey extends PrefSwitchSurvey {
44 // Correlation between names of field types and implementation classes
55 /* Static Functions */
6 -
 6+
77 /* update schema*/
8 - public static function schema( ){
 8+ public static function schema( ) {
99 global $wgExtModifiedFields, $wgExtNewTables;
10 -
11 - $wgExtNewTables[] = array( 'prefswitch_survey',
12 - dirname( dirname( __FILE__ ) ) ."/UsabilityInitiative/PrefSwitch/PrefSwitch.sql"
 10+
 11+ $wgExtNewTables[] = array( 'prefswitch_survey',
 12+ dirname( dirname( __FILE__ ) ) . "/UsabilityInitiative/PrefSwitch/PrefSwitch.sql"
1313 );
14 -
 14+
1515 $wgExtModifiedFields[] = array(
1616 'prefswitch_survey',
1717 'pss_user',
1818 dirname( __FILE__ ) . '/SimpleSurvey.patch-pssuser.sql'
1919 );
20 -
 20+
2121 return true;
2222 }
23 -
 23+
2424 /**
2525 * creates a random token
2626 * @return a random token
@@ -28,8 +28,8 @@
2929 global $wgUser;
3030 return wfGenerateToken( array( $wgUser, time() ) );
3131 }
32 -
33 -
 32+
 33+
3434 /**
3535 * Render the HTML for a survey.
3636 * @param $name string Survey name
@@ -39,29 +39,29 @@
4040 */
4141 public static function render( $questions ) {
4242 global $wgUser;
43 -
 43+
4444 $html = Xml::openElement( 'dl' );
4545 foreach ( $questions as $field => $config ) {
4646 $answer = null;
4747 $answerData = null;
4848 $invisible = false;
49 - if(isset($config['visibility']) && $config['visibility'] == 'hidden' ){
 49+ if ( isset( $config['visibility'] ) && $config['visibility'] == 'hidden' ) {
5050 $invisible = true;
5151 }
52 - if($invisible){
53 - $html .= Xml::openElement( 'div', array("style" => "display:none;") );
 52+ if ( $invisible ) {
 53+ $html .= Xml::openElement( 'div', array( "style" => "display:none;" ) );
5454 }
5555 $html .= call_user_func( array( self::$fieldTypes[$config['type']], 'render' ),
5656 $field, $config, $answer, $answerData
5757 );
58 - if($invisible){
59 - $html .= Xml::closeElement('div');
 58+ if ( $invisible ) {
 59+ $html .= Xml::closeElement( 'div' );
6060 }
6161 }
6262 $html .= Xml::closeElement( 'dl' );
6363 return $html;
6464 }
65 -
 65+
6666 /**
6767 * Save a survey to the database
6868 * @param $name string Survey name
@@ -71,12 +71,12 @@
7272 global $wgRequest, $wgUser;
7373 $dbw = wfGetDb( DB_MASTER );
7474 $now = $dbw->timestamp();
75 - $cookieID = $wgRequest->getCookie("vitals-survey");
76 - if($cookieID == null){
 75+ $cookieID = $wgRequest->getCookie( "vitals-survey" );
 76+ if ( $cookieID == null ) {
7777 $cookieID = self::generateRandomCookieID();
78 - $wgRequest->response()->setcookie("vitals-survey", $cookieID);
 78+ $wgRequest->response()->setcookie( "vitals-survey", $cookieID );
7979 }
80 -
 80+
8181 foreach ( $survey['questions'] as $question => $config ) {
8282 $dbw->insert(
8383 'prefswitch_survey',
@@ -92,8 +92,8 @@
9393 __METHOD__
9494 );
9595 }
96 -
97 - //pseudoquestion, logged in? IP address?
 96+
 97+ // pseudoquestion, logged in? IP address?
9898 $dbw->insert(
9999 'prefswitch_survey',
100100 array(
@@ -101,13 +101,13 @@
102102 'pss_timestamp' => $now,
103103 'pss_name' => $name,
104104 'pss_question' => "logged_in",
105 - 'pss_answer' => $wgUser->isLoggedIn()?"yes":"no",
 105+ 'pss_answer' => $wgUser->isLoggedIn() ? "yes":"no",
106106 'pss_answer_data' => wfGetIP(),
107107 ),
108108 __METHOD__
109109 );
110 -
111 -
112 -
 110+
 111+
 112+
113113 }
114114 }
\ No newline at end of file
Index: trunk/extensions/SimpleSurvey/SimpleSurvey.i18n.php
@@ -11,40 +11,40 @@
1212 'simple-survey-back' => 'Go back',
1313 'simple-survey-title' => 'Simple Survey',
1414 'simple-survey-confirm' => 'Thanks! Your data has been submitted.',
15 -
 15+
1616 /*vitals 07 2010 */
1717 'simple-survey-intro-vitals-07-2010' => 'This is a quick survey to give us a better idea of who you are',
1818 'vitals-07-2010-submit' => 'Submit',
19 -
 19+
2020 'vitals-07-2010-question-use' => 'How often do you use Wikipedia?',
2121 'vitals-07-2010-question-edit' => 'Do you edit Wikipedia?',
2222 'vitals-07-2010-question-nonprofit' => 'Did you know Wikipedia is a non-profit project?',
23 - 'vitals-07-2010-question-wikimedia'=> 'Which of these describes your knowledge of the Wikimedia Foundation, the organization that hosts Wikipedia and its sister projects such as Wiktionary and Wikiquote:',
24 - 'vitals-07-2010-question-age'=> 'Please tell us your age',
 23+ 'vitals-07-2010-question-wikimedia' => 'Which of these describes your knowledge of the Wikimedia Foundation, the organization that hosts Wikipedia and its sister projects such as Wiktionary and Wikiquote:',
 24+ 'vitals-07-2010-question-age' => 'Please tell us your age',
2525 'vitals-07-2010-question-programming' => 'Please tell us which one of these describes you:',
26 - 'vitals-07-2010-question-gender'=> 'Please tell us your gender',
27 - 'vitals-07-2010-question-story'=> 'We love hearing about ways Wikipedia has impacted your life! Please feel free to share any stories, explain any of your answers, or leave a comment for the Wikimedia Foundation here:',
 26+ 'vitals-07-2010-question-gender' => 'Please tell us your gender',
 27+ 'vitals-07-2010-question-story' => 'We love hearing about ways Wikipedia has impacted your life! Please feel free to share any stories, explain any of your answers, or leave a comment for the Wikimedia Foundation here:',
2828 'vitals-07-2010-question-computerexp' => "Which one of the following describes your computer experience?",
2929
30 - 'vitals-07-2010-blank'=> '',
31 - 'vitals-07-2010-answer-daily'=> 'Daily',
32 - 'vitals-07-2010-answer-weekly'=> 'Weekly',
33 - 'vitals-07-2010-answer-monthly'=> 'Monthly',
34 - 'vitals-07-2010-answer-rarely'=> 'less than monthly',
35 - 'vitals-07-2010-answer-firsttime'=> 'This was my first time',
36 - 'vitals-07-2010-answer-never'=> 'Never',
 30+ 'vitals-07-2010-blank' => '',
 31+ 'vitals-07-2010-answer-daily' => 'Daily',
 32+ 'vitals-07-2010-answer-weekly' => 'Weekly',
 33+ 'vitals-07-2010-answer-monthly' => 'Monthly',
 34+ 'vitals-07-2010-answer-rarely' => 'less than monthly',
 35+ 'vitals-07-2010-answer-firsttime' => 'This was my first time',
 36+ 'vitals-07-2010-answer-never' => 'Never',
3737
3838 'vitals-07-2010-answer-y-daily' => 'Yes, daily',
3939 'vitals-07-2010-answer-y-weekly' => 'Yes, weekly',
4040 'vitals-07-2010-answer-y-monthly' => 'Yes, monthly',
4141 'vitals-07-2010-answer-y-rarely' => 'Yes, but less than monthly',
4242 'vitals-07-2010-answer-n-never' => 'No, never',
43 - 'vitals-07-2010-answer-dunno-edit'=> "I didn't know you could edit",
44 -
 43+ 'vitals-07-2010-answer-dunno-edit' => "I didn't know you could edit",
 44+
4545 'vitals-07-2010-answer-nonprof-knew' => "I knew it was a non-profit",
4646 'vitals-07-2010-answer-nonprof-business' => "I assumed it was a for-profit business",
4747 'vitals-07-2010-answer-nonprof-think' => "I've never thought about it",
48 -
 48+
4949 'vitals-07-2010-answer-never-heard' => "I've never heard of it",
5050 'vitals-07-2010-answer-heard-nothing' => "I guess I've heard of it, but don't know anything about it",
5151 'vitals-07-2010-answer-hosted' => "I know that Wikipedia is hosted by the Wikimedia Foundation, but that's about it",
@@ -55,8 +55,8 @@
5656 'vitals-07-2010-answer-many-lang' => "I am comfortable with many programming languages",
5757 'vitals-07-2010-answer-no-lang' => "Programming? Not me!",
5858
59 - 'vitals-07-2010-answer-male'=> 'Male',
60 - 'vitals-07-2010-answer-female'=> 'Female',
61 - 'vitals-07-2010-answer-other'=> 'Other',
 59+ 'vitals-07-2010-answer-male' => 'Male',
 60+ 'vitals-07-2010-answer-female' => 'Female',
 61+ 'vitals-07-2010-answer-other' => 'Other',
6262 );
6363
Index: trunk/extensions/SimpleSurvey/SimpleSurvey.php
@@ -2,9 +2,9 @@
33
44 $dir = dirname( __FILE__ ) . '/';
55
6 -//from prefswitch in usability initiative
 6+// from prefswitch in usability initiative
77 require_once( dirname( dirname( __FILE__ ) ) . "/UsabilityInitiative/UsabilityInitiative.php" );
8 -$prefswitchdir = dirname( dirname( __FILE__ ) ) ."/UsabilityInitiative/PrefSwitch";
 8+$prefswitchdir = dirname( dirname( __FILE__ ) ) . "/UsabilityInitiative/PrefSwitch";
99
1010 // Adds Autoload Classes
1111 $wgAutoloadClasses = array_merge(
@@ -19,13 +19,13 @@
2020 'PrefSwitchSurveyFieldDimensions' => $prefswitchdir . '/PrefSwitch.classes.php',
2121 'PrefSwitchSurveyFieldText' => $prefswitchdir . '/PrefSwitch.classes.php',
2222 'SimpleSurvey' => $dir . "SimpleSurvey.classes.php",
23 - 'SpecialSimpleSurvey' => $dir. 'SpecialSimpleSurvey.php',
 23+ 'SpecialSimpleSurvey' => $dir . 'SpecialSimpleSurvey.php',
2424 )
2525 );
26 -unset($prefswitchdir);
 26+unset( $prefswitchdir );
2727
2828
29 -//add special pages
 29+// add special pages
3030 $wgSpecialPages['SimpleSurvey'] = 'SpecialSimpleSurvey';
3131 $wgSpecialPageGroups['SimpleSurvey'] = 'wiki';
3232 $wgExtensionMessagesFiles['SimpleSurvey'] = $dir . 'SimpleSurvey.i18n.php';
@@ -44,9 +44,9 @@
4545
4646 $wgValidSurveys = array();
4747
48 -//add surveys
49 -require_once($dir . "Surveys.php");
50 -unset($dir);
 48+// add surveys
 49+require_once( $dir . "Surveys.php" );
 50+unset( $dir );
5151
5252 // Always include the browser stuff...
5353 foreach ( $wgPrefSwitchSurveys as $survey ) {
@@ -61,7 +61,7 @@
6262 'ie8' => 'prefswitch-survey-answer-browser-ie8',
6363 'ff1' => 'prefswitch-survey-answer-browser-ff1',
6464 'ff2' => 'prefswitch-survey-answer-browser-ff2',
65 - 'ff3'=> 'prefswitch-survey-answer-browser-ff3',
 65+ 'ff3' => 'prefswitch-survey-answer-browser-ff3',
6666 'cb' => 'prefswitch-survey-answer-browser-cb',
6767 'c1' => 'prefswitch-survey-answer-browser-c1',
6868 'c2' => 'prefswitch-survey-answer-browser-c2',
Index: trunk/extensions/SimpleSurvey/SpecialSimpleSurvey.php
@@ -9,7 +9,7 @@
1010 class SpecialSimpleSurvey extends SpecialPage {
1111
1212 /* Private Members */
13 -
 13+
1414 private $origin = '';
1515 private $originTitle = null;
1616 private $originQuery = '';
@@ -19,51 +19,51 @@
2020 private $tokenToCheck = '';
2121
2222 /* Functions */
23 -
 23+
2424 /**
2525 * Quick token matching wrapper for form processing
2626 */
2727 public function checkToken() {
2828 global $wgRequest;
2929 $this->tokenToCheck = $_SESSION['wsSimpleSurveyToken'];
30 - if($this->tokenToCheck != "" &&
31 - ( $wgRequest->getVal( 'token' ) == $this->tokenToCheck ) ){
 30+ if ( $this->tokenToCheck != "" &&
 31+ ( $wgRequest->getVal( 'token' ) == $this->tokenToCheck ) ) {
3232 return true;
3333 }
3434 else return false;
3535 }
36 -
37 - public function setToken(){
 36+
 37+ public function setToken() {
3838 $this->tokenToCheck = wfGenerateToken( array( $this, time() ) );
3939 $_SESSION['wsSimpleSurveyToken'] = $this->tokenToCheck;
4040 }
41 -
 41+
4242 public function __construct() {
4343 parent::__construct( 'SimpleSurvey' );
4444 wfLoadExtensionMessages( 'SimpleSurvey' );
4545 }
46 -
47 -
 46+
 47+
4848 public function execute( $par ) {
4949 global $wgRequest, $wgOut, $wgUser, $wgPrefSwitchSurveys, $wgPrefSwitchStyleVersion, $wgValidSurveys, $wgSimpleSurveyRedirectURL;
5050 $this->setHeaders();
5151 // Set page title
5252 $wgOut->setPageTitle( wfMsg( 'simple-survey-title' ) );
53 - $surveyName = $wgRequest->getVal("survey");
54 -
55 - if($wgRequest->wasPosted()){
56 - if($surveyName && in_array($surveyName,$wgValidSurveys ) && $this->checkToken() ){
 53+ $surveyName = $wgRequest->getVal( "survey" );
 54+
 55+ if ( $wgRequest->wasPosted() ) {
 56+ if ( $surveyName && in_array( $surveyName, $wgValidSurveys ) && $this->checkToken() ) {
5757 SimpleSurvey::save( $surveyName, $wgPrefSwitchSurveys[$surveyName] );
58 - $wgOut->addHtml("<b>" . wfMsg( 'simple-survey-confirm' ). "</b>");
 58+ $wgOut->addHtml( "<b>" . wfMsg( 'simple-survey-confirm' ) . "</b>" );
5959 }
60 - //forward to new page
61 - if($wgSimpleSurveyRedirectURL){
62 - $wgRequest->response()->header("Location: $wgSimpleSurveyRedirectURL");
63 - }
64 -
 60+ // forward to new page
 61+ if ( $wgSimpleSurveyRedirectURL ) {
 62+ $wgRequest->response()->header( "Location: $wgSimpleSurveyRedirectURL" );
 63+ }
 64+
6565 return;
6666 }
67 -
 67+
6868 $this->setToken();
6969 // Get the origin from the request
7070 $par = $wgRequest->getVal( 'from', $par );
@@ -71,7 +71,7 @@
7272 // $this->originTitle should never be Special:Userlogout
7373 if (
7474 $this->originTitle &&
75 - $this->originTitle->isSpecial('Userlogout')
 75+ $this->originTitle->isSpecial( 'Userlogout' )
7676 ) {
7777 $this->originTitle = null;
7878 }
@@ -83,7 +83,7 @@
8484 $this->originLinkUrl = $this->originTitle->getLinkUrl( $this->originQuery );
8585 $this->originFullUrl = $this->originTitle->getFullUrl( $this->originQuery );
8686 }
87 -
 87+
8888 // Begin output
8989 $this->setHeaders();
9090 UsabilityInitiativeHooks::initialize();
@@ -91,29 +91,29 @@
9292 UsabilityInitiativeHooks::addStyle( 'PrefSwitch/PrefSwitch.css', $wgPrefSwitchStyleVersion );
9393 $wgOut->addHtml( '<div class="plainlinks">' );
9494 // Handle various modes
95 -
96 - $this->render( $wgRequest->getVal("survey") );
97 -
 95+
 96+ $this->render( $wgRequest->getVal( "survey" ) );
 97+
9898 $wgOut->addHtml( '</div>' );
9999 }
100 -
 100+
101101 /* Private Functions */
102 -
 102+
103103 private function render( $mode = null ) {
104104 global $wgUser, $wgOut, $wgPrefSwitchSurveys, $wgValidSurveys;
105105 // Make sure links will retain the origin
106106 $query = array( 'from' => $this->origin, 'fromquery' => $this->originQuery );
107 -
108 - if ( !isset( $wgPrefSwitchSurveys[$mode] ) && !in_array($mode, $wgValidSurveys) ){
 107+
 108+ if ( !isset( $wgPrefSwitchSurveys[$mode] ) && !in_array( $mode, $wgValidSurveys ) ) {
109109 $wgOut->addWikiMsg( "simple-survey-invalid" );
110 - if ( $this->originTitle ) {
 110+ if ( $this->originTitle ) {
111111 $wgOut->addHTML( wfMsg( "simple-survey-back", $this->originLink ) );
112112 }
113113 return;
114114 }
115 -
 115+
116116 $wgOut->addWikiMsg( "simple-survey-intro-{$mode}" );
117 -
 117+
118118 // Setup a form
119119 $html = Xml::openElement(
120120 'form', array(
@@ -124,7 +124,7 @@
125125 )
126126 );
127127 $html .= Xml::hidden( 'survey', $mode );
128 - $html .= Xml::hidden( 'token', $this->tokenToCheck);
 128+ $html .= Xml::hidden( 'token', $this->tokenToCheck );
129129 // Render a survey
130130 $html .= SimpleSurvey::render(
131131 $wgPrefSwitchSurveys[$mode]['questions']
@@ -137,6 +137,6 @@
138138 );
139139 $html .= Xml::closeElement( 'dt' );
140140 $html .= Xml::closeElement( 'form' );
141 - $wgOut->addHtml( $html );
 141+ $wgOut->addHtml( $html );
142142 }
143143 }
Index: trunk/extensions/ArticleAssessmentPilot/ArticleAssessmentPilot.php
@@ -1,35 +1,35 @@
22 <?php
33
4 -//settings
 4+// settings
55
6 -//number of reviews
 6+// number of reviews
77 $wgArticleAssessmentRevisionCutoff = 5;
88
9 -//Number of "ratings" to store. Allows it to be a bit more dynamic
 9+// Number of "ratings" to store. Allows it to be a bit more dynamic
1010 $wgArticleAssessmentRatingCount = 4;
1111
12 -//Auto-load files
 12+// Auto-load files
1313 $dir = dirname( __FILE__ ) . '/';
1414 $wgAutoloadClasses['ApiListArticleAssessment'] = $dir . 'api/ApiListArticleAssessment.php';
1515 $wgAutoloadClasses['ApiArticleAssessment'] = $dir . 'api/ApiArticleAssessment.php';
1616 $wgAutoloadClasses['ArticleAssessmentPilotHooks'] = $dir . 'ArticleAssessmentPilot.hooks.php';
1717
18 -//Schema and tables
 18+// Schema and tables
1919 $wgHooks['LoadExtensionSchemaUpdates'][] = 'ArticleAssessmentPilotHooks::schema';
2020 $wgHooks['ParserTestTables'][] = 'ArticleAssessmentPilotHooks::parserTestTables';
2121
22 -//Hooks
 22+// Hooks
2323 $wgHooks['SkinAfterContent'][] = 'ArticleAssessmentPilotHooks::addCode';
2424
25 -//API modules
 25+// API modules
2626 $wgAPIListModules['articleassessment'] = 'ApiListArticleAssessment';
2727 $wgAPIModules['articleassessment'] = 'ApiArticleAssessment';
2828
29 -//i18n and aliases
 29+// i18n and aliases
3030 // Adds Internationalized Messages
3131 $wgExtensionMessagesFiles['ArticleAssessmentPilot'] = $dir . 'ArticleAssessmentPilot.i18n.php';
3232
33 -//Credits
 33+// Credits
3434 $wgExtensionCredits['other'][] = array(
3535 'path' => __FILE__,
3636 'name' => 'Article Assessment Pilot',
Index: trunk/extensions/ArticleAssessmentPilot/ArticleAssessmentPilot.hooks.php
@@ -16,7 +16,7 @@
1717 'article_assessment',
1818 dirname( __FILE__ ) . '/ArticleAssessmentPilot.sql'
1919 );
20 -
 20+
2121 return true;
2222 }
2323
@@ -34,17 +34,17 @@
3535
3636 public static function addCode( &$data, $skin ) {
3737 $title = $skin->getTitle();
38 -
39 - //check if this page should have the form
40 -
41 - //Chances are we only want to be rating Mainspace, right?
 38+
 39+ // check if this page should have the form
 40+
 41+ // Chances are we only want to be rating Mainspace, right?
4242 if ( $title->getNamespace() !== NS_MAIN ) {
4343 return true;
4444 }
4545
46 - //write the form
 46+ // write the form
4747
48 - //if user has no cookie, set cookie
 48+ // if user has no cookie, set cookie
4949
5050 return true;
5151 }
Index: trunk/extensions/ArticleAssessmentPilot/api/ApiListArticleAssessment.php
@@ -1,7 +1,7 @@
22 <?php
33 /**
4 - *
54 *
 5+ *
66 * @file
77 * @ingroup API
88 */
@@ -12,31 +12,31 @@
1313
1414 public function execute() {
1515 $params = $this->extractRequestParams();
16 -
 16+
1717 $result = $this->getResult();
18 -
 18+
1919 $this->addTables( 'article_assessment_pages' );
2020 $this->addTables( 'article_assessment_ratings' );
21 -
 21+
2222 $this->addFields( array( 'aap_page_id', 'aap_total', 'aap_count', 'aap_rating_id', 'aam_rating' ) );
2323
2424 $this->addWhereFld( 'aap_rating_id', 'aam_rating_id' );
25 -
 25+
2626 if ( isset( $params['pageid'] ) ) {
2727 $this->addWhereFld( 'aa_page_id', $params['pageid'] );
2828 }
29 -
 29+
3030 $res = $this->select( __METHOD__ );
3131
3232 $assessments = array();
33 -
34 - foreach( $res as $row ) {
 33+
 34+ foreach ( $res as $row ) {
3535 if ( !isset( $assessments[$row->aap_page_id] ) ) {
3636 $assessments[$row->aap_page_id] = array(
3737 'pageid' => $row->aap_page_id,
3838 );
3939 }
40 -
 40+
4141 $assessments[$row->aap_page_id]['ratings']['r' . $row->aap_rating] = array(
4242 'ratingid' => $row->aap_rating_id,
4343 'ratingdesc' => $row->aam_rating,
@@ -45,10 +45,10 @@
4646 );
4747 }
4848
49 - foreach( $assessments as $ass ) {
 49+ foreach ( $assessments as $ass ) {
5050 $result->addValue( array( 'query', $this->getModuleName() ), null, $ass );
5151 }
52 -
 52+
5353 $result->setIndexedTagName_internal( array( 'query', $this->getModuleName() ), 'aa' );
5454 }
5555
@@ -69,12 +69,12 @@
7070 'List all article assessments'
7171 );
7272 }
73 -
 73+
7474 public function getPossibleErrors() {
7575 return array_merge( parent::getPossibleErrors(), array(
76 - ));
 76+ ) );
7777 }
78 -
 78+
7979 protected function getExamples() {
8080 return array(
8181 'api.php?action=query&list=articleassessment',
Index: trunk/extensions/ArticleAssessmentPilot/api/ApiArticleAssessment.php
@@ -12,7 +12,7 @@
1313
1414 $dbr = wfGetDB( DB_SLAVE );
1515
16 - //TODO:Refactor out...?
 16+ // TODO:Refactor out...?
1717 $res = $dbr->select(
1818 'article_assessment',
1919 array( 'aa_rating_id', 'aa_rating_value' ),
@@ -31,17 +31,17 @@
3232 $lastRatings[$row->aa_rating_id] = $row->aa_rating_value;
3333 }
3434
35 - //Do for each metric/dimension
 35+ // Do for each metric/dimension
3636
3737 $pageId = $params['pageid'];
3838 $revisionId = $params['revid'];
3939
40 - //TODO: Fold for loop into foreach above?
 40+ // TODO: Fold for loop into foreach above?
4141 global $wgArticleAssessmentRatingCount;
42 - for ($i = 1; $i <= $wgArticleAssessmentRatingCount; $i++){
 42+ for ( $i = 1; $i <= $wgArticleAssessmentRatingCount; $i++ ) {
4343 $lastRating = 0;
44 - if ( isset( $lastRatings[$i]) ) {
45 - $lastRating = $lastRatings[$i];
 44+ if ( isset( $lastRatings[$i] ) ) {
 45+ $lastRating = $lastRatings[$i];
4646 }
4747
4848 $thisRating = 0;
@@ -56,7 +56,7 @@
5757 $this->insertOrUpdateUserRatings( $pageId, $revisionId, $userName, $i, $thisRating );
5858 }
5959
60 - //Insert (or update) a users rating for a revision
 60+ // Insert (or update) a users rating for a revision
6161
6262 $r = array();
6363 $r['result'] = 'Success';

Status & tagging log