r63672 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r63671‎ | r63672 | r63673 >
Date:11:42, 13 March 2010
Author:raymond
Status:ok
Tags:
Comment:
* (bug 12797) Add $wgGalleryOptions for adjusting of default gallery display options
Reapply of r63197 (reverted with r63261). Per suggestion of demon now with 1 array with keys and w/o breaking parsertests
Modified paths:
  • /trunk/phase3/CREDITS (modified) (history)
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)
  • /trunk/phase3/includes/ImageGallery.php (modified) (history)

Diff [purge]

Index: trunk/phase3/CREDITS
@@ -118,6 +118,7 @@
119119 * Stefano Codari
120120 * Str4nd
121121 * svip
 122+* Zachary Hauri
122123
123124 == Translators ==
124125 * Anders Wegge Jakobsen
Index: trunk/phase3/includes/DefaultSettings.php
@@ -3040,6 +3040,18 @@
30413041 $wgThumbUpright = 0.75;
30423042
30433043 /**
 3044+ * Default parameters for the <gallery> tag
 3045+ */
 3046+
 3047+$wgGalleryOptions = array (
 3048+ 'imagesPerRow' => 4, // Default number of images per-row in the gallery
 3049+ 'imageWidth' => 120, // Width of the cells containing images in galleries (in "px")
 3050+ 'imageHeight' => 120, // Height of the cells containing images in galleries (in "px")
 3051+ 'captionLength' => 20, // Length of caption to truncate (in characters)
 3052+ 'showBytes' => true, // Show the filesize in bytes in categories
 3053+);
 3054+
 3055+/**
30443056 * On category pages, show thumbnail gallery for images belonging to that
30453057 * category instead of listing them as articles.
30463058 */
Index: trunk/phase3/includes/ImageGallery.php
@@ -32,20 +32,22 @@
3333 */
3434 private $contextTitle = false;
3535
36 - private $mPerRow = 4; // How many images wide should the gallery be?
37 - private $mWidths = 120, $mHeights = 120; // How wide/tall each thumbnail should be
38 -
3936 private $mAttribs = array();
4037
4138 /**
4239 * Create a new image gallery object.
4340 */
4441 function __construct( ) {
 42+ global $wgGalleryOptions;
4543 $this->mImages = array();
46 - $this->mShowBytes = true;
 44+ $this->mShowBytes = $wgGalleryOptions['showBytes'];
4745 $this->mShowFilename = true;
4846 $this->mParser = false;
4947 $this->mHideBadImages = false;
 48+ $this->mPerRow = $wgGalleryOptions['imagesPerRow'];
 49+ $this->mWidths = $wgGalleryOptions['imageWidth'];
 50+ $this->mHeights = $wgGalleryOptions['imageHeight'];
 51+ $this->mCaptionLength = $wgGalleryOptions['captionLength'];
5052 }
5153
5254 /**
@@ -308,7 +310,7 @@
309311 $textlink = $this->mShowFilename ?
310312 $sk->link(
311313 $nt,
312 - htmlspecialchars( $wgLang->truncate( $nt->getText(), 20 ) ),
 314+ htmlspecialchars( $wgLang->truncate( $nt->getText(), $this->mCaptionLength ) ),
313315 array(),
314316 array(),
315317 array( 'known', 'noclasses' )
Index: trunk/phase3/RELEASE-NOTES
@@ -28,6 +28,8 @@
2929 * (bug 22748) Add anchors on Special:ListGroupRights
3030 * (bug 21981) Add parameter 'showfilename' to <gallery> to automatically apply
3131 the names of the individual files within the gallery
 32+* (bug 12797) Add $wgGalleryOptions for adjusting of default gallery display
 33+ options
3234
3335 === Bug fixes in 1.17 ===
3436 * (bug 17560) Half-broken deletion moved image files to deletion archive without

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r63197(bug 12797) Allow adjusting of default gallery display optionsraymond13:07, 3 March 2010
r63261Revert r63197 '(bug 12797) Allow adjusting of default gallery display options...demon00:27, 5 March 2010

Status & tagging log