* (bug 2618) Fix regression from another fix; show initial preview for
authorBrion Vibber <brion@users.mediawiki.org>
Thu, 30 Jun 2005 06:51:43 +0000 (06:51 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Thu, 30 Jun 2005 06:51:43 +0000 (06:51 +0000)
  categories only if the page does not exist.

RELEASE-NOTES
includes/EditPage.php

index cc6bcc6..7f537f3 100644 (file)
@@ -427,6 +427,8 @@ Various bugfixes, small features, and a few experimental things:
   Also fix navigation links on current-with-oldid view.
 * (bug 2620) Return to prior behavior for some more things (such as
   subpage parent links) on current-diff view.
+* (bug 2618) Fix regression from another fix; show initial preview for
+  categories only if the page does not exist.
 
 
 === Caveats ===
index 1b53ba1..a97558f 100644 (file)
@@ -181,8 +181,7 @@ class EditPage {
                } else if ( $this->diff ) {
                        $this->editForm( 'diff' );
                } else { # First time through
-                       if( $wgUser->getOption('previewonfirst') 
-                               or $this->mTitle->getNamespace() == NS_CATEGORY ) {
+                       if( $this->previewOnOpen() ) {
                                $this->editForm( 'preview', true );
                        } else {
                                $this->extractMetaDataFromArticle () ;
@@ -190,6 +189,19 @@ class EditPage {
                        }
                }
        }
+       
+       /**
+        * Return true if this page should be previewed when the edit form
+        * is initially opened.
+        * @return bool
+        * @access private
+        */
+       function previewOnOpen() {
+               global $wgUser;
+               return $wgUser->getOption( 'previewonfirst' ) ||
+                       ( $this->mTitle->getNamespace() == NS_CATEGORY &&
+                               !$this->mTitle->exists() );
+       }
 
        /**
         * @todo document