Index: trunk/phase3/includes/Article.php |
— | — | @@ -1284,6 +1284,8 @@ |
1285 | 1285 | $v = new Validation ; |
1286 | 1286 | if ( $wgRequest->getVal ( "mode" , "" ) == "list" ) |
1287 | 1287 | $t = $v->showList ( $this ) ; |
| 1288 | + else if ( $wgRequest->getVal ( "mode" , "" ) == "details" ) |
| 1289 | + $t = $v->showDetails ( $this , $wgRequest->getVal( 'revision' ) ) ; |
1288 | 1290 | else |
1289 | 1291 | $t = $v->validatePageForm ( $this , $revision ) ; |
1290 | 1292 | |
Index: trunk/phase3/includes/SpecialValidate.php |
— | — | @@ -201,10 +201,17 @@ |
202 | 202 | # This function returns a link text to the page validation statistics |
203 | 203 | function link2statistics ( &$article ) { |
204 | 204 | $nt = $article->getTitle(); |
205 | | - $url = htmlspecialchars( $nt->getLocalURL( 'action=validate&mode=list' ) ); |
| 205 | + $url = htmlspecialchars( $nt->getLocalURL( "action=validate&mode=list" ) ); |
206 | 206 | return wfMsg ( 'val_rev_stats_link', $nt->getPrefixedText(), $url ); |
207 | 207 | } |
208 | 208 | |
| 209 | + # This function returns a link text to the page validation statistics of a single revision |
| 210 | + function link2revisionstatistics ( &$article , $revision ) { |
| 211 | + $nt = $article->getTitle(); |
| 212 | + $url = htmlspecialchars( $nt->getLocalURL( "action=validate&mode=details&revision={$revision}" ) ); |
| 213 | + return wfMsg ( 'val_revision_stats_link', $url ); |
| 214 | + } |
| 215 | + |
209 | 216 | # Returns the timestamp of a revision based on the revision number |
210 | 217 | function getTimestamp ( $revision ) { |
211 | 218 | $ts = $this->rev2date[$revision] ; |
— | — | @@ -308,6 +315,7 @@ |
309 | 316 | function validatePageForm ( &$article , $revision ) { |
310 | 317 | global $wgOut, $wgRequest ; |
311 | 318 | |
| 319 | + $ret = "" ; |
312 | 320 | $this->prepareRevisions ( $article->getID() ) ; |
313 | 321 | $this->topicList = $this->getTopicList() ; |
314 | 322 | $this->voteCache = $this->getVoteList ( $article->getID() ) ; |
— | — | @@ -323,6 +331,7 @@ |
324 | 332 | $this->updateRevision ( $article , $id ) ; |
325 | 333 | if ( $mergeOldRev ) $this->mergeOldRevisions ( $article , $id ) ; |
326 | 334 | if ( $clearOldRev ) $this->clearOldRevisions ( $article , $id ) ; |
| 335 | + $ret .= "<p><font color='red'>" . wfMsg ( 'val_revision_changes_ok' ) . "</font></p>" ; |
327 | 336 | } |
328 | 337 | |
329 | 338 | # Make sure the requested revision exists |
— | — | @@ -333,7 +342,6 @@ |
334 | 343 | krsort ( $this->voteCache ) ; |
335 | 344 | |
336 | 345 | # Output |
337 | | - $ret = "" ; |
338 | 346 | $title = $article->getTitle(); |
339 | 347 | $title = $title->getPrefixedText() ; |
340 | 348 | $wgOut->setPageTitle ( wfMsg ( 'val_rev_for' ) . $title ) ; |
— | — | @@ -390,11 +398,75 @@ |
391 | 399 | $r .= "</form>\n" ; |
392 | 400 | return $r ; |
393 | 401 | } |
| 402 | + |
| 403 | + function showDetails ( &$article , $revision ) { |
| 404 | + global $wgDBprefix , $wgOut ; |
| 405 | + $this->prepareRevisions ( $article->getID() ) ; |
| 406 | + $this->topicList = $this->getTopicList() ; |
| 407 | + |
| 408 | + $title = $article->getTitle() ; |
| 409 | + $wgOut->setPageTitle ( str_replace ( '$1' , $title->getPrefixedText() , wfMsg ( 'val_validation_of' ) ) ) ; |
| 410 | + |
| 411 | + # Collecting statistic data |
| 412 | + $id = $article->getID() ; |
| 413 | + $sql = "SELECT * FROM {$wgDBprefix}validate WHERE val_page='{$id}' AND val_revision='{$revision}'" ; |
| 414 | + $res = wfQuery( $sql, DB_READ ); |
| 415 | + $data = array () ; |
| 416 | + $users = array () ; |
| 417 | + $topics = array () ; |
| 418 | + while( $x = wfFetchObject( $res ) ) { |
| 419 | + $data[$x->val_user][$x->val_type] = $x ; |
| 420 | + $users[$x->val_user] = true ; |
| 421 | + $topics[$x->val_type] = true ; |
| 422 | + } |
| 423 | + |
| 424 | + # Sorting lists of topics and users |
| 425 | + ksort ( $users ) ; |
| 426 | + ksort ( $topics ) ; |
| 427 | + |
| 428 | + $ts = $this->getTimestamp ( $revision ) ; |
| 429 | + $url = $this->getVersionLink ( $article , $revision , wfTimestamp ( TS_DB , $ts ) ) ; |
| 430 | + |
| 431 | + # Table headers |
| 432 | + $ret = "" ; |
| 433 | + $ret .= "<p><b>" . str_replace ( '$1' , $url , wfMsg ( 'val_revision_of' ) ) . "</b></p>\n" ; |
| 434 | + $ret .= "<table border='1' cellspacing='0' cellpadding='2'>\n" ; |
| 435 | + $ret .= "<tr><th/>" ; |
| 436 | + |
| 437 | + foreach ( $topics AS $t => $dummy ) { |
| 438 | + $ret .= "<th>" . $this->topicList[$t]->val_comment . "</th>" ; |
| 439 | + } |
| 440 | + $ret .= "</tr>\n" ; |
| 441 | + |
| 442 | + # Table data |
| 443 | + foreach ( $users AS $u => $dummy ) { # Every row a user |
| 444 | + $ret .= "<tr>" ; |
| 445 | + $ret .= "<th>" . str_replace ( "$1" , $u , wfMsg ( 'val_details_th_user') ) . "</th>" ; |
| 446 | + foreach ( $topics AS $t => $dummy ) { # Every column a topic |
| 447 | + if ( !isset ( $data[$u][$t] ) ) $ret .= "<td/>" ; |
| 448 | + else { |
| 449 | + $ret .= "<td valign='center'>" ; |
| 450 | + $ret .= $data[$u][$t]->val_value ; |
| 451 | + if ( $data[$u][$t]->val_comment != "" ) |
| 452 | + $ret .= " <small>(" . $data[$u][$t]->val_comment . ")</small>" ; |
| 453 | + $ret .= "</td>" ; |
| 454 | + } |
| 455 | + } |
| 456 | + $ret .= "</tr>" ; |
| 457 | + } |
| 458 | + $ret .= "</table>" ; |
| 459 | + $ret .= "<p>" . $this->link2statistics ( $article ) . "</p>" ; |
| 460 | + |
| 461 | + return $ret ; |
| 462 | + } |
394 | 463 | |
395 | 464 | function showList ( &$article ) { |
396 | | - global $wgDBprefix ; |
| 465 | + global $wgDBprefix , $wgOut; |
397 | 466 | $this->prepareRevisions ( $article->getID() ) ; |
398 | 467 | $this->topicList = $this->getTopicList() ; |
| 468 | + |
| 469 | + $title = $article->getTitle() ; |
| 470 | + $wgOut->setPageTitle ( str_replace ( '$1' , $title->getPrefixedText() , wfMsg ( 'val_validation_of' ) ) ) ; |
399 | 471 | |
400 | 472 | # Collecting statistic data |
401 | 473 | $id = $article->getID() ; |
— | — | @@ -402,7 +474,6 @@ |
403 | 475 | $res = wfQuery( $sql, DB_READ ); |
404 | 476 | $data = array () ; |
405 | 477 | while( $x = wfFetchObject( $res ) ) { |
406 | | - #$idx = $x->val_revision ; |
407 | 478 | $idx = $this->getTimestamp ( $x->val_revision ) ; |
408 | 479 | if ( !isset ( $data[$idx] ) ) |
409 | 480 | $data[$idx] = array () ; |
— | — | @@ -419,16 +490,14 @@ |
420 | 491 | $ret = "" ; |
421 | 492 | $ret .= "<table border='1' cellspacing='0' cellpadding='2'>\n" ; |
422 | 493 | $ret .= "<tr><th>" . wfMsg("val_revision") . "</th>" ; |
423 | | -# $ret .= "<th>" . wfMsg("val_time") . "</th>" ; |
424 | 494 | foreach ( $this->topicList AS $x => $y ) |
425 | 495 | $ret .= "<th>{$y->val_comment}</th>" ; |
426 | 496 | $ret .= "</tr>\n" ; |
427 | 497 | foreach ( $data AS $ts => $y ) { |
428 | 498 | $revision = $this->getRevisionNumber ( $ts ) ; |
429 | | -# $url = $this->getVersionLink ( $article , $revision , $revision ) ; |
430 | 499 | $url = $this->getVersionLink ( $article , $revision , wfTimestamp ( TS_DB , $ts ) ) ; |
431 | | - $ret .= "<tr><th>{$url}</th>" ; |
432 | | -# $ret .= "<td nowrap>" . wfTimestamp ( TS_DB , $ts ) . "</td>" ; |
| 500 | + $detailsurl = $this->link2revisionstatistics ( $article , $revision ) ; |
| 501 | + $ret .= "<tr><td>{$url} {$detailsurl}</td>" ; |
433 | 502 | foreach ( $this->topicList AS $topicID => $dummy ) { |
434 | 503 | if ( isset ( $y[$topicID] ) ) { |
435 | 504 | $z = $y[$topicID] ; |
Index: trunk/phase3/languages/Language.php |
— | — | @@ -105,16 +105,6 @@ |
106 | 106 | 'chick' => 'Chick' |
107 | 107 | ); |
108 | 108 | |
109 | | -# Validation types |
110 | | -$wgValidationTypesEn = array ( |
111 | | - '0' => "Style|Awful|Awesome|5", |
112 | | - '1' => "Legal|Illegal|Legal|5", |
113 | | - '2' => "Completeness|Stub|Extensive|5", |
114 | | - '3' => "Facts|Wild guesses|Solid as a rock|5", |
115 | | - '4' => "Suitable for 1.0 (paper)|No|Yes|2", |
116 | | - '5' => "Suitable for 1.0 (CD)|No|Yes|2" |
117 | | -); |
118 | | - |
119 | 109 | /* private */ $wgMathNamesEn = array( |
120 | 110 | MW_MATH_PNG => 'mw_math_png', |
121 | 111 | MW_MATH_SIMPLE => 'mw_math_simple', |
— | — | @@ -1494,7 +1484,12 @@ |
1495 | 1485 | 'val_del' => 'Delete', |
1496 | 1486 | 'val_warning' => '<b>Never, <i>ever</i>, change something here without <i>explicit</i> community consensus!</b>', |
1497 | 1487 | 'val_rev_for' => 'Revisions for ', |
| 1488 | +'val_details_th_user' => 'User #$1', |
| 1489 | +'val_validation_of' => 'Validation of "$1"', |
| 1490 | +'val_revision_of' => 'Revision of $1', |
| 1491 | +'val_revision_changes_ok' => 'Your ratings have been stored!', |
1498 | 1492 | 'val_rev_stats_link' => 'See the validation statistics for "$1" <a href="$2">here</a>', |
| 1493 | +'val_revision_stats_link' => '(<a href="$1">details</a>)', |
1499 | 1494 | 'val_iamsure' => 'Check this box if you really mean it!', |
1500 | 1495 | 'val_clear_old' => 'Clear my older validation data', |
1501 | 1496 | 'val_merge_old' => 'Use my previous assessment where selected \'No opinion\'', |