diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2011-08-11 22:04:20 -0700 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2011-08-11 22:04:21 -0700 |
commit | 933a34986dbca248f388e8aa3c3aea4a6d71a94b (patch) | |
tree | 42251d934b3b257652f8b1658d5343d3f8759fab /modules/gallery/controllers | |
parent | b78f87cb80c1ee4b8608508cb8a9bf8be71c511d (diff) |
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.
Diffstat (limited to 'modules/gallery/controllers')
-rw-r--r-- | modules/gallery/controllers/albums.php | 3 | ||||
-rw-r--r-- | modules/gallery/controllers/movies.php | 23 | ||||
-rw-r--r-- | modules/gallery/controllers/photos.php | 23 |
3 files changed, 11 insertions, 38 deletions
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"); |