ENHANCEMENT: CMS Editor Upload panel now loads the root files directly and allows the user to upload to the root assets dir (from r97601)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@102520 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2010-04-12 23:05:23 +00:00
parent 95350bcdf8
commit afc0cd0ee7

View File

@ -8,7 +8,14 @@
(function($) { (function($) {
$(document).ready(function() { $(document).ready(function() {
/**
* On page refresh load the initial images (in root)
*/
if($("#FolderImages").length > 0) loadImages();
/**
* Show / Hide the Upload Form
*/
$("#Form_EditorToolbarImageForm .showUploadField a").click(function() { $("#Form_EditorToolbarImageForm .showUploadField a").click(function() {
if($(this).hasClass("showing")) { if($(this).hasClass("showing")) {
$("#Form_EditorToolbarImageForm_Files-0").parents('.file').hide(); $("#Form_EditorToolbarImageForm_Files-0").parents('.file').hide();
@ -20,6 +27,9 @@
} }
}).show(); }).show();
/**
* On folder change - lookup the new images
*/
$("#Form_EditorToolbarImageForm_Files-0").change(function() { $("#Form_EditorToolbarImageForm_Files-0").change(function() {
$("#contentPanel form").ajaxForm({ $("#contentPanel form").ajaxForm({
url: 'admin/assets/UploadForm?action_doUpload=1', url: 'admin/assets/UploadForm?action_doUpload=1',
@ -35,9 +45,19 @@
$("#FolderImages").html('<h2>'+ ss.i18n._t('HtmlEditorField.Loading', 'Loading') + '</h2>'); $("#FolderImages").html('<h2>'+ ss.i18n._t('HtmlEditorField.Loading', 'Loading') + '</h2>');
var ajaxURL = 'admin/EditorToolbar/ImageForm'; loadImages();
}
}).submit();
});
$.get(ajaxURL, { /**
* Loads images from getimages() to the thumbnail view. It's called on
*
*
*/
function loadImages(sel) {
console.debug(this);
$.get('admin/EditorToolbar/ImageForm', {
action_callfieldmethod: "1", action_callfieldmethod: "1",
fieldName: "FolderImages", fieldName: "FolderImages",
ajax: "1", ajax: "1",
@ -55,7 +75,5 @@
}) })
}); });
} }
}).submit();
});
}); });
})(jQuery); })(jQuery);