From: Brian Wolff Date: Fri, 23 Aug 2013 22:13:40 +0000 (-0700) Subject: Add url parameter to trigger autogenerated gallery type. X-Git-Tag: 1.31.0-rc.0~18864^2 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/pie.php?a=commitdiff_plain;h=a60b6f4048390f64de8be8acbadd8adb032e835e;p=lhc%2Fweb%2Fwiklou.git Add url parameter to trigger autogenerated gallery type. This was requested at commons as a temporary measure to evaluate the new gallery options. Change-Id: Ib12ac8228c824533262e1896adf2618dd298f655 --- diff --git a/includes/CategoryViewer.php b/includes/CategoryViewer.php index a9f5d236bd..5b6694fb0a 100644 --- a/includes/CategoryViewer.php +++ b/includes/CategoryViewer.php @@ -141,7 +141,15 @@ class CategoryViewer extends ContextSource { $this->children = array(); $this->children_start_char = array(); if ( $this->showGallery ) { - $this->gallery = ImageGalleryBase::factory(); + // Note that null for mode is taken to mean use default. + $mode = $this->getRequest()->getVal( 'gallerymode', null ); + try { + $this->gallery = ImageGalleryBase::factory( $mode ); + } catch ( MWException $e ) { + // User specified something invalid, fallback to default. + $this->gallery = ImageGalleryBase::factory(); + } + $this->gallery->setHideBadImages(); $this->gallery->setContext( $this->getContext() ); } else { diff --git a/includes/specials/SpecialNewimages.php b/includes/specials/SpecialNewimages.php index fa9b2d349a..814e213e9f 100644 --- a/includes/specials/SpecialNewimages.php +++ b/includes/specials/SpecialNewimages.php @@ -117,7 +117,14 @@ class NewFilesPager extends ReverseChronologicalPager { function getStartBody() { if ( !$this->gallery ) { - $this->gallery = ImageGalleryBase::factory(); + // Note that null for mode is taken to mean use default. + $mode = $this->getRequest()->getVal( 'gallerymode', null ); + try { + $this->gallery = ImageGalleryBase::factory( $mode ); + } catch ( MWException $e ) { + // User specified something invalid, fallback to default. + $this->gallery = ImageGalleryBase::factory(); + } $this->gallery->setContext( $this->getContext() ); }