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:
Ingo Schommer 2007-09-16 02:27:39 +00:00
parent e176c2c265
commit f72e6d9a56
3 changed files with 3 additions and 33 deletions

View File

@ -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
*/

View File

@ -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();

View File

@ -21,7 +21,6 @@
<% if ImportMessage %>
<script type="text/javascript">
top.statusMessage('Imported new members','good');
top.reloadRecipientsList();
</script>
<% end_if %>
</head>
@ -29,6 +28,7 @@
<% if ImportMessage %>
<p>
$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>
<li><label>New members imported:</label>$NewMembers</li>
<li><label>Members updated:</label>$ChangedMembers</li>