mirror of
https://github.com/Pathduck/gallery3.git
synced 2024-10-29 21:07:18 -04:00
Change back to using the ORM to update the child weight, but use the batch::start() method so notifications are queued
This commit is contained in:
parent
5e9c602b09
commit
69d1b16818
@ -173,6 +173,9 @@ class Organize_Controller extends Controller {
|
|||||||
$weight = $task->get("weight");
|
$weight = $task->get("weight");
|
||||||
$target_id = $task->get("target_id");
|
$target_id = $task->get("target_id");
|
||||||
$is_before = $task->get("before") == "before";
|
$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
|
// @todo at some point if we allow drag from album tree this needs to be changed
|
||||||
if ($phase == "dropping") {
|
if ($phase == "dropping") {
|
||||||
$children = ORM::factory("item")
|
$children = ORM::factory("item")
|
||||||
@ -208,9 +211,8 @@ class Organize_Controller extends Controller {
|
|||||||
$task->set("phase", "dropping");
|
$task->set("phase", "dropping");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Database::instance()->query(
|
$child->weight = item::get_max_weight();
|
||||||
"UPDATE {items} SET `weight` = " . item::get_max_weight() .
|
$child->save();
|
||||||
" WHERE `id` = " . $child->id);
|
|
||||||
|
|
||||||
$completed++;
|
$completed++;
|
||||||
if ($phase == "before_drop" && $child->id == $task->get("target_id")) {
|
if ($phase == "before_drop" && $child->id == $task->get("target_id")) {
|
||||||
@ -222,6 +224,7 @@ class Organize_Controller extends Controller {
|
|||||||
if ($completed == $task->get("total")) {
|
if ($completed == $task->get("total")) {
|
||||||
$parent->sort_column = "weight";
|
$parent->sort_column = "weight";
|
||||||
$parent->save();
|
$parent->save();
|
||||||
|
batch::stop();
|
||||||
$task->done = true;
|
$task->done = true;
|
||||||
$task->state = "success";
|
$task->state = "success";
|
||||||
$task->set("content", self::_get_micro_thumb_grid($parent, 0)->__toString());
|
$task->set("content", self::_get_micro_thumb_grid($parent, 0)->__toString());
|
||||||
|
Loading…
Reference in New Issue
Block a user