summaryrefslogtreecommitdiff
path: root/core/controllers/quick.php
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2009-01-29 09:26:39 +0000
committerBharat Mediratta <bharat@menalto.com>2009-01-29 09:26:39 +0000
commitb4f92c7de69466b2d4ec0c41b9b22e4511314a24 (patch)
treefa174f59d2cfaaf993600735f57053ba0b059ec4 /core/controllers/quick.php
parent6091350c9454c92e5a975901eff8f5f46bee3045 (diff)
Add delete support as a quick-edit option
Diffstat (limited to 'core/controllers/quick.php')
-rw-r--r--core/controllers/quick.php19
1 files changed, 19 insertions, 0 deletions
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 <b>%title</b>", array("title" => $item->title));
+ } else {
+ $msg = t("Deleted photo <b>%title</b>", 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);