BUGFIX Fixed AssetAdmin->SyncForm() execution by switching from calling dev/tasks/FilesystemSyncTask to doSync()

This commit is contained in:
Ingo Schommer 2011-03-16 10:13:49 +13:00
parent a99d7b0b1d
commit a27369978d
2 changed files with 9 additions and 23 deletions

View File

@ -30,7 +30,6 @@ class AssetAdmin extends LeftAndMain {
'movemarked', 'movemarked',
'removefile', 'removefile',
'savefile', 'savefile',
'sync',
'uploadiframe', 'uploadiframe',
'UploadForm', 'UploadForm',
'deleteUnusedThumbnails' => 'ADMIN', 'deleteUnusedThumbnails' => 'ADMIN',
@ -399,12 +398,15 @@ HTML;
); );
$form->addExtraClass('actionparams'); $form->addExtraClass('actionparams');
$form->setFormMethod('GET'); $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.')); $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; return $form;
} }
function doSync($data, $form) {
return Filesystem::sync();
}
/** /**
* ################################# * #################################
* Garbage collection. * Garbage collection.

View File

@ -2,23 +2,6 @@
* File: AssetAdmin.js * 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($) { (function($) {
/** /**
* Delete selected folders through "batch actions" tab. * Delete selected folders through "batch actions" tab.
@ -55,9 +38,10 @@ var _HANDLER_FORMS = {
onsubmit: function(e) { onsubmit: function(e) {
var button = jQuery(this).find(':submit:first'); var button = jQuery(this).find(':submit:first');
button.addClass('loading'); button.addClass('loading');
$.get( $.ajax({
jQuery(this).attr('action'), url: jQuery(this).attr('action'),
function() { data: this.serializeArray(),
success: function() {
button.removeClass('loading'); button.removeClass('loading');
// reload current form and tree // reload current form and tree
var currNode = $('#sitetree')[0].firstSelected(); var currNode = $('#sitetree')[0].firstSelected();
@ -70,7 +54,7 @@ var _HANDLER_FORMS = {
// TODO Reset current tree node // TODO Reset current tree node
}}); }});
} }
); });
return false; return false;
} }