From f9b314d6624bbce5e6cdc98de59f3102ee3abc47 Mon Sep 17 00:00:00 2001 From: Andrew O'Neil Date: Tue, 2 Oct 2007 05:10:35 +0000 Subject: [PATCH] Fixed CMS sort sub-pages bug git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@42935 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- code/LeftAndMain.php | 7 +++++-- javascript/CMSMain_left.js | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/code/LeftAndMain.php b/code/LeftAndMain.php index a8f578b5..fd600476 100644 --- a/code/LeftAndMain.php +++ b/code/LeftAndMain.php @@ -657,8 +657,11 @@ JS; $_REQUEST['ajax'] = 1; if(is_array($_REQUEST['ID'])) { - $movedNode = DataObject::get_by_id($className, $_REQUEST['MovedNodeID']); - + if($_REQUEST['MovedNodeID']==0){ //Sorting root + $movedNode = DataObject::get($className, "`ParentID`=0"); + }else{ + $movedNode = DataObject::get_by_id($className, $_REQUEST['MovedNodeID']); + } foreach($_REQUEST['ID'] as $id) { if($id == $movedNode->ID) { $movedNode->Sort = ++$counter; diff --git a/javascript/CMSMain_left.js b/javascript/CMSMain_left.js index edec030e..03b6d88d 100755 --- a/javascript/CMSMain_left.js +++ b/javascript/CMSMain_left.js @@ -381,6 +381,6 @@ TreeContextMenu = { treeNode.appendTreeNode(child); } - treeNode.onOrderChanged(sortedChildren); + treeNode.onOrderChanged(sortedChildren,treeNode); } }; \ No newline at end of file