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/tag/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/tag/controllers')
-rw-r--r-- | modules/tag/controllers/tag.php | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/modules/tag/controllers/tag.php b/modules/tag/controllers/tag.php index 7786daa1..06e2b5ed 100644 --- a/modules/tag/controllers/tag.php +++ b/modules/tag/controllers/tag.php @@ -22,7 +22,22 @@ class Tag_Controller extends Controller { $tag_id = $function; $tag = ORM::factory("tag")->where("id", "=", $tag_id)->find(); $page_size = module::get_var("gallery", "page_size", 9); - $page = (int) Input::instance()->get("page", "1"); + + $input = Input::instance(); + $show = $input->get("show"); + + if ($show) { + $child = ORM::factory("item", $show); + $index = tag::get_position($tag, $child); + if ($index) { + $page = ceil($index / $page_size); + $uri = "tag/$tag_id/" . urlencode($tag->name); + url::redirect($uri . ($page == 1 ? "" : "?page=$page")); + } + } else { + $page = (int) $input->get("page", "1"); + } + $children_count = $tag->items_count(); $offset = ($page-1) * $page_size; $max_pages = max(ceil($children_count / $page_size), 1); @@ -35,6 +50,11 @@ class Tag_Controller extends Controller { } $root = item::root(); + $title = t("Tag: %tag_name", array("tag_name" => $tag->name)); + Display_Context::factory("tag") + ->set(array("tag" => $tag)) + ->save(); + $template = new Theme_View("page.html", "collection", "tag"); $template->set_global( array("page" => $page, |