* (bug 12797) Add $wgGalleryOptions for adjusting of default gallery display options
authorRaimond Spekking <raymond@users.mediawiki.org>
Sat, 13 Mar 2010 11:42:04 +0000 (11:42 +0000)
committerRaimond Spekking <raymond@users.mediawiki.org>
Sat, 13 Mar 2010 11:42:04 +0000 (11:42 +0000)
Reapply of r63197 (reverted with r63261). Per suggestion of demon now with 1 array with keys and w/o breaking parsertests

CREDITS
RELEASE-NOTES
includes/DefaultSettings.php
includes/ImageGallery.php

diff --git a/CREDITS b/CREDITS
index 3aa4ba4..a07930a 100644 (file)
--- a/CREDITS
+++ b/CREDITS
@@ -118,6 +118,7 @@ following names for their contribution to the product.
 * Stefano Codari
 * Str4nd
 * svip
+* Zachary Hauri
 
 == Translators ==
 * Anders Wegge Jakobsen
index a7dbc5a..1ea8620 100644 (file)
@@ -28,6 +28,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 22748) Add anchors on Special:ListGroupRights  
 * (bug 21981) Add parameter 'showfilename' to <gallery> to automatically apply
   the names of the individual files within the gallery
+* (bug 12797) Add $wgGalleryOptions for adjusting of default gallery display
+  options
 
 === Bug fixes in 1.17 ===
 * (bug 17560) Half-broken deletion moved image files to deletion archive without
index 72904e0..563acfe 100644 (file)
@@ -3039,6 +3039,18 @@ $wgThumbLimits = array(
  */
 $wgThumbUpright = 0.75;
 
+/**
+ * Default parameters for the <gallery> tag
+ */
+
+$wgGalleryOptions = array (
+       'imagesPerRow' => 4, // Default number of images per-row in the gallery
+       'imageWidth' => 120, // Width of the cells containing images in galleries (in "px")
+       'imageHeight' => 120, // Height of the cells containing images in galleries (in "px")
+       'captionLength' => 20, // Length of caption to truncate (in characters)
+       'showBytes' => true, // Show the filesize in bytes in categories
+);
+
 /**
  *  On  category pages, show thumbnail gallery for images belonging to that
  * category instead of listing them as articles.
index c76c8e5..e5a8070 100644 (file)
@@ -32,20 +32,22 @@ class ImageGallery
         */
        private $contextTitle = false;
 
-       private $mPerRow = 4; // How many images wide should the gallery be?
-       private $mWidths = 120, $mHeights = 120; // How wide/tall each thumbnail should be
-
        private $mAttribs = array();
 
        /**
         * Create a new image gallery object.
         */
        function __construct( ) {
+               global $wgGalleryOptions;
                $this->mImages = array();
-               $this->mShowBytes = true;
+               $this->mShowBytes = $wgGalleryOptions['showBytes'];
                $this->mShowFilename = true;
                $this->mParser = false;
                $this->mHideBadImages = false;
+               $this->mPerRow = $wgGalleryOptions['imagesPerRow'];
+               $this->mWidths = $wgGalleryOptions['imageWidth'];
+               $this->mHeights = $wgGalleryOptions['imageHeight'];
+               $this->mCaptionLength = $wgGalleryOptions['captionLength'];
        }
 
        /**
@@ -308,7 +310,7 @@ class ImageGallery
                        $textlink = $this->mShowFilename ?
                                $sk->link(
                                        $nt,
-                                       htmlspecialchars( $wgLang->truncate( $nt->getText(), 20 ) ),
+                                       htmlspecialchars( $wgLang->truncate( $nt->getText(), $this->mCaptionLength ) ),
                                        array(),
                                        array(),
                                        array( 'known', 'noclasses' )