From: Chuck Hagenbuch Date: Mon, 9 Aug 2010 05:01:59 +0000 (-0400) Subject: Make it possible to set tilesperrow and tilesperpage through the API X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=944d14145612c137e8a2d80cfec23d6b4e521e22;p=horde.git Make it possible to set tilesperrow and tilesperpage through the API --- diff --git a/ansel/lib/View/GalleryRenderer/Base.php b/ansel/lib/View/GalleryRenderer/Base.php index 77e248b0d..aaaf4f204 100644 --- a/ansel/lib/View/GalleryRenderer/Base.php +++ b/ansel/lib/View/GalleryRenderer/Base.php @@ -21,7 +21,7 @@ abstract class Ansel_View_GalleryRenderer_Base /** * The gallery id for this view's gallery - * (Convienience instead of $this->view->gallery->id) + * (Convenience instead of $this->view->gallery->id) * * @var integer */ @@ -128,8 +128,12 @@ abstract class Ansel_View_GalleryRenderer_Base $this->page = $this->view->page; /* Number perpage from prefs or config */ - $this->perpage = min($prefs->getValue('tilesperpage'), - $conf['thumbnail']['perpage']); + if ($this->view->tilesperpage) { + $this->perpage = $this->view->tilesperpage; + } else { + $this->perpage = min($prefs->getValue('tilesperpage'), + $conf['thumbnail']['perpage']); + } /* Calculate the starting and ending images on this page */ $this->pagestart = ($this->page * $this->perpage) + 1; diff --git a/ansel/lib/View/GalleryRenderer/GalleryLightbox.php b/ansel/lib/View/GalleryRenderer/GalleryLightbox.php index 8cf874dac..962499059 100644 --- a/ansel/lib/View/GalleryRenderer/GalleryLightbox.php +++ b/ansel/lib/View/GalleryRenderer/GalleryLightbox.php @@ -61,7 +61,7 @@ class Ansel_View_GalleryRenderer_GalleryLightbox extends Ansel_View_GalleryRende } /* Don't bother if we are being called from the api */ - if (empty($this->view->api)) { + if (!$this->view->api) { $option_edit = $this->view->gallery->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::EDIT); $option_select = $option_delete = $this->view->gallery->hasPermission( @@ -91,11 +91,9 @@ class Ansel_View_GalleryRenderer_GalleryLightbox extends Ansel_View_GalleryRende $pagerurl = new Horde_Url(str_replace(array('%g', '%s'), array($this->galleryId, $this->gallerySlug), urldecode($this->view->gallery_view_url))); $pagerurl->add($date_params)->setRaw(true); } else { - /* - * Build the pager url. Add the needed variables directly to the - * url instead of passing it as a preserved variable to the pager - * since the logic to build the URL is already in getUrlFor() - */ + // Build the pager url. Add the needed variables directly to the + // url instead of passing it as a preserved variable to the pager + // since the logic to build the URL is already in getUrlFor() $pager_params = array_merge( array('gallery' => $this->galleryId, 'view' => 'Gallery', @@ -129,7 +127,7 @@ class Ansel_View_GalleryRenderer_GalleryLightbox extends Ansel_View_GalleryRende $jsvars['gallery_url'] = $pagerurl . '&'; } /* Output js/css here if we are calling via the api */ - if (!empty($this->view->api)) { + if ($this->view->api) { Ansel::attachStylesheet('lightbox.css', true); $includes = $GLOBALS['injector']->createInstance('Horde_Script_Files'); $includes->add('accesskeys.js', 'horde', true, true); @@ -139,7 +137,7 @@ class Ansel_View_GalleryRenderer_GalleryLightbox extends Ansel_View_GalleryRende } /* Needed in the template files */ - $tilesperrow = $prefs->getValue('tilesperrow'); + $tilesperrow = $this->view->tilesperrow ? $this->view->tilesperrow : $prefs->getValue('tilesperrow'); $cellwidth = round(100 / $tilesperrow); $count = 0;