1
0
mirror of https://github.com/silverstripe/silverstripe-reports synced 2024-10-22 09:05:53 +00:00

BUGFIX New folders weren't getting their name set correctly, instead they would just be called "NewFolder". This occurred in the Site Content section of the CMS, creating a folder using the right hand panel in that section.

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@64732 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sean Harvey 2008-10-24 01:21:12 +00:00
parent 0f4698726a
commit ae4986b0e5

@ -54,9 +54,10 @@ TinyMCEImageEnhancement.prototype = {
}, },
/** /**
* Called when user clicks "ok" anchor/ adds folder with given name. * The user clicks the "ok" anchor link, the click event calls up
* this function which creates a new AJAX request to add a new folder
* using the addfolder function in AssetAdmin.php (admin/assets/addfolder).
*/ */
onFolderOk: function(event) { onFolderOk: function(event) {
Event.stop(event); Event.stop(event);
var folderName = $('NewFolderName').value; var folderName = $('NewFolderName').value;
@ -68,17 +69,18 @@ TinyMCEImageEnhancement.prototype = {
errorMessage('Error: Folder not added', transport); errorMessage('Error: Folder not added', transport);
} }
}; };
new Ajax.Request('admin/assets/addfolder', options); new Ajax.Request('admin/assets/addfolder', options);
}, },
/** /**
* Method retrieves folder id and sends request which changes folder name. * If the "addFolderOk" function does a successful AJAX post, call this
* function. Take the folder ID that was created in "addFolderOk"
* via ajax and send data to modify that folder record.
*/ */
onFolderGetSuccess: function(transport) { onFolderGetSuccess: function(transport) {
var folderID = transport.responseText; var folderID = transport.responseText;
var date = new Date(); var date = new Date();
var year = date.getFullYear(); var year = date.getFullYear();
var month = date.getMonth() < 10 ? '0' + date.getMonth() : date.getMonth(); var month = date.getMonth() < 10 ? '0' + date.getMonth() : date.getMonth();
@ -87,8 +89,11 @@ TinyMCEImageEnhancement.prototype = {
var minutes = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes(); var minutes = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes();
var seconds = date.getSeconds() < 10 == 1 ? '0' + date.getSeconds() : date.getSeconds(); var seconds = date.getSeconds() < 10 == 1 ? '0' + date.getSeconds() : date.getSeconds();
var currentDate = year + '-' + month + '-' + day + ' ' + hours + ':' + minutes + ':' + seconds; var currentDate = year + '-' + month + '-' + day + ' ' + hours + ':' + minutes + ':' + seconds;
var folderName = $('NewFolderName').value; var folderName = $('NewFolderName').value;
this.folderID = folderID; this.folderID = folderID;
var options = { var options = {
method: 'post', method: 'post',
postBody: 'Created=' + currentDate + '&Name=' + folderName + '&ClassName=Folder&ID=' + folderID + '&ajax=1&action_save=1' + ($('SecurityID') ? '&SecurityID=' + $('SecurityID').value : ''), postBody: 'Created=' + currentDate + '&Name=' + folderName + '&ClassName=Folder&ID=' + folderID + '&ajax=1&action_save=1' + ($('SecurityID') ? '&SecurityID=' + $('SecurityID').value : ''),
@ -97,7 +102,8 @@ TinyMCEImageEnhancement.prototype = {
errorMessage('Error: Folder not added', transport); errorMessage('Error: Folder not added', transport);
} }
}; };
new Ajax.Request('admin/assets/index/' + this.getParentID() + '?executeForm=EditForm', options);
new Ajax.Request('admin/assets/EditForm', options);
}, },
/** /**
@ -119,7 +125,6 @@ TinyMCEImageEnhancement.prototype = {
*/ */
onFolderCancel: function(event) { onFolderCancel: function(event) {
Event.stop(event);
$('NewFolderName').value = ''; $('NewFolderName').value = '';
Element.show('AddFolder'); Element.show('AddFolder');
Element.hide('NewFolderName','FolderOk','FolderCancel'); Element.hide('NewFolderName','FolderOk','FolderCancel');