elofgren: Make class BouncedList? extend TableListField? so that checkboxes and red 'X' icon links will show. @TODO Make it possible to disable sending to bounced emails by unchecking a box and delete the email from the mailing list by clicking the red X @TODO Try to find way to show Firstname and Surname under a 'Username' heading

(merged from branches/gsoc)


git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@42012 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2007-09-16 01:36:04 +00:00
parent 6714eea295
commit 3a0d2596c9
2 changed files with 19 additions and 3 deletions

View File

@ -1,10 +1,14 @@
<?php
class BouncedList extends FormField {
// @TODO Make it possible to disable sending to bounced emails by unchecking a box and delete the email from the mailing list by clicking the red "X"
class BouncedList extends TableListField {
protected $nlType;
function __construct( $name, $newsletterType ) {
parent::__construct( $name, '', null );
parent::__construct($name, "Email_BounceRecord", array("BounceEmail" => "Email address", "Created" => "Last bounce at", "BounceMessage" => "Reason:"), "", "Created");
$this->Markable = true;
$this->IsReadOnly = false;
$this->setPermissions(array('edit', 'delete', 'add'));
if( is_object( $newsletterType ) )
$this->nlType = $newsletterType;
@ -12,10 +16,20 @@ class BouncedList extends FormField {
$this->nlType = DataObject::get_by_id( 'NewsletterType', $newsletterType );
}
function sourceItems() {
$id = $this->nlType->GroupID;
// @TODO Try to find way to show Firstname and Surname under a 'Username' heading
return DataObject::get( 'Email_BounceRecord', "`GroupID`='$id'", null, "INNER JOIN `Group_Members` USING(`MemberID`)" );
}
function setController($controller) {
$this->controller = $controller;
}
// Not needed now that we are extending TableListField instead of FormField
// @TODO Remove NewsletterAdmin_BouncedList.ss after copying out any needed bits
/*
function FieldHolder() {
return $this->renderWith( 'NewsletterAdmin_BouncedList' );
}
@ -42,5 +56,6 @@ class BouncedList extends FormField {
return new DataObjectSet( $bouncedUsers );
}
*/
}
?>

View File

@ -291,6 +291,7 @@ class NewsletterAdmin extends LeftAndMain {
$unsubscribedList = new UnsubscribedList("Unsubscribed", $mailType)
),
new Tab("Bounced",
new LiteralField('Instructions', '<p><b>Instructions:</b></p><ul><li>Uncheck the box and click the "Save" button to disable sending to an email address.</li><li>To delete an email address from your mailing list, click the red "X" icon.</li></ul>'),
$bouncedList = new BouncedList("Bounced", $mailType )
)
)