r82453 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r82452‎ | r82453 | r82454 >
Date:14:29, 19 February 2011
Author:thomasv
Status:ok
Tags:
Comment:
fix regression for small images (bug 27536)
Modified paths:
  • /trunk/extensions/ProofreadPage/ProofreadPage_body.php (modified) (history)
  • /trunk/extensions/ProofreadPage/proofread.js (modified) (history)

Diff [purge]

Index: trunk/extensions/ProofreadPage/ProofreadPage_body.php
@@ -357,19 +357,24 @@
358358 $height = $image->getHeight();
359359 if ( $m[2] ) {
360360 $thumbName = $image->thumbName( array( 'width' => '##WIDTH##', 'page' => $m[3] ) );
 361+ $thumbURL = $image->getThumbUrl( $thumbName );
 362+ $thumbURL = str_replace( '%23', '#', $thumbURL );
 363+ $fullURL = str_replace( '##WIDTH##', "$width", $thumbURL );
361364 } else {
362365 $thumbName = $image->thumbName( array( 'width' => '##WIDTH##' ) );
 366+ $thumbURL = $image->getThumbUrl( $thumbName );
 367+ $thumbURL = str_replace( '%23', '#', $thumbURL );
 368+ $fullURL = $image->getURL();
363369 }
364 - $thumbURL = $image->getThumbUrl( $thumbName );
365 - $thumbURL = str_replace( '%23', '#', $thumbURL );
366370 $scan_link = Html::element( 'a',
367 - array( 'href' => str_replace( '##WIDTH##', "$width", $thumbURL ),
 371+ array( 'href' => $fullURL,
368372 'title' => wfMsg( 'proofreadpage_image' ) ),
369373 wfMsg( 'proofreadpage_image' ) );
370374 } else {
371375 $width = 0;
372376 $height = 0;
373377 $thumbURL = '';
 378+ $fullURL = '';
374379 $scan_link = '';
375380 }
376381
@@ -388,6 +393,7 @@
389394 'proofreadPageHeight' => intval( $height ),
390395 'proofreadPageEditWidth' => $edit_width,
391396 'proofreadPageThumbURL' => $thumbURL,
 397+ 'proofreadPageURL' => $fullURL,
392398 'proofreadPageIsEdit' => intval( $isEdit ),
393399 'proofreadPageIndexLink' => $index_link,
394400 'proofreadPageNextLink' => $next_link,
Index: trunk/extensions/ProofreadPage/proofread.js
@@ -16,10 +16,15 @@
1717 // enforce quantization: width must be multiple of 100px
1818 var width = 100 * Math.round( requested_width / 100 );
1919 // compare to the width of the image
20 - width = Math.min( width, proofreadPageWidth );
21 - self.DisplayWidth = width;
22 - self.DisplayHeight = width * proofreadPageHeight / proofreadPageWidth;
23 - return proofreadPageThumbURL.replace( '##WIDTH##', '' + width );
 20+ if( width < proofreadPageWidth ) {
 21+ self.DisplayWidth = width;
 22+ self.DisplayHeight = width * proofreadPageHeight / proofreadPageWidth;
 23+ return proofreadPageThumbURL.replace( '##WIDTH##', '' + width );
 24+ } else {
 25+ self.DisplayWidth = proofreadPageWidth;
 26+ self.DisplayHeight = proofreadPageHeight;
 27+ return proofreadPageURL;
 28+ }
2429 }
2530 }
2631

Follow-up revisions

RevisionCommit summaryAuthorDate
r825331.17wmf1: MFT r78893, r78897, r78909, r82404, r82408, r82409, r82453, r82456,...catrope20:13, 20 February 2011
r85027MFT various extension fixes: r81713, r81742, r81743, r81908, r81966, r81969, ...demon18:23, 30 March 2011

Status & tagging log