elofgren: BUGFIX: Fix status message displayed after deleting items from the left 'Newsletters' tree. Instead of 'Deleted items', actually give a value to and display it as a number.

(merged from branches/gsoc)


git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@41851 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2007-09-15 00:51:37 +00:00
parent 768862a9e4
commit 05a8a40e01

View File

@ -60,6 +60,7 @@ class NewsletterAdmin extends LeftAndMain {
public function remove() { public function remove() {
$ids = explode( ',', $_REQUEST['csvIDs'] ); $ids = explode( ',', $_REQUEST['csvIDs'] );
$count = 0;
foreach( $ids as $id ) { foreach( $ids as $id ) {
if( preg_match( '/^mailtype_(\d+)$/', $id, $matches ) ) if( preg_match( '/^mailtype_(\d+)$/', $id, $matches ) )
$record = DataObject::get_by_id( 'NewsletterType', $matches[1] ); $record = DataObject::get_by_id( 'NewsletterType', $matches[1] );
@ -71,9 +72,10 @@ class NewsletterAdmin extends LeftAndMain {
} }
FormResponse::add("removeTreeNodeByIdx(\$('sitetree'), '$id' );"); FormResponse::add("removeTreeNodeByIdx(\$('sitetree'), '$id' );");
$count++;
} }
FormResponse::status_message('Deleted $count items','good'); FormResponse::status_message('Deleted '.$count.' items','good');
return FormResponse::respond(); return FormResponse::respond();
} }