From a27369978d49edc73f995ee91dc1cf84cb60e12b Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Wed, 16 Mar 2011 10:13:49 +1300 Subject: [PATCH] BUGFIX Fixed AssetAdmin->SyncForm() execution by switching from calling dev/tasks/FilesystemSyncTask to doSync() --- code/AssetAdmin.php | 6 ++++-- javascript/AssetAdmin.js | 26 +++++--------------------- 2 files changed, 9 insertions(+), 23 deletions(-) diff --git a/code/AssetAdmin.php b/code/AssetAdmin.php index 29cdca25..eda64d7b 100755 --- a/code/AssetAdmin.php +++ b/code/AssetAdmin.php @@ -30,7 +30,6 @@ class AssetAdmin extends LeftAndMain { 'movemarked', 'removefile', 'savefile', - 'sync', 'uploadiframe', 'UploadForm', 'deleteUnusedThumbnails' => 'ADMIN', @@ -399,12 +398,15 @@ HTML; ); $form->addExtraClass('actionparams'); $form->setFormMethod('GET'); - $form->setFormAction('dev/tasks/FilesystemSyncTask'); $btn->describe(_t('AssetAdmin_left.ss.FILESYSTEMSYNC_DESC', 'SilverStripe maintains its own database of the files & images stored in your assets/ folder. Click this button to update that database, if files are added to the assets/ folder from outside SilverStripe, for example, if you have uploaded files via FTP.')); return $form; } + function doSync($data, $form) { + return Filesystem::sync(); + } + /** * ################################# * Garbage collection. diff --git a/javascript/AssetAdmin.js b/javascript/AssetAdmin.js index 22261838..153af8d1 100755 --- a/javascript/AssetAdmin.js +++ b/javascript/AssetAdmin.js @@ -2,23 +2,6 @@ * File: AssetAdmin.js */ -/** - * Configuration for the left hand tree - */ -if(typeof SiteTreeHandlers == 'undefined') SiteTreeHandlers = {}; -SiteTreeHandlers.parentChanged_url = 'admin/assets/ajaxupdateparent'; -SiteTreeHandlers.orderChanged_url = 'admin/assets/ajaxupdatesort'; -SiteTreeHandlers.loadPage_url = 'admin/assets/getitem'; -SiteTreeHandlers.loadTree_url = 'admin/assets/getsubtree'; -SiteTreeHandlers.showRecord_url = 'admin/assets/show/'; -SiteTreeHandlers.controller_url = 'admin/assets'; - -var _HANDLER_FORMS = { - addpage : 'Form_AddForm', - deletepage : 'Form_DeleteItemsForm', - sortitems : 'sortitems_options' -}; - (function($) { /** * Delete selected folders through "batch actions" tab. @@ -55,9 +38,10 @@ var _HANDLER_FORMS = { onsubmit: function(e) { var button = jQuery(this).find(':submit:first'); button.addClass('loading'); - $.get( - jQuery(this).attr('action'), - function() { + $.ajax({ + url: jQuery(this).attr('action'), + data: this.serializeArray(), + success: function() { button.removeClass('loading'); // reload current form and tree var currNode = $('#sitetree')[0].firstSelected(); @@ -70,7 +54,7 @@ var _HANDLER_FORMS = { // TODO Reset current tree node }}); } - ); + }); return false; }