* (bug 1175) Fix "preview on first edit" mode
authorBrion Vibber <brion@users.mediawiki.org>
Fri, 24 Dec 2004 05:19:04 +0000 (05:19 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Fri, 24 Dec 2004 05:19:04 +0000 (05:19 +0000)
merge fix from REL1_4

includes/EditPage.php

index 33e17c9..07d01c1 100644 (file)
@@ -71,10 +71,15 @@ class EditPage {
                }
                if ( $this->save ) {
                        $this->editForm( 'save' );
-               } else if ( $this->preview or $wgUser->getOption('previewonfirst')) {
+               } else if ( $this->preview ) {
                        $this->editForm( 'preview' );
                } else { # First time through
-                       $this->editForm( 'initial' );
+                       $this->initForm();
+                       if( $wgUser->getOption('previewonfirst') ) {
+                               $this->editForm( 'preview' );
+                       } else {
+                               $this->editForm( 'initial' );
+                       }
                }
        }
 
@@ -272,10 +277,7 @@ class EditPage {
                # checking, etc.
 
                if ( 'initial' == $formtype ) {
-                       $this->edittime = $this->mArticle->getTimestamp();
-                       $this->textbox1 = $this->mArticle->getContent( true );
-                       $this->summary = '';
-                       $this->proxyCheck();
+                       $this->initForm();
                }
                $wgOut->setRobotpolicy( 'noindex,nofollow' );
 
@@ -513,6 +515,16 @@ END
                        $wgOut->addHTML('<div id="wikiPreview">' . $previewOutput . '</div>');
                }
        }
+       
+       /**
+        * @todo document
+        */
+       function initForm() {
+               $this->edittime = $this->mArticle->getTimestamp();
+               $this->textbox1 = $this->mArticle->getContent( true );
+               $this->summary = '';
+               $this->proxyCheck();
+       }
 
        function getPreviewText( $isConflict, $isCssJsSubpage ) {
                global $wgOut, $wgUser, $wgTitle, $wgParser;