r22905 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r22904‎ | r22905 | r22906 >
Date:11:57, 11 June 2007
Author:robchurch
Status:old
Tags:
Comment:
* Show custom editing introduction when editing existing pages, too
* Clean up handling of editing introductions

[Based on a patch from ZJH]
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/EditPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/EditPage.php
@@ -410,9 +410,10 @@
411411 }
412412 }
413413
414 - if(!$this->mTitle->getArticleID() && ('initial' == $this->formtype || $this->firsttime )) { # new article
 414+ # Show applicable editing introductions
 415+ if( $this->formtype == 'initial' || $this->firsttime )
415416 $this->showIntro();
416 - }
 417+
417418 if( $this->mTitle->isTalkPage() ) {
418419 $wgOut->addWikiText( wfMsg( 'talkpagetext' ) );
419420 }
@@ -585,29 +586,40 @@
586587 return $this->mTokenOk;
587588 }
588589
589 - /** */
590 - function showIntro() {
 590+ /**
 591+ * Show all applicable editing introductions
 592+ */
 593+ private function showIntro() {
591594 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() ) {
605597 $wgOut->addWikiText( wfMsg( 'newarticletext' ) );
606 - else
 598+ } else {
607599 $wgOut->addWikiText( wfMsg( 'newarticletextanon' ) );
608 - # Let the user know about previous deletions if applicable
609600 $this->showDeletionLog( $wgOut );
 601+ }
610602 }
611603 }
 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+ }
612624
613625 /**
614626 * Attempt submission
Index: trunk/phase3/RELEASE-NOTES
@@ -161,6 +161,7 @@
162162 * (bug 6743) Don't link broken image links to the upload form when uploads
163163 are disabled
164164 * (bug 9679) Improve documentation for $wgSiteNotice
 165+* Show custom editing introduction when editing existing pages
165166
166167 == API changes since 1.10 ==
167168

Follow-up revisions

RevisionCommit summaryAuthorDate
r22919Merged revisions 22878-22918 via svnmerge from...david00:00, 12 June 2007

Status & tagging log