From: Magnus Manske Date: Sun, 1 Aug 2004 12:19:43 +0000 (+0000) Subject: Article validation code (list of validated pages) X-Git-Tag: 1.5.0alpha1~2548 X-Git-Url: http://git.cyclocoop.org/fichier?a=commitdiff_plain;h=bd2c0ed7d51276ca75e1ef26e78e0cac200dbb83;p=lhc%2Fweb%2Fwiklou.git Article validation code (list of validated pages) --- diff --git a/includes/SpecialValidate.php b/includes/SpecialValidate.php index 3af59d6517..8f0915a3e8 100644 --- a/includes/SpecialValidate.php +++ b/includes/SpecialValidate.php @@ -254,7 +254,7 @@ class Validation # Show statistics for the different versions of a single article function getPageStatistics ( $article_title = "" ) { - global $wgLang, $wgUser ; + global $wgLang, $wgUser , $wgOut ; $validationtypes = $wgLang->getValidationTypes() ; if ( $article_title == "" ) $article_title = $_GET['article_title'] ; $d = $this->getData ( -1 , $article_title , -1 ) ; @@ -271,8 +271,10 @@ class Validation } # Generating HTML - $html = "

Page validation statistics

\n" ; - + $title = Title::newFromDBkey ( $article_title ) ; + $wgOut->setPageTitle ( wfMsg ( 'val_page_validation_statistics' , $title->getText() ) ) ; +# $html = "

" . wfMsg ( 'val_page_validation_statistics' , $title->getText() ) . "

\n" ; + $html = "" ; $skin = $wgUser->getSkin() ; $listurl = $skin->makeSpecialURL ( "validate" , "mode=list_page" ) ; $html .= "" . wfMsg('val_article_lists') . "

\n" ; @@ -365,6 +367,117 @@ class Validation function getArticleList () { + global $wgLang , $wgOut ; + $validationtypes = $wgLang->getValidationTypes() ; + $wgOut->setPageTitle ( wfMsg ( 'val_article_lists' ) ) ; + $html = "" ; + + # Choices + $choice = array () ; + $maxw = 0 ; + foreach ( $validationtypes AS $idx => $data ) + { + $x = explode ( "|" , $data , 4 ) ; + if ( $x[3] > $maxw ) $maxw = $x[3] ; + } + foreach ( $validationtypes AS $idx => $data ) + { + $choice[$idx] = array () ; + for ( $a = 0 ; $a < $maxw ; $a++ ) + { + $var = "cb_{$idx}_{$a}" ; + if ( isset ( $_POST[$var] ) ) $choice[$idx][$a] = $_POST[$var] ; # Selected + else if ( !isset ( $_POST["doit"] ) ) $choice[$idx][$a] = 1 ; # First time + else $choice[$idx][$a] = 0 ; # De-selected + } + } + + + # The form + $html .= "
\n" ; + $html .= "" ; + foreach ( $validationtypes AS $idx => $data ) + { + $x = explode ( "|" , $data , 4 ) ; + + $html .= "" ; + $html .= "" ; + $html .= "" ; + + for ( $a = 0 ; $a < $maxw ; $a++ ) + { + if ( $a < $x[3] ) + { + $td = "\n" ; + $html .= "" ; + $html .= "
{$x[0]}{$x[1]}
\n" ; + $html .= "
\n" ; + + # The query + $articles = array() ; + $sql = "SELECT DISTINCT val_title,val_timestamp,val_type,avg(val_value) AS avg FROM validate GROUP BY val_title,val_timestamp,val_type" ; + $res = wfQuery( $sql, DB_READ ); + while( $s = wfFetchObject( $res ) ) $articles[$s->val_title][$s->val_timestamp][$s->val_type] = $s ; + + # The list + $html .= "\n" ; + return $html ; + } + + function getVersionLink ( &$title , $timestamp ) + { + $dbkey = $title->getDBkey () ; + $this->find_this_version ( $dbkey , $timestamp , $table_id , $table_name ) ; + if ( $table_name == 'cur' ) $link = $title->getLocalURL( "" ) ; + else $link = $title->getLocalURL( "action=validate×tamp={$table_id}" ) ; + $linktitle = wfMsg( 'val_version_of', gmdate( "F d, Y H:i:s", wfTimestamp2Unix( $timestamp ) ) ) ; + $link = "" . $linktitle . "" ; + if ( $table_name == 'cur' ) $link .= " (" . wfMsg ( 'val_this_is_current_version' ) . ")" ; + + $vlink = wfMsg ( 'val_tab' ) ; + $vlink = "[getLocalURL( "action=validate×tamp={$timestamp}" ) . "\">{$vlink}] " . $link ; + return $vlink ; } } diff --git a/languages/Language.php b/languages/Language.php index 1483e79968..2fa2158f42 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -1284,7 +1284,8 @@ merging will fill in the other options with your previous settings.', 'val_no_anon_validation' => 'You have to be logged in to validate an article.', 'val_validate_article_namespace_only' => 'Only articles can be validated. This page is not in the article namespace.', 'val_validated' => 'Validation done.', -'val_article_lists' => 'List validated articles', +'val_article_lists' => 'List of validated articles', +'val_page_validation_statistics' => 'Page validation statistics for $1', # Move page #