Allow user to always preview text on editing ( implement http://bugzilla.wikipedia...
authorAntoine Musso <hashar@users.mediawiki.org>
Sun, 19 Sep 2004 17:09:12 +0000 (17:09 +0000)
committerAntoine Musso <hashar@users.mediawiki.org>
Sun, 19 Sep 2004 17:09:12 +0000 (17:09 +0000)
RELEASE-NOTES
includes/EditPage.php
includes/SpecialPreferences.php
languages/Language.php

index 8ad8765..e92463a 100644 (file)
@@ -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 ===
index 16be537..da5c802 100644 (file)
@@ -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')) {
index e3d6142..976bbd2 100644 (file)
@@ -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 {
                </div> " .
                $this->getToggle( "editwidth" ) .
                $this->getToggle( "showtoolbar" ) .
+               $this->getToggle( "previewonfirst" ) .
                $this->getToggle( "previewontop" ) .
                $this->getToggle( "watchdefault" ) .
                $this->getToggle( "minordefault" ) . "
index 84895c0..c92f9d9 100644 (file)
@@ -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