summaryrefslogtreecommitdiff
path: root/program/steps/addressbook/delete.inc
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2010-11-03 14:19:48 +0000
committeralecpl <alec@alec.pl>2010-11-03 14:19:48 +0000
commitc50d8872ced7c09dd9fcf5b3bf460c31e5b0c0ce (patch)
tree33d773910562f4a078e0276e67b85a12a835a7f5 /program/steps/addressbook/delete.inc
parent8f558fc624e4cef86487b9ecc8e4cdfd09cd44dc (diff)
- Add missing confirmation/error messages on contact/group/message actions (#1486845)
- Add 'loading' message on message move/copy/delete/mark actions
Diffstat (limited to 'program/steps/addressbook/delete.inc')
-rw-r--r--program/steps/addressbook/delete.inc39
1 files changed, 21 insertions, 18 deletions
diff --git a/program/steps/addressbook/delete.inc b/program/steps/addressbook/delete.inc
index bb0457be7..a41065f7b 100644
--- a/program/steps/addressbook/delete.inc
+++ b/program/steps/addressbook/delete.inc
@@ -23,30 +23,33 @@ if ($OUTPUT->ajax_call &&
($cid = get_input_value('_cid', RCUBE_INPUT_POST)) &&
preg_match('/^[a-zA-Z0-9\+\/=_-]+(,[a-zA-Z0-9\+\/=_-]+)*$/', $cid)
) {
- $plugin = $RCMAIL->plugins->exec_hook('contact_delete', array(
- 'id' => $cid, 'source' => get_input_value('_source', RCUBE_INPUT_GPC)));
+ $plugin = $RCMAIL->plugins->exec_hook('contact_delete', array(
+ 'id' => $cid, 'source' => get_input_value('_source', RCUBE_INPUT_GPC)));
- $deleted = !$plugin['abort'] ? $CONTACTS->delete($cid) : $plugin['result'];
+ $deleted = !$plugin['abort'] ? $CONTACTS->delete($cid) : $plugin['result'];
- if (!$deleted) {
- // send error message
- exit;
- }
+ if (!$deleted) {
+ $OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'contactdelerror', 'error');
+ $OUTPUT->command('list_contacts');
+ }
+ else {
+ $OUTPUT->show_message('contactdeleted', 'confirmation');
- // count contacts for this user
- $result = $CONTACTS->count();
+ // count contacts for this user
+ $result = $CONTACTS->count();
- // update message count display
- $OUTPUT->set_env('pagecount', ceil($result->count / $CONTACTS->page_size));
- $OUTPUT->command('set_rowcount', rcmail_get_rowcount_text($result->count));
+ // update message count display
+ $OUTPUT->set_env('pagecount', ceil($result->count / $CONTACTS->page_size));
+ $OUTPUT->command('set_rowcount', rcmail_get_rowcount_text($result->count));
- // add new rows from next page (if any)
- $pages = ceil(($result->count + $deleted) / $CONTACTS->page_size);
- if ($_GET['_from'] != 'show' && $pages > 1 && $CONTACTS->list_page < $pages)
- rcmail_js_contacts_list($CONTACTS->list_records(null, -$deleted));
+ // add new rows from next page (if any)
+ $pages = ceil(($result->count + $deleted) / $CONTACTS->page_size);
+ if ($_GET['_from'] != 'show' && $pages > 1 && $CONTACTS->list_page < $pages)
+ rcmail_js_contacts_list($CONTACTS->list_records(null, -$deleted));
+ }
- // send response
- $OUTPUT->send();
+ // send response
+ $OUTPUT->send();
}
exit;