From: Magnus Manske Date: Tue, 20 Jul 2004 20:48:19 +0000 (+0000) Subject: Article validation code (as a tab now) X-Git-Tag: 1.5.0alpha1~2629 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/journal.php?a=commitdiff_plain;h=1b8983ea763f2b1423674e1143737bfbc7905571;p=lhc%2Fweb%2Fwiklou.git Article validation code (as a tab now) --- diff --git a/includes/Article.php b/includes/Article.php index 21fd21bac5..0fe1352c6d 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -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 ) diff --git a/includes/SkinPHPTal.php b/includes/SkinPHPTal.php index 5479d20d7e..d53720ea65 100644 --- a/includes/SkinPHPTal.php +++ b/includes/SkinPHPTal.php @@ -434,6 +434,13 @@ '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 */ diff --git a/includes/SpecialValidate.php b/includes/SpecialValidate.php index f5b432ee93..1bd180ff64 100644 --- a/includes/SpecialValidate.php +++ b/includes/SpecialValidate.php @@ -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 = "

" . $article->getPrefixedText() . "

\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 = "

" . $article->getPrefixedText() . "

\n" ; + $html = $heading ; foreach ( $val AS $time => $stuff ) { if ( $time == $article_time ) $html .= "

This version

\n" ; diff --git a/index.php b/index.php index 803a5486ae..7680dbb3d7 100644 --- 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; diff --git a/languages/Language.php b/languages/Language.php index fbefd8327a..cd3a7d9b27 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -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 $2 article', 'val_noop' => 'No opinion', 'val_percent' => '$1% ($2 of $3 points)', +'val_tab' => 'Validate', # Move page #