From d45a73777935c86fc5131955831833d7465b5e9d Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Mon, 21 Jan 2013 01:22:01 -0500 Subject: Update copyright to 2013. Fixes #1953. --- modules/gallery/libraries/Theme_View.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/gallery/libraries/Theme_View.php') diff --git a/modules/gallery/libraries/Theme_View.php b/modules/gallery/libraries/Theme_View.php index 78b74cde..1dfa72a0 100644 --- a/modules/gallery/libraries/Theme_View.php +++ b/modules/gallery/libraries/Theme_View.php @@ -1,7 +1,7 @@ Date: Wed, 23 Jan 2013 14:03:44 -0500 Subject: Use the thumb proportion from the first item in an album if the album has children. Fixes #1958. --- modules/gallery/libraries/Theme_View.php | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'modules/gallery/libraries/Theme_View.php') diff --git a/modules/gallery/libraries/Theme_View.php b/modules/gallery/libraries/Theme_View.php index 1dfa72a0..8d69f23b 100644 --- a/modules/gallery/libraries/Theme_View.php +++ b/modules/gallery/libraries/Theme_View.php @@ -63,6 +63,13 @@ class Theme_View_Core extends Gallery_View { * @return int */ public function thumb_proportion($item=null) { + // If the item is an album with children, grab the first item in that album instead. We're + // interested in the size of the thumbnails in this album, not the thumbnail of the + // album itself. + if ($item && $item->is_album() && $item->children_count()) { + $item = $item->children(1)->current(); + } + // By default we have a globally fixed thumbnail size In core code, we just return a fixed // proportion based on the global thumbnail size, but since modules can override that, we // return the actual proportions when we have them. -- cgit v1.2.3 From 49dd0994df6f6709dcd9ea6971beb13c68a99cf0 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Wed, 30 Jan 2013 19:32:35 -0500 Subject: Follow-on to 1e4d75c12072b49c3469f18af13bcf3439afc6b0 for #1975. Create a siblings() function which pulls together the siblings_callback function and makes it a more palatable API. --- modules/gallery/libraries/Theme_View.php | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'modules/gallery/libraries/Theme_View.php') diff --git a/modules/gallery/libraries/Theme_View.php b/modules/gallery/libraries/Theme_View.php index 8d69f23b..cf384109 100644 --- a/modules/gallery/libraries/Theme_View.php +++ b/modules/gallery/libraries/Theme_View.php @@ -86,6 +86,10 @@ class Theme_View_Core extends Gallery_View { return $this->item; } + public function siblings() { + return call_user_func_array($this->siblings_callback[0], $this->siblings_callback[1]); + } + public function tag() { return $this->tag; } -- cgit v1.2.3 From 9dbe2e15ad9db3b2be53e46bc5f67d382fb4089d Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sat, 9 Feb 2013 14:53:34 -0500 Subject: Extend siblings callbacks to take a $limit and an $offset for navigating large sibling sets. Useful for the thumbnav module since we don't want to iterate a thousand siblings to find the one we care about. Fixes #1999. --- modules/gallery/controllers/albums.php | 4 ++-- modules/gallery/libraries/Theme_View.php | 6 ++++-- modules/search/controllers/search.php | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) (limited to 'modules/gallery/libraries/Theme_View.php') diff --git a/modules/gallery/controllers/albums.php b/modules/gallery/controllers/albums.php index d545b415..0fb033a8 100644 --- a/modules/gallery/controllers/albums.php +++ b/modules/gallery/controllers/albums.php @@ -98,9 +98,9 @@ class Albums_Controller extends Items_Controller { "breadcrumbs" => Breadcrumb::array_from_item_parents($item)); } - static function get_siblings($item) { + static function get_siblings($item, $limit=null, $offset=null) { // @todo consider creating Item_Model::siblings() if we use this more broadly. - return $item->parent()->viewable()->children(); + return $item->parent()->viewable()->children($limit, $offset); } public function create($parent_id) { diff --git a/modules/gallery/libraries/Theme_View.php b/modules/gallery/libraries/Theme_View.php index cf384109..986fc8a2 100644 --- a/modules/gallery/libraries/Theme_View.php +++ b/modules/gallery/libraries/Theme_View.php @@ -86,8 +86,10 @@ class Theme_View_Core extends Gallery_View { return $this->item; } - public function siblings() { - return call_user_func_array($this->siblings_callback[0], $this->siblings_callback[1]); + public function siblings($limit=null, $offset=null) { + return call_user_func_array( + $this->siblings_callback[0], + array_merge($this->siblings_callback[1], array($offset, $limit))); } public function tag() { diff --git a/modules/search/controllers/search.php b/modules/search/controllers/search.php index b54d7699..25ccd81c 100644 --- a/modules/search/controllers/search.php +++ b/modules/search/controllers/search.php @@ -110,8 +110,8 @@ class Search_Controller extends Controller { Breadcrumb::instance($item->title, $item->url())->set_last())); } - static function get_siblings($q, $album) { - $result = search::search_within_album(search::add_query_terms($q), $album, 1000, 1); + static function get_siblings($q, $album, $limit=1000, $offset=1) { + $result = search::search_within_album(search::add_query_terms($q), $album, $limit, $offset); return $result[1]; } } -- cgit v1.2.3