Permalink
Browse files

MINOR Moved 'delete files' logic from AssetAdmin.DragDrop.js into Ass…

…etTableField.js

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@92803 467b73ca-7a2a-4603-9d3b-597d59a354a9
  • Loading branch information...
chillu committed Nov 21, 2009
1 parent 067b7bc commit c2e1c12bba14a8e14bb63fa69aaaba4253497bb0
Showing with 41 additions and 39 deletions.
  1. +0 −39 javascript/AssetAdmin.DragDrop.js
  2. +41 −0 javascript/AssetTableField.js
@@ -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
var CheckBoxRange = Class.create();
@@ -94,4 +94,45 @@ FileFilterButton.prototype = {
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;
+ }
}

0 comments on commit c2e1c12

Please sign in to comment.