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 ++++++++++++---- modules/organize/js/organize.js | 2 ++ 2 files changed, 14 insertions(+), 4 deletions(-) (limited to 'modules') 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(); diff --git a/modules/organize/js/organize.js b/modules/organize/js/organize.js index 38e9e5ad..00db46d3 100644 --- a/modules/organize/js/organize.js +++ b/modules/organize/js/organize.js @@ -181,6 +181,7 @@ var startRearrangeCallback = function (data, textStatus) { $(".gProgressBar").progressbar("value", 0); task = data.task; } + $(".gMicroThumbContainer").draggable("disable"); var done = false; paused = false; while (!done && !paused) { @@ -208,6 +209,7 @@ var startRearrangeCallback = function (data, textStatus) { url: get_url("organize/rearrangeFinish", task.id) }); } + $(".gMicroThumbContainer").draggable("enable"); }; // ************************************************************************** -- cgit v1.2.3