From 4b85ab4a10beabc9249f98d40e8aeddf00223e08 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Thu, 3 Nov 2005 22:40:02 +0000 Subject: [PATCH] * (bug 3487) Fix category edit preview with preview-on-bottom --- RELEASE-NOTES | 1 + includes/EditPage.php | 35 +++++++++++++++++++++++------------ 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 624642f1a8..467cc62c56 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 === diff --git a/includes/EditPage.php b/includes/EditPage.php index d1d0e20bb4..002f0ed7eb 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -771,18 +771,9 @@ class EditPage { $checkboxhtml = $minoredithtml . $watchhtml; - $wgOut->addHTML( '
' ); - 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( "
\n" ); - } + if ( 'preview' == $this->formtype && $wgUser->getOption( 'previewontop' ) ) { + $this->showPreview(); } - $wgOut->addHTML( '
' ); if ( 'diff' == $this->formtype ) { if ( $wgUser->getOption('previewontop' ) ) { $wgOut->addHTML( $this->getDiff() ); @@ -912,7 +903,7 @@ END } $wgOut->addHTML( "\n" ); if ( $this->formtype == 'preview' && !$wgUser->getOption( 'previewontop' ) ) { - $wgOut->addHTML( '
' . $previewOutput . '
' ); + $this->showPreview(); } if ( $this->formtype == 'diff' && !$wgUser->getOption( 'previewontop' ) ) { #$wgOut->addHTML( '
' . $difftext . '
' ); @@ -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( '
' ); + 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( "
\n" ); + $wgOut->addHTML( '
' ); + } /** * Prepare a list of templates used by this page. Returns HTML. -- 2.20.1