provided option for showLogExtract to wrap result. Added log for create protected...
authorTobias <churchofemacs@users.mediawiki.org>
Sat, 16 Jan 2010 11:24:23 +0000 (11:24 +0000)
committerTobias <churchofemacs@users.mediawiki.org>
Sat, 16 Jan 2010 11:24:23 +0000 (11:24 +0000)
includes/EditPage.php
includes/LogEventsList.php
languages/messages/MessagesEn.php

index 5f6d68d..73a2f04 100644 (file)
@@ -1506,7 +1506,11 @@ HTML
                        $wgOut->wrapWikiMsg( $notice, array( 'cascadeprotectedwarning', $cascadeSourcesCount ) );
                }
                if ( !$this->mTitle->exists() && $this->mTitle->getRestrictions( 'create' ) ) {
-                       $wgOut->wrapWikiMsg( "<div class=\"mw-titleprotectedwarning\">\n$1</div>", 'titleprotectedwarning' );
+                       LogEventsList::showLogExtract( $wgOut, 'protect', $this->mTitle->getPrefixedText(), '',
+                               array(  'lim' => 1,
+                                       'showIfEmpty' => false,
+                                       'msgKey' => array( 'titleprotectedwarning' ),
+                                       'wrap' => "<div class=\"mw-titleprotectedwarning\">\n$1</div>" ) );
                }
 
                if ( $this->kblength === false ) {
@@ -2685,5 +2689,5 @@ INPUTS
                } else {
                        return $this->mBaseRevision;
                }
-       }
+       }       
 }
index 2215568..4bfdc2a 100644 (file)
@@ -609,6 +609,7 @@ class LogEventsList {
         *   that are processed with wgMsgExt and option 'parse'
         * - offset Set to overwrite offset parameter in $wgRequest
         *   set to '' to unset offset
+        * - wrap String: Wrap the message in html (usually something like "<div ...>$1</div>").
         * @return Integer Number of total log items (not limited by $lim)
         */
        public static function showLogExtract( &$out, $types=array(), $page='', $user='', 
@@ -618,7 +619,8 @@ class LogEventsList {
                        'lim' => 25,
                        'conds' => array(),
                        'showIfEmpty' => true,
-                       'msgKey' => array('')
+                       'msgKey' => array(''),
+                       'wrap' => "$1"
                );
        
                # The + operator appends elements of remaining keys from the right
@@ -631,6 +633,7 @@ class LogEventsList {
                $conds = $param['conds'];
                $showIfEmpty = $param['showIfEmpty'];
                $msgKey = $param['msgKey'];
+               $wrap = $param['wrap'];
                if ( !is_array( $msgKey ) )
                        $msgKey = array( $msgKey );
                # Insert list of top 50 (or top $lim) items
@@ -683,6 +686,11 @@ class LogEventsList {
                if ( $logBody && $msgKey[0] )
                        $s .= '</div>';
 
+               if ( $wrap!='' ) { // Wrap message in html
+                       $s = str_replace( '$1', $s, $wrap );
+               }
+
+               // $out can be either an OutputPage object or a String-by-reference
                if( $out instanceof OutputPage ){
                        $out->addHTML( $s );
                } else {
@@ -890,6 +898,7 @@ class LogPager extends ReverseChronologicalPager {
        }
 
        public function getQueryInfo() {
+               global $wgOut;
                $tables = array( 'logging', 'user' );
                $this->mConds[] = 'user_id = log_user';
                $index = array();
@@ -930,7 +939,6 @@ class LogPager extends ReverseChronologicalPager {
                # Add ChangeTags filter query
                ChangeTags::modifyDisplayQuery( $info['tables'], $info['fields'], $info['conds'],
                        $info['join_conds'], $info['options'], $this->mTagFilter );
-
                return $info;
        }
 
index 5d64beb..04c0808 100644 (file)
@@ -1325,10 +1325,10 @@ It cannot be saved.",
 You may wish to cut-n-paste the text into a text file and save it for later.
 
 The administrator who locked it offered this explanation: $1",
-'protectedpagewarning'             => "'''Warning: This page has been locked so that only users with administrator privileges can edit it.'''",
-'semiprotectedpagewarning'         => "'''Note:''' This page has been locked so that only registered users can edit it.",
+'protectedpagewarning'             => "'''Warning: This page has been locked so that only users with administrator privileges can edit it.''' The lastest log entry is provided below for reference:",
+'semiprotectedpagewarning'         => "'''Note:''' This page has been locked so that only registered users can edit it. The lastest log entry is provided below for reference:",
 'cascadeprotectedwarning'          => "'''Warning:''' This page has been locked so that only users with administrator privileges can edit it, because it is included in the following cascade-protected {{PLURAL:$1|page|pages}}:",
-'titleprotectedwarning'            => "'''Warning: This page has been locked so that [[Special:ListGroupRights|specific rights]] are needed to create it.'''",
+'titleprotectedwarning'            => "'''Warning: This page has been locked so that [[Special:ListGroupRights|specific rights]] are needed to create it.''' The lastest log entry is provided below for reference:",
 'templatesused'                    => '{{PLURAL:$1|Template|Templates}} used on this page:',
 'templatesusedpreview'             => '{{PLURAL:$1|Template|Templates}} used in this preview:',
 'templatesusedsection'             => '{{PLURAL:$1|Template|Templates}} used in this section:',
@@ -3071,8 +3071,8 @@ cannot move a page over itself.',
 'imageinvalidfilename'         => 'The target file name is invalid',
 'fix-double-redirects'         => 'Update any redirects that point to the original title',
 'move-leave-redirect'          => 'Leave a redirect behind',
-'protectedpagemovewarning'     => "'''Warning:''' This page has been locked so that only users with administrator privileges can move it.",
-'semiprotectedpagemovewarning' => "'''Note:''' This page has been locked so that only registered users can move it.",
+'protectedpagemovewarning'     => "'''Warning:''' This page has been locked so that only users with administrator privileges can move it. The lastest log entry is provided below for reference:",
+'semiprotectedpagemovewarning' => "'''Note:''' This page has been locked so that only registered users can move it. The lastest log entry is provided below for reference:",
 'move-over-sharedrepo'         => '== File exists ==
 [[:$1]] exists on a shared repository. Moving a file to this title will override the shared file.',
 'file-exists-sharedrepo'       => 'The file name chosen is already in use on a shared repository.