mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02: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:
parent
0f4698726a
commit
ae4986b0e5
@ -53,51 +53,57 @@ TinyMCEImageEnhancement.prototype = {
|
|||||||
this.applyIE6Hack();
|
this.applyIE6Hack();
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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) {
|
||||||
|
Event.stop(event);
|
||||||
|
var folderName = $('NewFolderName').value;
|
||||||
|
var options = {
|
||||||
|
method: 'post',
|
||||||
|
postBody: 'ParentID=' + this.getParentID() + '&ajax=1&returnID=1' + ($('SecurityID') ? '&SecurityID=' + $('SecurityID').value : ''),
|
||||||
|
onSuccess: this.onFolderGetSuccess.bind(this),
|
||||||
|
onFailure: function(transport) {
|
||||||
|
errorMessage('Error: Folder not added', transport);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
new Ajax.Request('admin/assets/addfolder', options);
|
||||||
|
},
|
||||||
|
|
||||||
onFolderOk: function(event) {
|
/**
|
||||||
Event.stop(event);
|
* If the "addFolderOk" function does a successful AJAX post, call this
|
||||||
var folderName = $('NewFolderName').value;
|
* function. Take the folder ID that was created in "addFolderOk"
|
||||||
var options = {
|
* via ajax and send data to modify that folder record.
|
||||||
method: 'post',
|
*/
|
||||||
postBody: 'ParentID=' + this.getParentID() + '&ajax=1&returnID=1' + ($('SecurityID') ? '&SecurityID=' + $('SecurityID').value : ''),
|
onFolderGetSuccess: function(transport) {
|
||||||
onSuccess: this.onFolderGetSuccess.bind(this),
|
var folderID = transport.responseText;
|
||||||
onFailure: function(transport) {
|
|
||||||
errorMessage('Error: Folder not added', transport);
|
var date = new Date();
|
||||||
}
|
var year = date.getFullYear();
|
||||||
};
|
var month = date.getMonth() < 10 ? '0' + date.getMonth() : date.getMonth();
|
||||||
new Ajax.Request('admin/assets/addfolder', options);
|
var day = date.getDay() < 10 ? '0' + date.getDay() : date.getDay();
|
||||||
|
var hours = date.getHours() < 10 ? '0' + date.getHours() : date.getHours();
|
||||||
|
var minutes = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes();
|
||||||
},
|
var seconds = date.getSeconds() < 10 == 1 ? '0' + date.getSeconds() : date.getSeconds();
|
||||||
|
var currentDate = year + '-' + month + '-' + day + ' ' + hours + ':' + minutes + ':' + seconds;
|
||||||
/**
|
|
||||||
* Method retrieves folder id and sends request which changes folder name.
|
var folderName = $('NewFolderName').value;
|
||||||
*/
|
|
||||||
|
this.folderID = folderID;
|
||||||
onFolderGetSuccess: function(transport) {
|
|
||||||
var folderID = transport.responseText;
|
var options = {
|
||||||
var date = new Date();
|
method: 'post',
|
||||||
var year = date.getFullYear();
|
postBody: 'Created=' + currentDate + '&Name=' + folderName + '&ClassName=Folder&ID=' + folderID + '&ajax=1&action_save=1' + ($('SecurityID') ? '&SecurityID=' + $('SecurityID').value : ''),
|
||||||
var month = date.getMonth() < 10 ? '0' + date.getMonth() : date.getMonth();
|
onSuccess: this.onFolderAddSuccess.bind(this),
|
||||||
var day = date.getDay() < 10 ? '0' + date.getDay() : date.getDay();
|
onFailure: function(transport) {
|
||||||
var hours = date.getHours() < 10 ? '0' + date.getHours() : date.getHours();
|
errorMessage('Error: Folder not added', transport);
|
||||||
var minutes = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes();
|
}
|
||||||
var seconds = date.getSeconds() < 10 == 1 ? '0' + date.getSeconds() : date.getSeconds();
|
};
|
||||||
var currentDate = year + '-' + month + '-' + day + ' ' + hours + ':' + minutes + ':' + seconds;
|
|
||||||
var folderName = $('NewFolderName').value;
|
new Ajax.Request('admin/assets/EditForm', options);
|
||||||
this.folderID = folderID;
|
|
||||||
var options = {
|
|
||||||
method: 'post',
|
|
||||||
postBody: 'Created=' + currentDate + '&Name=' + folderName + '&ClassName=Folder&ID=' + folderID + '&ajax=1&action_save=1' + ($('SecurityID') ? '&SecurityID=' + $('SecurityID').value : ''),
|
|
||||||
onSuccess: this.onFolderAddSuccess.bind(this),
|
|
||||||
onFailure: function(transport) {
|
|
||||||
errorMessage('Error: Folder not added', transport);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
new Ajax.Request('admin/assets/index/' + this.getParentID() + '?executeForm=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');
|
||||||
|
Loading…
Reference in New Issue
Block a user