(bug 10347) Add subtitle message for protected pages
authorAaron Schulz <aaron@users.mediawiki.org>
Mon, 27 Oct 2008 15:05:16 +0000 (15:05 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Mon, 27 Oct 2008 15:05:16 +0000 (15:05 +0000)
includes/SkinTemplate.php
languages/messages/MessagesEn.php

index 33307e3..28c63cd 100644 (file)
@@ -203,12 +203,7 @@ class SkinTemplate extends Skin {
                $tpl->set( 'isarticle', $out->isArticle() );
 
                $tpl->setRef( "thispage", $this->thispage );
-               $subpagestr = $this->subPageSubtitle();
-               $tpl->set(
-                       'subtitle',  !empty($subpagestr)?
-                       '<span class="subpages">'.$subpagestr.'</span>'.$out->getSubtitle():
-                       $out->getSubtitle()
-               );
+
                $undelete = $this->getUndeleteLink();
                $tpl->set(
                        "undelete", !empty($undelete)?
@@ -416,7 +411,8 @@ class SkinTemplate extends Skin {
                                if ( $nt ) {
                                        $language_urls[] = array(
                                                'href' => $nt->getFullURL(),
-                                               'text' => ($wgContLang->getLanguageName( $nt->getInterwiki()) != ''?$wgContLang->getLanguageName( $nt->getInterwiki()) : $l),
+                                               'text' => $wgContLang->getLanguageName( $nt->getInterwiki() ) != '' ?
+                                                       $wgContLang->getLanguageName( $nt->getInterwiki()) : $l,
                                                'class' => $class
                                        );
                                }
@@ -435,6 +431,12 @@ class SkinTemplate extends Skin {
                $content_actions = $this->buildContentActionUrls();
                $tpl->setRef('content_actions', $content_actions);
 
+               $subpagestr = $this->subPageSubtitle();
+               $tpl->set(
+                       'subtitle',  !empty($subpagestr) ?
+                       '<span class="subpages">'.$subpagestr.'</span>'.$out->getSubtitle() : $out->getSubtitle()
+               );
+
                // XXX: attach this from javascript, same with section editing
                if($this->iseditable && $wgUser->getOption("editondblclick") )
                {
@@ -652,7 +654,7 @@ class SkinTemplate extends Skin {
                wfProfileIn( __METHOD__ );
 
                global $wgUser, $wgRequest;
-               $action = $wgRequest->getText( 'action' );
+               $action = $wgRequest->getText( 'action', 'view' );
                $section = $wgRequest->getText( 'section' );
                $content_actions = array();
 
@@ -696,12 +698,26 @@ class SkinTemplate extends Skin {
                                                'href' => $this->mTitle->getLocalUrl( 'action=edit&section=new' )
                                        );
                                }
+                               # Give notice if this page is locked for others
+                               if( ($action == 'view' || $action == 'purge') && $this->mTitle->isProtected( 'edit' ) ) {
+                                       $wgOut->appendSubtitle( "<span class='plainlinks'>" . 
+                                               wfMsgExt('protected-sub-allowed',array('parse'),$this->mTitle->getFullUrl('action=protect')) .
+                                               "</span>"
+                                       );
+                               }
                        } elseif ( $this->mTitle->exists() || $this->mTitle->isAlwaysKnown() ) {
                                $content_actions['viewsource'] = array(
                                        'class' => ($action == 'edit') ? 'selected' : false,
                                        'text' => wfMsg('viewsource'),
                                        'href' => $this->mTitle->getLocalUrl( $this->editUrlOptions() )
                                );
+                               # Give notice if this page is locked
+                               if( ($action == 'view' || $action == 'purge') && $this->mTitle->isProtected( 'edit' ) ) {
+                                       $wgOut->appendSubtitle( "<span class='plainlinks'>" . 
+                                               wfMsgExt('protected-sub-disallowed',array('parseinline'),$this->mTitle->getFullUrl('action=protect')) .
+                                               "</span>"
+                                       );
+                               }
                        }
                        wfProfileOut( __METHOD__."-edit" );
 
index 3ea7f1d..f18d84e 100644 (file)
@@ -2126,7 +2126,6 @@ Each row contains links to the first and second redirect, as well as the target
 You can narrow down the view by selecting a log type, the user name (case-sensitive), or the affected page (also case-sensitive).',
 'logempty'             => 'No matching items in log.',
 'log-title-wildcard'   => 'Search titles starting with this text',
-'logshowhide-patrol'   => '$1 patrol log',
 
 # Special:AllPages
 'allpages'          => 'All pages',
@@ -2998,11 +2997,12 @@ This is probably caused by a link to a blacklisted external site.',
 'markedaspatrollederror-noautopatrol' => 'You are not allowed to mark your own changes as patrolled.',
 
 # Patrol log
-'patrol-log-page'   => 'Patrol log',
-'patrol-log-header' => 'This is a log of patrolled revisions.',
-'patrol-log-line'   => 'marked $1 of $2 patrolled $3',
-'patrol-log-auto'   => '(automatic)',
-'patrol-log-diff'   => 'r$1', # only translate this message to other languages if you have to change it
+'patrol-log-page'    => 'Patrol log',
+'patrol-log-header'  => 'This is a log of patrolled revisions.',
+'patrol-log-line'    => 'marked $1 of $2 patrolled $3',
+'patrol-log-auto'    => '(automatic)',
+'patrol-log-diff'    => 'r$1', # only translate this message to other languages if you have to change it
+'logshowhide-patrol' => '$1 patrol log',
 
 # Image deletion
 'deletedrevision'                 => 'Deleted old revision $1',
@@ -3728,4 +3728,8 @@ Enter the filename without the "{{ns:image}}:" prefix.',
 
 #Put all regex fragments above this line. Leave this line exactly as it is</pre>',
 
+# Unknown messages
+'protected-sub-allowed'    => "Some users '''cannot edit this page''' because it has been [$1 restricted] to prevent editing",
+'protected-sub-disallowed' => "You '''cannot edit this page''' because it has been [$1 restricted] to prevent editing",
+
 );