From: Antoine Musso Date: Sun, 19 Sep 2004 17:09:12 +0000 (+0000) Subject: Allow user to always preview text on editing ( implement http://bugzilla.wikipedia... X-Git-Tag: 1.5.0alpha1~1957 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=ec5fffe8ed64e3110f2a1bbdd2d734de44c9a397;p=lhc%2Fweb%2Fwiklou.git Allow user to always preview text on editing ( implement bugzilla.wikipedia.org/show_bug.cgi?id=530 ) --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 8ad8765657..e92463a269 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -21,6 +21,7 @@ Major changes from 1.3.x: * New user preference for limitting the image size for images on image description pages * Error pages no more offer edit / talk / watch links (bug #502) +* Allow user to preview article on first edit (bug #530) * ... and more! === Caveats === diff --git a/includes/EditPage.php b/includes/EditPage.php index 16be5378d7..da5c8027b0 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -66,7 +66,7 @@ class EditPage { } if ( $this->save ) { $this->editForm( 'save' ); - } else if ( $this->preview ) { + } else if ( $this->preview or $wgUser->getOption('previewonfirst')) { $this->editForm( 'preview' ); } else { # First time through $this->editForm( 'initial' ); @@ -402,8 +402,14 @@ class EditPage { $parserOutput = $wgParser->parse( $previewtext , $wgTitle, $parserOptions ); $wgOut->addHTML( $parserOutput->mText ); } else { + # if user want to see preview when he edit an article + if( $wgUser->getOption('previewonfirst') and ($this->textbox1 == '')) { + $this->textbox1 = $this->mArticle->getContent(true); + } + $parserOutput = $wgParser->parse( $this->mArticle->preSaveTransform( $this->textbox1 ) ."\n\n", - $wgTitle, $parserOptions ); + $wgTitle, $parserOptions ); + $previewHTML = $parserOutput->mText; if($wgUser->getOption('previewontop')) { diff --git a/includes/SpecialPreferences.php b/includes/SpecialPreferences.php index e3d614278e..976bbd287f 100644 --- a/includes/SpecialPreferences.php +++ b/includes/SpecialPreferences.php @@ -309,7 +309,6 @@ class PreferencesForm { /** * @access private */ - function mainPrefsForm( $err ) { global $wgUser, $wgOut, $wgLang, $wgUseDynamicDates, $wgValidSkinNames; global $wgAllowRealName, $wgImageLimits; @@ -513,6 +512,7 @@ class PreferencesForm { " . $this->getToggle( "editwidth" ) . $this->getToggle( "showtoolbar" ) . + $this->getToggle( "previewonfirst" ) . $this->getToggle( "previewontop" ) . $this->getToggle( "watchdefault" ) . $this->getToggle( "minordefault" ) . " diff --git a/languages/Language.php b/languages/Language.php index 84895c06ee..c92f9d9ef8 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -132,6 +132,7 @@ define( 'MW_DATE_USER_FORMAT', true ); 'watchdefault', 'minordefault', 'previewontop', + 'previewonfirst', 'nocache', ); @@ -255,6 +256,7 @@ global $wgRightsText; 'tog-watchdefault' => 'Add pages you edit to your watchlist', 'tog-minordefault' => 'Mark all edits minor by default', 'tog-previewontop' => 'Show preview before edit box and not after it', +'tog-previewonfirst' => 'Show preview on first edit', 'tog-nocache' => 'Disable page caching', # dates