* (bug 3487) Fix category edit preview with preview-on-bottom
authorBrion Vibber <brion@users.mediawiki.org>
Thu, 3 Nov 2005 22:40:02 +0000 (22:40 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Thu, 3 Nov 2005 22:40:02 +0000 (22:40 +0000)
RELEASE-NOTES
includes/EditPage.php

index 624642f..467cc62 100644 (file)
@@ -200,6 +200,7 @@ fully support the editing toolbar, but was found to be too confusing.
 * (bug 3845) Update attribute.php for 1.5 schema
 * changed directory hierarchy in images/math/. System upgrades from old to
   new hierarchy on the fly.
+* (bug 3487) Fix category edit preview with preview-on-bottom
 
 
 === Caveats ===
index d1d0e20..002f0ed 100644 (file)
@@ -771,18 +771,9 @@ class EditPage {
 
                $checkboxhtml = $minoredithtml . $watchhtml;
 
-               $wgOut->addHTML( '<div id="wikiPreview">' );
-               if ( 'preview' == $this->formtype) {
-                       $previewOutput = $this->getPreviewText();
-                       if ( $wgUser->getOption('previewontop' ) ) {
-                               $wgOut->addHTML( $previewOutput );
-                               if($this->mTitle->getNamespace() == NS_CATEGORY) {
-                                       $this->mArticle->closeShowCategory();
-                               }
-                               $wgOut->addHTML( "<br style=\"clear:both;\" />\n" );
-                       }
+               if ( 'preview' == $this->formtype && $wgUser->getOption( 'previewontop' ) ) {
+                       $this->showPreview();
                }
-               $wgOut->addHTML( '</div>' );
                if ( 'diff' == $this->formtype ) {
                        if ( $wgUser->getOption('previewontop' ) ) {
                                $wgOut->addHTML( $this->getDiff() );
@@ -912,7 +903,7 @@ END
                }
                $wgOut->addHTML( "</form>\n" );
                if ( $this->formtype == 'preview' && !$wgUser->getOption( 'previewontop' ) ) {
-                       $wgOut->addHTML( '<div id="wikiPreview">' . $previewOutput . '</div>' );
+                       $this->showPreview();
                }
                if ( $this->formtype == 'diff' && !$wgUser->getOption( 'previewontop' ) ) {
                        #$wgOut->addHTML( '<div id="wikiPreview">' . $difftext . '</div>' );
@@ -921,6 +912,26 @@ END
 
                wfProfileOut( $fname );
        }
+       
+       /**
+        * Append preview output to $wgOut.
+        * Includes category rendering if this is a category page.
+        * @access private
+        */
+       function showPreview() {
+               global $wgOut;
+               $wgOut->addHTML( '<div id="wikiPreview">' );
+               if($this->mTitle->getNamespace() == NS_CATEGORY) {
+                       $this->mArticle->openShowCategory();
+               }
+               $previewOutput = $this->getPreviewText();
+               $wgOut->addHTML( $previewOutput );
+               if($this->mTitle->getNamespace() == NS_CATEGORY) {
+                       $this->mArticle->closeShowCategory();
+               }
+               $wgOut->addHTML( "<br style=\"clear:both;\" />\n" );
+               $wgOut->addHTML( '</div>' );
+       }
 
        /**
         * Prepare a list of templates used by this page. Returns HTML.