Patch for bug 4273: "New section" editing page should not submit when user hits Enter...
authorLupin <lupin-wp@users.mediawiki.org>
Wed, 1 Mar 2006 23:00:07 +0000 (23:00 +0000)
committerLupin <lupin-wp@users.mediawiki.org>
Wed, 1 Mar 2006 23:00:07 +0000 (23:00 +0000)
includes/EditPage.php
languages/Messages.php

index 46d9e8d..e15dc15 100644 (file)
@@ -26,6 +26,7 @@ class EditPage {
        var $mTokenOk = true;
        var $tooBig = false;
        var $kblength = false;
+       var $missingComment = false;
 
        # Form values
        var $save = false, $preview = false, $diff = false;
@@ -630,6 +631,10 @@ class EditPage {
                wfProfileIn( "$fname-sectionanchor" );
                $sectionanchor = '';
                if( $this->section == 'new' ) {
+                       if ( $this->textbox1 == '' ) {
+                               $this->missingComment = true;
+                               return true;
+                       }
                        if( $this->summary != '' ) {
                                $sectionanchor = $this->sectionAnchor( $this->summary );
                        }
@@ -735,6 +740,11 @@ class EditPage {
                                $s = wfMsg( 'editing', $this->mTitle->getPrefixedText() );
                        }
                        $wgOut->setPageTitle( $s );
+
+                       if ( $this->missingComment ) {
+                               $wgOut->addWikiText( wfMsg( 'missingcommenttext' ) );
+                       }
+
                        if ( !$this->checkUnicodeCompliantBrowser() ) {
                                $wgOut->addWikiText( wfMsg( 'nonunicodebrowser') );
                        }
index 6f8bb15..924168b 100644 (file)
@@ -453,6 +453,7 @@ format. Please enter a well-formatted address or empty that field.',
 'showlivepreview'      => 'Live preview',
 'showdiff'     => 'Show changes',
 'anoneditwarning' => 'You are not logged in. Your IP address will be recorded in this page\'s edit history.',
+'missingcommenttext' => 'Please enter a comment below.',
 'blockedtitle' => 'User is blocked',
 'blockedtext'  => 'Your user name or IP address has been blocked by $1.
 The reason given is this:<br />\'\'$2\'\'<p>You may contact $1 or one of the other