Index: trunk/phase3/includes/EditPage.php |
— | — | @@ -410,9 +410,10 @@ |
411 | 411 | } |
412 | 412 | } |
413 | 413 | |
414 | | - if(!$this->mTitle->getArticleID() && ('initial' == $this->formtype || $this->firsttime )) { # new article |
| 414 | + # Show applicable editing introductions |
| 415 | + if( $this->formtype == 'initial' || $this->firsttime ) |
415 | 416 | $this->showIntro(); |
416 | | - } |
| 417 | + |
417 | 418 | if( $this->mTitle->isTalkPage() ) { |
418 | 419 | $wgOut->addWikiText( wfMsg( 'talkpagetext' ) ); |
419 | 420 | } |
— | — | @@ -585,29 +586,40 @@ |
586 | 587 | return $this->mTokenOk; |
587 | 588 | } |
588 | 589 | |
589 | | - /** */ |
590 | | - function showIntro() { |
| 590 | + /** |
| 591 | + * Show all applicable editing introductions |
| 592 | + */ |
| 593 | + private function showIntro() { |
591 | 594 | global $wgOut, $wgUser; |
592 | | - $addstandardintro=true; |
593 | | - if($this->editintro) { |
594 | | - $introtitle=Title::newFromText($this->editintro); |
595 | | - if(isset($introtitle) && $introtitle->userCanRead()) { |
596 | | - $rev=Revision::newFromTitle($introtitle); |
597 | | - if($rev) { |
598 | | - $wgOut->addSecondaryWikiText($rev->getText()); |
599 | | - $addstandardintro=false; |
600 | | - } |
601 | | - } |
602 | | - } |
603 | | - if($addstandardintro) { |
604 | | - if ( $wgUser->isLoggedIn() ) |
| 595 | + if( !$this->showCustomIntro() && !$this->mTitle->exists() ) { |
| 596 | + if( $wgUser->isLoggedIn() ) { |
605 | 597 | $wgOut->addWikiText( wfMsg( 'newarticletext' ) ); |
606 | | - else |
| 598 | + } else { |
607 | 599 | $wgOut->addWikiText( wfMsg( 'newarticletextanon' ) ); |
608 | | - # Let the user know about previous deletions if applicable |
609 | 600 | $this->showDeletionLog( $wgOut ); |
| 601 | + } |
610 | 602 | } |
611 | 603 | } |
| 604 | + |
| 605 | + /** |
| 606 | + * Attempt to show a custom editing introduction, if supplied |
| 607 | + * |
| 608 | + * @return bool |
| 609 | + */ |
| 610 | + private function showCustomIntro() { |
| 611 | + if( $this->editintro ) { |
| 612 | + $title = Title::newFromText( $this->editintro ); |
| 613 | + if( $title instanceof Title && $title->exists() && $title->userCanRead() ) { |
| 614 | + $revision = Revision::newFromTitle( $title ); |
| 615 | + $wgOut->addSecondaryWikiText( $revision->getText() ); |
| 616 | + return true; |
| 617 | + } else { |
| 618 | + return false; |
| 619 | + } |
| 620 | + } else { |
| 621 | + return false; |
| 622 | + } |
| 623 | + } |
612 | 624 | |
613 | 625 | /** |
614 | 626 | * Attempt submission |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -161,6 +161,7 @@ |
162 | 162 | * (bug 6743) Don't link broken image links to the upload form when uploads |
163 | 163 | are disabled |
164 | 164 | * (bug 9679) Improve documentation for $wgSiteNotice |
| 165 | +* Show custom editing introduction when editing existing pages |
165 | 166 | |
166 | 167 | == API changes since 1.10 == |
167 | 168 | |