From 3f6a4dedfd552b83bd5cd58bed9c2e5a8523c510 Mon Sep 17 00:00:00 2001 From: Mateusz Uzdowski Date: Tue, 9 Mar 2010 03:24:37 +0000 Subject: [PATCH] BUGFIX: moving the ajaxupdatesort JS response code from php to js to get rid of eval. Also disable the "loading" on the moved element when we are done, in case we are repositioning other than the selected item - otherwise the progress indicator is displayed indefinitely. git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.4@100701 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- code/LeftAndMain.php | 9 --------- javascript/LeftAndMain_left.js | 13 +++++++++---- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/code/LeftAndMain.php b/code/LeftAndMain.php index 2a79fe61..23f6762e 100644 --- a/code/LeftAndMain.php +++ b/code/LeftAndMain.php @@ -924,15 +924,6 @@ JS; DB::query("UPDATE \"$className\" SET \"Sort\" = $counter WHERE \"ID\" = '$id'"); } } - // Virtual pages require selected to be null if the page is the same. - FormResponse::add( - "if( $('sitetree').selected && $('sitetree').selected[0]){ - var idx = $('sitetree').selected[0].getIdx(); - if(idx){ - $('Form_EditForm').getPageFromServer(idx); - } - }\n" . $js - ); FormResponse::status_message(_t('LeftAndMain.SAVED'), 'good'); } else { FormResponse::error(_t('LeftAndMain.REQUESTERROR',"Error in request")); diff --git a/javascript/LeftAndMain_left.js b/javascript/LeftAndMain_left.js index 8d07c056..c1eb7986 100755 --- a/javascript/LeftAndMain_left.js +++ b/javascript/LeftAndMain_left.js @@ -469,10 +469,15 @@ SiteTreeNode.prototype = { new Ajax.Request(SiteTreeHandlers.orderChanged_url, { method : 'post', postBody : parts.join('&') + '&CurrentlyOpenPageID=' + currentlyOpenPageID, - /*onSuccess : function(response) { - // statusMessage(response.responseText, 'good'); - },*/ - onSuccess: Ajax.Evaluator, + onSuccess : function(response) { + movedNode.removeNodeClass('loading'); + if( $('sitetree').selected && $('sitetree').selected[0]){ + var idx = $('sitetree').selected[0].getIdx(); + if(idx){ + $('Form_EditForm').getPageFromServer(idx); + } + } + }, onFailure : function(response) { errorMessage('error saving order', response); }