From 933a34986dbca248f388e8aa3c3aea4a6d71a94b Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Thu, 11 Aug 2011 22:04:20 -0700 Subject: Patch for tickets #1428 and #1760 Create the concept of a Photo_Display_Context. If the user is browsing a dynamic album (i.e. tags) and chooses to look at an image in that album. The display of the image happens correctly, but the 'next' and 'previous' buttons are no longer consistent. When one of these is clicked, Gallery will open the adjacent image in the actuall album, not the dynamic album. --- modules/gallery/controllers/albums.php | 3 +++ modules/gallery/controllers/movies.php | 23 ++++------------------- modules/gallery/controllers/photos.php | 23 ++++------------------- 3 files changed, 11 insertions(+), 38 deletions(-) (limited to 'modules/gallery/controllers') diff --git a/modules/gallery/controllers/albums.php b/modules/gallery/controllers/albums.php index 1c48c734..9bf7b9bf 100644 --- a/modules/gallery/controllers/albums.php +++ b/modules/gallery/controllers/albums.php @@ -60,6 +60,9 @@ class Albums_Controller extends Items_Controller { url::redirect($album->abs_url("page=$max_pages")); } + Display_Context::factory("item") + ->save(); + $template = new Theme_View("page.html", "collection", "album"); $template->set_global( array("page" => $page, diff --git a/modules/gallery/controllers/movies.php b/modules/gallery/controllers/movies.php index 0f12c3fb..bbf89f17 100644 --- a/modules/gallery/controllers/movies.php +++ b/modules/gallery/controllers/movies.php @@ -27,27 +27,12 @@ class Movies_Controller extends Items_Controller { access::required("view", $movie); - $where = array(array("type", "!=", "album")); - $position = item::get_position($movie, $where); - if ($position > 1) { - list ($previous_item, $ignore, $next_item) = - $movie->parent()->viewable()->children(3, $position - 2, $where); - } else { - $previous_item = null; - list ($next_item) = $movie->parent()->viewable()->children(1, $position, $where); - } - $template = new Theme_View("page.html", "item", "movie"); $template->set_global( - array("item" => $movie, - "children" => array(), - "children_count" => 0, - "parents" => $movie->parents()->as_array(), - "breadcrumbs" => Breadcrumb::array_from_item_parents($movie), - "next_item" => $next_item, - "previous_item" => $previous_item, - "sibling_count" => $movie->parent()->viewable()->children_count($where), - "position" => $position)); + array_merge(array("item" => $movie, + "children" => array(), + "children_count" => 0), + Display_Context::factory()->display_context($movie))); $template->content = new View("movie.html"); diff --git a/modules/gallery/controllers/photos.php b/modules/gallery/controllers/photos.php index af8aed16..49bb5a25 100644 --- a/modules/gallery/controllers/photos.php +++ b/modules/gallery/controllers/photos.php @@ -27,27 +27,12 @@ class Photos_Controller extends Items_Controller { access::required("view", $photo); - $where = array(array("type", "!=", "album")); - $position = item::get_position($photo, $where); - if ($position > 1) { - list ($previous_item, $ignore, $next_item) = - $photo->parent()->viewable()->children(3, $position - 2, $where); - } else { - $previous_item = null; - list ($next_item) = $photo->parent()->viewable()->children(1, $position, $where); - } - $template = new Theme_View("page.html", "item", "photo"); $template->set_global( - array("item" => $photo, - "children" => array(), - "children_count" => 0, - "parents" => $photo->parents()->as_array(), - "breadcrumbs" => Breadcrumb::array_from_item_parents($photo), - "next_item" => $next_item, - "previous_item" => $previous_item, - "sibling_count" => $photo->parent()->viewable()->children_count($where), - "position" => $position)); + array_merge(array("item" => $photo, + "children" => array(), + "children_count" => 0), + Display_Context::factory()->display_context($photo))); $template->content = new View("photo.html"); -- cgit v1.2.3