* @package MediaWiki
* @subpackage SpecialPage
*/
+
class Validation {
var $topicList;
var $voteCache;
function getVersionLink( &$article, $revision, $text = "" ) {
$t = $article->getTitle();
if( $text == "" ) $text = wfMsg("val_view_version");
- $ret = "<a href=\"" . htmlspecialchars($t->getLocalURL( "oldid={$revision}" )) . "\">" . $text . "</a>";
+ $ret = "<a href=\"" . $t->getLocalURL( htmlspecialchars("oldid={$revision}" )) . "\">" . $this->getParsedWiki($text) . "</a>";
return $ret;
}
function link2revisionstatistics( &$article, $revision ) {
$nt = $article->getTitle();
$url = $nt->escapeLocalURL( "action=validate&mode=details&revision={$revision}" );
- return wfMsg( 'val_revision_stats_link', $url );
+ return '(<a href="{$url}">' . $this->getParsedWiki( 'val_revision_stats_link') . '</a>)' ;
}
# This function returns a link text to the user rating statistics page
$user = $wgUser->GetName();
}
$nt = Title::newFromText( "Special:Validate" );
- $url = htmlspecialchars( $nt->getLocalURL( "mode=userstats&user={$user}" ) );
+ $url = $nt->getLocalURL( "mode=userstats&user=" . htmlspecialchars ( $user ) );
return "<a href=\"{$url}\">{$text}</a>";
}
$url = "<a href='" . $nt->getLocalUrl() . "'>" . $nt->getText() . "</a>";
$metadata .= $url;
}
- $metadata .= " : <small>\"" . htmlspecialchars( $x->rev_comment ) . "\"</small>";
+ $metadata .= " : <small>\"" . $this->getParsedWiki( $x->rev_comment ) . "\"</small>";
return $metadata;
}
$r .= "\">{$s}</a>" ;
return $r ;
}
+
+ # Generates HTML from a wiki text, e.g., a wfMsg
+ function getParsedWiki ( $text ) {
+ global $wgOut , $wgTitle, $wgParser ;
+ $parserOutput = $wgParser->parse( $text , $wgTitle, $wgOut->mParserOptions,false);
+ return $parserOutput->getText() ;
+ }
# Generates a form for a single revision
function getRevisionForm( &$article, $idx, &$data, $focus = false ) {
# Generate form
$ret = "<form method='post'>";
- $ret .= "<table border='1' cellspacing='0' cellpadding='2'";
- if( $focus ) {
- $ret .= " style='background-color:#00BBFF'";
- }
- $ret .= ">\n";
+ $ret .= "<table cellspacing='0' cellpadding='2' class='";
+ if( $focus ) $ret .= "revisionform_focus" ;
+ else $ret .= "revisionform_default" ;
+ $ret .= "'>\n";
$head = "Revision #" . $revision;
$link = " " . $this->getVersionLink( $article, $revision );
$metadata = $this->getMetadata( $revision );
$line = 0;
foreach( $data as $x => $y ) {
$line = 1 - $line;
- $col = $line == 1 ? "#DDDDDD" : "#EEEEEE";
+ $trclass = $line == 1 ? "revision_tr_first" : "revision_tr_default";
$idx = "_{$revision}[{$x}]";
- $ret .= "<tr bgcolor='{$col}'>\n";
+ $ret .= "<tr class='{$trclass}'>\n";
$ret .= "<th nowrap>";
$ret .= $this->linkTopic ( $this->topicList[$x]->val_comment ) ;
$ret .= "</th>\n";
}
$checked = $focus ? " checked='checked'" : "";
$ret .= "<tr><td colspan='3' valign='center'>\n";
- $ret .= "<input type='checkbox' name='re_merge_{$revision}' value='1'{$checked}/>" . htmlspecialchars( wfMsg( 'val_merge_old' ) ) . " \n";
- $ret .= "<input type='checkbox' name='re_clear_{$revision}' value='1'{$checked}/>" . htmlspecialchars( wfMsg( 'val_clear_old' ) ) . " \n";
- $ret .= "<input type='submit' name='re_submit[{$revision}]' value='" . htmlspecialchars( wfMsg("ok") ) . "'/>\n";
+ $ret .= "<input type='checkbox' name='re_merge_{$revision}' value='1'{$checked}/>" . $this->getParsedWiki( wfMsg( 'val_merge_old' ) ) . " \n";
+ $ret .= "<input type='checkbox' name='re_clear_{$revision}' value='1'{$checked}/>" . $this->getParsedWiki( wfMsg( 'val_clear_old' ) ) . " \n";
+ $ret .= "<input type='submit' name='re_submit[{$revision}]' value='" . $this->getParsedWiki( wfMsg("ok") ) . "'/>\n";
+
if( $focus ) {
- $ret .= "<br/>\n<small>" . htmlspecialchars( wfMsg( "val_form_note" ) ) . "</small>";
+ $ret .= "<br/>\n<small>" . $this->getParsedWiki ( wfMsg( "val_form_note" ) ) . "</small>";
}
$ret .= "</td></tr>\n";
$ret .= "</table>\n</form>\n\n";
if( $clearOldRev ) {
$this->clearOldRevisions( $article, $id );
}
- $ret .= "<p><font color='red'>" . htmlspecialchars( wfMsg( 'val_revision_changes_ok' ) ) . "</font></p>";
+ $ret .= "<p class='revision_saved'>" . $this->getParsedWiki( wfMsg( 'val_revision_changes_ok' ) ) . "</p>";
}
else $ret .= wfMsg ( 'val_votepage_intro' ) ;
# Output
$title = $article->getTitle();
$title = $title->getPrefixedText();
- $wgOut->setPageTitle( wfMsg( 'val_rev_for' ) . $title );
+ $wgOut->setPageTitle( str_replace ( '$1' , $title , wfMsg( 'val_rev_for' ) ) );
foreach( $this->voteCache as $x => $y ) {
$ret .= $this->getRevisionForm( $article, $x, $y, $x == $ts );
$ret .= "<br/>\n";
}
# FIXME: Wikitext this
- $r = "<p>" . htmlspecialchars( wfMsg( 'val_warning' ) ) . "</p>\n";
+ $r = "<p>" . $this->getParsedWiki( wfMsg( 'val_warning' ) ) . "</p>\n";
$r .= "<form method='post'>\n";
$r .= "<table border='1' cellspacing='0' cellpadding='2'>\n";
$r .= "<tr>" . wfMsg( 'val_list_header' ) . "</tr>\n";
foreach( $this->topicList as $x => $y ) {
$r .= "<tr>\n";
- $r .= "<th>" . htmlspecialchars( $y->val_type ) . "</th>\n";
+ $r .= "<th>" . $this->getParsedWiki( $y->val_type ) . "</th>\n";
$r .= "<td>" . $this->linkTopic ( $y->val_comment ) . "</td>\n";
$r .= "<td>1 .. <b>" . intval( $y->val_value ) . "</b></td>\n";
$r .= "<td><input type='submit' name='m_del[" . intval( $x ) . "]' value='" . htmlspecialchars( wfMsg( 'val_del' ) ) . "'/></td>\n";
$r .= "<td><input type='submit' name='m_add' value='" . htmlspecialchars( wfMsg( 'val_add' ) ) . "'/></td>\n";
$r .= "</tr>\n";
$r .= "</table>\n";
- $r .= "<input type='checkbox' name='iamsure' value='1'/>" . htmlspecialchars( wfMsg( 'val_iamsure' ) ) . "\n";
+ $r .= "<input type='checkbox' name='iamsure' value='1'/>" . $this->getParsedWiki( wfMsg( 'val_iamsure' ) ) . "\n";
$r .= "</form>\n";
return $r;
}
$ret .= "<td valign='center'>";
$ret .= $data[$u][$t]->val_value;
if( $data[$u][$t]->val_comment != "" ) {
- $ret .= " <small>(" . htmlspecialchars( $data[$u][$t]->val_comment ) . ")</small>";
+ $ret .= " <small>(" . $this->getParsedWiki( $data[$u][$t]->val_comment ) . ")</small>";
}
$ret .= "</td>";
}
$ret = "";
$ret .= "<table border='1' cellspacing='0' cellpadding='2'>\n";
- $ret .= "<tr><th>" . htmlspecialchars( wfMsg( "val_revision" ) ) . "</th>";
+ $ret .= "<tr><th>" . $this->getParsedWiki( wfMsg( "val_revision" ) ) . "</th>";
foreach( $this->topicList as $x => $y ) {
$ret .= "<th>" . $this->linkTopic ( $y->val_comment ) . "</th>";
}
$initial = false;
$ret .= "<td>" . $this->linkTopic ( $this->topicList[$topic]->val_comment ) . "</td>";
$ret .= "<td>" . $this->getRatingText( $rating->val_value, $this->topicList[$topic]->val_value ) . "</td>";
- $ret .= "<td>" . htmlspecialchars( $rating->val_comment ) . "</td>";
+ $ret .= "<td>" . $this->getParsedWiki( $rating->val_comment ) . "</td>";
$ret .= "</tr>";
}
}
'val_show_my_ratings' => 'Show my validations',
'val_revision_number' => 'Revision #$1',
'val_warning' => '<b>Never, <i>ever</i>, change something here without <i>explicit</i> community consensus!</b>',
-'val_rev_for' => 'Revisions for ',
+'val_rev_for' => 'Revisions for $1',
'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_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\'',
-'val_form_note' => '<b>Hint:</b> Merging your data means that for the article
-revision you select, all options where you have specified <i>no opinion</i>
-will be set to the value and comment of the most recent revision for which you
-have expressed an opinion. For example, if you want to change a single option
-for a newer revision, but also keep your other settings for this article in
-this revision, just select which option you intend to <i>change</i>, and
-merging will fill in the other options with your previous settings.',
+'val_form_note' => "'''Hint:''' Merging your data means that for the article revision you select, all options where you have specified ''no opinion'' will be set to the value and comment of the most recent revision for which you have expressed an opinion. For example, if you want to change a single option for a newer revision, but also keep your other settings for this article in this revision, just select which option you intend to ''change'', and merging will fill in the other options with your previous settings.",
'val_noop' => 'No opinion',
'val_topic_desc_page' => 'Project:Validation topics',
-'val_votepage_intro' => '<p>Change this text <a href="{{SERVER}}{{localurl:MediaWiki:Val_votepage_intro}}">here</a>!</p>',
+'val_votepage_intro' => 'Change this text <a href="{{SERVER}}{{localurl:MediaWiki:Val_votepage_intro}}">here</a>!',
'val_percent' => '<b>$1%</b><br />($2 of $3 points<br />by $4 users)',
'val_percent_single' => '<b>$1%</b><br />($2 of $3 points<br />by one user)',
'val_total' => 'Total',