diff options
| author | Tim Almdal <tnalmdal@shaw.ca> | 2009-04-21 18:11:27 +0000 |
|---|---|---|
| committer | Tim Almdal <tnalmdal@shaw.ca> | 2009-04-21 18:11:27 +0000 |
| commit | 9d31564b7cfe067f5260e3bc904980f3cd3231a7 (patch) | |
| tree | b7cebe7c5ec4e6f9a6128790c19b58a4df8b67f1 /modules/organize/controllers | |
| parent | 0fdc4639c357fe66b4d05f0deb0123de3fa0a0f6 (diff) | |
1) Disable drag when the rearrange task is running
2) Add the album name to the task name
Diffstat (limited to 'modules/organize/controllers')
| -rw-r--r-- | modules/organize/controllers/organize.php | 16 |
1 files changed, 12 insertions, 4 deletions
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(); |
