From a60b6f4048390f64de8be8acbadd8adb032e835e Mon Sep 17 00:00:00 2001 From: Brian Wolff Date: Fri, 23 Aug 2013 15:13:40 -0700 Subject: [PATCH] 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 --- includes/CategoryViewer.php | 10 +++++++++- includes/specials/SpecialNewimages.php | 9 ++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) 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() ); } -- 2.20.1