From bcbdd364e0ed518656a100a8d062e0782e906ddf Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Sat, 15 Sep 2007 22:02:06 +0000 Subject: [PATCH] elofgren: BUGFIX: Fix bug 'Errors when Importing Recipients to Newsletter Mailing List'. Fixes gsoc trac ticket #38. Tested and importing newsletter recipients works in FF2 and IE7. Reported here: http://www.silverstripe.com/bugs/flat/1470 This fix needs GenericEmail?.ss added in r38503 (merged from branches/gsoc) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@41970 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- code/Newsletter/RecipientImportField.php | 3 ++- code/NewsletterAdmin.php | 7 +++++-- javascript/NewsletterAdmin_right.js | 10 +++++++--- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/code/Newsletter/RecipientImportField.php b/code/Newsletter/RecipientImportField.php index fb4ee3ac..125d2e0e 100755 --- a/code/Newsletter/RecipientImportField.php +++ b/code/Newsletter/RecipientImportField.php @@ -216,6 +216,7 @@ class RecipientImportField_UploadForm extends Form { $mailType = DataObject::get_one("NewsletterType", "ID = $id"); if($mailType->GroupID) $group = DataObject::get_one("Group", "ID = $mailType->GroupID"); + // @TODO Look into seeing if $data['Set'] should be removed since it seems to be undefined return $this->importMembers( $id, $group, $data['ImportFileColumns'], $data['Set'] ); } @@ -243,7 +244,7 @@ class RecipientImportField_UploadForm extends Form { $startTime = time(); - $importData = Session::set("ImportFile.{$id}"); + $importData = Session::get("ImportFile.{$id}"); $validColumns = array_keys( RecipientImportField::$column_types ); diff --git a/code/NewsletterAdmin.php b/code/NewsletterAdmin.php index 68d895ec..1a08c37c 100755 --- a/code/NewsletterAdmin.php +++ b/code/NewsletterAdmin.php @@ -309,7 +309,7 @@ class NewsletterAdmin extends LeftAndMain { $actions = new FieldSet(new FormAction('save','Save')); - $form = new Form($this, "MailingListEditForm", $fields, $actions); + $form = new Form($this, "EditForm", $fields, $actions); $form->loadDataFrom(array( 'Title' => $mailType->Title, 'FromEmail' => $mailType->FromEmail @@ -328,7 +328,10 @@ class NewsletterAdmin extends LeftAndMain { function getrecipientslist() { if( $_REQUEST['ajax'] ) { $newsletterType = DataObject::get_by_id('NewsletterType', $this->urlParams['ID'] ); - $memberList = new MemberTableField($this, "Recipients", $newsletterType->Group() ); + $fields = new FieldSet($memberList = new MemberTableField($this, "Recipients", $newsletterType->Group() )); + $memberList->setController($this); + $actions = new FieldSet(new FormAction('save','Save')); + $form = new Form($this, "EditForm", $fields, $actions); return $memberList->FieldHolder(); } } diff --git a/javascript/NewsletterAdmin_right.js b/javascript/NewsletterAdmin_right.js index b0e19df0..25b308ab 100755 --- a/javascript/NewsletterAdmin_right.js +++ b/javascript/NewsletterAdmin_right.js @@ -456,10 +456,14 @@ function autoSave(confirmation, callAfter) { function reloadRecipientsList() { var id = $('Form_EditForm_ID').value; - - var request = new Ajax.Request( 'admin/newsletter/getrecipientslist/' + id + '?ajax=1', { + if(navigator.appName == "Microsoft Internet Explorer") { + var url = 'admin/newsletter/getrecipientslist/'; + } else { + var url = 'getrecipientslist/'; + } + var request = new Ajax.Request(url + id + '?ajax=1', { onSuccess: function( response ) { - $('MemberList').outerHTML = response.responseText; + $('Root_Recipients').innerHTML = response.responseText; Behaviour.apply( $('MemberList') ); }, onFailure: function(response) {