MINOR update batchactions to state how many failed to process

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@90489 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Tom Rix 2009-10-30 00:55:37 +00:00
parent 2b9bb9c48a
commit 8e2a5bf7c6
2 changed files with 17 additions and 34 deletions

View File

@ -54,7 +54,8 @@ abstract class CMSBatchAction extends Object {
unset($page);
}
$message = sprintf($successMessage, $pages->Count());
$message = sprintf($successMessage, $pages->Count()-$failures, $failures);
FormResponse::add('statusMessage("'.$message.'","good");');
return FormResponse::respond();
@ -82,28 +83,7 @@ class CMSBatchAction_Publish extends CMSBatchAction {
function run(DataObjectSet $pages) {
return $this->batchaction($pages, 'doPublish',
_t('CMSBatchActions.PUBLISHED_PAGES', 'Published %d pages')
);
}
}
/**
* Un-publish items batch action.
*
* @package cms
* @subpackage batchaction
*/
class CMSBatchAction_Unpublish extends CMSBatchAction {
function getActionTitle() {
return _t('CMSBatchActions.UNPUBLISH_PAGES', 'Un-publish');
}
function getDoingText() {
return _t('CMSBatchActions.UNPUBLISHING_PAGES', 'Un-publishing pages');
}
function run(DataObjectSet $pages) {
return $this->batchaction($pages, 'doUnpublish',
_t('CMSBatchActions.UNPUBLISHED_PAGES', 'Un-published %d pages')
_t('CMSBatchActions.PUBLISHED_PAGES', 'Published %d pages, %d failures')
);
}
}
@ -146,7 +126,7 @@ class CMSBatchAction_Delete extends CMSBatchAction {
unset($page);
}
$message = sprintf(_t('CMSBatchActions.DELETED_PAGES', 'Deleted %d pages from the draft site'), $pages->Count());
$message = sprintf(_t('CMSBatchActions.DELETED_PAGES', 'Deleted %d pages from the draft site, %d failures'), $pages->Count()-$failures, $failures);
FormResponse::add('statusMessage("'.$message.'","good");');
return FormResponse::respond();
@ -168,11 +148,13 @@ class CMSBatchAction_DeleteFromLive extends CMSBatchAction {
}
function run(DataObjectSet $pages) {
foreach($pages as $page) {
$id = $page->ID;
// Perform the action
if($page->canDelete()) $page->doDeleteFromLive();
$ids = $pages->column('ID');
$this->batchaction($pages, 'doUnpublish',
_t('CMSBatchActions.DELETED_PAGES', 'Deleted %d pages from the published site, %d failures')
);
foreach($ids as $pageID) {
$id = $pageID;
// check to see if the record exists on the live site, if it doesn't remove the tree node
$stageRecord = Versioned::get_one_by_stage( 'SiteTree', 'Stage', "\"SiteTree\".\"ID\"=$id");

View File

@ -60,12 +60,9 @@ $lang['en_US']['AssetTableField.ss']['SHOW'] = 'Show asset';
$lang['en_US']['CMSBatchActions']['DELETED_PAGES'] = 'Deleted %d pages from the published site';
$lang['en_US']['CMSBatchActions']['DELETE_PAGES'] = 'Delete from published site';
$lang['en_US']['CMSBatchActions']['DELETING_PAGES'] = 'Deleting selected pages from the published site';
$lang['en_US']['CMSBatchActions']['PUBLISHED_PAGES'] = 'Published %d pages';
$lang['en_US']['CMSBatchActions']['PUBLISHED_PAGES'] = 'Published %d pages, %d failures';
$lang['en_US']['CMSBatchActions']['PUBLISHING_PAGES'] = 'Publishing pages';
$lang['en_US']['CMSBatchActions']['PUBLISH_PAGES'] = 'Publish';
$lang['en_US']['CMSBatchActions']['UNPUBLISHED_PAGES'] = 'Un-published %d pages';
$lang['en_US']['CMSBatchActions']['UNPUBLISHING_PAGES'] = 'Un-publishing pages';
$lang['en_US']['CMSBatchActions']['UNPUBLISH_PAGES'] = 'Un-publish';
$lang['en_US']['CMSMain']['ACCESS'] = array(
'Access to %s',
PR_MEDIUM,
@ -433,6 +430,7 @@ $lang['en_US']['ReportAdmin_right.ss']['WELCOME2'] = array(
50
);
$lang['en_US']['SecurityAdmin']['ADDMEMBER'] = 'Add Member';
$lang['en_US']['SecurityAdmin']['APPLY_ROLES'] = 'Apply roles to groups';
$lang['en_US']['SecurityAdmin']['EDITPERMISSIONS'] = 'Manage permissions for groups';
$lang['en_US']['SecurityAdmin']['MENUTITLE'] = array(
'Security',
@ -462,7 +460,10 @@ $lang['en_US']['SecurityAdmin_right.ss']['WELCOME2'] = array(
'security admininistration section. Please choose a group from the left.',
50
);
$lang['en_US']['SideReport']['BROKENPAGEFILELINKS'] = 'Broken Page & File Links';
$lang['en_US']['SideReport']['BROKENFILES'] = 'Pages with broken files';
$lang['en_US']['SideReport']['BROKENLINKS'] = 'Pages with broken links';
$lang['en_US']['SideReport']['BROKENREDIRECTORPAGES'] = 'RedirectorPages pointing to deleted pages';
$lang['en_US']['SideReport']['BROKENVIRTUALPAGES'] = 'VirtualPages pointing to deleted pages';
$lang['en_US']['SideReport']['EMPTYPAGES'] = 'Pages with no content';
$lang['en_US']['SideReport']['LAST2WEEKS'] = 'Pages edited in the last 2 weeks';
$lang['en_US']['SideReport']['REPEMPTY'] = array(