bug 22756: Add parameter to noarticletext/newarticletext indicating if it's the curre...
authorTobias <churchofemacs@users.mediawiki.org>
Sun, 7 Mar 2010 16:26:42 +0000 (16:26 +0000)
committerTobias <churchofemacs@users.mediawiki.org>
Sun, 7 Mar 2010 16:26:42 +0000 (16:26 +0000)
RELEASE-NOTES
includes/Article.php
includes/EditPage.php
languages/messages/MessagesQqq.php

index f69ff16..b1422d4 100644 (file)
@@ -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:<name>/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
index 78d7485..d405cca 100644 (file)
@@ -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 = "<div class='noarticletext'>\n$text\n</div>";
                if ( !$this->hasViewableContent() ) {
index d25e0f2..539badb 100644 (file)
@@ -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( "<div class=\"mw-newarticletext\">\n$1</div>", 'newarticletext' );
+                               $wgOut->wrapWikiMsg( "<div class=\"mw-newarticletext\">\n$1</div>", array( 'newarticletext', $isCurrent ) );
                        } else {
-                               $wgOut->wrapWikiMsg( "<div class=\"mw-newarticletextanon\">\n$1</div>", 'newarticletextanon' );
+                               $wgOut->wrapWikiMsg( "<div class=\"mw-newarticletextanon\">\n$1</div>", array( 'newarticletext', $isCurrent ) );
                        }
                }
                # Give a notice if the user is editing a deleted/moved page...
index bb563cf..056d956 100644 (file)
@@ -795,11 +795,17 @@ Parameters:
 
 {{doc-important|Do not translate \"<nowiki>[[User talk:\$1|\$1]]</nowiki>\" and ''Special:ChangePassword''.}}",
 'newarticle'                       => '{{Identical|New}}',
-'newarticletext'                   => "Text displayed above the edit box in editor when trying to create a new page.<br />'''Very important:''' leave <tt><nowiki>{{MediaWiki:Helppage}}</nowiki></tt> exactly as it is!",
+'newarticletext'                   => "Text displayed above the edit box in editor when trying to create a new page.<br />'''Very important:''' leave <tt><nowiki>{{MediaWiki:Helppage}}</nowiki></tt> 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',