Dereckson has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/306329

Change subject: Show document covers in Special:IndexPages
......................................................................

Show document covers in Special:IndexPages

Bug: T143764
Change-Id: I0169bb3bbdea9fe274c5cb7794d2e4518eeb5363
---
M SpecialProofreadPages.php
1 file changed, 41 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ProofreadPage 
refs/changes/29/306329/1

diff --git a/SpecialProofreadPages.php b/SpecialProofreadPages.php
index eb275f7..ca937c8 100644
--- a/SpecialProofreadPages.php
+++ b/SpecialProofreadPages.php
@@ -200,21 +200,51 @@
                $num_void = $size - $q1 - $q2 - $q3 - $q4 - $q0;
                $void_cell = $num_void ? '<td class="qualitye" style="width:' . 
$num_void . 'px;"></td>' : '';
                $textualAlternative = $this->msg( 
'proofreadpage-indexquality-alt', $q4, $q3, $q1 );
-               $qualityOutput = '<table class="pr_quality" title="' . 
$textualAlternative . '">
-<tr>
-<td class="quality4" style="width:' . $q4 . 'px;"></td>
-<td class="quality3" style="width:' . $q3 . 'px;"></td>
-<td class="quality2" style="width:' . $q2 . 'px;"></td>
-<td class="quality1" style="width:' . $q1 . 'px;"></td>
-<td class="quality0" style="width:' . $q0 . 'px;"></td>
-' . $void_cell . '
-</tr>
-</table>';
+
+               # Get the file for this document
+               $imageTitle = Title::makeTitle( NS_IMAGE, $result->title );
+               $cover = wfFindFile( $imageTitle );
+
+               # TODO: use the page number from the index metadata
+               $params = array( 'width' => 100, 'page' => 1 );
+
+               # If the file exist, get the thumbnail url
+               if ( $cover and $cover->exists() ) {
+                       $thumbName = $cover->thumbName( $params );
+                       $fullURL = $cover->getThumbUrl( $thumbName );
+               } else {
+                       # TODO set URL for unknown cover (?)
+                       $fullURL = "";
+               }
+
+               # Free memory
+               unset( $cover );
 
                $dirmark = $this->getLanguage()->getDirMark();
                $pages = $this->msg( 'proofreadpage_pages', $size )->numParams( 
$size )->text();
 
-               return "<div class=\"prp-indexpages-row\"><span>{$plink} 
{$dirmark}[$pages]</span><div>{$qualityOutput}</div></div>";
+        return "<div class=\"prp-indexpages-row media clearfix\">
+       <a class=\"pull-left\" href=\"{$title}\">
+               <img class=\"media-object\" src=\"{$fullURL}\" />
+       </a>
+       <div class=\"media-body\">
+               <h4 class=\"media-heading\">{$plink}</h4>
+               <p>{$dirmark}</p>
+               <p>{$pages}</p>
+               <table class=\"pr_quality\" title=\"$textualAlternative\">
+                       <tr>
+                               <td width=\"2\">&#160;</td>
+                               <td class=\"quality4\" 
style=\"width:{$q4}px;\"></td>
+                               <td class=\"quality3\" 
style=\"width:{$q3}px;\"></td>
+                               <td class=\"quality2\" 
style=\"width:{$q2}px;\"></td>
+                               <td class=\"quality1\" 
style=\"width:${q1}px;\"></td>
+                               <td class=\"quality0\" 
style=\"width:${q0}px;\"></td>
+                               $void_cell
+                       </tr>
+               </table>
+       </div>
+</div>";
+
        }
 
        protected function getGroupName() {

-- 
To view, visit https://gerrit.wikimedia.org/r/306329
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0169bb3bbdea9fe274c5cb7794d2e4518eeb5363
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ProofreadPage
Gerrit-Branch: master
Gerrit-Owner: Dereckson <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to