Uploads that throw a warning (UploadFromStash) a thumbnail is now shown.
[lhc/web/wiklou.git] / includes / specials / SpecialListfiles.php
index ed48f56..638d2de 100644 (file)
@@ -48,7 +48,7 @@ class ImageListPager extends TablePager {
                        $this->mDefaultDirection = false;
                }
                
-               $userName = $wgRequest->getText( 'username', $par );
+               $userName = $wgRequest->getText( 'user', $par );
                if ( $userName ) {
                        $nt = Title::newFromText( $userName, NS_USER );
                        if ( !is_null( $nt ) ) {
@@ -74,6 +74,7 @@ class ImageListPager extends TablePager {
                if ( !$this->mFieldNames ) {
                        global $wgMiserMode;
                        $this->mFieldNames = array(
+                               'thumb' => wfMsg( 'listfiles_thumb' ),
                                'img_timestamp' => wfMsg( 'listfiles_date' ),
                                'img_name' => wfMsg( 'listfiles_name' ),
                                'img_user_text' => wfMsg( 'listfiles_user' ),
@@ -100,6 +101,7 @@ class ImageListPager extends TablePager {
                $tables = array( 'image' );
                $fields = array_keys( $this->getFieldNames() );
                $fields[] = 'img_user';
+               $fields[array_search('thumb', $fields)] = 'img_name AS thumb';
                $options = $join_conds = array();
 
                # Depends on $wgMiserMode
@@ -107,9 +109,11 @@ class ImageListPager extends TablePager {
                        $tables[] = 'oldimage';
 
                        # Need to rewrite this one
-                       foreach ( $fields as &$field )
-                               if ( $field == 'count' )
-                                       $field = 'COUNT(oi_archive_name) as count';
+                       foreach ( $fields as &$field ) {
+                               if ( $field == 'count' ) {
+                                       $field = 'COUNT(oi_archive_name) AS count';
+                               }
+                       }
                        unset( $field );
 
                        $dbr = wfGetDB( DB_SLAVE );
@@ -153,6 +157,10 @@ class ImageListPager extends TablePager {
        function formatValue( $field, $value ) {
                global $wgLang;
                switch ( $field ) {
+                       case 'thumb':
+                               $file = wfLocalFile( $value );
+                               $thumb = $file->transform( array( 'width' => 180 ) );
+                               return $thumb->toHtml( array( 'desc-link' => true ) );
                        case 'img_timestamp':
                                return htmlspecialchars( $wgLang->timeanddate( $value, true ) );
                        case 'img_name':
@@ -196,10 +204,10 @@ class ImageListPager extends TablePager {
                                                                'id' => 'mw-ilsearch',
                        ) );
                }
-               $inputForm['username'] = Html::input( 'username', $this->mUserName, 'text', array(
+               $inputForm['username'] = Html::input( 'user', $this->mUserName, 'text', array(
                                                'size' => '40',
                                                'maxlength' => '255',
-                                               'id' => 'mw-listfiles-username',
+                                               'id' => 'mw-listfiles-user',
                ) );
                $s = Html::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript, 'id' => 'mw-listfiles-form' ) ) .
                        Xml::fieldset( wfMsg( 'listfiles' ) ) .
@@ -228,7 +236,7 @@ class ImageListPager extends TablePager {
                $queries = parent::getPagingQueries();
                if ( !is_null( $this->mUserName ) ) {
                        # Append the username to the query string
-                       foreach ( $queries as $key => &$query ) {
+                       foreach ( $queries as &$query ) {
                                $query['username'] = $this->mUserName;
                        }
                }