# Get variables from query string :P
$action = $wgRequest->getText( 'action', 'view' );
$section = $wgRequest->getText( 'section' );
+ $preload = $wgRequest->getText( 'preload' );
+ $newpagetext = $wgRequest->getText('newpagetext');
$fname = 'Article::getContent';
wfProfileIn( $fname );
if ( 0 == $this->getID() ) {
if ( 'edit' == $action ) {
- wfProfileOut( $fname );
- return ''; # was "newarticletext", now moved above the box)
+ 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.
+ if($preload) {
+ $preloadTitle=Title::newFromText($preload);
+ if($preloadTitle->userCanRead()) {
+ $rev=Revision::newFromTitle($preloadTitle);
+ if($rev) {
+ return $rev->getText();
+ }
+ }
+ }
+ # Don't preload anything.
+ # We used to put MediaWiki:Newarticletext here.
+ # This is now shown above the edit box instead.
+ return '';
}
wfProfileOut( $fname );
+
return wfMsg( 'noarticletext' );
} else {
$this->loadContent( $noredir );
function editForm( $formtype, $firsttime = false ) {
global $wgOut, $wgUser;
global $wgLang, $wgContLang, $wgParser, $wgTitle;
- global $wgAllowAnonymousMinor;
+ global $wgAllowAnonymousMinor, $wgRequest;
global $wgSpamRegex, $wgFilterCallback;
$sk = $wgUser->getSkin();
if(!$this->mTitle->getArticleID()) { # new article
- $wgOut->addWikiText(wfmsg('newarticletext'));
+ $editintro = $wgRequest->getText( 'editintro' );
+ $addstandardintro=true;
+ if($editintro) {
+ $introtitle=Title::newFromText($editintro);
+ if($introtitle->userCanRead()) {
+ $rev=Revision::newFromTitle($introtitle);
+ if($rev) {
+ $wgOut->addWikiText($rev->getText());
+ $addstandardintro=false;
+ }
+ }
+ }
+ if($addstandardintro) {
+ $wgOut->addWikiText(wfmsg('newarticletext'));
+ }
}
if( $this->mTitle->isTalkPage() ) {