From 8e2a5bf7c626afcce62bc490ca6da3831c30daae Mon Sep 17 00:00:00 2001 From: Tom Rix Date: Fri, 30 Oct 2009 00:55:37 +0000 Subject: [PATCH] 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 --- code/CMSBatchAction.php | 40 +++++++++++----------------------------- lang/en_US.php | 11 ++++++----- 2 files changed, 17 insertions(+), 34 deletions(-) diff --git a/code/CMSBatchAction.php b/code/CMSBatchAction.php index 9c0540fe..27945e1f 100644 --- a/code/CMSBatchAction.php +++ b/code/CMSBatchAction.php @@ -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"); diff --git a/lang/en_US.php b/lang/en_US.php index 699bb699..952e092d 100755 --- a/lang/en_US.php +++ b/lang/en_US.php @@ -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(