fixes to broken HTML messages; table markup now CSS
authorMagnus Manske <magnusmanske@users.mediawiki.org>
Tue, 21 Jun 2005 19:59:19 +0000 (19:59 +0000)
committerMagnus Manske <magnusmanske@users.mediawiki.org>
Tue, 21 Jun 2005 19:59:19 +0000 (19:59 +0000)
includes/SpecialValidate.php
languages/Language.php
skins/monobook/main.css

index 130d1a8..dea35b0 100644 (file)
@@ -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 = "<a href=\"" . htmlspecialchars($t->getLocalURL( "oldid={$revision}" )) . "\">" . $text . "</a>";
+               $ret = "<a href=\"" . $t->getLocalURL( htmlspecialchars("oldid={$revision}" )) . "\">" . $this->getParsedWiki($text) . "</a>";
                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 '(<a href="{$url}">' . $this->getParsedWiki( 'val_revision_stats_link') . '</a>)' ;
        }
 
        # 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 "<a href=\"{$url}\">{$text}</a>";
        }
 
@@ -317,7 +318,7 @@ class Validation {
                        $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;
        }
        
@@ -330,6 +331,13 @@ class Validation {
                $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 ) {
@@ -346,11 +354,10 @@ class Validation {
        
                # 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 );
@@ -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 .= "<tr bgcolor='{$col}'>\n";
+                       $ret .= "<tr class='{$trclass}'>\n";
                        $ret .= "<th nowrap>";
                        $ret .= $this->linkTopic ( $this->topicList[$x]->val_comment ) ;
                        $ret .= "</th>\n";
@@ -395,11 +402,12 @@ class Validation {
                }
                $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";
@@ -430,7 +438,7 @@ class Validation {
                        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' ) ;
                
@@ -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 .= "<br/>\n";
@@ -479,14 +487,14 @@ class Validation {
                }
                
                # 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";
@@ -499,7 +507,7 @@ class Validation {
                $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;
        }
@@ -569,7 +577,7 @@ class Validation {
                                        $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>";
                                }
@@ -613,7 +621,7 @@ class Validation {
                
                $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>";
                }
@@ -687,7 +695,7 @@ class Validation {
                                        $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>";
                                }
                        }
index cdd6527..f4b4a33 100644 (file)
@@ -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' => '<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',
index 61ea653..69c11bb 100644 (file)
@@ -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;
+}