r63361 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r63360‎ | r63361 | r63362 >
Date:16:26, 7 March 2010
Author:churchofemacs
Status:reverted
Tags:
Comment:
bug 22756: Add parameter to noarticletext/newarticletext indicating if it's the current user's user (talk) page
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/Article.php (modified) (history)
  • /trunk/phase3/includes/EditPage.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesQqq.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Article.php
@@ -1253,14 +1253,23 @@
12541254 // Use the default message text
12551255 $text = $this->getContent();
12561256 } else {
 1257+ # If it is a user (talk) page of the current user, add true as parameter, otherwise false.
 1258+ $isCurrent = false;
 1259+ if ( ( $this->mTitle->getNamespace() == NS_USER || $this->mTitle->getNamespace() == NS_USER_TALK )
 1260+ && $wgUser->getName() == $this->mTitle->getBaseText() )
 1261+ {
 1262+ $isCurrent = true;
 1263+ }
 1264+
 1265+ # Don't show option "create this page" in the message if the user isn't allowed to.
12571266 $createErrors = $this->mTitle->getUserPermissionsErrors( 'create', $wgUser );
12581267 $editErrors = $this->mTitle->getUserPermissionsErrors( 'edit', $wgUser );
12591268 $errors = array_merge( $createErrors, $editErrors );
12601269
12611270 if ( !count( $errors ) )
1262 - $text = wfMsgNoTrans( 'noarticletext' );
 1271+ $text = wfMsgNoTrans( 'noarticletext', $isCurrent );
12631272 else
1264 - $text = wfMsgNoTrans( 'noarticletext-nopermission' );
 1273+ $text = wfMsgNoTrans( 'noarticletext-nopermission', $isCurrent );
12651274 }
12661275 $text = "<div class='noarticletext'>\n$text\n</div>";
12671276 if ( !$this->hasViewableContent() ) {
Index: trunk/phase3/includes/EditPage.php
@@ -722,10 +722,19 @@
723723 }
724724 # Try to add a custom edit intro, or use the standard one if this is not possible.
725725 if ( !$this->showCustomIntro() && !$this->mTitle->exists() ) {
 726+ # If it is a user (talk) page of the current user, add true as parameter, otherwise false.
 727+ $isCurrent = false;
 728+ if ( ( $this->mTitle->getNamespace() == NS_USER || $this->mTitle->getNamespace() == NS_USER_TALK )
 729+ && $wgUser->getName() == $this->mTitle->getBaseText() )
 730+ {
 731+ $isCurrent = true;
 732+ }
 733+
 734+ # Show standard message
726735 if ( $wgUser->isLoggedIn() ) {
727 - $wgOut->wrapWikiMsg( "<div class=\"mw-newarticletext\">\n$1</div>", 'newarticletext' );
 736+ $wgOut->wrapWikiMsg( "<div class=\"mw-newarticletext\">\n$1</div>", array( 'newarticletext', $isCurrent ) );
728737 } else {
729 - $wgOut->wrapWikiMsg( "<div class=\"mw-newarticletextanon\">\n$1</div>", 'newarticletextanon' );
 738+ $wgOut->wrapWikiMsg( "<div class=\"mw-newarticletextanon\">\n$1</div>", array( 'newarticletext', $isCurrent ) );
730739 }
731740 }
732741 # Give a notice if the user is editing a deleted/moved page...
Index: trunk/phase3/languages/messages/MessagesQqq.php
@@ -795,11 +795,17 @@
796796
797797 {{doc-important|Do not translate \"<nowiki>[[User talk:\$1|\$1]]</nowiki>\" and ''Special:ChangePassword''.}}",
798798 'newarticle' => '{{Identical|New}}',
799 -'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!",
 799+'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!
 800+
 801+$1 is true when the page is a user (talk) page of the current user, otherwise false.",
800802 'noarticletext' => 'This is the message that you get if you search for a term that has not yet got any entries on the wiki.
801803
802 -See also {{msg-mw|Noarticletext-nopermission}}.',
803 -'noarticletext-nopermission' => 'See also {{msg-mw|Noarticletext}}.',
 804+See also {{msg-mw|Noarticletext-nopermission}}.
 805+
 806+$1 is true when the page is a user (talk) page of the current user, otherwise false.',
 807+'noarticletext-nopermission' => 'See also {{msg-mw|Noarticletext}}.
 808+
 809+$1 is true when the page is a user (talk) page of the current user, otherwise false.',
804810 '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',
805811 'userpage-userdoesnotexist-view' => 'Shown in user pages of non existing users. See for example [http://translatewiki.net/wiki/User:Foo User:Foo].',
806812 'clearyourcache' => 'Text at the top of .js/.css pages',
Index: trunk/phase3/RELEASE-NOTES
@@ -26,7 +26,9 @@
2727 * (bug 10183) Users can now add personal styles and scripts to all skins via
2828 User:<name>/common.css and /common.js (if user css/js is enabled)
2929 * (bug 22748) Add anchors on Special:ListGroupRights
30 -
 30+* (bug 22756) Adding a parameter to noarticletext/newarticletext which indicates
 31+ if it's the current user's user (talk) page ($1 is true in that case)
 32+
3133 === Bug fixes in 1.17 ===
3234 * (bug 17560) Half-broken deletion moved image files to deletion archive without
3335 updating DB

Follow-up revisions

RevisionCommit summaryAuthorDate
r63364Refine documentation added in r63361siebrand17:08, 7 March 2010
r63369reverting myself (r63361) due to comment #2 in bug 22756. Feature not neededchurchofemacs18:29, 7 March 2010

Status & tagging log