Article validation code (bug fixes)
authorMagnus Manske <magnusmanske@users.mediawiki.org>
Sun, 1 Aug 2004 09:47:50 +0000 (09:47 +0000)
committerMagnus Manske <magnusmanske@users.mediawiki.org>
Sun, 1 Aug 2004 09:47:50 +0000 (09:47 +0000)
includes/SkinPHPTal.php
includes/SpecialValidate.php
languages/Language.php

index 3ea009c..ad717d5 100644 (file)
                        if( $this->iscontent ) {
 
                                $nskey = $this->getNameSpaceKey();
-                               $content_actions[$nskey] = array('class' => (!Namespace::isTalk( $wgTitle->getNamespace())) ? 'selected' : false,
+                               $is_active = !Namespace::isTalk( $wgTitle->getNamespace()) ;
+                               if ( $action == 'validate' ) $is_active = false ; # Show article tab deselected when validating
+                               $content_actions[$nskey] = array('class' => ($is_active) ? 'selected' : false,
                                'text' => wfMsg($nskey),
                                'href' => $this->makeArticleUrl($this->thispage));
 
                                        }
                                }
 
-                               if ( $wgUseValidation && /*$wgUser->getID() != 0 && */ $wgTitle->getArticleId() && $wgTitle->getNamespace() == 0 ) {
+                               # Show validate tab
+                               if ( $wgUseValidation && $wgTitle->getArticleId() && $wgTitle->getNamespace() == 0 ) {
                                        global $wgArticle ;
                                        $article_time = "&timestamp=" . $wgArticle->mTimestamp ;
                                        $content_actions['validate'] = array('class' => ($action == 'validate') ? 'selected' : false ,
index b138249..3af59d6 100644 (file)
@@ -60,7 +60,7 @@ class Validation
        
        function validate_form ( $article_title = "" )
                {
-               global $wgOut, $wgLang, $wgUser;
+               global $wgOut, $wgLang, $wgUser, $wgArticle ;
                
                if ( $wgUser->getID() == 0 ) # Anon
                        {
@@ -164,6 +164,8 @@ class Validation
                                        if ( $rad != -1 ) wfQuery( $sql, DB_WRITE );
                                        }
                                }
+                       $wgArticle->showArticle( "Juhuu", wfMsg( 'val_validated' ) );
+                       return ; # Show article instead of validation page
                        }
                
                # Generating HTML
@@ -171,7 +173,9 @@ class Validation
                
                $skin = $wgUser->getSkin() ;
                $staturl = $skin->makeSpecialURL ( "validate" , "mode=stat_page&article_title={$article_title}" ) ;
-               $html .= "<a href=\"{$staturl}\">" . wfMsg('val_stat_link_text') . "</a><br>\n" ;
+               $listurl = $skin->makeSpecialURL ( "validate" , "mode=list_page" ) ;
+               $html .= "<a href=\"{$staturl}\">" . wfMsg('val_stat_link_text') . "</a> \n" ;
+               $html .= "<a href=\"{$listurl}\">" . wfMsg('val_article_lists') . "</a><br>\n" ;
                $html .= "<small>" . wfMsg('val_form_note') . "</small><br>\n" ;
                
                # Generating data tables
@@ -227,7 +231,6 @@ class Validation
                        $html .= "</tr></table></form>\n" ;
                        }
                
-               global $wgArticle ;
                $html .= "<h2>" . wfMsg ( 'preview' ) . "</h2>" ;
                $wgOut->addHTML ( $html ) ;
                $wgOut->addWikiText ( $wgArticle->getContent( true ) ) ;
@@ -269,6 +272,11 @@ class Validation
  
                # Generating HTML
                $html = "<h1>Page validation statistics</h1>\n" ;
+
+               $skin = $wgUser->getSkin() ;
+               $listurl = $skin->makeSpecialURL ( "validate" , "mode=list_page" ) ;
+               $html .= "<a href=\"{$listurl}\">" . wfMsg('val_article_lists') . "</a><br><br>\n" ;
+
                $html .= "<table border=1 cellpadding=2 style='font-size:8pt;'>\n" ;
                $html .= "<tr><th>" . wfMsg('val_version') . "</th>" ;
                foreach ( $validationtypes AS $idx => $title )
@@ -354,6 +362,10 @@ class Validation
                else $num = 0 ;
                return $num ;
                }
+               
+       function getArticleList ()
+               {
+               }
 
        }
 
@@ -364,14 +376,19 @@ function wfSpecialValidate( $page = "" )
        else $mode = "form" ;
        $v = new Validation ;
        $html = "" ;
-       if ( $mode == "form" )
+/*     if ( $mode == "form" )
                {
                $html = $v->validate_form () ;
                }
-       else if ( $mode == "stat_page" )
+       else */
+       if ( $mode == "stat_page" )
                {
                $html = $v->getPageStatistics () ;
                }
+       else if ( $mode == "list_page" )
+               {
+               $html = $v->getArticleList () ;
+               }
        
        $wgOut->addHTML( $html ) ;
        }
index bf0bfbd..1483e79 100644 (file)
@@ -1283,6 +1283,8 @@ merging will fill in the other options with your previous settings.',
 'val_user_validations' => 'This user has validated $1 pages.',
 'val_no_anon_validation' => 'You have to be logged in to validate an article.',
 'val_validate_article_namespace_only' => 'Only articles can be validated. This page is <i>not</i> in the article namespace.',
+'val_validated' => 'Validation done.',
+'val_article_lists' => 'List validated articles',
 
 # Move page
 #