summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2009-04-21 18:11:27 +0000
committerTim Almdal <tnalmdal@shaw.ca>2009-04-21 18:11:27 +0000
commit9d31564b7cfe067f5260e3bc904980f3cd3231a7 (patch)
treeb7cebe7c5ec4e6f9a6128790c19b58a4df8b67f1
parent0fdc4639c357fe66b4d05f0deb0123de3fa0a0f6 (diff)
1) Disable drag when the rearrange task is running
2) Add the album name to the task name
-rw-r--r--modules/organize/controllers/organize.php16
-rw-r--r--modules/organize/js/organize.js2
2 files changed, 14 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();
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");
};
// **************************************************************************