5107fb0ac318383b5683a708f6854c8a78ba344a
2 # Copyright (C) 2004 Magnus Manske <magnus.manske@web.de>
3 # http://www.mediawiki.org/
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License along
16 # with this program; if not, write to the Free Software Foundation, Inc.,
17 # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 # http://www.gnu.org/copyleft/gpl.html
23 * @subpackage SpecialPage
31 function getRevisionFromId( $rev_id ) {
32 if( isset( $this->id2rev
[$rev_id] ) ) return $this->id2rev
[$rev_id];
34 $db =& wfGetDB( DB_SLAVE
);
35 $fname = 'SpecialValidate::getRevisionFromId';
36 $res = $db->select( 'revision', '*', array( 'rev_id' => $rev_id ), $fname, array( 'LIMIT' => 1 ) );
37 $rev = $db->fetchObject($res);
38 $db->freeResult($res);
40 $this->id2rev
[$rev->rev_id
] = $rev;
41 $this->ts2rev
[$rev->rev_timestamp
] = $rev;
46 function getRevisionFromTimestamp( $timestamp ) {
47 if( isset( $this->ts2rev
[$timestamp] ) ) return $this->ts2rev
[$timestamp];
49 $db =& wfGetDB( DB_SLAVE
);
50 $fname = 'SpecialValidate::getRevisionFromTimestamp';
51 $res = $db->select( 'revision', '*',
52 array( 'rev_page' => $this->page_id
, 'rev_timestamp' => $timestamp ),
53 $fname, array( 'LIMIT' => 1 )
55 $rev = $db->fetchObject($res);
56 $db->freeResult($res);
58 $this->id2rev
[$rev->rev_id
] = $rev;
59 $this->ts2rev
[$rev->rev_timestamp
] = $rev;
64 # Returns a HTML link to the specified article revision
65 function getRevisionLink( &$article, $revision, $text = "" ) {
67 $sk = $wgUser->getSkin();
68 $t = $article->getTitle();
69 if( $text == "" ) $text = wfMsg("val_view_version");
70 return $sk->makeKnownLinkObj( $t, $this->getParsedWiki($text), 'oldid='.urlencode($revision) );
73 # Returns an array containing all topics you can vote on
74 function getTopicList() {
75 $db =& wfGetDB( DB_SLAVE
);
78 $res = $db->select( 'validate', '*', array( 'val_page' => 0 ), 'SpecialValidate::getTopicList' );
79 while( $topic = $db->fetchObject($res) ) {
80 $topics[$topic->val_type
] = $topic;
82 $db->freeResult($res);
88 # Merges one dataset into another
89 function mergeInto( &$source, &$dest ) {
91 foreach( $source as $x => $y ) {
93 if( !isset( $dest[$x] ) ) {
95 } elseif( $dest[$x]->value
== 0 ) {
109 # Merges all votes prior to the given revision into it
110 function mergeOldRevisions( &$article, $revision ) {
111 $tmp = $this->voteCache
;
114 $ts = $this->getRevisionTimestamp( $revision );
115 $data = $this->voteCache
[$ts];
116 foreach( $tmp as $x => $y ) {
118 if( $this->mergeInto( $y, $data ) ) {
124 $this->setRevision( $article, $revision, $data );
128 # Clears all votes prior to the given revision
129 function clearOldRevisions( &$article, $revision ) {
130 $tmp = $this->voteCache
;
131 $ts = $this->getRevisionTimestamp( $revision );
132 foreach( $tmp as $x => $y ) {
134 $this->deleteRevisionVote ( $article, $this->getRevisionId( $x ) );
139 # Updates the votes for the given revision from the FORM data
140 function updateRevision( &$article, $revision ) {
143 if( isset( $this->voteCache
[$this->getRevisionTimestamp( $revision )] ) ) {
144 $data = $this->voteCache
[$this->getRevisionTimestamp( $revision )];
148 $nv = $wgRequest->getArray( "re_v_{$revision}", array() );
149 $nc = $wgRequest->getArray( "re_c_{$revision}", array() );
151 foreach( $nv as $x => $y ) {
152 $data[$x]->value
= $y;
153 $data[$x]->comment
= $nc[$x];
157 $this->setRevision( $article, $revision, $data );
160 # Sets a specific revision to both cache and database
161 function setRevision( &$article, $revision, &$data ) {
163 $this->deleteRevisionVote( $article, $revision );
164 $this->voteCache
[ $this->getRevisionTimestamp($revision) ] = $data;
165 foreach( $data as $x => $y ) {
166 if( $y->value
> 0 ) {
167 $ip = $wgUser->isAnon() ?
$wgUser->getName() : '';
168 $dbw =& wfGetDB( DB_MASTER
);
169 $dbw->insert( 'validate',
171 'val_user' => $wgUser->getId(),
172 'val_page' => $article->getId(),
173 'val_revision' => $revision,
175 'val_value' => $y->value
,
176 'val_comment' => $y->comment
,
178 'SpecialValidate::setRevision'
184 # Returns a map identifying the current user
185 function identifyUser( $user = "" ) {
187 if( $user == "" ) $user = $wgUser->getID();
188 return User
::isIP($user)
189 ?
array( 'val_user' => 0, 'val_ip' => $user )
190 : array( 'val_user' => $user );
193 # Deletes a specific vote set in both cache and database
194 function deleteRevisionVote( &$article, $revision ) {
195 $ts = $this->getRevisionTimestamp( $revision );
196 if( !isset ( $this->voteCache
[$ts] ) ) return;
198 $db =& wfGetDB( DB_MASTER
);
202 $this->identifyUser(),
204 'val_page' => $article->getID(),
205 'val_revision' => $revision
208 'SpecialValidate::deleteRevisionVote'
211 unset( $this->voteCache
[$ts] );
214 # Reads the entire vote list for this user for the given article
215 function getVoteList( $id, $user = "" ) {
216 $db =& wfGetDB( DB_SLAVE
);
217 $res = $db->select( 'validate', '*', array_merge( array( 'val_page' => $id ), $this->identifyUser($user) ) );
219 $revisions = array();
220 while( $vote = $db->fetchObject($res) ) {
221 $ts = $this->getRevisionTimestamp( $vote->val_revision
);
222 if( ! isset( $revisions[$ts] ) ) {
223 $revisions[$ts] = array();
225 $revisions[$ts][$vote->val_type
]->value
= $vote->val_value
;
226 $revisions[$ts][$vote->val_type
]->comment
= $vote->val_comment
;
228 $db->freeResult($res);
233 # Reads the entire vote list for this user for all articles
234 # XXX Should be paged
235 function getAllVoteLists( $user ) {
236 $db =& wfGetDB( DB_SLAVE
);
237 $res = $db->select( 'validate', '*', $this->identifyUser($user) );
240 while( $vote = $db->fetchObject($res) ) {
241 $votes[$vote->val_page
][$vote->val_revision
][$vote->val_type
] = $vote;
243 $db->freeResult($res);
248 # This functions adds a topic to the database
249 function addTopic( $topic, $limit ) {
250 $db =& wfGetDB( DB_MASTER
);
253 while( isset( $this->topicList
[$next_idx] ) ) {
263 'val_type' => $next_idx,
264 'val_value' => $limit,
265 'val_comment' => $topic,
268 'SpecialValidate::addTopic'
271 $t->val_user
= $t->val_page
= $t->val_revision
= 0;
272 $t->val_type
= $next_idx;
273 $t->val_value
= $limit;
274 $t->val_comment
= $topic;
276 $this->topicList
[$next_idx] = $t;
278 ksort( $this->topicList
);
281 function deleteTopic( $id ) {
282 $db =& wfGetDB( DB_MASTER
);
283 $db->delete( 'validate', array( 'val_type' => $id ), 'SpecialValidate::deleteTopic' );
284 unset( $this->topicList
[$id] );
287 # This function returns a link text to the page validation statistics
288 function getStatisticsLink( &$article ) {
290 $sk = $wgUser->getSkin();
291 $nt = $article->getTitle();
292 return $sk->makeKnownLinkObj( $nt, wfMsg( 'val_rev_stats', $nt->getPrefixedText() ), 'action=validate&mode=list' );
295 # This function returns a link text to the page validation statistics of a single revision
296 function getRevisionStatsLink( &$article, $revision ) {
298 $sk = $wgUser->getSkin();
299 $nt = $article->getTitle();
300 $text = $this->getParsedWiki( wfMsg('val_revision_stats_link') );
301 $query = "action=validate&mode=details&revision={$revision}";
302 return '(' . $sk->makeKnownLinkObj( $nt, $text, $query ) . ')';
305 # This function returns a link text to the user rating statistics page
306 function getUserRatingsLink( $user, $text ) {
308 $sk = $wgUser->getSkin();
309 if( $user == 0 ) $user = $wgUser->getName();
310 $nt = Title
::newFromText( 'Special:Validate' );
311 return $sk->makeKnownLinkObj( $nt, $text, 'mode=userstats&user='.urlencode($user) );
314 # Returns the timestamp of a revision based on the revision number
315 function getRevisionTimestamp( $rev_id ) {
316 $rev = $this->getRevisionFromId( $rev_id );
317 return $rev->rev_timestamp
;
320 # Returns the revision number of a revision based on the timestamp
321 function getRevisionId( $ts ) {
322 $rev = $this->getRevisionFromTimestamp( $ts );
327 # HTML generation functions from this point on
329 # Returns the metadata string for a revision
330 function getMetadata( $rev_id, &$article ) {
332 $sk = $wgUser->getSkin();
335 $x = $this->getRevisionFromId($rev_id);
336 $metadata .= wfTimestamp( TS_DB
, $x->rev_timestamp
);
338 if( $x->rev_user
== 0 ) {
339 $metadata .= $x->rev_user_text
;
342 $u->setId( $x->rev_user
);
343 $u->setName( $x->rev_user_text
);
344 $nt = $u->getUserPage();
345 $metadata .= $sk->makeKnownLinkObj( $nt, htmlspecialchars( $nt->getText() ) );
347 $metadata .= ': '. $sk->commentBlock( $x->rev_comment
, $article->getTitle() );
351 # Generates a link to the topic description
352 function getTopicLink($s) {
353 $t = Title
::newFromText ( wfMsg ( 'val_topic_desc_page' ) ) ;
354 # FIXME: Why doesn't this use standard linking code?
356 $r .= $t->escapeLocalURL () ;
357 $r .= "#" . urlencode ( $s ) ;
358 $r .= "\">{$s}</a>" ;
362 # Generates HTML from a wiki text, e.g., a wfMsg
363 function getParsedWiki ( $text ) {
364 global $wgOut, $wgTitle, $wgParser ;
365 $parserOutput = $wgParser->parse( $text , $wgTitle, $wgOut->mParserOptions
,false);
366 return $parserOutput->getText() ;
369 # Generates a form for a single revision
370 function getRevisionForm( &$article, $idx, &$data, $focus = false ) {
371 # Fill data with blank values
373 $revision = $this->getRevisionId( $ts );
374 foreach( $this->topicList
as $x => $y ) {
375 if( !isset( $data[$x] ) ) {
376 $data[$x]->value
= 0;
377 $data[$x]->comment
= "";
383 $table_class = $focus ?
'revisionform_focus' : 'revisionform_default';
384 $ret = "<form method='post'><table class='{$table_class}'>\n";
385 $head = "Revision #" . $revision;
386 $link = $this->getRevisionLink( $article, $revision );
387 $metadata = $this->getMetadata( $revision, $article );
388 $ret .= "<tr><th colspan='3'>" . $head . " ({$link}) {$metadata}</th></tr>\n";
390 foreach( $data as $x => $y ) {
392 $trclass = $line == 1 ?
"revision_tr_first" : "revision_tr_default";
393 $idx = "_{$revision}[{$x}]";
394 $ret .= "<tr class='{$trclass}'>\n";
396 $ret .= $this->getTopicLink ( $this->topicList
[$x]->val_comment
) ;
399 $tlx = $this->topicList
[$x];
401 $max = $tlx->val_value
;
402 for( $a = 0 ; $a <= $max ; $a++
) {
404 $vote .= wfMsg ( "val_noop" );
406 $vote .= "<input type='radio' name='re_v{$idx}' value='{$a}'";
407 if( $a == $y->value
) {
408 $vote .= " checked='checked'";
411 if( $max == 2 && $a == 1 ) {
412 $vote .= wfMsg( "val_no" ) . " ";
413 } elseif( $max == 2 && $a == 2 ) {
414 $vote .= wfMsg( "val_yes" );
415 } elseif( $a != 0 ) {
422 $ret .= "<td>{$vote}</td>\n";
424 $ret .= "<td><input size='50' style='width:98%' maxlength='250' type='text' name='re_c{$idx}' value='{$y->comment}'/>";
425 $ret .= "</td></tr>\n";
427 $checked = $focus ?
" checked='checked'" : "";
428 $ret .= "<tr><td colspan='3'>\n";
429 $ret .= "<input type='checkbox' name='re_merge_{$revision}' value='1'{$checked} />" . $this->getParsedWiki( wfMsg( 'val_merge_old' ) ) . " \n";
430 $ret .= "<input type='checkbox' name='re_clear_{$revision}' value='1'{$checked} />" . $this->getParsedWiki( wfMsg( 'val_clear_old' ) ) . " \n";
431 $ret .= "<input type='submit' name='re_submit[{$revision}]' value=\"" . wfMsgHtml( "ok" ) . "\" />\n";
433 if( $focus ) $ret .= "<br/>\n<small>" . $this->getParsedWiki ( wfMsg( "val_form_note" ) ) . "</small>";
434 $ret .= "</td></tr>\n";
435 $ret .= "</table></form>\n\n";
440 # Generates the page from the validation tab
441 function validatePageForm( &$article, $revision ) {
442 global $wgOut, $wgRequest, $wgUser;
445 $this->page_id
= $article->getID();
446 $this->topicList
= $this->getTopicList();
447 $this->voteCache
= $this->getVoteList( $article->getID() );
449 # Check for POST data
450 $re = $wgRequest->getArray( 're_submit' );
451 if ( isset( $re ) ) {
452 $id = array_keys( $re );
453 $id = $id[0] ; # $id is now the revision number the user clicked "OK" for
454 $clearOldRev = $wgRequest->getVal( "re_clear_{$id}", 0 );
455 $mergeOldRev = $wgRequest->getVal( "re_merge_{$id}", 0 );
456 $this->updateRevision( $article, $id );
458 $this->mergeOldRevisions( $article, $id );
461 $this->clearOldRevisions( $article, $id );
463 $ret .= '<p class="revision_saved">' . $this->getParsedWiki( wfMsg( 'val_revision_changes_ok' ) ) . "</p>";
465 $ret .= $this->getParsedWiki( wfMsg ('val_votepage_intro') );
468 # Make sure the requested revision exists
469 $rev = $this->getRevisionFromId($revision);
470 $ts = $rev->rev_timestamp
;
471 if( !isset( $this->voteCache
[$ts] ) ) {
472 $this->voteCache
[$ts] = array();
475 # Sort revisions list, newest first
476 krsort( $this->voteCache
);
479 $title = $article->getTitle();
480 $title = $title->getPrefixedText();
481 $wgOut->setPageTitle( wfMsg( 'val_rev_for', $title ) );
482 foreach( $this->voteCache
as $x => $y ) {
483 $ret .= $this->getRevisionForm( $article, $x, $y, $x == $ts );
486 $ret .= $this->getStatisticsLink( $article );
487 $ret .= "<p>" . $this->getUserRatingsLink( $wgUser->getID(), wfMsg( 'val_show_my_ratings' ) ) . "</p>";
491 # This function performs the "management" mode on Special:Validate
492 function manageTopics() {
494 $this->topicList
= $this->getTopicList();
496 $iamsure = true ; # Sure by default # $wgRequest->getVal( "iamsure", "0" ) == 1;
498 if( $iamsure && $wgRequest->getVal( "m_add", "--" ) != "--" ) {
499 $new_topic = $wgRequest->getVal( "m_topic" );
500 $new_limit = $wgRequest->getVal( "m_limit" );
501 if( $new_topic != "" && $new_limit > 1 ) {
502 $this->addTopic( $new_topic, $new_limit );
506 $da = $wgRequest->getArray( "m_del" );
507 if( $iamsure && isset( $da ) && count( $da ) > 0 ) {
508 $id = array_keys( $da );
509 $id = array_shift( $id );
510 $this->deleteTopic( $id );
513 # FIXME: Wikitext this
514 $r = "<p>" . $this->getParsedWiki( wfMsg( 'val_warning' ) ) . "</p>\n";
515 $r .= "<form method='post'>\n";
517 $r .= "<tr>" . wfMsg( 'val_list_header' ) . "</tr>\n";
518 foreach( $this->topicList
as $x => $y ) {
520 $r .= "<th>{$y->val_type}</th>\n";
521 $r .= "<td>" . $this->getTopicLink ( $y->val_comment
) . "</td>\n";
522 $r .= "<td>1 .. <b>" . intval( $y->val_value
) . "</b></td>\n";
523 $r .= "<td><input type='submit' name='m_del[" . intval( $x ) . "]' value='" . htmlspecialchars( wfMsg( 'val_del' ) ) . "'/></td>\n";
528 $r .= '<td><input type="text" name="m_topic" value=""/></td>' . "\n";
529 $r .= '<td>1 .. <input type="text" name="m_limit" value="" size="4"/></td>' . "\n";
530 $r .= '<td><input type="submit" name="m_add" value="' . htmlspecialchars( wfMsg( 'val_add' ) ) . '"/></td>' . "\n";
531 $r .= "</tr></table>\n";
532 # $r .= '<p><input type="checkbox" name="iamsure" id="iamsure" value="1"/>';
533 # $r .= '<label for="iamsure">' . $this->getParsedWiki( wfMsg( 'val_iamsure' ) ) . "</label></p>\n";
538 # Generates an ID for both logged-in users and anons; $res is an object from an SQL query
539 function make_user_id( &$res ) {
540 return $res->val_user
== 0 ?
$res->val_ip
: $res->val_user
;
543 function showDetails( &$article, $revision ) {
544 global $wgOut, $wgUser;
545 $this->page_id
= $article->getID();
546 $this->topicList
= $this->getTopicList();
548 $sk = $wgUser->getSkin();
549 $title = $article->getTitle();
550 $wgOut->setPageTitle( str_replace( '$1', $title->getPrefixedText(), wfMsg( 'val_validation_of' ) ) );
556 # Collecting statistic data
557 $db =& wfGetDB( DB_SLAVE
);
558 $res = $db->select( 'validate', '*', array( 'val_page' => $this->page_id
, 'val_revision' => $revision ), 'SpecialValidate::showDetails' );
559 while( $x = $db->fetchObject($res) ) {
560 $data[$this->make_user_id($x)][$x->val_type
] = $x;
561 $users[$this->make_user_id($x)] = true;
562 $topics[$x->val_type
] = true;
564 $db->freeResult($res);
566 # Sorting lists of topics and users
570 $ts = $this->getRevisionTimestamp( $revision );
571 $url = $this->getRevisionLink( $article, $revision, wfTimestamp( TS_DB
, $ts ) );
575 $ret .= "<p><b>" . str_replace( '$1', $url, wfMsg( 'val_revision_of' ) ) . "</b></p>\n";
577 $ret .= "<tr><th>" . $this->getParsedWiki ( wfMsg('val_details_th') ) . "</th>" ;
579 foreach( $topics as $t => $dummy ) {
580 $ret .= '<th>' . $sk->commentBlock( $this->topicList
[$t]->val_comment
, $article->getTitle() ) . '</th>';
585 foreach( $users as $u => $dummy ) { # Every row a user
588 if( !User
::IsIP( $u ) ) { # Logged-in user rating
589 $ret .= $this->getUserRatingsLink( $u, User
::whoIs( $u ) );
590 } else { # Anon rating
591 $ret .= $this->getUserRatingsLink( $u, $u );
594 foreach( $topics as $t => $dummy ) { # Every column a topic
595 if( !isset( $data[$u][$t] ) ) {
599 $ret .= $data[$u][$t]->val_value
;
600 if( $data[$u][$t]->val_comment
!= "" ) {
601 $ret .= ' ' . $sk->commentBlock( $data[$u][$t]->val_comment
, $article->getTitle() );
609 $ret .= "<p>" . $this->getStatisticsLink( $article ) . "</p>";
610 $ret .= "<p>" . $this->getUserRatingsLink( $wgUser->getID(), wfMsg( 'val_show_my_ratings' ) ) . "</p>";
615 # XXX This should be paged
616 function showList( &$article ) {
617 global $wgOut, $wgUser;
618 $this->page_id
= $article->getID();
619 $this->topicList
= $this->getTopicList();
621 $title = $article->getTitle();
622 $wgOut->setPageTitle( str_replace( '$1', $title->getPrefixedText(), wfMsg( 'val_validation_of' ) ) );
624 # Collecting statistic data
625 $db =& wfGetDB( DB_SLAVE
);
626 $res = $db->select( 'validate', '*', array( "val_page" => $this->page_id
), 'SpecialValidate::showList' );
628 $statistics = array();
629 while( $vote = $db->fetchObject($res) ) {
630 $ts = $this->getRevisionTimestamp($vote->val_revision
);
631 if ( !isset ( $statistics[$ts] ) ) $statistics[$ts] = array () ;
632 if ( !isset ( $statistics[$ts][$vote->val_type
]->count
) ) $statistics[$ts][$vote->val_type
]->count
= 0 ;
633 if ( !isset ( $statistics[$ts][$vote->val_type
]->sum
) ) $statistics[$ts][$vote->val_type
]->sum
= 0 ;
634 $statistics[$ts][$vote->val_type
]->count++
;
635 $statistics[$ts][$vote->val_type
]->sum +
= $vote->val_value
;
637 $db->freeResult($res);
639 krsort( $statistics );
641 $ret = "<table><tr>\n";
642 $ret .= "<th>" . $this->getParsedWiki( wfMsg( "val_revision" ) ) . "</th>\n";
643 foreach( $this->topicList
as $topic ) {
644 $ret .= "<th>" . $this->getTopicLink($topic->val_comment
) . "</th>";
648 foreach( $statistics as $ts => $data ) {
649 $rev_id = $this->getRevisionId( $ts );
650 $revision_link = $this->getRevisionLink( $article, $rev_id, wfTimestamp( TS_DB
, $ts ) );
651 $details_link = $this->getRevisionStatsLink( $article, $rev_id );
652 $ret .= "<tr><td>{$revision_link} {$details_link}</td>";
653 foreach( $this->topicList
as $topicType => $topic ) {
654 if( isset( $data[$topicType] ) ) {
655 $stats = $data[$topicType];
656 $average = $stats->count
== 0 ?
0 : $stats->sum
/ $stats->count
;
657 $ret .= sprintf( "<td><b>%1.1f</b> (%d)</td>", $average, $stats->count
);
664 $ret .= "</table>\n";
665 $ret .= "<p>" . $this->getUserRatingsLink( $wgUser->getID(), wfMsg( 'val_show_my_ratings' ) ) . "</p>";
669 function getRatingText( $value, $max ) {
670 if( $max == 2 && $value == 1 ) {
671 $ret = wfMsg ( "val_no" ) . " ";
672 } elseif( $max == 2 && $value == 2 ) {
673 $ret = wfMsg( "val_yes" );
674 } elseif( $value != 0 ) {
675 $ret = wfMsg( "val_of", $value, $max ) . " ";
682 # XXX This should be paged
683 function showUserStats( $user ) {
684 global $wgOut, $wgUser;
685 $this->topicList
= $this->getTopicList();
686 $data = $this->getAllVoteLists( $user );
687 $sk = $wgUser->getSkin();
689 if( $user == $wgUser->getID() ) {
690 $wgOut->setPageTitle ( wfMsg ( 'val_my_stats_title' ) );
691 } elseif( !User
::IsIP( $user ) ) {
692 $wgOut->setPageTitle( wfMsg( 'val_user_stats_title', User
::whoIs( $user ) ) );
694 $wgOut->setPageTitle( wfMsg( 'val_user_stats_title', $user ) );
698 foreach( $data as $articleid => $revisions ) {
699 $title = Title
::newFromID( $articleid );
700 $ret .= "<tr><th colspan='4'>";
701 $ret .= $sk->makeKnownLinkObj( $title, $title->getEscapedText() );
702 $ret .= "</th></tr>";
703 krsort( $revisions );
704 foreach( $revisions as $revid => $revision ) {
705 $url = $title->getLocalURL( "oldid={$revid}" );
707 $ret .= $sk->makeKnownLinkObj( $title, wfMsg('val_revision_number', $revid ), "oldid={$revid}" );
711 foreach( $revision as $topic => $rating ) {
716 $ret .= "<td>" . $this->getTopicLink ( $this->topicList
[$topic]->val_comment
) . "</td>";
717 $ret .= "<td>" . $this->getRatingText( $rating->val_value
, $this->topicList
[$topic]->val_value
) . "</td>";
718 $ret .= "<td>" . $sk->commentBlock( $rating->val_comment
) . "</td>";
734 function wfSpecialValidate( $page = '' ) {
735 global $wgOut, $wgRequest, $wgUseValidation, $wgUser, $wgContLang;
737 if( !$wgUseValidation ) {
738 $wgOut->errorpage( "nosuchspecialpage", "nospecialpagetext" );
744 if( ! $wgUser->isAllowed('change_validation') ) {
745 $wgOut->sysopRequired();
750 $mode = $wgRequest->getVal( "mode" );
751 $skin = $wgUser->getSkin();
754 if( $mode == "manage" ) {
755 $v = new Validation();
756 $html = $v->manageTopics();
757 } elseif( $mode == "userstats" ) {
758 $v = new Validation();
759 $user = $wgRequest->getVal( "user" );
760 $html = $v->showUserStats( $user );
765 $t = Title
::newFromText( "Special:Validate" );
766 $url = $t->escapeLocalURL( "mode=manage" );
767 $html .= "<li><a href=\"" . $url . "\">Manage</a></li>\n";
772 $wgOut->addHTML( $html );