Merge "SpecialUploadStash: Add links to view a thumb of each uploaded file"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 23 Mar 2016 21:20:56 +0000 (21:20 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 23 Mar 2016 21:20:56 +0000 (21:20 +0000)
1  2 
includes/specials/SpecialUploadStash.php
languages/i18n/en.json
languages/i18n/qqq.json

@@@ -392,17 -392,27 +392,27 @@@ class SpecialUploadStash extends Unlist
                        sort( $files );
                        $fileListItemsHtml = '';
                        foreach ( $files as $file ) {
-                               // TODO: Use Linker::link or even construct the list in plain wikitext
-                               $fileListItemsHtml .= Html::rawElement( 'li', [],
-                                       Html::element( 'a', [ 'href' =>
-                                               $this->getPageTitle( "file/$file" )->getLocalURL() ], $file )
-                               );
+                               $itemHtml = Linker::linkKnown( $this->getPageTitle( "file/$file" ), htmlspecialchars( $file ) );
+                               try {
+                                       $fileObj = $this->stash->getFile( $file );
+                                       $thumb = $fileObj->generateThumbName( $file, [ 'width' => 220 ] );
+                                       $itemHtml .=
+                                               $this->msg( 'word-separator' )->escaped() .
+                                               $this->msg( 'parentheses' )->rawParams(
+                                                       Linker::linkKnown(
+                                                               $this->getPageTitle( "thumb/$file/$thumb" ),
+                                                               $this->msg( 'uploadstash-thumbnail' )->escaped()
+                                                       )
+                                               )->escaped();
+                               } catch ( Exception $e ) {
+                               }
+                               $fileListItemsHtml .= Html::rawElement( 'li', [], $itemHtml );
                        }
 -                      $this->getOutput()->addHtml( Html::rawElement( 'ul', [], $fileListItemsHtml ) );
 +                      $this->getOutput()->addHTML( Html::rawElement( 'ul', [], $fileListItemsHtml ) );
                        $form->displayForm( $formResult );
 -                      $this->getOutput()->addHtml( Html::rawElement( 'p', [], $refreshHtml ) );
 +                      $this->getOutput()->addHTML( Html::rawElement( 'p', [], $refreshHtml ) );
                } else {
 -                      $this->getOutput()->addHtml( Html::rawElement( 'p', [],
 +                      $this->getOutput()->addHTML( Html::rawElement( 'p', [],
                                Html::element( 'span', [], $this->msg( 'uploadstash-nofiles' )->text() )
                                . ' '
                                . $refreshHtml
Simple merge
Simple merge