http://www.mediawiki.org/wiki/Special:Code/MediaWiki/65035

Revision: 65035
Author:   btongminh
Date:     2010-04-14 16:15:14 +0000 (Wed, 14 Apr 2010)

Log Message:
-----------
Follow-up to r65013: Preserve username when clicking navigation links.

Modified Paths:
--------------
    trunk/phase3/includes/specials/SpecialListfiles.php

Modified: trunk/phase3/includes/specials/SpecialListfiles.php
===================================================================
--- trunk/phase3/includes/specials/SpecialListfiles.php 2010-04-14 16:10:04 UTC 
(rev 65034)
+++ trunk/phase3/includes/specials/SpecialListfiles.php 2010-04-14 16:15:14 UTC 
(rev 65035)
@@ -24,6 +24,7 @@
 class ImageListPager extends TablePager {
        var $mFieldNames = null;
        var $mQueryConds = array();
+       var $mUserName = null;
        
        function __construct( $par = null ) {
                global $wgRequest, $wgMiserMode;
@@ -37,14 +38,15 @@
                if ( $userName ) {
                        $nt = Title::newFromText( $userName, NS_USER );
                        if ( !is_null( $nt ) ) {
-                               $this->mQueryConds['img_user_text'] = 
$nt->getText();
+                               $this->mUserName = $nt->getText();
+                               $this->mQueryConds['img_user_text'] = 
$this->mUserName;
                        }
                } 
                
                $search = $wgRequest->getText( 'ilsearch' );
                if ( $search != '' && !$wgMiserMode ) {
                        $nt = Title::newFromURL( $search );
-                       if( $nt ) {
+                       if ( $nt ) {
                                $dbr = wfGetDB( DB_SLAVE );
                                $this->mQueryConds[] = 'LOWER(img_name)' . 
$dbr->buildLike( $dbr->anyString(), 
                                        strtolower( $nt->getDBkey() ), 
$dbr->anyString() );
@@ -200,4 +202,15 @@
        function getSortHeaderClass() {
                return 'listfiles_sort ' . parent::getSortHeaderClass();
        }
+       
+       function getPagingQueries() {
+               $queries = parent::getPagingQueries();
+               if ( !is_null( $this->mUserName ) ) {
+                       # Append the username to the query string
+                       foreach ( $queries as $key => &$query ) {
+                               $query['username'] = $this->mUserName;
+                       }
+               }
+               return $queries;
+       }
 }



_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to