# 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] ;
function validatePageForm ( &$article , $revision ) {
global $wgOut, $wgRequest ;
+ $ret = "" ;
$this->prepareRevisions ( $article->getID() ) ;
$this->topicList = $this->getTopicList() ;
$this->voteCache = $this->getVoteList ( $article->getID() ) ;
$this->updateRevision ( $article , $id ) ;
if ( $mergeOldRev ) $this->mergeOldRevisions ( $article , $id ) ;
if ( $clearOldRev ) $this->clearOldRevisions ( $article , $id ) ;
+ $ret .= "<p><font color='red'>" . wfMsg ( 'val_revision_changes_ok' ) . "</font></p>" ;
}
# Make sure the requested revision exists
krsort ( $this->voteCache ) ;
# Output
- $ret = "" ;
$title = $article->getTitle();
$title = $title->getPrefixedText() ;
$wgOut->setPageTitle ( wfMsg ( 'val_rev_for' ) . $title ) ;
$r .= "</form>\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 .= "<p><b>" . str_replace ( '$1' , $url , wfMsg ( 'val_revision_of' ) ) . "</b></p>\n" ;
+ $ret .= "<table border='1' cellspacing='0' cellpadding='2'>\n" ;
+ $ret .= "<tr><th/>" ;
+
+ foreach ( $topics AS $t => $dummy ) {
+ $ret .= "<th>" . $this->topicList[$t]->val_comment . "</th>" ;
+ }
+ $ret .= "</tr>\n" ;
+
+ # Table data
+ foreach ( $users AS $u => $dummy ) { # Every row a user
+ $ret .= "<tr>" ;
+ $ret .= "<th>" . str_replace ( "$1" , $u , wfMsg ( 'val_details_th_user') ) . "</th>" ;
+ foreach ( $topics AS $t => $dummy ) { # Every column a topic
+ if ( !isset ( $data[$u][$t] ) ) $ret .= "<td/>" ;
+ else {
+ $ret .= "<td valign='center'>" ;
+ $ret .= $data[$u][$t]->val_value ;
+ if ( $data[$u][$t]->val_comment != "" )
+ $ret .= " <small>(" . $data[$u][$t]->val_comment . ")</small>" ;
+ $ret .= "</td>" ;
+ }
+ }
+ $ret .= "</tr>" ;
+ }
+ $ret .= "</table>" ;
+ $ret .= "<p>" . $this->link2statistics ( $article ) . "</p>" ;
+
+ 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() ;
$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 () ;
$ret = "" ;
$ret .= "<table border='1' cellspacing='0' cellpadding='2'>\n" ;
$ret .= "<tr><th>" . wfMsg("val_revision") . "</th>" ;
-# $ret .= "<th>" . wfMsg("val_time") . "</th>" ;
foreach ( $this->topicList AS $x => $y )
$ret .= "<th>{$y->val_comment}</th>" ;
$ret .= "</tr>\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 .= "<tr><th>{$url}</th>" ;
-# $ret .= "<td nowrap>" . wfTimestamp ( TS_DB , $ts ) . "</td>" ;
+ $detailsurl = $this->link2revisionstatistics ( $article , $revision ) ;
+ $ret .= "<tr><td>{$url} {$detailsurl}</td>" ;
foreach ( $this->topicList AS $topicID => $dummy ) {
if ( isset ( $y[$topicID] ) ) {
$z = $y[$topicID] ;
'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',
'val_del' => 'Delete',
'val_warning' => '<b>Never, <i>ever</i>, change something here without <i>explicit</i> community consensus!</b>',
'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" <a href="$2">here</a>',
+'val_revision_stats_link' => '(<a href="$1">details</a>)',
'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\'',