From 7a7bf240c06327eac0cb9c917799e0929a1fee28 Mon Sep 17 00:00:00 2001 From: Tim Laqua Date: Sun, 26 Aug 2007 14:39:17 +0000 Subject: [PATCH] Fixed i18n files, switched over to utilize abstraction layer f/ messages, etc, etc. + Doxygen comments. --- ContributionScores.i18n.php | 15 +++++++- ContributionScores.php | 4 +++ ContributionScores_body.php | 69 +++++++++++++++++++++++-------------- 3 files changed, 62 insertions(+), 26 deletions(-) diff --git a/ContributionScores.i18n.php b/ContributionScores.i18n.php index dd68c82..1987967 100644 --- a/ContributionScores.i18n.php +++ b/ContributionScores.i18n.php @@ -1,7 +1,20 @@ array( - 'contributionscores' => 'Contribution Scores' + 'contributionscores' => 'Contribution Scores', + 'contributionscores-info' => "Scores are calculated as follows:\n". + "*1 point for each unique page edited\n". + "*Square Root of (Total Edits Made) - (Total Unique Pages) * 2\n". + "Scores calculated in this manner weight edit diversity over edit volume. Basically, this score measures". + " primarily unique pages edited, with consideration for high edit volume - assumed to be a higher quality ". + "article.", + 'contributionscores-top' => '(Top $1)', + 'contributionscores-days' => 'Last $1 Days', + 'contributionscores-allrevisions' => 'All Revisions' ), 'de' => array( 'contributionscores' => 'Benutzerbeiträge auswerten', diff --git a/ContributionScores.php b/ContributionScores.php index 43631e5..7324a3f 100644 --- a/ContributionScores.php +++ b/ContributionScores.php @@ -1,4 +1,8 @@ + */ class ContributionScores extends SpecialPage { function ContributionScores() { SpecialPage::SpecialPage("ContributionScores"); self::loadMessages(); } - + + ///Generates a "Contribution Scores" table for a given LIMIT and date range + /** + * Function generates Contribution Scores tables in HTML format (not wikiText) + * + * @param $days int Days in the past to run report for + * @param $limit int Maximum number of users to return (default 50) + * + * @return HTML Table representing the requested Contribution Scores. + */ function genContributionScoreTable( $days, $limit ) { - global $contribScoreIgnoreBots; + global $contribScoreIgnoreBots, $wgUser; $dbr =& wfGetDB( DB_SLAVE ); @@ -44,22 +66,23 @@ class ContributionScores extends SpecialPage $res = $dbr->query($sql); - $output = "{|class=\"wikitable sortable\"\n". - "|-\n". - "|style=\"font-weight: bold;\"|Score\n". - "|style=\"font-weight: bold;\"|Pages\n". - "|style=\"font-weight: bold;\"|Changes\n". - "|style=\"font-weight: bold;\"|Username\n"; + $output = "\n". + "\n". + "\n". + "\n". + "\n". + "\n"; + $skin =& $wgUser->getSkin(); while ( $row = $dbr->fetchObject( $res ) ) { - $wikiUserName = $row->user_name; - $output .= "|-\n|" . - round($row->wiki_rank,0) . "\n|" . - $row->page_count . "\n|" . - $row->rev_count . "\n|" . - "[[User:".$wikiUserName."|".$wikiUserName."]] ([[User_talk:".$wikiUserName."|Talk]] | [[Special:Contributions/".$wikiUserName."|contribs]])" . "\n"; + $output .= "\n\n"; } - $output .= "|}"; + $output .= "
ScorePagesChangesUsername
" . + round($row->wiki_rank,0) . "\n" . + $row->page_count . "\n" . + $row->rev_count . "\n" . + $skin->userLink( $row->user_id, $row->user_name ) . + $skin->userToolLinks( $row->user_id, $row->user_name ) . "
"; $dbr->freeResult( $res ); return $output; @@ -80,21 +103,17 @@ class ContributionScores extends SpecialPage array(0,50)); } - $wgOut->addWikiText ("Scores are calculated as follows:\n". - "*1 point for each unique page edited\n". - "*Square Root of (Total Edits Made) - (Total Unique Pages) * 2\n". - "Scores calculated in this manner weight edit diversity over edit volume. Basically, this score measures". - " primarily unique pages edited, with consideration for high edit volume - assumed to be a higher quality ". - "article."); + $wgOut->addWikiText (wfMsgForContent('contributionscores-info')); foreach ( $contribScoreReports as $scoreReport) { if ( $scoreReport[0] > 0 ) { - $reportTitle = "Last $scoreReport[0] Days"; + $reportTitle = wfMsgForContent('contributionscores-days', $scoreReport[0]); } else { - $reportTitle = "All Revisions"; + $reportTitle = wfMsgForContent('contributionscores-allrevisions'); } - $reportTitle .= " (Top $scoreReport[1])"; - $wgOut->addWikiText ("== $reportTitle ==\n".$this->genContributionScoreTable($scoreReport[0],$scoreReport[1])); + $reportTitle .= " " . wfMsgForContent('contributionscores-top', $scoreReport[1]); + $wgOut->addWikiText ("== $reportTitle ==\n"); + $wgOut->addHtml( $this->genContributionScoreTable($scoreReport[0],$scoreReport[1])); } }