From b4f92c7de69466b2d4ec0c41b9b22e4511314a24 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Thu, 29 Jan 2009 09:26:39 +0000 Subject: Add delete support as a quick-edit option --- core/controllers/quick.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'core/controllers/quick.php') diff --git a/core/controllers/quick.php b/core/controllers/quick.php index b9a8fb82..20072044 100644 --- a/core/controllers/quick.php +++ b/core/controllers/quick.php @@ -93,6 +93,25 @@ class Quick_Controller extends Controller { print json_encode(array("result" => "success")); } + public function delete($id) { + access::verify_csrf(); + $item = ORM::factory("item", $id); + access::required("edit", $item); + + $parent = $item->parent(); + + if ($item->type == "album") { + $msg = t("Deleted album %title", array("title" => $item->title)); + } else { + $msg = t("Deleted photo %title", array("title" => $item->title)); + } + + $item->delete(); + message::success($msg); + + print json_encode(array("result" => "success", "reload" => 1)); + } + public function form_edit($id) { $item = ORM::factory("item", $id); access::required("edit", $item); -- cgit v1.2.3