mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
MINOR Moved 'delete files' logic from AssetAdmin.DragDrop.js into AssetTableField.js
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@92803 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
067b7bcaeb
commit
c2e1c12bba
@ -1,42 +1,3 @@
|
|||||||
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<checkboxes.length;i++) {
|
|
||||||
if(checkboxes[i].checked) list += (list?',':'') + checkboxes[i].value;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(list == "") {
|
|
||||||
alert(this.noneCheckedError);
|
|
||||||
return false;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
$('Form_EditForm_FileIDs').value = list;
|
|
||||||
}
|
|
||||||
// If there is a confirmation message, show it before submitting
|
|
||||||
if('' != this.confirmMessage) {
|
|
||||||
// Only submit if OK button is clicked
|
|
||||||
if (confirm(this.confirmMessage)) {
|
|
||||||
$('Form_EditForm').save(false, null, this.action);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$('Form_EditForm').save(false, null, this.action);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// CheckBoxRange adapted from: http://jroller.com/page/rmcmahon?entry=checkboxrange_with_prototype
|
// CheckBoxRange adapted from: http://jroller.com/page/rmcmahon?entry=checkboxrange_with_prototype
|
||||||
var CheckBoxRange = Class.create();
|
var CheckBoxRange = Class.create();
|
||||||
|
|
||||||
|
@ -94,4 +94,45 @@ FileFilterButton.prototype = {
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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<checkboxes.length;i++) {
|
||||||
|
if(checkboxes[i].checked) list += (list?',':'') + checkboxes[i].value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(list == "") {
|
||||||
|
alert(this.noneCheckedError);
|
||||||
|
return false;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$('Form_EditForm_FileIDs').value = list;
|
||||||
|
}
|
||||||
|
// If there is a confirmation message, show it before submitting
|
||||||
|
if('' != this.confirmMessage) {
|
||||||
|
// Only submit if OK button is clicked
|
||||||
|
if (confirm(this.confirmMessage)) {
|
||||||
|
$('Form_EditForm').save(false, null, this.action);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$('Form_EditForm').save(false, null, this.action);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user