From: Magnus Manske Date: Sat, 21 May 2005 14:09:24 +0000 (+0000) Subject: validation updates X-Git-Tag: 1.5.0alpha2~136 X-Git-Url: https://git.cyclocoop.org/%2C?a=commitdiff_plain;h=48bf97d21ad277fc06a69583e878b0f7fb8a9c70;p=lhc%2Fweb%2Fwiklou.git validation updates --- diff --git a/includes/Article.php b/includes/Article.php index 5f872f27b9..dd64784ada 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -1284,6 +1284,8 @@ class Article { $v = new Validation ; if ( $wgRequest->getVal ( "mode" , "" ) == "list" ) $t = $v->showList ( $this ) ; + else if ( $wgRequest->getVal ( "mode" , "" ) == "details" ) + $t = $v->showDetails ( $this , $wgRequest->getVal( 'revision' ) ) ; else $t = $v->validatePageForm ( $this , $revision ) ; diff --git a/includes/SpecialValidate.php b/includes/SpecialValidate.php index e78be0fdfa..b95716256d 100644 --- a/includes/SpecialValidate.php +++ b/includes/SpecialValidate.php @@ -201,10 +201,17 @@ class Validation { # This function returns a link text to the page validation statistics function link2statistics ( &$article ) { $nt = $article->getTitle(); - $url = htmlspecialchars( $nt->getLocalURL( 'action=validate&mode=list' ) ); + $url = htmlspecialchars( $nt->getLocalURL( "action=validate&mode=list" ) ); return wfMsg ( 'val_rev_stats_link', $nt->getPrefixedText(), $url ); } + # This function returns a link text to the page validation statistics of a single revision + function link2revisionstatistics ( &$article , $revision ) { + $nt = $article->getTitle(); + $url = htmlspecialchars( $nt->getLocalURL( "action=validate&mode=details&revision={$revision}" ) ); + return wfMsg ( 'val_revision_stats_link', $url ); + } + # Returns the timestamp of a revision based on the revision number function getTimestamp ( $revision ) { $ts = $this->rev2date[$revision] ; @@ -308,6 +315,7 @@ class Validation { function validatePageForm ( &$article , $revision ) { global $wgOut, $wgRequest ; + $ret = "" ; $this->prepareRevisions ( $article->getID() ) ; $this->topicList = $this->getTopicList() ; $this->voteCache = $this->getVoteList ( $article->getID() ) ; @@ -323,6 +331,7 @@ class Validation { $this->updateRevision ( $article , $id ) ; if ( $mergeOldRev ) $this->mergeOldRevisions ( $article , $id ) ; if ( $clearOldRev ) $this->clearOldRevisions ( $article , $id ) ; + $ret .= "

" . wfMsg ( 'val_revision_changes_ok' ) . "

" ; } # Make sure the requested revision exists @@ -333,7 +342,6 @@ class Validation { krsort ( $this->voteCache ) ; # Output - $ret = "" ; $title = $article->getTitle(); $title = $title->getPrefixedText() ; $wgOut->setPageTitle ( wfMsg ( 'val_rev_for' ) . $title ) ; @@ -390,11 +398,75 @@ class Validation { $r .= "\n" ; return $r ; } + + function showDetails ( &$article , $revision ) { + global $wgDBprefix , $wgOut ; + $this->prepareRevisions ( $article->getID() ) ; + $this->topicList = $this->getTopicList() ; + + $title = $article->getTitle() ; + $wgOut->setPageTitle ( str_replace ( '$1' , $title->getPrefixedText() , wfMsg ( 'val_validation_of' ) ) ) ; + + # Collecting statistic data + $id = $article->getID() ; + $sql = "SELECT * FROM {$wgDBprefix}validate WHERE val_page='{$id}' AND val_revision='{$revision}'" ; + $res = wfQuery( $sql, DB_READ ); + $data = array () ; + $users = array () ; + $topics = array () ; + while( $x = wfFetchObject( $res ) ) { + $data[$x->val_user][$x->val_type] = $x ; + $users[$x->val_user] = true ; + $topics[$x->val_type] = true ; + } + + # Sorting lists of topics and users + ksort ( $users ) ; + ksort ( $topics ) ; + + $ts = $this->getTimestamp ( $revision ) ; + $url = $this->getVersionLink ( $article , $revision , wfTimestamp ( TS_DB , $ts ) ) ; + + # Table headers + $ret = "" ; + $ret .= "

" . str_replace ( '$1' , $url , wfMsg ( 'val_revision_of' ) ) . "

\n" ; + $ret .= "\n" ; + $ret .= "" ; + } + $ret .= "\n" ; + + # Table data + foreach ( $users AS $u => $dummy ) { # Every row a user + $ret .= "" ; + $ret .= "" ; + foreach ( $topics AS $t => $dummy ) { # Every column a topic + if ( !isset ( $data[$u][$t] ) ) $ret .= "" ; + } + } + $ret .= "" ; + } + $ret .= "
" ; + + foreach ( $topics AS $t => $dummy ) { + $ret .= "" . $this->topicList[$t]->val_comment . "
" . str_replace ( "$1" , $u , wfMsg ( 'val_details_th_user') ) . "" ; + else { + $ret .= "" ; + $ret .= $data[$u][$t]->val_value ; + if ( $data[$u][$t]->val_comment != "" ) + $ret .= " (" . $data[$u][$t]->val_comment . ")" ; + $ret .= "
" ; + $ret .= "

" . $this->link2statistics ( $article ) . "

" ; + + return $ret ; + } function showList ( &$article ) { - global $wgDBprefix ; + global $wgDBprefix , $wgOut; $this->prepareRevisions ( $article->getID() ) ; $this->topicList = $this->getTopicList() ; + + $title = $article->getTitle() ; + $wgOut->setPageTitle ( str_replace ( '$1' , $title->getPrefixedText() , wfMsg ( 'val_validation_of' ) ) ) ; # Collecting statistic data $id = $article->getID() ; @@ -402,7 +474,6 @@ class Validation { $res = wfQuery( $sql, DB_READ ); $data = array () ; while( $x = wfFetchObject( $res ) ) { - #$idx = $x->val_revision ; $idx = $this->getTimestamp ( $x->val_revision ) ; if ( !isset ( $data[$idx] ) ) $data[$idx] = array () ; @@ -419,16 +490,14 @@ class Validation { $ret = "" ; $ret .= "\n" ; $ret .= "" ; -# $ret .= "" ; foreach ( $this->topicList AS $x => $y ) $ret .= "" ; $ret .= "\n" ; foreach ( $data AS $ts => $y ) { $revision = $this->getRevisionNumber ( $ts ) ; -# $url = $this->getVersionLink ( $article , $revision , $revision ) ; $url = $this->getVersionLink ( $article , $revision , wfTimestamp ( TS_DB , $ts ) ) ; - $ret .= "" ; -# $ret .= "" ; + $detailsurl = $this->link2revisionstatistics ( $article , $revision ) ; + $ret .= "" ; foreach ( $this->topicList AS $topicID => $dummy ) { if ( isset ( $y[$topicID] ) ) { $z = $y[$topicID] ; diff --git a/languages/Language.php b/languages/Language.php index e1ad746184..59e88a59da 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -105,16 +105,6 @@ if(isset($wgExtraNamespaces)) { 'chick' => 'Chick' ); -# 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', @@ -1494,7 +1484,12 @@ Type the name of the user in the box and press the button to make the user an ad 'val_del' => 'Delete', 'val_warning' => 'Never, ever, change something here without explicit community consensus!', 'val_rev_for' => 'Revisions for ', +'val_details_th_user' => 'User #$1', +'val_validation_of' => 'Validation of "$1"', +'val_revision_of' => 'Revision of $1', +'val_revision_changes_ok' => 'Your ratings have been stored!', 'val_rev_stats_link' => 'See the validation statistics for "$1" here', +'val_revision_stats_link' => '(details)', 'val_iamsure' => 'Check this box if you really mean it!', 'val_clear_old' => 'Clear my older validation data', 'val_merge_old' => 'Use my previous assessment where selected \'No opinion\'',
" . wfMsg("val_revision") . "" . wfMsg("val_time") . "{$y->val_comment}
{$url}" . wfTimestamp ( TS_DB , $ts ) . "
{$url} {$detailsurl}