Use the request::referrer to determine if we are editting the photo or album

from the context menu or from its photo or album page.
Fixes ticket #745.  Thanks to jankoprowski for the referrer approach.
This commit is contained in:
Tim Almdal
2009-10-22 10:09:25 -07:00
parent 95f3eb3aad
commit e906e6bcbd
2 changed files with 6 additions and 2 deletions
+3 -1
View File
@@ -200,6 +200,8 @@ class Albums_Controller extends Items_Controller {
}
if ($valid) {
$watching_album = $album->url() != ($location = parse_url(request::referrer(), PHP_URL_PATH));
$album->title = $form->edit_item->title->value;
$album->description = $form->edit_item->description->value;
$album->sort_column = $form->edit_item->sort_order->column->value;
@@ -217,7 +219,7 @@ class Albums_Controller extends Items_Controller {
print json_encode(
array("result" => "success",
"location" => $album->url()));
"location" => $watching_album ? $location : $album->url()));
} else {
print json_encode(
array("result" => "error",
+3 -1
View File
@@ -100,6 +100,8 @@ 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;
@@ -114,7 +116,7 @@ class Photos_Controller extends Items_Controller {
print json_encode(
array("result" => "success",
"location" => $photo->url()));
"location" => $watching_album ? $location : $photo->url()));
} else {
print json_encode(
array("result" => "error",