* (bug 6660) Fix behaviour of EditPage::blockedPage() when the article does not exist...
authorRob Church <robchurch@users.mediawiki.org>
Thu, 13 Jul 2006 10:03:45 +0000 (10:03 +0000)
committerRob Church <robchurch@users.mediawiki.org>
Thu, 13 Jul 2006 10:03:45 +0000 (10:03 +0000)
RELEASE-NOTES
includes/EditPage.php

index b0d680d..fa5eb7f 100644 (file)
@@ -62,7 +62,9 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 6642) Don't offer to unlock the database when it isn't locked
 * cleanupTitles.php changed from --dry-run option to --fix, so default
   behavior is now a non-invasive check as with namespaceDupes.php
-
+* (bug 6660) Fix behaviour of EditPage::blockedPage() when the article does
+  not exist; now doesn't show the source box if the user hasn't provided it
+  (blocked mid-edit) and the page doesn't exist
 
 == Languages updated ==
 
index d43a120..f41e85c 100644 (file)
@@ -1416,15 +1416,21 @@ END
                # If the user made changes, preserve them when showing the markup
                # (This happens when a user is blocked during edit, for instance)               
                $first = $this->firsttime || ( !$this->save && $this->textbox1 == '' );
-               $source = $first ? $this->getContent() : $this->textbox1;
-               
+               if( $first ) {
+                       $source = $this->mTitle->exists() ? $this->getContent() : false;
+               } else {
+                       $source = $this->textbox1;
+               }
+       
                # Spit out the source or the user's modified version
-               $rows = $wgUser->getOption( 'rows' );
-               $cols = $wgUser->getOption( 'cols' );
-               $attribs = array( 'id' => 'wpTextbox1', 'name' => 'wpTextbox1', 'cols' => $cols, 'rows' => $rows, 'readonly' => 'readonly' );
-               $wgOut->addHtml( '<hr />' );
-               $wgOut->addWikiText( wfMsg( $first ? 'blockedoriginalsource' : 'blockededitsource', $this->mTitle->getPrefixedText() ) );
-               $wgOut->addHtml( wfElement( 'textarea', $attribs, $source ) );
+               if( $source !== false ) {
+                       $rows = $wgUser->getOption( 'rows' );
+                       $cols = $wgUser->getOption( 'cols' );
+                       $attribs = array( 'id' => 'wpTextbox1', 'name' => 'wpTextbox1', 'cols' => $cols, 'rows' => $rows, 'readonly' => 'readonly' );
+                       $wgOut->addHtml( '<hr />' );
+                       $wgOut->addWikiText( wfMsg( $first ? 'blockedoriginalsource' : 'blockededitsource', $this->mTitle->getPrefixedText() ) );
+                       $wgOut->addHtml( wfElement( 'textarea', $attribs, $source ) );
+               }
        }
 
        /**