mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
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
This commit is contained in:
parent
e176c2c265
commit
f72e6d9a56
@ -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
|
* Reloads the "Sent Status Report" tab via ajax
|
||||||
*/
|
*/
|
||||||
|
@ -108,7 +108,7 @@ Behaviour.register({
|
|||||||
if( otherid ) {
|
if( otherid ) {
|
||||||
requestURL = 'admin/newsletter/shownewsletter/' + otherid;
|
requestURL = 'admin/newsletter/shownewsletter/' + otherid;
|
||||||
}
|
}
|
||||||
new Ajax.Request(requestURL, {
|
new Ajax.Request(baseHref() + requestURL, {
|
||||||
asynchronous : true,
|
asynchronous : true,
|
||||||
method : 'post',
|
method : 'post',
|
||||||
postBody : /*'ID=' + id + 'type=' + type + */'ajax=1'+ (otherid?('&otherid='+otherid):''),
|
postBody : /*'ID=' + id + 'type=' + type + */'ajax=1'+ (otherid?('&otherid='+otherid):''),
|
||||||
@ -535,22 +535,7 @@ function autoSave(confirmation, callAfter) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function reloadRecipientsList() {
|
function reloadRecipientsList() {
|
||||||
|
$('Form_EditForm').getPageFromServer($('Form_EditForm_ID').value, 'recipients', 0, 'Root_Recipients');
|
||||||
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');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*RecipientImportField = Class.create();
|
/*RecipientImportField = Class.create();
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
<% if ImportMessage %>
|
<% if ImportMessage %>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
top.statusMessage('Imported new members','good');
|
top.statusMessage('Imported new members','good');
|
||||||
top.reloadRecipientsList();
|
|
||||||
</script>
|
</script>
|
||||||
<% end_if %>
|
<% end_if %>
|
||||||
</head>
|
</head>
|
||||||
@ -29,6 +28,7 @@
|
|||||||
<% if ImportMessage %>
|
<% if ImportMessage %>
|
||||||
<p>
|
<p>
|
||||||
$ImportMessage
|
$ImportMessage
|
||||||
|
<p><b>Note:</b> To see the new members on the Recipients tab, you need to <a href="#" onclick="javascript:top.reloadRecipientsList()">reload the Mailing List</a>.</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li><label>New members imported:</label>$NewMembers</li>
|
<li><label>New members imported:</label>$NewMembers</li>
|
||||||
<li><label>Members updated:</label>$ChangedMembers</li>
|
<li><label>Members updated:</label>$ChangedMembers</li>
|
||||||
|
Loading…
Reference in New Issue
Block a user