(bug 23194) Special:ListFiles now has thumbnails
authorBryan Tong Minh <btongminh@users.mediawiki.org>
Wed, 27 Oct 2010 21:02:58 +0000 (21:02 +0000)
committerBryan Tong Minh <btongminh@users.mediawiki.org>
Wed, 27 Oct 2010 21:02:58 +0000 (21:02 +0000)
  Added new message listfiles_thumb

RELEASE-NOTES
includes/specials/SpecialListfiles.php
languages/messages/MessagesEn.php
maintenance/language/messages.inc

index 610642f..f34b290 100644 (file)
@@ -185,6 +185,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * Maintenance scripts get a --memory-limit option to override defaults (which
   is usually to set it to -1 to disable the limit)
 * (bug 25397) Allow uploading (not displaying) of WebP images, disabled by default
+* (bug 23194) Special:ListFiles now has thumbnails
 
 === Bug fixes in 1.17 ===
 * (bug 17560) Half-broken deletion moved image files to deletion archive
index 1464110..97b318b 100644 (file)
@@ -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' )
+                       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':
index c9d45f6..ae1b4b2 100644 (file)
@@ -2258,6 +2258,7 @@ A click on a column header changes the sorting.',
 'listfiles_search_for'  => 'Search for media name:',
 'imgfile'               => 'file',
 'listfiles'             => 'File list',
+'listfiles_thumb'       => 'Thumbnail',
 'listfiles_date'        => 'Date',
 'listfiles_name'        => 'Name',
 'listfiles_user'        => 'User',
index f9e2195..7abedfc 100644 (file)
@@ -1354,6 +1354,7 @@ $wgMessageStructure = array(
                'listfiles_search_for',
                'imgfile',
                'listfiles',
+               'listfiles_thumbnail',
                'listfiles_date',
                'listfiles_name',
                'listfiles_user',