From c042af512e83cdb6ffb770738615dbcdcbc5155c Mon Sep 17 00:00:00 2001 From: Magnus Manske Date: Tue, 21 Jun 2005 19:59:19 +0000 Subject: [PATCH] fixes to broken HTML messages; table markup now CSS --- includes/SpecialValidate.php | 54 +++++++++++++++++++++--------------- languages/Language.php | 14 +++------- skins/monobook/main.css | 27 +++++++++++++++++- 3 files changed, 61 insertions(+), 34 deletions(-) diff --git a/includes/SpecialValidate.php b/includes/SpecialValidate.php index 130d1a8208..dea35b0d7d 100644 --- a/includes/SpecialValidate.php +++ b/includes/SpecialValidate.php @@ -28,6 +28,7 @@ * @package MediaWiki * @subpackage SpecialPage */ + class Validation { var $topicList; var $voteCache; @@ -51,7 +52,7 @@ class Validation { function getVersionLink( &$article, $revision, $text = "" ) { $t = $article->getTitle(); if( $text == "" ) $text = wfMsg("val_view_version"); - $ret = "getLocalURL( "oldid={$revision}" )) . "\">" . $text . ""; + $ret = "getLocalURL( htmlspecialchars("oldid={$revision}" )) . "\">" . $this->getParsedWiki($text) . ""; return $ret; } @@ -270,7 +271,7 @@ class Validation { function link2revisionstatistics( &$article, $revision ) { $nt = $article->getTitle(); $url = $nt->escapeLocalURL( "action=validate&mode=details&revision={$revision}" ); - return wfMsg( 'val_revision_stats_link', $url ); + return '(' . $this->getParsedWiki( 'val_revision_stats_link') . ')' ; } # This function returns a link text to the user rating statistics page @@ -280,7 +281,7 @@ class Validation { $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 "{$text}"; } @@ -317,7 +318,7 @@ class Validation { $url = "" . $nt->getText() . ""; $metadata .= $url; } - $metadata .= " : \"" . htmlspecialchars( $x->rev_comment ) . "\""; + $metadata .= " : \"" . $this->getParsedWiki( $x->rev_comment ) . "\""; return $metadata; } @@ -330,6 +331,13 @@ class Validation { $r .= "\">{$s}" ; 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 ) { @@ -346,11 +354,10 @@ class Validation { # Generate form $ret = "
"; - $ret .= "getVersionLink( $article, $revision ); $metadata = $this->getMetadata( $revision ); @@ -358,9 +365,9 @@ class Validation { $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 .= "\n"; + $ret .= "\n"; $ret .= "\n"; @@ -395,11 +402,12 @@ class Validation { } $checked = $focus ? " checked='checked'" : ""; $ret .= "\n"; $ret .= "
"; $ret .= $this->linkTopic ( $this->topicList[$x]->val_comment ) ; $ret .= "
\n"; - $ret .= "" . htmlspecialchars( wfMsg( 'val_merge_old' ) ) . " \n"; - $ret .= "" . htmlspecialchars( wfMsg( 'val_clear_old' ) ) . " \n"; - $ret .= "\n"; + $ret .= "" . $this->getParsedWiki( wfMsg( 'val_merge_old' ) ) . " \n"; + $ret .= "" . $this->getParsedWiki( wfMsg( 'val_clear_old' ) ) . " \n"; + $ret .= "\n"; + if( $focus ) { - $ret .= "
\n" . htmlspecialchars( wfMsg( "val_form_note" ) ) . ""; + $ret .= "
\n" . $this->getParsedWiki ( wfMsg( "val_form_note" ) ) . ""; } $ret .= "
\n
\n\n"; @@ -430,7 +438,7 @@ class Validation { if( $clearOldRev ) { $this->clearOldRevisions( $article, $id ); } - $ret .= "

" . htmlspecialchars( wfMsg( 'val_revision_changes_ok' ) ) . "

"; + $ret .= "

" . $this->getParsedWiki( wfMsg( 'val_revision_changes_ok' ) ) . "

"; } else $ret .= wfMsg ( 'val_votepage_intro' ) ; @@ -446,7 +454,7 @@ class Validation { # 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 .= "
\n"; @@ -479,14 +487,14 @@ class Validation { } # FIXME: Wikitext this - $r = "

" . htmlspecialchars( wfMsg( 'val_warning' ) ) . "

\n"; + $r = "

" . $this->getParsedWiki( wfMsg( 'val_warning' ) ) . "

\n"; $r .= "
\n"; $r .= "\n"; $r .= "" . wfMsg( 'val_list_header' ) . "\n"; foreach( $this->topicList as $x => $y ) { $r .= "\n"; - $r .= "\n"; + $r .= "\n"; $r .= "\n"; $r .= "\n"; $r .= "\n"; @@ -499,7 +507,7 @@ class Validation { $r .= "\n"; $r .= "\n"; $r .= "
" . htmlspecialchars( $y->val_type ) . "" . $this->getParsedWiki( $y->val_type ) . "" . $this->linkTopic ( $y->val_comment ) . "1 .. " . intval( $y->val_value ) . "
\n"; - $r .= "" . htmlspecialchars( wfMsg( 'val_iamsure' ) ) . "\n"; + $r .= "" . $this->getParsedWiki( wfMsg( 'val_iamsure' ) ) . "\n"; $r .= "
\n"; return $r; } @@ -569,7 +577,7 @@ class Validation { $ret .= ""; $ret .= $data[$u][$t]->val_value; if( $data[$u][$t]->val_comment != "" ) { - $ret .= " (" . htmlspecialchars( $data[$u][$t]->val_comment ) . ")"; + $ret .= " (" . $this->getParsedWiki( $data[$u][$t]->val_comment ) . ")"; } $ret .= ""; } @@ -613,7 +621,7 @@ class Validation { $ret = ""; $ret .= "\n"; - $ret .= ""; + $ret .= ""; foreach( $this->topicList as $x => $y ) { $ret .= ""; } @@ -687,7 +695,7 @@ class Validation { $initial = false; $ret .= ""; $ret .= ""; - $ret .= ""; + $ret .= ""; $ret .= ""; } } diff --git a/languages/Language.php b/languages/Language.php index cdd65275ae..f4b4a33333 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -1514,26 +1514,20 @@ Type the name of the user in the box and press the button to make the user an ad 'val_show_my_ratings' => 'Show my validations', 'val_revision_number' => 'Revision #$1', 'val_warning' => 'Never, ever, change something here without explicit community consensus!', -'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" here', -'val_revision_stats_link' => '(details)', +'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' => '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_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' => '

Change this text here!

', +'val_votepage_intro' => 'Change this text here!', 'val_percent' => '$1%
($2 of $3 points
by $4 users)', 'val_percent_single' => '$1%
($2 of $3 points
by one user)', 'val_total' => 'Total', diff --git a/skins/monobook/main.css b/skins/monobook/main.css index 61ea653eec..69c11bb069 100644 --- a/skins/monobook/main.css +++ b/skins/monobook/main.css @@ -1,4 +1,4 @@ -/* +/* ** MediaWiki 'monobook' style sheet for CSS2-capable browsers. ** Copyright Gabriel Wicke - http://wikidev.net/ ** License: GPL (http://www.gnu.org/copyleft/gpl.html) @@ -1151,3 +1151,28 @@ ul#filetoc { input#wpSave, input#wpDiff { margin-right: 0.33em; } + + +/* Classes for article validation */ + +table.revisionform_default { + border: 1px solid #000000; +} + +table.revisionform_focus { + border: 1px solid #000000; + background-color:#00BBFF; +} + +tr.revision_tr_default { + background-color:#EEEEEE; +} + +tr.revision_tr_first { + background-color:#DDDDDD; +} + +p.revision_saved { + color: green; + font-weight:bold; +} -- 2.20.1
" . htmlspecialchars( wfMsg( "val_revision" ) ) . "
" . $this->getParsedWiki( wfMsg( "val_revision" ) ) . "" . $this->linkTopic ( $y->val_comment ) . "" . $this->linkTopic ( $this->topicList[$topic]->val_comment ) . "" . $this->getRatingText( $rating->val_value, $this->topicList[$topic]->val_value ) . "" . htmlspecialchars( $rating->val_comment ) . "" . $this->getParsedWiki( $rating->val_comment ) . "