From 477f1ce36bef6e4c94c2306eb36836d39b89c6bc Mon Sep 17 00:00:00 2001 From: Magnus Manske Date: Sat, 31 Jul 2004 13:55:52 +0000 Subject: [PATCH] Article validation code (statistics update) --- includes/SpecialValidate.php | 41 ++++++++++++++++++++++++++---------- languages/Language.php | 8 ++++--- 2 files changed, 35 insertions(+), 14 deletions(-) diff --git a/includes/SpecialValidate.php b/includes/SpecialValidate.php index 4ec0869dce..eccd77b719 100644 --- a/includes/SpecialValidate.php +++ b/includes/SpecialValidate.php @@ -226,16 +226,27 @@ class Validation return $ret ; } + # Show statistics for the different versions of a single article function getPageStatistics ( $article_title = "" ) { global $wgLang, $wgUser ; $validationtypes = $wgLang->getValidationTypes() ; $article_title = $_GET['article_title'] ; - $html = "

Page validation statistics

\n" ; $d = $this->getData ( -1 , $article_title , -1 ) ; if ( count ( $d ) ) $d = array_shift ( $d ) ; else $d = array () ; krsort ( $d ) ; + + # Getting table data (cur_id, old_id etc.) for each version + $table_id = array() ; + $table_name = array() ; + foreach ( $d AS $version => $data ) + { + $this->find_this_version ( $article_title , $version , $table_id[$version] , $table_name[$version] ) ; + } + + # Generating HTML + $html = "

Page validation statistics

\n" ; $html .= "\n" ; $html .= "" ; foreach ( $validationtypes AS $idx => $title ) @@ -247,12 +258,18 @@ class Validation $html .= "\n" ; foreach ( $d AS $version => $data ) { + # Preamble for this version $title = Title::newFromDBkey ( $article_title ) ; - $version_link = $title->getLocalURL( "action=validate×tamp={$version}" ) ; - $version_link = "" . gmdate("F d, Y H:i:s",wfTimestamp2Unix($version)) . "" ; + $version_date = gmdate("F d, Y H:i:s",wfTimestamp2Unix($version)) ; + $version_validate_link = $title->getLocalURL( "action=validate×tamp={$version}" ) ; + $version_validate_link = "" . wfMsg('val_validate_version') . "" ; + if ( $table_name[$version] == 'cur' ) $version_view_link = $title->getLocalURL( "" ) ; + else $version_view_link = $title->getLocalURL( "oldid={$table_id[$version]}" ) ; + $version_view_link = "" . wfMsg('val_view_version') . "" ; $html .= "" ; - $html .= "" ; + $html .= "" ; + # Individual data $vmax = array() ; $vcur = array() ; $users = array() ; @@ -270,12 +287,10 @@ class Validation } } - $total_count = 0 ; $total_percent = 0 ; foreach ( $validationtypes AS $idx => $title ) { - $html .= "" ; } if ( $total_count > 0 ) { $total = $total_percent / $total_count ; - $total = "{$total} %" ; + $total = number_format ( $total , 2 ) . " %" ; } else $total = "" ; - $html .= "" ; + $html .= "" ; $html .= "" ; } diff --git a/languages/Language.php b/languages/Language.php index 5c71635ca7..352f144f75 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -1260,7 +1260,7 @@ Type the name of the user in the box and press the button to make the user an ad # Validation 'val_clear_old' => 'Clear my other validation data for $1', -'val_merge_old' => 'Merge my other validation data into this version', +'val_merge_old' => 'Use my previous assessment where selected \'No opinion\'', 'val_form_note' => 'Hint: Merging your data means that for the article revision you select, all options where you have specified no opinion will be set to the value and comment of the most recent revision for which you @@ -1269,8 +1269,8 @@ for a newer revision, but also keep your other settings for this article in this revision, just select which option you intend to change, and merging will fill in the other options with your previous settings.', 'val_noop' => 'No opinion', -'val_percent' => '$1%
($2 of $3 points by $4 users)', -'val_percent_single' => '$1%
($2 of $3 points by one user)', +'val_percent' => '$1%
($2 of $3 points
by $4 users)', +'val_percent_single' => '$1%
($2 of $3 points
by one user)', 'val_total' => 'Total', 'val_version' => 'Version', 'val_tab' => 'Validate', @@ -1278,6 +1278,8 @@ merging will fill in the other options with your previous settings.', 'val_version_of' => "

Version of $1

\n" , 'val_table_header' => "$1$1\n", 'val_stat_link_text' => 'Validation statistics for this article', +'val_view_version' => 'View this version', +'val_validate_version' => 'Validate this version', # Move page # -- 2.20.1
" . wfMsg('val_version') . "
{$version_link}{$version_date}
{$version_view_link}
{$version_validate_link}
" ; if ( isset ( $vcur[$idx] ) ) { $average = 100 * $vcur[$idx] / $vmax[$idx] ; @@ -283,23 +298,27 @@ class Validation $total_percent += $average ; if ( $users[$idx] > 1 ) $h = wfMsg ( "val_percent" ) ; else $h = wfMsg ( "val_percent_single" ) ; - $h = str_replace ( "$1" , $average , $h ) ; + $h = str_replace ( "$1" , number_format ( $average , 2 ) , $h ) ; $h = str_replace ( "$2" , $vcur[$idx] , $h ) ; $h = str_replace ( "$3" , $vmax[$idx] , $h ) ; $h = str_replace ( "$4" , $users[$idx] , $h ) ; - $html .= $h ; + $html .= "" . $h ; + } + else + { + $html .= "" ; + $html .= "(" . wfMsg ( "val_noop" ) . ")" ; } - else $html .= "(" . wfMsg ( "val_noop" ) . ")" ; $html .= "{$total}{$total}
ClassOpinionComment