Fixed i18n files, switched over to utilize abstraction layer f/ messages, etc, etc. + Doxygen comments.
This commit is contained in:
parent
d9d0690dea
commit
7a7bf240c0
3 changed files with 62 additions and 26 deletions
|
@ -1,7 +1,20 @@
|
||||||
<?php
|
<?php
|
||||||
|
/** \file
|
||||||
|
* \brief Internationalisation file for the Contribution Scores Extension.
|
||||||
|
*/
|
||||||
|
|
||||||
$allMessages = array(
|
$allMessages = array(
|
||||||
'en' => array(
|
'en' => 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(
|
'de' => array(
|
||||||
'contributionscores' => 'Benutzerbeiträge auswerten',
|
'contributionscores' => 'Benutzerbeiträge auswerten',
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
|
/** \file
|
||||||
|
* \brief Contains setup code for the Contribution Scores Extension.
|
||||||
|
*/
|
||||||
|
|
||||||
# Not a valid entry point, skip unless MEDIAWIKI is defined
|
# Not a valid entry point, skip unless MEDIAWIKI is defined
|
||||||
if (!defined('MEDIAWIKI')) {
|
if (!defined('MEDIAWIKI')) {
|
||||||
echo "Contribution Scores extension";
|
echo "Contribution Scores extension";
|
||||||
|
|
|
@ -1,13 +1,35 @@
|
||||||
<?php
|
<?php
|
||||||
|
/** \file
|
||||||
|
* \brief Contains code for the ContributionScores Class (extends SpecialPage).
|
||||||
|
*/
|
||||||
|
|
||||||
|
///Special page class for the Contribution Scores extension
|
||||||
|
/**
|
||||||
|
* Special page that generates a list of wiki contributors based
|
||||||
|
* on edit diversity (unique pages edited) and edit volume (total
|
||||||
|
* number of edits.
|
||||||
|
*
|
||||||
|
* @addtogroup Extensions
|
||||||
|
* @author Tim Laqua <t.laqua@gmail.com>
|
||||||
|
*/
|
||||||
class ContributionScores extends SpecialPage
|
class ContributionScores extends SpecialPage
|
||||||
{
|
{
|
||||||
function ContributionScores() {
|
function ContributionScores() {
|
||||||
SpecialPage::SpecialPage("ContributionScores");
|
SpecialPage::SpecialPage("ContributionScores");
|
||||||
self::loadMessages();
|
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 ) {
|
function genContributionScoreTable( $days, $limit ) {
|
||||||
global $contribScoreIgnoreBots;
|
global $contribScoreIgnoreBots, $wgUser;
|
||||||
|
|
||||||
$dbr =& wfGetDB( DB_SLAVE );
|
$dbr =& wfGetDB( DB_SLAVE );
|
||||||
|
|
||||||
|
@ -44,22 +66,23 @@ class ContributionScores extends SpecialPage
|
||||||
|
|
||||||
$res = $dbr->query($sql);
|
$res = $dbr->query($sql);
|
||||||
|
|
||||||
$output = "{|class=\"wikitable sortable\"\n".
|
$output = "<table class=\"wikitable sortable\">\n".
|
||||||
"|-\n".
|
"<tr>\n".
|
||||||
"|style=\"font-weight: bold;\"|Score\n".
|
"<td style=\"font-weight: bold;\">Score</td>\n".
|
||||||
"|style=\"font-weight: bold;\"|Pages\n".
|
"<td style=\"font-weight: bold;\">Pages</td>\n".
|
||||||
"|style=\"font-weight: bold;\"|Changes\n".
|
"<td style=\"font-weight: bold;\">Changes</td>\n".
|
||||||
"|style=\"font-weight: bold;\"|Username\n";
|
"<td style=\"font-weight: bold;\">Username</td>\n";
|
||||||
|
|
||||||
|
$skin =& $wgUser->getSkin();
|
||||||
while ( $row = $dbr->fetchObject( $res ) ) {
|
while ( $row = $dbr->fetchObject( $res ) ) {
|
||||||
$wikiUserName = $row->user_name;
|
$output .= "</tr><tr>\n<td>" .
|
||||||
$output .= "|-\n|" .
|
round($row->wiki_rank,0) . "\n</td><td>" .
|
||||||
round($row->wiki_rank,0) . "\n|" .
|
$row->page_count . "\n</td><td>" .
|
||||||
$row->page_count . "\n|" .
|
$row->rev_count . "\n</td><td>" .
|
||||||
$row->rev_count . "\n|" .
|
$skin->userLink( $row->user_id, $row->user_name ) .
|
||||||
"[[User:".$wikiUserName."|".$wikiUserName."]] ([[User_talk:".$wikiUserName."|Talk]] | [[Special:Contributions/".$wikiUserName."|contribs]])" . "\n";
|
$skin->userToolLinks( $row->user_id, $row->user_name ) . "</td>\n";
|
||||||
}
|
}
|
||||||
$output .= "|}";
|
$output .= "</tr></table>";
|
||||||
$dbr->freeResult( $res );
|
$dbr->freeResult( $res );
|
||||||
|
|
||||||
return $output;
|
return $output;
|
||||||
|
@ -80,21 +103,17 @@ class ContributionScores extends SpecialPage
|
||||||
array(0,50));
|
array(0,50));
|
||||||
}
|
}
|
||||||
|
|
||||||
$wgOut->addWikiText ("Scores are calculated as follows:\n".
|
$wgOut->addWikiText (wfMsgForContent('contributionscores-info'));
|
||||||
"*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.");
|
|
||||||
|
|
||||||
foreach ( $contribScoreReports as $scoreReport) {
|
foreach ( $contribScoreReports as $scoreReport) {
|
||||||
if ( $scoreReport[0] > 0 ) {
|
if ( $scoreReport[0] > 0 ) {
|
||||||
$reportTitle = "Last $scoreReport[0] Days";
|
$reportTitle = wfMsgForContent('contributionscores-days', $scoreReport[0]);
|
||||||
} else {
|
} else {
|
||||||
$reportTitle = "All Revisions";
|
$reportTitle = wfMsgForContent('contributionscores-allrevisions');
|
||||||
}
|
}
|
||||||
$reportTitle .= " (Top $scoreReport[1])";
|
$reportTitle .= " " . wfMsgForContent('contributionscores-top', $scoreReport[1]);
|
||||||
$wgOut->addWikiText ("== $reportTitle ==\n".$this->genContributionScoreTable($scoreReport[0],$scoreReport[1]));
|
$wgOut->addWikiText ("== $reportTitle ==\n");
|
||||||
|
$wgOut->addHtml( $this->genContributionScoreTable($scoreReport[0],$scoreReport[1]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue