From da4fca6569a5fa90d932542de5abe8a43b00b0ce Mon Sep 17 00:00:00 2001 From: Tobias Date: Sun, 7 Mar 2010 16:26:42 +0000 Subject: [PATCH] bug 22756: Add parameter to noarticletext/newarticletext indicating if it's the current user's user (talk) page --- RELEASE-NOTES | 4 +++- includes/Article.php | 13 +++++++++++-- includes/EditPage.php | 13 +++++++++++-- languages/messages/MessagesQqq.php | 12 +++++++++--- 4 files changed, 34 insertions(+), 8 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index f69ff16c7b..b1422d409b 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -26,7 +26,9 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 10183) Users can now add personal styles and scripts to all skins via User:/common.css and /common.js (if user css/js is enabled) * (bug 22748) Add anchors on Special:ListGroupRights - +* (bug 22756) Adding a parameter to noarticletext/newarticletext which indicates + if it's the current user's user (talk) page ($1 is true in that case) + === Bug fixes in 1.17 === * (bug 17560) Half-broken deletion moved image files to deletion archive without updating DB diff --git a/includes/Article.php b/includes/Article.php index 78d7485ddf..d405ccac52 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -1253,14 +1253,23 @@ class Article { // Use the default message text $text = $this->getContent(); } else { + # If it is a user (talk) page of the current user, add true as parameter, otherwise false. + $isCurrent = false; + if ( ( $this->mTitle->getNamespace() == NS_USER || $this->mTitle->getNamespace() == NS_USER_TALK ) + && $wgUser->getName() == $this->mTitle->getBaseText() ) + { + $isCurrent = true; + } + + # Don't show option "create this page" in the message if the user isn't allowed to. $createErrors = $this->mTitle->getUserPermissionsErrors( 'create', $wgUser ); $editErrors = $this->mTitle->getUserPermissionsErrors( 'edit', $wgUser ); $errors = array_merge( $createErrors, $editErrors ); if ( !count( $errors ) ) - $text = wfMsgNoTrans( 'noarticletext' ); + $text = wfMsgNoTrans( 'noarticletext', $isCurrent ); else - $text = wfMsgNoTrans( 'noarticletext-nopermission' ); + $text = wfMsgNoTrans( 'noarticletext-nopermission', $isCurrent ); } $text = "
\n$text\n
"; if ( !$this->hasViewableContent() ) { diff --git a/includes/EditPage.php b/includes/EditPage.php index d25e0f2d8b..539badb7a5 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -722,10 +722,19 @@ class EditPage { } # Try to add a custom edit intro, or use the standard one if this is not possible. if ( !$this->showCustomIntro() && !$this->mTitle->exists() ) { + # If it is a user (talk) page of the current user, add true as parameter, otherwise false. + $isCurrent = false; + if ( ( $this->mTitle->getNamespace() == NS_USER || $this->mTitle->getNamespace() == NS_USER_TALK ) + && $wgUser->getName() == $this->mTitle->getBaseText() ) + { + $isCurrent = true; + } + + # Show standard message if ( $wgUser->isLoggedIn() ) { - $wgOut->wrapWikiMsg( "
\n$1
", 'newarticletext' ); + $wgOut->wrapWikiMsg( "
\n$1
", array( 'newarticletext', $isCurrent ) ); } else { - $wgOut->wrapWikiMsg( "
\n$1
", 'newarticletextanon' ); + $wgOut->wrapWikiMsg( "
\n$1
", array( 'newarticletext', $isCurrent ) ); } } # Give a notice if the user is editing a deleted/moved page... diff --git a/languages/messages/MessagesQqq.php b/languages/messages/MessagesQqq.php index bb563cf0c7..056d956c26 100644 --- a/languages/messages/MessagesQqq.php +++ b/languages/messages/MessagesQqq.php @@ -795,11 +795,17 @@ Parameters: {{doc-important|Do not translate \"[[User talk:\$1|\$1]]\" and ''Special:ChangePassword''.}}", 'newarticle' => '{{Identical|New}}', -'newarticletext' => "Text displayed above the edit box in editor when trying to create a new page.
'''Very important:''' leave {{MediaWiki:Helppage}} exactly as it is!", +'newarticletext' => "Text displayed above the edit box in editor when trying to create a new page.
'''Very important:''' leave {{MediaWiki:Helppage}} exactly as it is! + +$1 is true when the page is a user (talk) page of the current user, otherwise false.", 'noarticletext' => 'This is the message that you get if you search for a term that has not yet got any entries on the wiki. -See also {{msg-mw|Noarticletext-nopermission}}.', -'noarticletext-nopermission' => 'See also {{msg-mw|Noarticletext}}.', +See also {{msg-mw|Noarticletext-nopermission}}. + +$1 is true when the page is a user (talk) page of the current user, otherwise false.', +'noarticletext-nopermission' => 'See also {{msg-mw|Noarticletext}}. + +$1 is true when the page is a user (talk) page of the current user, otherwise false.', 'userpage-userdoesnotexist' => 'Error message displayed when trying to edit or create a page or a subpage that belongs to a user who is not registered on the wiki', 'userpage-userdoesnotexist-view' => 'Shown in user pages of non existing users. See for example [http://translatewiki.net/wiki/User:Foo User:Foo].', 'clearyourcache' => 'Text at the top of .js/.css pages', -- 2.20.1