mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
API CHANGE: Added capability for batch actions to indicate failure through red checkboxes (from r94868)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.4@96824 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
27907e4ced
commit
79968d0814
@ -44,10 +44,12 @@ abstract class CMSBatchAction extends Object {
|
|||||||
foreach($pages as $page) {
|
foreach($pages as $page) {
|
||||||
|
|
||||||
// Perform the action
|
// Perform the action
|
||||||
if (!call_user_func_array(array($page, $helperMethod), $arguments)) {
|
if (call_user_func_array(array($page, $helperMethod), $arguments) === false) {
|
||||||
$failures++;
|
$failures++;
|
||||||
|
FormResponse::add("\$('sitetree').addNodeClassByIdx('$page->ID', 'failed');");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Now make sure the tree title is appropriately updated
|
// Now make sure the tree title is appropriately updated
|
||||||
$publishedRecord = DataObject::get_by_id('SiteTree', $page->ID);
|
$publishedRecord = DataObject::get_by_id('SiteTree', $page->ID);
|
||||||
if ($publishedRecord) {
|
if ($publishedRecord) {
|
||||||
|
@ -119,6 +119,9 @@ ul.tree.multiselect span.a.nodelete span.b a {
|
|||||||
ul.tree.multiselect span.a.treeloading span.b a {
|
ul.tree.multiselect span.a.treeloading span.b a {
|
||||||
background-image: url(../images/tickbox-greyedout.gif) !important;
|
background-image: url(../images/tickbox-greyedout.gif) !important;
|
||||||
}
|
}
|
||||||
|
ul.tree.multiselect span.a.failed span.b a {
|
||||||
|
background-image: url(../images/tickbox-fail.gif) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
ul.tree.multiselect span.a.selected span.b span.c a {
|
ul.tree.multiselect span.a.selected span.b span.c a {
|
||||||
|
BIN
images/tickbox-fail.gif
Normal file
BIN
images/tickbox-fail.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 64 B |
@ -273,6 +273,9 @@ batchactionsclass.prototype = {
|
|||||||
jQuery('#BatchActionParameters').hide();
|
jQuery('#BatchActionParameters').hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Don't show actions that have failed from the previous execution
|
||||||
|
batchActionGlobals.removeFailures();
|
||||||
|
|
||||||
batchActionGlobals.refreshSelected();
|
batchActionGlobals.refreshSelected();
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -407,7 +410,7 @@ batchActionGlobals = {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Post to the server to ask which pages can have this batch action applied
|
// Post to the server to ask which pages can have this batch action applied
|
||||||
var applicablePagesURL = $('choose_batch_action').value + '/applicablepages?csvIDs=' + ids.join(',') + ',horse';
|
var applicablePagesURL = $('choose_batch_action').value + '/applicablepages?csvIDs=' + ids.join(',');
|
||||||
jQuery.getJSON(applicablePagesURL, function(applicableIDs) {
|
jQuery.getJSON(applicablePagesURL, function(applicableIDs) {
|
||||||
var i;
|
var i;
|
||||||
var applicableIDMap = {};
|
var applicableIDMap = {};
|
||||||
@ -433,6 +436,27 @@ batchActionGlobals = {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deselect all nodes in the tree
|
||||||
|
*/
|
||||||
|
deselectAll : function() {
|
||||||
|
batchActionGlobals.selectedNodes = {}
|
||||||
|
jQuery('#sitetree').find('li').each(function() {
|
||||||
|
this.removeNodeClass('selected');
|
||||||
|
this.selected = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the indications of failed batch actions
|
||||||
|
*/
|
||||||
|
removeFailures : function() {
|
||||||
|
jQuery('#sitetree').find('li.failed').each(function() {
|
||||||
|
this.removeNodeClass('failed');
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
unfilterSiteTree : function() {
|
unfilterSiteTree : function() {
|
||||||
// Reload the site tree if it has been filtered
|
// Reload the site tree if it has been filtered
|
||||||
if ($('SiteTreeIsFiltered').value == 1) {
|
if ($('SiteTreeIsFiltered').value == 1) {
|
||||||
@ -495,12 +519,15 @@ publishpage.prototype = {
|
|||||||
statusMessage(ingText);
|
statusMessage(ingText);
|
||||||
$('batchactions_go').className = 'loading';
|
$('batchactions_go').className = 'loading';
|
||||||
|
|
||||||
|
// Don't show actions that have failed from the previous execution
|
||||||
|
batchActionGlobals.removeFailures();
|
||||||
|
|
||||||
// Submit form
|
// Submit form
|
||||||
Ajax.SubmitForm(this, null, {
|
Ajax.SubmitForm(this, null, {
|
||||||
onSuccess : function(response) {
|
onSuccess : function(response) {
|
||||||
Ajax.Evaluator(response);
|
Ajax.Evaluator(response);
|
||||||
$('batchactions_go').className = '';
|
$('batchactions_go').className = '';
|
||||||
treeactions.closeSelection($('batchactions'));
|
batchActionGlobals.deselectAll();
|
||||||
},
|
},
|
||||||
onFailure : function(response) {
|
onFailure : function(response) {
|
||||||
errorMessage('Error ' + ingText, response);
|
errorMessage('Error ' + ingText, response);
|
||||||
|
@ -133,6 +133,12 @@ TreeAPI.prototype = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
addNodeClassByIdx : function(idx, className) {
|
||||||
|
this.performOnTreeNode(idx, function(treeNode) {
|
||||||
|
treeNode.addNodeClass(className);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
setNodeIcon: function(idx, oldClassName, newClassName) {
|
setNodeIcon: function(idx, oldClassName, newClassName) {
|
||||||
this.performOnTreeNode(idx, function(treeNode) {
|
this.performOnTreeNode(idx, function(treeNode) {
|
||||||
treeNode.className = treeNode.className.replace(oldClassName,newClassName);
|
treeNode.className = treeNode.className.replace(oldClassName,newClassName);
|
||||||
|
Loading…
Reference in New Issue
Block a user