From 9d31564b7cfe067f5260e3bc904980f3cd3231a7 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Tue, 21 Apr 2009 18:11:27 +0000 Subject: 1) Disable drag when the rearrange task is running 2) Add the album name to the task name --- modules/organize/controllers/organize.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'modules/organize/controllers') diff --git a/modules/organize/controllers/organize.php b/modules/organize/controllers/organize.php index 58ca73a2..bb74f23a 100644 --- a/modules/organize/controllers/organize.php +++ b/modules/organize/controllers/organize.php @@ -87,11 +87,13 @@ class Organize_Controller extends Controller { function rearrangeStart($id) { access::verify_csrf(); $items = $this->input->post("item"); + + $item = ORM::factory("item", $id); $task_def = Task_Definition::factory() ->callback("organize_task::rearrange") ->description(t("Rearrange the order of albums and photos")) - ->name(t("Rearrange")); + ->name(t("Rearrange: %name", array("name" => $item->title))); $task = task::create($task_def, array("items" => $items, "position" => 0, "batch" => ceil(count($items) * .1))); @@ -125,9 +127,15 @@ class Organize_Controller extends Controller { $task = ORM::factory("task", $task_id); if ($task->done) { - $item = ORM::factory("item", $id); - $item->sort_column = "weight"; - $item->save(); + try { + $item = ORM::factory("item", $id); + $item->sort_column = "weight"; + $item->save(); + $task->status = t("Rearrange for '%album' completed", array("album" => $item->title)); + } catch (Exception $e) { + $task->state = "error"; + $task->status = $e->getMessage(); + } } batch::stop(); -- cgit v1.2.3