From bc08cee26e279bf6d8142de643fcf3448bedbb23 Mon Sep 17 00:00:00 2001 From: Magnus Manske Date: Fri, 23 Jul 2004 20:58:43 +0000 Subject: [PATCH] Article validation code --- includes/SkinPHPTal.php | 8 +++----- includes/SpecialValidate.php | 15 +++++++++------ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/includes/SkinPHPTal.php b/includes/SkinPHPTal.php index 98b7a1714b..01ff30e6da 100644 --- a/includes/SkinPHPTal.php +++ b/includes/SkinPHPTal.php @@ -304,7 +304,7 @@ # 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' ); @@ -435,11 +435,9 @@ } } - 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 = "×tamp=" . $wgArticle->mTimestamp ; - else $article_time = ""; + $article_time = "×tamp=" . $wgArticle->mTimestamp ; $content_actions['validate'] = array('class' => ($action == 'validate') ? 'selected' : false , 'text' => wfMsg('val_tab'), 'href' => $this->makeUrl($this->thispage, "action=validate{$article_time}")); diff --git a/includes/SpecialValidate.php b/includes/SpecialValidate.php index 60c7b7dc97..346d855684 100644 --- a/includes/SpecialValidate.php +++ b/includes/SpecialValidate.php @@ -65,7 +65,6 @@ class Validation if ( $article_title == "" ) { $article_title = $_GET['article'] ; -# $heading = "

" . $article->getPrefixedText() . "

\n" ; $heading = "

" . $article_title . "

\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 = "" ; $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 .= "
\n" ; $html .= "" ; - $html .= "\n" ; + $html .= "
\n" ; $html .= str_replace ( "$1" , $tabsep , wfMsg("val_table_header") ) ; for ( $idx = 0 ; $idx < count ( $validationtypes) ; $idx++ ) { -- 2.20.1