Merge "Add url parameter to trigger autogenerated gallery type."
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Mon, 26 Aug 2013 23:42:19 +0000 (23:42 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 26 Aug 2013 23:42:19 +0000 (23:42 +0000)
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() );
                }