Add url parameter to trigger autogenerated gallery type.
authorBrian Wolff <bawolff+wn@gmail.com>
Fri, 23 Aug 2013 22:13:40 +0000 (15:13 -0700)
committerBrian Wolff <bawolff+wn@gmail.com>
Fri, 23 Aug 2013 22:13:40 +0000 (15:13 -0700)
This was requested at commons as a temporary measure to
evaluate the new gallery options.

Change-Id: Ib12ac8228c824533262e1896adf2618dd298f655

includes/CategoryViewer.php
includes/specials/SpecialNewimages.php

index a9f5d23..5b6694f 100644 (file)
@@ -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 {
index fa9b2d3..814e213 100644 (file)
@@ -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() );
                }