API CHANGE: Added capability for batch actions to indicate failure through red checkboxes (from r94868) (from r96824)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@102701 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2010-04-13 06:57:12 +00:00
parent a9f8fa2d24
commit a88eb81395
3 changed files with 17 additions and 8 deletions

BIN
images/tickbox-fail.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 B

View File

@ -185,6 +185,9 @@
// write (possibly modified) IDs back into to the hidden field // write (possibly modified) IDs back into to the hidden field
this.setIDs(ids); this.setIDs(ids);
// Reset failure states
$(tree).find('li').removeClass('failed');
var button = this.find(':submit:first'); var button = this.find(':submit:first');
button.addClass('loading'); button.addClass('loading');
@ -216,10 +219,19 @@
if(node && node.parentTreeNode) node.parentTreeNode.removeTreeNode(node); if(node && node.parentTreeNode) node.parentTreeNode.removeTreeNode(node);
} }
} }
if(data.error) {
for(id in data.error) {
var node = tree.getTreeNodeByIdx(id);
$(node).addClass('failed');
}
}
// Deselect all nodes
$(tree).find('li').removeClass('selected');
// reset selection state // reset selection state
// TODO Should unselect all selected nodes as well // TODO Should unselect all selected nodes as well
jQuery(tree).removeClass('multiselect'); // jQuery(tree).removeClass('multiselect');
// Check if current page still exists, and refresh it. // Check if current page still exists, and refresh it.
// Otherwise remove the current form // Otherwise remove the current form
@ -238,7 +250,7 @@
// close panel // close panel
// TODO Coupling with tabs // TODO Coupling with tabs
jQuery('#TreeActions').tabs('select', -1); // jQuery('#TreeActions').tabs('select', -1);
}, },
dataType: 'json' dataType: 'json'
}); });
@ -256,8 +268,7 @@
// auto-select the current node // auto-select the current node
var node = this.getTree().firstSelected(); var node = this.getTree().firstSelected();
if(node){ if(node){
node.removeNodeClass('current'); $(node).removeClass('current').addClass('selected');
node.addNodeClass('selected');
node.open(); node.open();
// Open all existing children, which might trigger further // Open all existing children, which might trigger further
@ -277,12 +288,10 @@
if(!this._isActive()) return; if(!this._isActive()) return;
if(node.selected) { if(node.selected) {
node.removeNodeClass('selected'); $(node).removeClass('selected').attr('selected', false);
node.selected = false;
} else { } else {
// Select node // Select node
node.addNodeClass('selected'); $(node).addClass('selected').attr('selected', true);
node.selected = true;
// Open node in order to allow proper selection of children // Open node in order to allow proper selection of children
if($(node).hasClass('unexpanded')) { if($(node).hasClass('unexpanded')) {