summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2009-08-17 12:32:33 -0700
committerTim Almdal <tnalmdal@shaw.ca>2009-08-17 12:32:33 -0700
commit69d1b168189541fbdf2c91e30e59dbd96f600921 (patch)
treeb72fdccd84ed7e0d83f182830eeaaf8e68459de2
parent5e9c602b094a9290e1caa0ffaa53e291e739edfd (diff)
Change back to using the ORM to update the child weight, but use the batch::start() method so notifications are queued
-rw-r--r--modules/organize/controllers/organize.php9
1 files changed, 6 insertions, 3 deletions
diff --git a/modules/organize/controllers/organize.php b/modules/organize/controllers/organize.php
index 2d00a187..c418136b 100644
--- a/modules/organize/controllers/organize.php
+++ b/modules/organize/controllers/organize.php
@@ -173,6 +173,9 @@ class Organize_Controller extends Controller {
$weight = $task->get("weight");
$target_id = $task->get("target_id");
$is_before = $task->get("before") == "before";
+ if ($task->percent_complete == 0) {
+ batch::start();
+ }
// @todo at some point if we allow drag from album tree this needs to be changed
if ($phase == "dropping") {
$children = ORM::factory("item")
@@ -208,9 +211,8 @@ class Organize_Controller extends Controller {
$task->set("phase", "dropping");
break;
}
- Database::instance()->query(
- "UPDATE {items} SET `weight` = " . item::get_max_weight() .
- " WHERE `id` = " . $child->id);
+ $child->weight = item::get_max_weight();
+ $child->save();
$completed++;
if ($phase == "before_drop" && $child->id == $task->get("target_id")) {
@@ -222,6 +224,7 @@ class Organize_Controller extends Controller {
if ($completed == $task->get("total")) {
$parent->sort_column = "weight";
$parent->save();
+ batch::stop();
$task->done = true;
$task->state = "success";
$task->set("content", self::_get_micro_thumb_grid($parent, 0)->__toString());