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
This commit is contained in:
Mateusz Uzdowski 2010-03-09 03:24:37 +00:00 committed by Sam Minnee
parent 16f4e99af9
commit 3f6a4dedfd
2 changed files with 9 additions and 13 deletions

View File

@ -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"));

View File

@ -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);
}