summaryrefslogtreecommitdiff
path: root/modules/gallery/helpers/gallery_event.php
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2009-12-31 17:21:19 -0800
committerBharat Mediratta <bharat@menalto.com>2009-12-31 17:21:19 -0800
commit20bd09ff004816ae152a2f890a24dc5e85741fac (patch)
tree5eb58b7e9cbb23faffb2aeaffe0aff7e87b56918 /modules/gallery/helpers/gallery_event.php
parenta018e6235f09dd727b07f24801a8f237e07b3260 (diff)
A more thorough fix for #745 and #940. Stop using the referer to
guess how to send the user back. Instead, proxy the originating item id through the edit forms so that we can tell exactly what page we were on when we began editing. If we were viewing the item, then redirect to its new url (in case it changed) to fix ticket #745. But if we were viewing some other item, then just stay on the current page to fix #940. The page_type approach didn't work because you'd have the same "collection" page_type when doing a context menu edit for an album.
Diffstat (limited to 'modules/gallery/helpers/gallery_event.php')
-rw-r--r--modules/gallery/helpers/gallery_event.php13
1 files changed, 6 insertions, 7 deletions
diff --git a/modules/gallery/helpers/gallery_event.php b/modules/gallery/helpers/gallery_event.php
index 0303c9cb..5565850d 100644
--- a/modules/gallery/helpers/gallery_event.php
+++ b/modules/gallery/helpers/gallery_event.php
@@ -272,8 +272,6 @@ class gallery_event_Core {
->css_class("ui-icon-carat-1-n"));
if (access::can("edit", $item)) {
- $page_type = $theme->page_type();
- $page_subtype = $theme->page_subtype();
switch ($item->type) {
case "movie":
$edit_title = t("Edit this movie");
@@ -295,11 +293,12 @@ class gallery_event_Core {
$csrf = access::csrf_token();
+ $theme_item = $theme->item();
$options_menu->append(Menu::factory("dialog")
->id("edit")
->label($edit_title)
->css_class("ui-icon-pencil")
- ->url(url::site("quick/form_edit/$item->id?page_type=$page_type")));
+ ->url(url::site("quick/form_edit/$item->id?from_id=$theme_item->id")));
if ($item->is_photo() && graphics::can("rotate")) {
$options_menu
@@ -310,7 +309,7 @@ class gallery_event_Core {
->css_class("ui-icon-rotate-ccw")
->ajax_handler("function(data) { " .
"\$.gallery_replace_image(data, \$('$thumb_css_selector')) }")
- ->url(url::site("quick/rotate/$item->id/ccw?csrf=$csrf&page_type=$page_type")))
+ ->url(url::site("quick/rotate/$item->id/ccw?csrf=$csrf&from_id=$theme_item->id")))
->append(
Menu::factory("ajax_link")
->id("rotate_cw")
@@ -318,12 +317,12 @@ class gallery_event_Core {
->css_class("ui-icon-rotate-cw")
->ajax_handler("function(data) { " .
"\$.gallery_replace_image(data, \$('$thumb_css_selector')) }")
- ->url(url::site("quick/rotate/$item->id/cw?csrf=$csrf&page_type=$page_type")));
+ ->url(url::site("quick/rotate/$item->id/cw?csrf=$csrf&from_id=$theme_item->id")));
}
// @todo Don't move photos from the photo page; we don't yet have a good way of redirecting
// after move
- if ($page_subtype == "album") {
+ if ($theme->page_subtype() == "album") {
$options_menu
->append(Menu::factory("dialog")
->id("move")
@@ -358,7 +357,7 @@ class gallery_event_Core {
->label($delete_title)
->css_class("ui-icon-trash")
->css_id("g-quick-delete")
- ->url(url::site("quick/form_delete/$item->id?csrf=$csrf&page_type=$page_type")));
+ ->url(url::site("quick/form_delete/$item->id?csrf=$csrf&from_id=$theme_item->id")));
}
if ($item->is_album()) {