From bb781a70c536758f9532abf46b33319f7baeac61 Mon Sep 17 00:00:00 2001 From: cap2501 Date: Sun, 8 Oct 2006 20:24:15 +0000 Subject: [PATCH] made changes to the way the block movment was handled to eliminate some errors that came up. --- course/rest.php | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/course/rest.php b/course/rest.php index 4a04a1ea4ea..0c1948e00b7 100644 --- a/course/rest.php +++ b/course/rest.php @@ -31,7 +31,6 @@ if (!$course = get_record('course', 'id', $courseid)) { $PAGE = page_create_object(PAGE_COURSE_VIEW, $course->id); $pageblocks = blocks_setup($PAGE,BLOCKS_PINNED_BOTH); - if (!empty($instanceid)) { $blockinstance = blocks_find_instance($instanceid, $pageblocks); if (!$blockinstance || $blockinstance->pageid != $course->id || $blockinstance->pagetype != 'course-view') { @@ -57,14 +56,8 @@ switch($_SERVER['REQUEST_METHOD']) { break; case 'position': - $newblockinstance = new object; - $newblockinstance->id = $blockinstance->id; - $newblockinstance->position = $column; - $newblockinstance->weight = $value; - if (!update_record('block_instance',$newblockinstance)) { - error_log('AJAX commands.php: Failed to update block with ID '.$blockinstance->id); - die; - } + //while not entirely restful this will handle all the details of moving a block + blocks_execute_repositioning_atomic($blockinstance, $column, $value); break; } break;