Skip to content

Commit

Permalink
ENHANCEMENT: Update Asset's left and right panels with filders and fi…
Browse files Browse the repository at this point in the history
…les 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
  • Loading branch information
Saophalkun Ponlu authored and Sam Minnee committed Feb 2, 2011
1 parent b8338bc commit 75f12d5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
3 changes: 2 additions & 1 deletion code/AssetAdmin.php
Expand Up @@ -38,7 +38,8 @@ class AssetAdmin extends LeftAndMain {
'sync', 'sync',
'uploadiframe', 'uploadiframe',
'UploadForm', 'UploadForm',
'deleteUnusedThumbnails' => 'ADMIN' 'deleteUnusedThumbnails' => 'ADMIN',
'SitetreeAsUL'
); );


/** /**
Expand Down
26 changes: 19 additions & 7 deletions javascript/AssetAdmin.js
Expand Up @@ -342,13 +342,25 @@ FilesystemSyncClass.prototype = {


onclick : function() { onclick : function() {
statusMessage('Looking for new files'); statusMessage('Looking for new files');
new Ajax.Request('admin/assets/sync', { new Ajax.Request('admin/assets/sync', {
onSuccess: function(t) { onSuccess: function(t) {
statusMessage(t.responseText, "good"); statusMessage(t.responseText, "good");
},
onFailure: function(t) { // Refresh asset tree
errorMessage("There was an error looking for new files"); 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; return false;
} }
Expand Down

0 comments on commit 75f12d5

Please sign in to comment.