summaryrefslogtreecommitdiff
path: root/modules/gallery/controllers/photos.php
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2009-12-31 18:32:24 -0800
committerTim Almdal <tnalmdal@shaw.ca>2009-12-31 18:32:24 -0800
commitee1a032e4dec8dcb85702ac2c30807345feaa7e6 (patch)
treed487969c510ebf301bd994ef86dc23ae569d04e8 /modules/gallery/controllers/photos.php
parent40d496edeef614f7f3bc55d2fb178ea581dcd9f6 (diff)
parent25f936e1edc8c47a789b423b9cadbe071a65256d (diff)
Merge branch 'master' into talmdal_dev
Diffstat (limited to 'modules/gallery/controllers/photos.php')
-rw-r--r--modules/gallery/controllers/photos.php15
1 files changed, 8 insertions, 7 deletions
diff --git a/modules/gallery/controllers/photos.php b/modules/gallery/controllers/photos.php
index ced9da2f..56b454ce 100644
--- a/modules/gallery/controllers/photos.php
+++ b/modules/gallery/controllers/photos.php
@@ -99,8 +99,6 @@ class Photos_Controller extends Items_Controller {
}
if ($valid) {
- $watching_album = $photo->url() != ($location = parse_url(request::referrer(), PHP_URL_PATH));
-
$photo->title = $form->edit_item->title->value;
$photo->description = $form->edit_item->description->value;
$photo->slug = $form->edit_item->slug->value;
@@ -110,12 +108,15 @@ class Photos_Controller extends Items_Controller {
log::success("content", "Updated photo", "<a href=\"{$photo->url()}\">view</a>");
message::success(
- t("Saved photo %photo_title",
- array("photo_title" => html::purify($photo->title))));
+ t("Saved photo %photo_title", array("photo_title" => html::purify($photo->title))));
- print json_encode(
- array("result" => "success",
- "location" => $watching_album ? $location : $photo->url()));
+ if ($form->from_id->value == $photo->id) {
+ // Use the new url; it might have changed.
+ print json_encode(array("result" => "success", "location" => $photo->url()));
+ } else {
+ // Stay on the same page
+ print json_encode(array("result" => "success"));
+ }
} else {
print json_encode(
array("result" => "error",