From 0b92d62616b40cf67eb77c8b3d1dae14a8bff4a9 Mon Sep 17 00:00:00 2001 From: Raimond Spekking Date: Tue, 23 Nov 2010 12:57:27 +0000 Subject: [PATCH] (bug 21911) Per Tim Starling's comment #10: Remove hard coded limit for long page warning. New message [[MediaWiki:Longpage-hint]] (empty per default) can be used instead. Parameters: $1 shows the formatted textsize in Byte/KB/MB, $2 is the raw number of the textsize in Byte for calculation with PerserFunctions (yes, I know that PerserFunctions are not in core, unfortunately, but every installation I know or attend have it) --- RELEASE-NOTES | 4 ++++ includes/EditPage.php | 17 ++++++++++------- languages/messages/MessagesEn.php | 4 +--- maintenance/language/messageTypes.inc | 1 + maintenance/language/messages.inc | 2 +- 5 files changed, 17 insertions(+), 11 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 9385101c4b..a18e376543 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -210,6 +210,10 @@ LocalSettings.php. The specific bugs are listed below in the general notes. * When viewing a redirect, the redirect arrow and redirection target are both wrapped in a div that has the class "redirectMsg" so that the redirection arrow can be customized with CSS +* (bug 21911) Hard coded limit for long page warning removed. New message + [[MediaWiki:Longpage-hint]] (empty per default) can be used instead. + Parameters: $1 shows the formatted textsize in Byte/KB/MB, $2 is the raw + number of the textsize in Byte === Bug fixes in 1.17 === * (bug 17560) Half-broken deletion moved image files to deletion archive diff --git a/includes/EditPage.php b/includes/EditPage.php index 2f8fadf275..1182ef7995 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -1457,13 +1457,16 @@ HTML } if ( $this->tooBig || $this->kblength > $wgMaxArticleSize ) { - $wgOut->addHTML( "
\n" ); - $wgOut->addWikiMsg( 'longpageerror', $wgLang->formatNum( $this->kblength ), $wgLang->formatNum( $wgMaxArticleSize ) ); - $wgOut->addHTML( "
\n" ); - } elseif ( $this->kblength > 29 ) { - $wgOut->addHTML( "
\n" ); - $wgOut->addWikiMsg( 'longpagewarning', $wgLang->formatNum( $this->kblength ) ); - $wgOut->addHTML( "
\n" ); + $wgOut->wrapWikiMsg( "
\n$1\n
", + array( 'longpageerror', $wgLang->formatNum( $this->kblength ), $wgLang->formatNum( $wgMaxArticleSize ) ) ); + } else { + $msg = 'longpage-hint'; + $text = wfMsg( $msg ); + if( !wfEmptyMsg( $msg, $text ) && $text !== '-' ) { + $wgOut->wrapWikiMsg( "
\n$1\n
", + array( 'longpage-hint', $wgLang->formatSize( strlen( $this->textbox1 ) ), strlen( $this->textbox1 ) ) + ); + } } } diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index 94e085a5ef..ab8de9dc89 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -1337,9 +1337,7 @@ If you do not want your writing to be edited mercilessly, then do not submit it You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see $1 for details). '''Do not submit copyrighted work without permission!'''", 'editpage-tos-summary' => '-', # do not translate or duplicate this message to other languages -'longpagewarning' => "'''Warning:''' This page is $1 kilobytes long; -some browsers may have problems editing pages approaching or longer than 32kb. -Please consider breaking the page into smaller sections.", +'longpage-hint' => '-', # do not translate or duplicate this message to other languages 'longpageerror' => "'''Error: The text you have submitted is $1 kilobytes long, which is longer than the maximum of $2 kilobytes.''' It cannot be saved.", 'readonlywarning' => "'''Warning: The database has been locked for maintenance, so you will not be able to save your edits right now.''' diff --git a/maintenance/language/messageTypes.inc b/maintenance/language/messageTypes.inc index a9b25a7c0b..a631d1a8ad 100644 --- a/maintenance/language/messageTypes.inc +++ b/maintenance/language/messageTypes.inc @@ -168,6 +168,7 @@ $wgIgnoredMessages = array( 'editpage-tos-summary', 'addsection-preload', 'addsection-editintro', + 'longpage-hint', ); /** Optional messages, which may be translated only if changed in the target language. */ diff --git a/maintenance/language/messages.inc b/maintenance/language/messages.inc index 6754ed4d81..56ef4e35ea 100644 --- a/maintenance/language/messages.inc +++ b/maintenance/language/messages.inc @@ -581,7 +581,7 @@ $wgMessageStructure = array( 'copyrightwarning', 'copyrightwarning2', 'editpage-tos-summary', - 'longpagewarning', + 'longpage-hint', 'longpageerror', 'readonlywarning', 'protectedpagewarning', -- 2.20.1