Article validation code (as a tab now)
authorMagnus Manske <magnusmanske@users.mediawiki.org>
Tue, 20 Jul 2004 20:48:19 +0000 (20:48 +0000)
committerMagnus Manske <magnusmanske@users.mediawiki.org>
Tue, 20 Jul 2004 20:48:19 +0000 (20:48 +0000)
includes/Article.php
includes/SkinPHPTal.php
includes/SpecialValidate.php
index.php
languages/Language.php

index 21fd21b..0fe1352 100644 (file)
@@ -7,7 +7,8 @@
 # Note: edit user interface and cache support functions have been
 # moved to separate EditPage and CacheManager classes.
 
-require_once( 'CacheManager.php' );
+require_once ( 'CacheManager.php' );
+include_once ( 'SpecialValidate.php' ) ;
 
 $wgArticleCurContentFields = false;
 $wgArticleOldContentFields = false;
@@ -1047,6 +1048,18 @@ class Article {
                $wgOut->redirect( $this->mTitle->getFullURL( $r ).$sectionanchor );
        }
 
+       # Validate article
+       
+       function validate ()
+       {
+               global $wgOut ;
+               $v = new Validation ;
+               $html = $v->validate_form ( $this->mTitle->getDBkey() ) ;               
+               $wgOut->setPagetitle( wfMsg( 'validate' ) . " : " . $this->mTitle->getText()  );
+               $wgOut->setRobotpolicy( 'noindex,follow' );
+               $wgOut->addHTML( $html ) ;
+       }
+
        # Add this page to my watchlist
 
        function watch( $add = true )
index 5479d20..d53720e 100644 (file)
                                                'href' => $this->makeUrl($this->thispage, 'action=unwatch'));
                                        }
                                }
+
+                               if ( $wgUser->getID() != 0 && $wgTitle->getArticleId() ) {
+                                       $content_actions['validate'] = array('class' => ($action == 'validate') ? 'selected' : false ,
+                                               'text' => wfMsg('val_tab'),
+                                               'href' => $this->makeUrl($this->thispage, 'action=validate'));
+                                       }
+
                        } else {
                                /* show special page tab */
 
index f5b432e..1bd180f 100644 (file)
@@ -68,7 +68,12 @@ class Validation
                {
                global $wgOut, $wgLang, $wgUser;
                if ( $wgUser->getID() == 0 ) return ; # Anon
-               if ( $article_title == "" ) $article_title = $_GET['article'] ;
+               if ( $article_title == "" )
+                       {
+                       $article_title = $_GET['article'] ;
+                       $heading = "<h1>" . $article->getPrefixedText() . "</h1>\n" ;
+                       }
+               else $heading = "" ;
                $article_time = "" ;
                if ( isset ( $_GET['timestamp'] ) ) $article_time = $_GET['timestamp'] ;        
                $article = Title::newFromText ( $article_title ) ;
@@ -115,7 +120,7 @@ class Validation
                        }
                
                # Generating HTML
-               $html = "<h1>" . $article->getPrefixedText() . "</h1>\n" ;
+               $html = $heading ;
                foreach ( $val AS $time => $stuff )
                        {
                        if ( $time == $article_time ) $html .= "<h2>This version</h2>\n" ;
index 803a548..7680dbb 100644 (file)
--- a/index.php
+++ b/index.php
@@ -110,6 +110,7 @@ if ( $search = $wgRequest->getText( 'search' ) ) {
                case "rollback":
                case "protect":
                case "unprotect":
+               case "validate":
                case "info":
                        $wgArticle->$action();
                        break;
index fbefd83..cd3a7d9 100644 (file)
@@ -1232,6 +1232,7 @@ Type the name of the user in the box and press the button to make the user an ad
 'val_clear_old' => 'Clear my other validation data for the <a href="$1">$2</a> article',
 'val_noop' => 'No opinion',
 'val_percent' => '<b>$1%</b> ($2 of $3 points)',
+'val_tab' => 'Validate',
 
 # Move page
 #