From 8e05a6497dfd2c35b7206b503b1266c0a985d24c Mon Sep 17 00:00:00 2001 From: Magnus Manske Date: Thu, 22 Jul 2004 20:38:13 +0000 Subject: [PATCH] Article validation code --- includes/SpecialValidate.php | 41 +++++++++++++++++------------------- languages/Language.php | 21 +++++++++++++++++- 2 files changed, 39 insertions(+), 23 deletions(-) diff --git a/includes/SpecialValidate.php b/includes/SpecialValidate.php index 155376e6df..392183d87c 100644 --- a/includes/SpecialValidate.php +++ b/includes/SpecialValidate.php @@ -19,13 +19,6 @@ class Validation { - # Things that should be in the language files - var $types = array ( - "0" => "Style|Awful|Awesome|5", - "1" => "Legal|Illegal|Legal|5", - "2" => "Completeness|Stub|Extensive|5", - "3" => "Facts|Wild guesses|Concrete|5" - ) ; function find_this_version ( $article_title , &$article_time , &$id , &$tab ) { @@ -68,6 +61,7 @@ class Validation { global $wgOut, $wgLang, $wgUser; if ( $wgUser->getID() == 0 ) return ; # Anon + $validationtypes = $wgLang->getValidationTypes() ; if ( $article_title == "" ) { $article_title = $_GET['article'] ; @@ -102,7 +96,7 @@ class Validation $sql .= $wgUser->getID() . "'" ; wfQuery( $sql, DB_WRITE ); - for ( $idx = 0 ; $idx < count ( $this->types) ; $idx++ ) # Changes + for ( $idx = 0 ; $idx < count ( $validationtypes) ; $idx++ ) # Changes { $comment = $_POST["comment{$idx}"] ; $comment_sql = str_replace ( "'" , "\'" , $comment ) ; @@ -122,22 +116,24 @@ class Validation # Generating HTML $html = $heading ; + $tabsep = "" ; + $topstyle = "style='border-top:2px solid black'" ; foreach ( $val AS $time => $stuff ) { - if ( $time == $article_time ) $html .= "

This version

\n" ; - else $html .= "

Version of {$time}

\n" ; + if ( $time == $article_time ) $html .= wfMsg("val_this_version") ; + else $html .= str_replace ( "$1" , gmdate("F d, Y H:i:s",wfTimestamp2Unix($time)) , wfMsg("val_version_of") ) ; $html .= "
\n" ; $html .= "" ; - $html .= "\n" ; - $html .= "\n" ; - for ( $idx = 0 ; $idx < count ( $this->types) ; $idx++ ) + $html .= "
ClassOpinionComment
\n" ; + $html .= str_replace ( "$1" , $tabsep , wfMsg("val_table_header") ) ; + for ( $idx = 0 ; $idx < count ( $validationtypes) ; $idx++ ) { - $x = explode ( "|" , $this->types[$idx] , 4 ) ; + $x = explode ( "|" , $validationtypes[$idx] , 4 ) ; if ( isset ( $stuff[$idx] ) ) $choice = $stuff[$idx]->val_value ; else $choice = -1 ; if ( isset ( $stuff[$idx] ) ) $comment = $stuff[$idx]->val_comment ; else $comment = "" ; - $html .= "{$tabsep}{$tabsep}" ; $html .= "" ; $html .= "\n" ; } - $html .= "" ; - $html .= "
{$x[0]}{$x[1]}" ; + $html .= "
{$x[0]}{$x[1]}" ; for ( $cnt = 0 ; $cnt < $x[3] ; $cnt++) { $html .= "" ; + $html .= "> " . wfMsg ( "val_noop" ) . "
" ; - $html .= str_replace ( "$1" , $article->getPrefixedURL() , wfMsg("clear_old") ) ; - $html .= "
\n" ; + $html .= "" ; + $html .= str_replace ( "$1" , $article->getPrefixedURL() , wfMsg("val_clear_old") ) ; + $html .= "" ; + $html .= "\n" ; } return $html ; } @@ -176,6 +172,7 @@ class Validation function getPageStatistics ( $article_title = "" ) { + $validationtypes = $wgLang->getValidationTypes() ; $article_title = $_GET['article'] ; $html = "

Page validation statistics

\n" ; $d = $this->getData ( -1 , $article_title , -1 ) ; @@ -183,7 +180,7 @@ class Validation else $d = array () ; $html .= "\n" ; $html .= "" ; - foreach ( $this->types AS $idx => $title ) + foreach ( $validationtypes AS $idx => $title ) { $title = explode ( "|" , $title ) ; $html .= "" ; @@ -205,7 +202,7 @@ class Validation } - foreach ( $this->types AS $idx => $title ) + foreach ( $validationtypes AS $idx => $title ) { $html .= "$1$1\n", # Move page # @@ -1505,6 +1519,11 @@ class Language { return $wgDateFormatsEn; } + function getValidationTypes() { + global $wgValidationTypesEn; + return $wgValidationTypesEn; + } + function getUserToggles() { global $wgUserTogglesEn; return $wgUserTogglesEn; -- 2.20.1
Version{$title[0]}" ; if ( isset ( $vcur[$idx] ) ) diff --git a/languages/Language.php b/languages/Language.php index cd3a7d9b27..41f3ae9ba2 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -76,6 +76,17 @@ define( "MW_MATH_SOURCE", 3 ); define( "MW_MATH_MODERN", 4 ); define( "MW_MATH_MATHML", 5 ); +# Validation types +$wgValidationTypesEn = array ( + "0" => "Style|Awful|Awesome|5", + "1" => "Legal|Illegal|Legal|5", + "2" => "Completeness|Stub|Extensive|5", + "3" => "Facts|Wild guesses|Solid as a rock|5", + "4" => "Suitable for 1.0 (paper)|No|Yes|2", + "5" => "Suitable for 1.0 (CD)|No|Yes|2" + ) ; + + /* private */ $wgMathNamesEn = array( MW_MATH_PNG => 'mw_math_png', MW_MATH_SIMPLE => 'mw_math_simple', @@ -1229,10 +1240,13 @@ Type the name of the user in the box and press the button to make the user an ad 'makesysop' => 'Make a user into a sysop', # Validation -'val_clear_old' => 'Clear my other validation data for the $2 article', +'val_clear_old' => 'Clear my other validation data for this article', 'val_noop' => 'No opinion', 'val_percent' => '$1% ($2 of $3 points)', 'val_tab' => 'Validate', +'val_this_version' => "

This version

\n", +'val_version_of' => "

Version of $1

\n" , +'val_table_header' => "
ClassOpinionComment