Article validation code
authorMagnus Manske <magnusmanske@users.mediawiki.org>
Fri, 23 Jul 2004 20:58:43 +0000 (20:58 +0000)
committerMagnus Manske <magnusmanske@users.mediawiki.org>
Fri, 23 Jul 2004 20:58:43 +0000 (20:58 +0000)
includes/SkinPHPTal.php
includes/SpecialValidate.php

index 98b7a17..01ff30e 100644 (file)
 
                # an array of edit links by default used for the tabs
                function buildContentActionUrls () {
-                       global $wgTitle, $wgUser, $wgRequest;
+                       global $wgTitle, $wgUser, $wgRequest, $wgUseValidation;
                        $action = $wgRequest->getText( 'action' );
                        $section = $wgRequest->getText( 'section' );
                        $oldid = $wgRequest->getVal( 'oldid' );
                                        }
                                }
 
-                               if ( $wgUser->getID() != 0 && $wgTitle->getArticleId() && $wgTitle->getNamespace() == 0 ) {
+                               if ( $wgUseValidation && $wgUser->getID() != 0 && $wgTitle->getArticleId() && $wgTitle->getNamespace() == 0 ) {
                                        global $wgArticle ;
-                                       extract( $wgRequest->getValues( 'oldid' ) );
-                                       if ( isset ( $oldid ) ) $article_time = "&timestamp=" . $wgArticle->mTimestamp ;
-                                       else $article_time = "";
+                                       $article_time = "&timestamp=" . $wgArticle->mTimestamp ;
                                        $content_actions['validate'] = array('class' => ($action == 'validate') ? 'selected' : false ,
                                                'text' => wfMsg('val_tab'),
                                                'href' => $this->makeUrl($this->thispage, "action=validate{$article_time}"));
index 60c7b7d..346d855 100644 (file)
@@ -65,7 +65,6 @@ class Validation
                if ( $article_title == "" )
                        {
                        $article_title = $_GET['article'] ;
-#                      $heading = "<h1>" . $article->getPrefixedText() . "</h1>\n" ;
                        $heading = "<h1>" . $article_title . "</h1>\n" ;
                        }
                else $heading = "" ;
@@ -75,7 +74,10 @@ class Validation
                $article = Title::newFromText ( $article_title ) ;
                        
                # Now we get all the "votes" for the different versions of this article for this user
-               $val = $this->get_prev_data ( $wgUser->getID() , $article_title , $article_time ) ;
+               $val = $this->get_prev_data ( $wgUser->getID() , $article_title ) ;
+               krsort ( $val ) ; # Newest versions first
+               
+               #print "!" . count ( $val ) ;
                
                # No votes for this version, initial data
                if ( count ( $val ) == 0 )
@@ -127,16 +129,17 @@ class Validation
                        }
                
                # Generating HTML
-               $html = $heading ;
+               $html = "" ;
                $tabsep = "<td width=0px style='border-left:2px solid black;'></td>" ;
                $topstyle = "style='border-top:2px solid black'" ;
                foreach ( $val AS $time => $stuff )
                        {
-                       if ( $time != $article_time ) $html .= wfMsg("val_this_version") ;
-                       else $html .= str_replace ( "$1" , gmdate("F d, Y H:i:s",wfTimestamp2Unix($time)) , wfMsg("val_version_of") ) ;
+                       $tablestyle = "cellspacing=0 cellpadding=2" ;
+                       if ( $article_time == $time ) $tablestyle .=" style='border: 2px solid red'" ;
+                       $html .= str_replace ( "$1" , gmdate("F d, Y H:i:s",wfTimestamp2Unix($time)) , wfMsg("val_version_of") ) ;
                        $html .= "<form method=post>\n" ;
                        $html .= "<input type=hidden name=oldtime value='{$time}'>" ;
-                       $html .= "<table cellspacing=0 cellpadding=2>\n" ;
+                       $html .= "<table {$tablestyle}>\n" ;
                        $html .= str_replace ( "$1" , $tabsep , wfMsg("val_table_header") ) ;
                        for ( $idx = 0 ; $idx < count ( $validationtypes) ; $idx++ )
                                {