Permalink
Browse files

BUGFIX Fixed AssetAdmin->SyncForm() execution by switching from calli…

…ng dev/tasks/FilesystemSyncTask to doSync()
  • Loading branch information...
1 parent a99d7b0 commit a27369978d49edc73f995ee91dc1cf84cb60e12b @chillu chillu committed Mar 15, 2011
Showing with 9 additions and 23 deletions.
  1. +4 −2 code/AssetAdmin.php
  2. +5 −21 javascript/AssetAdmin.js
View
@@ -30,7 +30,6 @@ class AssetAdmin extends LeftAndMain {
'movemarked',
'removefile',
'savefile',
- 'sync',
'uploadiframe',
'UploadForm',
'deleteUnusedThumbnails' => 'ADMIN',
@@ -399,12 +398,15 @@ function SyncForm() {
);
$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.
View
@@ -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;
}

0 comments on commit a273699

Please sign in to comment.