Commit 7d793f27 authored by Son Nguyen's avatar Son Nguyen Committed by Aaron Wells
Browse files

Fix bugs when changing view layout. Bug 1432641



Change-Id: I0ae87e94bd7ad723a19045598280a6c4880aa3d8
Signed-off-by: default avatarSon Nguyen <son.nguyen@catalyst.net.nz>
parent 6049db95
...@@ -2469,14 +2469,10 @@ class View { ...@@ -2469,14 +2469,10 @@ class View {
if ($currentcol > $prevrownumcolumns) { if ($currentcol > $prevrownumcolumns) {
$currentcol = 1; $currentcol = 1;
} }
if ($currentcol == $values['column']) {
// don't redistrubute blocks here!
}
if (!array_key_exists($currentcol, $prevrowcolumnmax)) { if (!array_key_exists($currentcol, $prevrowcolumnmax)) {
$prevrowcolumnmax[$currentcol] = $this->get_current_max_order($values['row']-1, $currentcol); $prevrowcolumnmax[$currentcol] = $this->get_current_max_order($values['row']-1, $currentcol);
} }
$this->shuffle_cell($values['row']-1, $currentcol, $prevrowcolumnmax[$currentcol]+1); $this->shuffle_cell($values['row']-1, $currentcol, $prevrowcolumnmax[$currentcol]+1);
$this->shuffle_cell($values['row'], $currentcol, null, $block->get('order'));
$block->set('row', $values['row']-1); $block->set('row', $values['row']-1);
$block->set('column', $currentcol); $block->set('column', $currentcol);
$block->set('order', $prevrowcolumnmax[$currentcol]+1); $block->set('order', $prevrowcolumnmax[$currentcol]+1);
...@@ -2670,7 +2666,7 @@ class View { ...@@ -2670,7 +2666,7 @@ class View {
$extravalues = array(); $extravalues = array();
} }
// first move them one but switch to negtaive // first move them one but switch to negative
$sql = 'UPDATE {block_instance} $sql = 'UPDATE {block_instance}
SET "' . $field .'" = (-1 * ("' . $field . '") ' . (($direction == 'up') ? '-' : '+') . ' 1) SET "' . $field .'" = (-1 * ("' . $field . '") ' . (($direction == 'up') ? '-' : '+') . ' 1)
WHERE "view" = ? AND "' . $field . '"' . $operator . ' ? ' . $extrawhere; WHERE "view" = ? AND "' . $field . '"' . $operator . ' ? ' . $extrawhere;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment