From: River Tarnell Date: Sun, 3 Jul 2005 04:00:33 +0000 (+0000) Subject: implement "action=render" X-Git-Tag: 1.5.0beta2~67 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/operations/recherche.php?a=commitdiff_plain;h=e4a87e105aa20858d5edd07dee20ea8cad5643dc;p=lhc%2Fweb%2Fwiklou.git implement "action=render" --- diff --git a/includes/Article.php b/includes/Article.php index a35d535c1b..5d239e13c3 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -93,7 +93,7 @@ class Article { if ( 0 == $this->getID() ) { if ( 'edit' == $action ) { - wfProfileOut( $fname ); + wfProfileOut( $fname ); # Should we put something in the textarea? # if &preload=Pagename is set, we try to get # the revision text and put it in. @@ -109,12 +109,12 @@ class Article { # Don't preload anything. # We used to put MediaWiki:Newarticletext here. # This is now shown above the edit box instead. - return ''; + return ''; } wfProfileOut( $fname ); - + return wfMsg( 'noarticletext' ); - } else { + } else { $this->loadContent( $noredir ); # check if we're displaying a [[User talk:x.x.x.x]] anonymous talk page if ( $this->mTitle->getNamespace() == NS_USER_TALK && @@ -833,6 +833,13 @@ class Article { wfProfileOut( $fname ); } + function render() { + global $wgOut; + + $wgOut->setArticleBodyOnly(true); + $this->view(); + } + /** * Insert a new empty page record for this article. * This *must* be followed up by creating a revision diff --git a/includes/OutputPage.php b/includes/OutputPage.php index e079edb1fa..f58fde9f06 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -32,6 +32,7 @@ class OutputPage { var $mParserOptions; var $mShowFeedLinks = false; var $mEnableClientCache = true; + var $mArticleBodyOnly = false; /** * Constructor @@ -67,6 +68,7 @@ class OutputPage { function getScript() { return $this->mScripts; } function setETag($tag) { $this->mETag = $tag; } + function setArticleBodyOnly($only) { $this->mArticleBodyOnly = $only; } function addLink( $linkarr ) { # $linkarr should be an associative array of attributes. We'll escape on output. @@ -447,9 +449,13 @@ class OutputPage { setcookie( $name, $val, $exp, '/' ); } - wfProfileIn( 'Output-skin' ); - $sk->outputPage( $this ); - wfProfileOut( 'Output-skin' ); + if ($this->mArticleBodyOnly) { + $this->out($this->mBodytext); + } else { + wfProfileIn( 'Output-skin' ); + $sk->outputPage( $this ); + wfProfileOut( 'Output-skin' ); + } $this->sendCacheControl(); ob_end_flush(); diff --git a/includes/Setup.php b/includes/Setup.php index ecbd474b5b..1b31c1881b 100644 --- a/includes/Setup.php +++ b/includes/Setup.php @@ -51,7 +51,7 @@ wfProfileIn( $fname.'-includes' ); require_once( 'GlobalFunctions.php' ); require_once( 'Hooks.php' ); require_once( 'Namespace.php' ); -require_once( 'RecentChange.php' ); +require_once( 'RecentChange.php' ); require_once( 'User.php' ); require_once( 'Skin.php' ); require_once( 'OutputPage.php' ); @@ -110,8 +110,8 @@ $wgMemc =& wfGetMainCache(); $messageMemc =& wfGetMessageCacheStorage(); $parserMemc =& wfGetParserCacheStorage(); -wfDebug( 'Main cache: ' . get_class( $wgMemc ) . - "\nMessage cache: " . get_class( $messageMemc ) . +wfDebug( 'Main cache: ' . get_class( $wgMemc ) . + "\nMessage cache: " . get_class( $messageMemc ) . "\nParser cache: " . get_class( $parserMemc ) . "\n" ); wfProfileOut( $fname.'-memcached' ); @@ -134,7 +134,7 @@ wfProfileOut( $fname.'-SetupSession' ); wfProfileIn( $fname.'-database' ); if ( !$wgDBservers ) { - $wgDBservers = array(array( + $wgDBservers = array(array( 'host' => $wgDBserver, 'user' => $wgDBuser, 'password' => $wgDBpassword, @@ -188,7 +188,7 @@ wfProfileOut( $fname.'-language1' ); wfProfileIn( $fname.'-User' ); # Skin setup functions -# Entries can be added to this variable during the inclusion +# Entries can be added to this variable during the inclusion # of the extension file. Skins can then perform any necessary initialisation. foreach ( $wgSkinExtensionFunctions as $func ) { $func(); @@ -246,14 +246,14 @@ wfProfileOut( $fname.'-MessageCache' ); # SEARCH INDEX UPDATES, AND MANY MANY THINGS. # DO NOT USE THIS MODE EXCEPT FOR TESTING RIGHT NOW. # -# To disable it, the easiest thing could be to uncomment the +# To disable it, the easiest thing could be to uncomment the # following; they should effectively disable the UI switch functionality # # $wgLangClass = $wgContLangClass; # $wgLanguageCode = $wgContLanguageCode; # $wgLang = $wgContLang; # -# TODO: Need to change reference to $wgLang to $wgContLang at proper +# TODO: Need to change reference to $wgLang to $wgContLang at proper # places, including namespaces, dates in signatures, magic words, # and links # @@ -299,8 +299,8 @@ wfProfileOut( $fname.'-misc2' ); wfProfileIn( $fname.'-extensions' ); # Extension setup functions for extensions other than skins -# Entries should be added to this variable during the inclusion -# of the extension file. This allows the extension to perform +# Entries should be added to this variable during the inclusion +# of the extension file. This allows the extension to perform # any necessary initialisation in the fully initialised environment foreach ( $wgExtensionFunctions as $func ) { $func(); diff --git a/includes/Skin.php b/includes/Skin.php index 65b16d31dc..ad48e25210 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -147,6 +147,7 @@ class Skin extends Linker { wfProfileIn( 'Skin::outputPage' ); $this->initPage( $out ); + $out->out( $out->headElement() ); $out->out( "\nout( "\n" ); } + $out->out( $this->beforeContent() ); $out->out( $out->mBodytext . "\n" ); @@ -197,17 +199,17 @@ class Skin extends Linker { */ function userCanPreview( $action ) { global $wgTitle, $wgRequest, $wgUser; - + if( $action != 'submit' ) return false; if( !$wgRequest->wasPosted() ) return false; - if( !$wgTitle->userCanEditCssJsSubpage() ) + if( !$wgTitle->userCanEditCssJsSubpage() ) return false; return $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) ); } - + # get the user/site-specific stylesheet, SkinPHPTal called from RawPage.php (settings are cached that way) function getUserStylesheet() { global $wgOut, $wgStylePath, $wgContLang, $wgUser, $wgRequest, $wgTitle, $wgAllowUserCss; @@ -258,7 +260,7 @@ class Skin extends Linker { return $s . $this->reallyDoGetUserStyles(); } - + function reallyDoGetUserStyles() { global $wgUser; $s = ''; @@ -406,7 +408,7 @@ END; return $s; } - + function getCategoryLinks () { global $wgOut, $wgTitle, $wgParser; global $wgUseCategoryMagic, $wgUseCategoryBrowser, $wgLang; @@ -926,7 +928,7 @@ END; } } } - + $go = wfMsg( 'go' ); $sp = wfMsg( 'specialpages' ); $spp = $wgContLang->specialPage( 'Specialpages' ); @@ -936,7 +938,7 @@ END; $s .= "