summaryrefslogtreecommitdiff
path: root/program/steps
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
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')
-rw-r--r--program/steps/addressbook/delete.inc39
-rw-r--r--program/steps/addressbook/groups.inc32
-rw-r--r--program/steps/mail/copy.inc5
-rw-r--r--program/steps/mail/func.inc3
-rw-r--r--program/steps/mail/mark.inc3
-rw-r--r--program/steps/mail/move_del.inc10
-rw-r--r--program/steps/mail/show.inc3
7 files changed, 58 insertions, 37 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;
diff --git a/program/steps/addressbook/groups.inc b/program/steps/addressbook/groups.inc
index 66619fa7d..f8bd0d7f2 100644
--- a/program/steps/addressbook/groups.inc
+++ b/program/steps/addressbook/groups.inc
@@ -29,10 +29,10 @@ $source = get_input_value('_source', RCUBE_INPUT_GPC);
if ($RCMAIL->action == 'group-addmembers') {
if (($gid = get_input_value('_gid', RCUBE_INPUT_POST)) && ($ids = get_input_value('_cid', RCUBE_INPUT_POST))) {
$plugin = $RCMAIL->plugins->exec_hook('group_addmembers', array('group_id' => $gid, 'ids' => $ids, 'source' => $source));
-
+
$CONTACTS->set_group($gid);
$num2add = count(explode(',', $plugin['ids']));
-
+
if (!$plugin['abort']) {
if (($maxnum = $RCMAIL->config->get('max_group_members', 0)) && ($CONTACTS->count()->count + $num2add > $maxnum)) {
$OUTPUT->show_message('maxgroupmembersreached', 'warning', array('max' => $maxnum));
@@ -44,26 +44,26 @@ if ($RCMAIL->action == 'group-addmembers') {
$result = $plugin['result'];
}
- if ($result)
+ if ($result)
$OUTPUT->show_message('contactaddedtogroup');
- else if ($plugin['message'])
- $OUTPUT->show_message($plugin['message'], 'warning');
+ else
+ $OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'errorsaving', 'error');
}
}
else if ($RCMAIL->action == 'group-delmembers') {
if (($gid = get_input_value('_gid', RCUBE_INPUT_POST)) && ($ids = get_input_value('_cid', RCUBE_INPUT_POST))) {
$plugin = $RCMAIL->plugins->exec_hook('group_delmembers', array('group_id' => $gid, 'ids' => $ids, 'source' => $source));
-
+
if (!$plugin['abort'])
$result = $CONTACTS->remove_from_group($gid, $plugin['ids']);
else
$result = $plugin['result'];
- if ($result)
+ if ($result)
$OUTPUT->show_message('contactremovedfromgroup');
- else if ($plugin['message'])
- $OUTPUT->show_message($plugin['message'], 'warning');
+ else
+ $OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'errorsaving', 'error');
}
}
@@ -76,10 +76,10 @@ else if ($RCMAIL->action == 'group-create') {
else
$created = $plugin['result'];
}
-
+
if ($created && $OUTPUT->ajax_call) {
- $created['source'] = $source;
- $OUTPUT->command('insert_contact_group', $created);
+ $OUTPUT->show_message('groupcreated', 'confirmation');
+ $OUTPUT->command('insert_contact_group', array('source' => $created));
}
else if (!$created) {
$OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'errorsaving', 'error');
@@ -96,8 +96,10 @@ else if ($RCMAIL->action == 'group-rename') {
$newname = $plugin['result'];
}
- if ($newname && $OUTPUT->ajax_call)
+ if ($newname && $OUTPUT->ajax_call) {
+ $OUTPUT->show_message('grouprenamed', 'confirmation');
$OUTPUT->command('update_contact_group', array('source' => $source, 'id' => $gid, 'name' => $newname));
+ }
else if (!$newname)
$OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'errorsaving', 'error');
}
@@ -112,8 +114,10 @@ else if ($RCMAIL->action == 'group-delete') {
$deleted = $plugin['result'];
}
- if ($deleted)
+ if ($deleted) {
+ $OUTPUT->show_message('groupdeleted', 'confirmation');
$OUTPUT->command('remove_group_item', array('source' => $source, 'id' => $gid));
+ }
else
$OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'errorsaving', 'error');
}
diff --git a/program/steps/mail/copy.inc b/program/steps/mail/copy.inc
index b42ef392f..ba5fa723c 100644
--- a/program/steps/mail/copy.inc
+++ b/program/steps/mail/copy.inc
@@ -34,13 +34,16 @@ if (!empty($_POST['_uid']) && !empty($_POST['_target_mbox'])) {
$mbox = get_input_value('_mbox', RCUBE_INPUT_POST);
$copied = $IMAP->copy_message($uids, $target, $mbox);
-
+
if (!$copied) {
// send error message
$OUTPUT->show_message('errorcopying', 'error');
$OUTPUT->send();
exit;
}
+ else {
+ $OUTPUT->show_message('messagecopied', 'confirmation');
+ }
rcmail_send_unread_count($target, true);
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index 629e68bfd..11df12845 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -131,7 +131,8 @@ if (empty($RCMAIL->action) || $RCMAIL->action == 'list') {
if (!$OUTPUT->ajax_call)
$OUTPUT->add_label('checkingmail', 'deletemessage', 'movemessagetotrash',
- 'movingmessage', 'copyingmessage', 'copy', 'move', 'quota');
+ 'movingmessage', 'copyingmessage', 'deletingmessage', 'markingmessage',
+ 'copy', 'move', 'quota');
$OUTPUT->set_pagetitle(rcmail_localize_foldername($mbox_name));
}
diff --git a/program/steps/mail/mark.inc b/program/steps/mail/mark.inc
index 57eae64e2..467548161 100644
--- a/program/steps/mail/mark.inc
+++ b/program/steps/mail/mark.inc
@@ -51,6 +51,9 @@ if (($uids = get_input_value('_uid', RCUBE_INPUT_POST)) && ($flag = get_input_va
$OUTPUT->send();
exit;
}
+ else {
+ $OUTPUT->show_message('messagemarked', 'confirmation');
+ }
if ($flag == 'DELETED' && $CONFIG['read_when_deleted'] && !empty($_POST['_ruid'])) {
$ruids = get_input_value('_ruid', RCUBE_INPUT_POST);
diff --git a/program/steps/mail/move_del.inc b/program/steps/mail/move_del.inc
index 5078fb02c..4f52a60ca 100644
--- a/program/steps/mail/move_del.inc
+++ b/program/steps/mail/move_del.inc
@@ -43,6 +43,9 @@ if ($RCMAIL->action=='moveto' && !empty($_POST['_uid']) && !empty($_POST['_targe
$OUTPUT->send();
exit;
}
+ else {
+ $OUTPUT->show_message('messagemoved', 'confirmation');
+ }
$addrows = true;
}
@@ -52,7 +55,7 @@ else if ($RCMAIL->action=='delete' && !empty($_POST['_uid'])) {
$mbox = get_input_value('_mbox', RCUBE_INPUT_POST);
$del = $IMAP->delete_message($uids, $mbox);
-
+
if (!$del) {
// send error message
if ($_POST['_from'] != 'show')
@@ -61,7 +64,10 @@ else if ($RCMAIL->action=='delete' && !empty($_POST['_uid'])) {
$OUTPUT->send();
exit;
}
-
+ else {
+ $OUTPUT->show_message('messagedeleted', 'confirmation');
+ }
+
$addrows = true;
}
// unknown action or missing query param
diff --git a/program/steps/mail/show.inc b/program/steps/mail/show.inc
index a5df3475d..13b7ed650 100644
--- a/program/steps/mail/show.inc
+++ b/program/steps/mail/show.inc
@@ -66,7 +66,8 @@ if ($uid = get_input_value('_uid', RCUBE_INPUT_GET)) {
$OUTPUT->set_env('list_post', true);
if (!$OUTPUT->ajax_call)
- $OUTPUT->add_label('checkingmail', 'deletemessage', 'movemessagetotrash', 'movingmessage');
+ $OUTPUT->add_label('checkingmail', 'deletemessage', 'movemessagetotrash',
+ 'movingmessage', 'deletingmessage');
// check for unset disposition notification
if ($MESSAGE->headers->mdn_to &&