(bug 4630) Add user preference to prompt users when entering blank edit summaries
authorRob Church <robchurch@users.mediawiki.org>
Sat, 25 Mar 2006 00:57:14 +0000 (00:57 +0000)
committerRob Church <robchurch@users.mediawiki.org>
Sat, 25 Mar 2006 00:57:14 +0000 (00:57 +0000)
RELEASE-NOTES
includes/EditPage.php
includes/SpecialPreferences.php
languages/Language.php
languages/Messages.php

index 857b090..1fd664a 100644 (file)
@@ -714,6 +714,7 @@ fully support the editing toolbar, but was found to be too confusing.
 * (bug 5286) Fix regression in display of missing/bad revision IDs
 * (bug 4729) Add user preference that marks a user's edits as patrolled if user is able to
 * (bug 4497,4704,5010) Added some new language codes.
+* (bug 4630) Add user preference to prompt users when entering blank edit summaries
 
 === Caveats ===
 
index b47dce7..18e99cd 100644 (file)
@@ -27,6 +27,8 @@ class EditPage {
        var $tooBig = false;
        var $kblength = false;
        var $missingComment = false;
+       var $missingSummary = false;
+       var $allowBlankSummary = false;
 
        # Form values
        var $save = false, $preview = false, $diff = false;
@@ -381,6 +383,8 @@ class EditPage {
 
                        $this->minoredit = $request->getCheck( 'wpMinoredit' );
                        $this->watchthis = $request->getCheck( 'wpWatchthis' );
+                       $this->allowBlankSummary = $request->getBool( 'wpIgnoreBlankSummary' );
+                       
                } else {
                        # Not a posted form? Start with nothing.
                        wfDebug( "$fname: Not a posted form.\n" );
@@ -627,6 +631,13 @@ class EditPage {
                        return true;
                }
 
+               # Handle the user preference to force summaries here
+               if( trim( $this->summary ) == '' && !$this->allowBlankSummary  && $wgUser->getOption( 'forceeditsummary' ) ) {
+                       $this->missingSummary = true;
+                       wfProfileOut( $fname );
+                       return( true );
+               }                                       
+
                # All's well
                wfProfileIn( "$fname-sectionanchor" );
                $sectionanchor = '';
@@ -744,6 +755,10 @@ class EditPage {
                        if ( $this->missingComment ) {
                                $wgOut->addWikiText( wfMsg( 'missingcommenttext' ) );
                        }
+                       
+                       if( $this->missingSummary ) {
+                               $wgOut->addWikiText( wfMsg( 'missingsummary' ) );
+                       }
 
                        if ( !$this->checkUnicodeCompliantBrowser() ) {
                                $wgOut->addWikiText( wfMsg( 'nonunicodebrowser') );
@@ -1055,6 +1070,12 @@ END
                        $wgOut->addHTML( "\n<input type='hidden' value=\"$token\" name=\"wpEditToken\" />\n" );
                }
 
+               # If there's no summary, slip in a hidden tag here
+               # If the user doesn't want to provide one, hitting Save a second time will cause it to go
+               # through without further hassle
+               if( $this->missingSummary ) {
+                       $wgOut->addHTML( "<input type=\"hidden\" name=\"wpIgnoreBlankSummary\" value=\"1\" />\n" );
+               }
 
                if ( $this->isConflict ) {
                        require_once( "DifferenceEngine.php" );
index 7af9b26..16a176f 100644 (file)
@@ -818,8 +818,9 @@ class PreferencesForm {
                                'externaleditor',
                                'externaldiff',
                                $wgLivePreview ? 'uselivepreview' : false,
-                               $wgUser->isAllowed( 'patrol' ) ? 'autopatrol' : false, )
-                       ) . '</fieldset>'
+                               $wgUser->isAllowed( 'patrol' ) ? 'autopatrol' : false,
+                               'forceeditsummary',
+                       ) ) . '</fieldset>'
                );
                $this->mUsedToggles['autopatrol'] = true; # Don't show this up for users who can't; the handler below is dumb and doesn't know it
 
index c7e853d..3eb8fa2 100644 (file)
@@ -160,6 +160,7 @@ $wgDateFormatsEn = array(
        'showjumplinks',
        'uselivepreview',
        'autopatrol',
+       'forceeditsummary',
 );
 
 /* private */ $wgBookstoreListEn = array(
index 5372650..821adc4 100644 (file)
@@ -62,6 +62,7 @@ parent class in order maintain consistency across languages.
 'tog-showjumplinks' => 'Enable "jump to" accessibility links',
 'tog-uselivepreview' => 'Use live preview (JavaScript) (Experimental)',
 'tog-autopatrol' => 'Mark edits you make as patrolled',
+'tog-forceeditsummary' => 'Prompt me when entering a blank edit summary',
 
 'underline-always' => 'Always',
 'underline-never' => 'Never',
@@ -456,6 +457,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.',
+'missingsummary' => "'''Reminder:''' You have not provided an edit summary. If you click Save again, your edit will be saved without one.",
 'missingcommenttext' => 'Please enter a comment below.',
 'blockedtitle' => 'User is blocked',
 'blockedtext'  => 'Your user name or IP address has been blocked by $1.