When a user is prohibited from creating a page, a title of "View source" makes no sense, and there should be no "Return to [[Page]]" link.

This commit is contained in:
Aryeh Gregor 2008-01-02 02:49:31 +00:00
parent b24975a3ff
commit b72368d65a
3 changed files with 15 additions and 5 deletions

View file

@ -112,6 +112,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
* Add HTML ID's mw-read-only-warning and mw-anon-edit-warning to warnings when
editing to allow CSS styling.
* Parser now returns list of sections
* When a user is prohibited from creating a page, a title of "View source"
makes no sense, and there should be no "Return to [[Page]]" link.
=== Bug fixes in 1.12 ===

View file

@ -389,8 +389,7 @@ class EditPage {
# array_diff returns elements in $permErrors that are not in $remove.
$permErrors = array_diff( $permErrors, $remove );
if ( !empty($permErrors) )
{
if ( !empty($permErrors) ) {
wfDebug( "$fname: User can't edit\n" );
$wgOut->readOnlyPage( $this->getContent(), true, $permErrors );
wfProfileOut( $fname );

View file

@ -1037,8 +1037,12 @@ class OutputPage {
if ( !empty($reasons) ) {
// Permissions error
$this->setPageTitle( wfMsg( 'viewsource' ) );
$this->setSubtitle( wfMsg( 'viewsourcefor', $skin->makeKnownLinkObj( $wgTitle ) ) );
if( $source ) {
$this->setPageTitle( wfMsg( 'viewsource' ) );
$this->setSubtitle( wfMsg( 'viewsourcefor', $skin->makeKnownLinkObj( $wgTitle ) ) );
} else {
$this->setPageTitle( wfMsg( 'badaccess' ) );
}
$this->addWikiText( $this->formatPermissionsErrorMessage( $reasons ) );
} else {
// Wiki is read only
@ -1071,7 +1075,12 @@ class OutputPage {
$this->addHTML( $skin->formatTemplates( $article->getUsedTemplates() ) );
}
$this->returnToMain( false, $wgTitle );
# If the title doesn't exist, it's fairly pointless to print a return
# link to it. After all, you just tried editing it and couldn't, so
# what's there to do there?
if( $wgTitle->exists() ) {
$this->returnToMain( false, $wgTitle );
}
}
/** @deprecated */