ENHANCEMENT: Update Asset's left and right panels with filders and files after 'Look for new files' was triggered (open #5543)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.4@113871 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Saophalkun Ponlu 2010-11-17 05:21:03 +00:00 committed by Sam Minnee
parent b8338bc2bc
commit 75f12d5a7e
2 changed files with 21 additions and 8 deletions

View File

@ -38,7 +38,8 @@ class AssetAdmin extends LeftAndMain {
'sync',
'uploadiframe',
'UploadForm',
'deleteUnusedThumbnails' => 'ADMIN'
'deleteUnusedThumbnails' => 'ADMIN',
'SitetreeAsUL'
);
/**

View File

@ -342,13 +342,25 @@ FilesystemSyncClass.prototype = {
onclick : function() {
statusMessage('Looking for new files');
new Ajax.Request('admin/assets/sync', {
onSuccess: function(t) {
statusMessage(t.responseText, "good");
},
onFailure: function(t) {
errorMessage("There was an error looking for new files");
}
new Ajax.Request('admin/assets/sync', {
onSuccess: function(t) {
statusMessage(t.responseText, "good");
// Refresh asset tree
new Ajax.Request('admin/assets/SitetreeAsUL', {
onSuccess: function(t) {
Element.replace($('sitetree'), t.responseText);
SiteTree.applyTo('#sitetree');
// Reload the right panel
var sel = $('sitetree').firstSelected();
if(sel !== undefined) sel.selectTreeNode();
}
});
},
onFailure: function(t) {
errorMessage("There was an error looking for new files");
}
});
return false;
}