From: cenarium Date: Wed, 20 Jan 2016 20:43:47 +0000 (+0100) Subject: Add class to EditPage text area when editing an old revision X-Git-Tag: 1.31.0-rc.0~5030 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dcompta/comptes/journal.php?a=commitdiff_plain;h=81698d4c1605f491709e636acd5ca0e6857e3821;p=lhc%2Fweb%2Fwiklou.git Add class to EditPage text area when editing an old revision This adds a class 'mw-textarea-oldrev' to the editing area when an old page revision is edited. It seems that the warning MediaWiki:Editingold is not sufficient for some users and some css tweaks might be appreciated, as is already done for protected pages. Bug: T124226 Change-Id: Ifc53af0f827a5cebfd9cc220b0aa247210e8dcfc --- diff --git a/includes/EditPage.php b/includes/EditPage.php index 770a74ec00..e8ea20f16a 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -408,6 +408,11 @@ class EditPage { */ protected $context; + /** + * @var bool Whether an old revision is edited + */ + private $isOldRev = false; + /** * @param Article $article */ @@ -2968,6 +2973,7 @@ ERROR; if ( !$revision->isCurrent() ) { $this->mArticle->setOldSubtitle( $revision->getId() ); $wgOut->addWikiMsg( 'editingold' ); + $this->isOldRev = true; } } elseif ( $this->mTitle->exists() ) { // Something went wrong @@ -3278,6 +3284,10 @@ HTML $classes[] = 'mw-textarea-cprotected'; } } + # Is an old revision being edited? + if ( $this->isOldRev ) { + $classes[] = 'mw-textarea-oldrev'; + } $attribs = [ 'tabindex' => 1 ];