diff --git a/javascript/AssetAdmin.DragDrop.js b/javascript/AssetAdmin.DragDrop.js new file mode 100644 index 00000000..4482996a --- /dev/null +++ b/javascript/AssetAdmin.DragDrop.js @@ -0,0 +1,217 @@ +MarkingPropertiesButton = Class.create(); +MarkingPropertiesButton.applyTo('#Form_EditForm_deletemarked', "Please select some files to delete!", 'deletemarked', 'Do you really want to delete the marked files?'); + +MarkingPropertiesButton.prototype = { + initialize: function(noneCheckedError, action, confirmMessage) { + this.noneCheckedError = noneCheckedError; + this.action = action; + this.confirmMessage = confirmMessage; + }, + + onclick: function() { + var i, list = "", checkboxes = $('Form_EditForm').elements['Files[]']; + if(!checkboxes) checkboxes = []; + if(!checkboxes.length) checkboxes = [ checkboxes ]; + for(i=0;i would give a recordID of 6 + if(this.id && this.id.match(/-([^-]+)$/)) + this.recordID = RegExp.$1; + 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:
  • 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