From: Victor Vasiliev Date: Sat, 12 Apr 2008 17:58:58 +0000 (+0000) Subject: * Hide (undo) link if user isn't able to edit page X-Git-Tag: 1.31.0-rc.0~48411 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=516be01b35967a18be6f18b1aeb43aa25f7a155f;p=lhc%2Fweb%2Fwiklou.git * Hide (undo) link if user isn't able to edit page --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 2707ea5efa..779ecc8d86 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -173,6 +173,7 @@ Special:EmailUser * (bug 13678) Fix CSS validation for Monobook * (bug 13684) Links in Special:ListGroupRights should be in content language * (bug 13690) Fix PHP notice on accessing some URLs +* Hide (undo) link if user isn't able to edit page === API changes in 1.13 === diff --git a/includes/DifferenceEngine.php b/includes/DifferenceEngine.php index 4d5848a126..37c73ecfdc 100644 --- a/includes/DifferenceEngine.php +++ b/includes/DifferenceEngine.php @@ -638,6 +638,9 @@ CONTROL; // Update the new revision ID in case it was 0 (makes life easier doing UI stuff) $this->mNewid = $this->mNewRev->getId(); + + // Check if page is editable + $editable = $this->mNewRev->getTitle()->userCan( 'edit' ); // Set assorted variables $timestamp = $wgLang->timeanddate( $this->mNewRev->getTimestamp(), true ); @@ -647,16 +650,16 @@ CONTROL; $this->mPagetitle = htmlspecialchars( wfMsg( 'currentrev' ) ); $newEdit = $this->mNewPage->escapeLocalUrl( 'action=edit' ); - $this->mNewtitle = "{$this->mPagetitle} ($timestamp)" - . " (" . htmlspecialchars( wfMsg( 'editold' ) ) . ")"; + $this->mNewtitle = "{$this->mPagetitle} ($timestamp)"; + $this->mNewtitle .= " (" . wfMsgHtml( $editable ? 'editold' : 'viewsourceold' ) . ")"; } else { $newLink = $this->mNewPage->escapeLocalUrl( 'oldid=' . $this->mNewid ); $newEdit = $this->mNewPage->escapeLocalUrl( 'action=edit&oldid=' . $this->mNewid ); $this->mPagetitle = wfMsgHTML( 'revisionasof', $timestamp ); - $this->mNewtitle = "{$this->mPagetitle}" - . " (" . htmlspecialchars( wfMsg( 'editold' ) ) . ")"; + $this->mNewtitle = "{$this->mPagetitle}"; + $this->mNewtitle .= " (" . wfMsgHtml( $editable ? 'editold' : 'viewsourceold' ) . ")"; } if ( !$this->mNewRev->userCan(Revision::DELETED_TEXT) ) { $this->mNewtitle = "{$this->mPagetitle}"; @@ -693,10 +696,10 @@ CONTROL; $this->mOldPagetitle = htmlspecialchars( wfMsg( 'revisionasof', $t ) ); $this->mOldtitle = "{$this->mOldPagetitle}" - . " (" . htmlspecialchars( wfMsg( 'editold' ) ) . ")"; + . " (" . wfMsgHtml( $editable ? 'editold' : 'viewsourceold' ) . ")"; // Add an "undo" link $newUndo = $this->mNewPage->escapeLocalUrl( 'action=edit&undoafter=' . $this->mOldid . '&undo=' . $this->mNewid); - if ( $this->mNewRev->userCan(Revision::DELETED_TEXT) ) + if ( $editable && $this->mNewRev->userCan(Revision::DELETED_TEXT) ) $this->mNewtitle .= " (" . htmlspecialchars( wfMsg( 'editundo' ) ) . ")"; if ( !$this->mOldRev->userCan(Revision::DELETED_TEXT) ) { diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index 14b7a71bb8..1063e8f7ac 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -721,6 +721,7 @@ XHTML id names. 'editsection' => 'edit', 'editsection-brackets' => '[$1]', # only translate this message to other languages if you have to change it 'editold' => 'edit', +'viewsourceold' => 'view source', 'editsectionhint' => 'Edit section: $1', 'toc' => 'Contents', 'showtoc' => 'show', diff --git a/maintenance/language/messages.inc b/maintenance/language/messages.inc index cbf4d8ce37..6b0df77fd9 100644 --- a/maintenance/language/messages.inc +++ b/maintenance/language/messages.inc @@ -270,6 +270,7 @@ $wgMessageStructure = array( 'editsection', 'editsection-brackets', 'editold', + 'viewsourceold', 'editsectionhint', 'toc', 'showtoc',