From: Raimond Spekking Date: Sat, 13 Mar 2010 11:42:04 +0000 (+0000) Subject: * (bug 12797) Add $wgGalleryOptions for adjusting of default gallery display options X-Git-Tag: 1.31.0-rc.0~37474 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/operations/recherche.php?a=commitdiff_plain;h=042a49ab7db060db8bd998d050e6a71877f2c51d;p=lhc%2Fweb%2Fwiklou.git * (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 --- diff --git a/CREDITS b/CREDITS index 3aa4ba42fa..a07930a919 100644 --- 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 diff --git a/RELEASE-NOTES b/RELEASE-NOTES index a7dbc5a792..1ea8620a18 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 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 diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 72904e072f..563acfea59 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -3039,6 +3039,18 @@ $wgThumbLimits = array( */ $wgThumbUpright = 0.75; +/** + * Default parameters for the 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. diff --git a/includes/ImageGallery.php b/includes/ImageGallery.php index c76c8e5779..e5a8070963 100644 --- a/includes/ImageGallery.php +++ b/includes/ImageGallery.php @@ -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' )