From f72e6d9a56312a30b4f1bcb02347a446b289a5a2 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Sun, 16 Sep 2007 02:27:39 +0000 Subject: [PATCH] elofgren: In order to fix: http://support.silverstripe.com/gsoc/ticket/58 "Add" button is broken after reloadRecipientsList() is called do the following: After recipients are imported, show a link to "reload the Mailing List" which calls reloadRecipientsList() instead of doing it automatically. Simply call getPageFromServer() and focus the Recipients tab, instead of only reloading the Recipients tab. (merged from branches/gsoc) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@42052 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- code/NewsletterAdmin.php | 15 --------------- javascript/NewsletterAdmin_right.js | 19 ++----------------- templates/Newsletter_RecipientImportField.ss | 2 +- 3 files changed, 3 insertions(+), 33 deletions(-) diff --git a/code/NewsletterAdmin.php b/code/NewsletterAdmin.php index 46449e18..20924a73 100755 --- a/code/NewsletterAdmin.php +++ b/code/NewsletterAdmin.php @@ -352,21 +352,6 @@ class NewsletterAdmin extends LeftAndMain { } } - - /** - * Reloads the list of recipients via ajax - */ - function getrecipientslist() { - if(Director::is_ajax()) { - $newsletterType = DataObject::get_by_id('NewsletterType', $this->urlParams['ID'] ); - $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(); - } - } - /** * Reloads the "Sent Status Report" tab via ajax */ diff --git a/javascript/NewsletterAdmin_right.js b/javascript/NewsletterAdmin_right.js index 1cd92af6..e63af8d7 100755 --- a/javascript/NewsletterAdmin_right.js +++ b/javascript/NewsletterAdmin_right.js @@ -108,7 +108,7 @@ Behaviour.register({ if( otherid ) { requestURL = 'admin/newsletter/shownewsletter/' + otherid; } - new Ajax.Request(requestURL, { + new Ajax.Request(baseHref() + requestURL, { asynchronous : true, method : 'post', postBody : /*'ID=' + id + 'type=' + type + */'ajax=1'+ (otherid?('&otherid='+otherid):''), @@ -535,22 +535,7 @@ function autoSave(confirmation, callAfter) { } function reloadRecipientsList() { - - var id = $('Form_EditForm_ID').value; - 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 ) { - $('Root_Recipients').innerHTML = response.responseText; - Behaviour.apply( $('MemberList') ); - }, - onFailure: function(response) { - statusMessage('Could not automatically refresh recipients list', 'bad'); - } - }); + $('Form_EditForm').getPageFromServer($('Form_EditForm_ID').value, 'recipients', 0, 'Root_Recipients'); } /*RecipientImportField = Class.create(); diff --git a/templates/Newsletter_RecipientImportField.ss b/templates/Newsletter_RecipientImportField.ss index c7a3c535..2fd01579 100755 --- a/templates/Newsletter_RecipientImportField.ss +++ b/templates/Newsletter_RecipientImportField.ss @@ -21,7 +21,6 @@ <% if ImportMessage %> <% end_if %> @@ -29,6 +28,7 @@ <% if ImportMessage %>

$ImportMessage +

Note: To see the new members on the Recipients tab, you need to reload the Mailing List.