mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 06:05:56 +00:00
FEATURE #1531 - Allow moving files in root assets file (hamish)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.3@66163 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
6078fe75dc
commit
53f59b6593
@ -298,8 +298,8 @@ HTML;
|
||||
* Called and returns in same way as 'save' function
|
||||
*/
|
||||
public function movemarked($urlParams, $form) {
|
||||
if($_REQUEST['DestFolderID'] && is_numeric($_REQUEST['DestFolderID'])) {
|
||||
$destFolderID = $_REQUEST['DestFolderID'];
|
||||
if($_REQUEST['DestFolderID'] && (is_numeric($_REQUEST['DestFolderID']) || ($_REQUEST['DestFolderID']) == 'root')) {
|
||||
$destFolderID = ($_REQUEST['DestFolderID'] == 'root') ? 0 : $_REQUEST['DestFolderID'];
|
||||
$fileList = "'" . ereg_replace(' *, *',"','",trim(addslashes($_REQUEST['FileIDs']))) . "'";
|
||||
$numFiles = 0;
|
||||
|
||||
|
@ -238,30 +238,27 @@ DropFileItem.prototype = {
|
||||
// eg: <li id="treenode-6"> would give a recordID of 6
|
||||
if(this.id && this.id.match(/-([^-]+)$/))
|
||||
this.recordID = RegExp.$1;
|
||||
// Do not allow files to be dropped to the root
|
||||
if (this.recordID != 'root') {
|
||||
this.droppable = Droppables.add(this.id, {accept:'dragfile', hoverclass:'filefolderhover',
|
||||
onDrop:function(droppedElement) {
|
||||
// Get this.recordID from the last "-" separated chunk of the id HTML attribute
|
||||
// eg: <li id="treenode-6"> would give a recordID of 6
|
||||
if(this.element.id && this.element.id.match(/-([^-]+)$/))
|
||||
this.recordID = RegExp.$1;
|
||||
$('Form_EditForm').elements['DestFolderID'].value = this.recordID;
|
||||
this.droppable = Droppables.add(this.id, {accept:'dragfile', hoverclass:'filefolderhover',
|
||||
onDrop:function(droppedElement) {
|
||||
// Get this.recordID from the last "-" separated chunk of the id HTML attribute
|
||||
// eg: <li id="treenode-6"> would give a recordID of 6
|
||||
if(this.element.id && this.element.id.match(/-([^-]+)$/))
|
||||
this.recordID = RegExp.$1;
|
||||
$('Form_EditForm').elements['DestFolderID'].value = this.recordID;
|
||||
|
||||
// Add the dropped file to the list of files to move
|
||||
var list = droppedElement.getElementsByTagName('img')[0].id.replace('drag-img-Files-','');
|
||||
var i, checkboxes = $('Form_EditForm').elements['Files[]'];
|
||||
if(!checkboxes) checkboxes = [];
|
||||
if(!checkboxes.length) checkboxes = [ checkboxes ];
|
||||
// Add each checked file to the list of ones to move
|
||||
for(i=0;i<checkboxes.length;i++) {
|
||||
if(checkboxes[i].checked) list += (list?',':'') + checkboxes[i].value;
|
||||
}
|
||||
$('Form_EditForm_FileIDs').value = list;
|
||||
$('Form_EditForm').save(false, null, 'movemarked')
|
||||
// Add the dropped file to the list of files to move
|
||||
var list = droppedElement.getElementsByTagName('img')[0].id.replace('drag-img-Files-','');
|
||||
var i, checkboxes = $('Form_EditForm').elements['Files[]'];
|
||||
if(!checkboxes) checkboxes = [];
|
||||
if(!checkboxes.length) checkboxes = [ checkboxes ];
|
||||
// Add each checked file to the list of ones to move
|
||||
for(i=0;i<checkboxes.length;i++) {
|
||||
if(checkboxes[i].checked) list += (list?',':'') + checkboxes[i].value;
|
||||
}
|
||||
});
|
||||
}
|
||||
$('Form_EditForm_FileIDs').value = list;
|
||||
$('Form_EditForm').save(false, null, 'movemarked')
|
||||
}
|
||||
});
|
||||
},
|
||||
destroy: function() {
|
||||
this.droppable = null;
|
||||
|
Loading…
x
Reference in New Issue
Block a user