[ticket/11713] Do not remove module if it couldn't be deleted

Up to now, the module or module category was always removed with jQuery,
even if there was an error. With this change, the modules will not be deleted
by jQuery if the return JSON array will have SUCCESS set to false.

PHPBB3-11713
This commit is contained in:
Marc Alexander 2013-07-18 22:41:23 +02:00
parent 29322e85ff
commit f421c082f7
2 changed files with 5 additions and 2 deletions

View file

@ -127,8 +127,10 @@ phpbb.addAjaxCallback('activate_deactivate', function(res) {
* The removes the parent row of the link or form that triggered the callback, * The removes the parent row of the link or form that triggered the callback,
* and is good for stuff like the removal of forums. * and is good for stuff like the removal of forums.
*/ */
phpbb.addAjaxCallback('row_delete', function() { phpbb.addAjaxCallback('row_delete', function(res) {
$(this).parents('tr').remove(); if (res.SUCCESS !== false) {
$(this).parents('tr').remove();
}
}); });

View file

@ -379,6 +379,7 @@ class acp_modules
$json_response->send(array( $json_response->send(array(
'MESSAGE_TITLE' => $user->lang('ERROR'), 'MESSAGE_TITLE' => $user->lang('ERROR'),
'MESSAGE_TEXT' => implode('<br />', $errors), 'MESSAGE_TEXT' => implode('<br />', $errors),
'SUCCESS' => false,
)); ));
} }