diff options
author | alecpl <alec@alec.pl> | 2010-11-03 14:19:48 +0000 |
---|---|---|
committer | alecpl <alec@alec.pl> | 2010-11-03 14:19:48 +0000 |
commit | c50d8872ced7c09dd9fcf5b3bf460c31e5b0c0ce (patch) | |
tree | 33d773910562f4a078e0276e67b85a12a835a7f5 | |
parent | 8f558fc624e4cef86487b9ecc8e4cdfd09cd44dc (diff) |
- Add missing confirmation/error messages on contact/group/message actions (#1486845)
- Add 'loading' message on message move/copy/delete/mark actions
-rw-r--r-- | CHANGELOG | 2 | ||||
-rw-r--r-- | program/js/app.js | 36 | ||||
-rw-r--r-- | program/localization/en_US/messages.inc | 15 | ||||
-rw-r--r-- | program/localization/pl_PL/messages.inc | 13 | ||||
-rw-r--r-- | program/steps/addressbook/delete.inc | 39 | ||||
-rw-r--r-- | program/steps/addressbook/groups.inc | 32 | ||||
-rw-r--r-- | program/steps/mail/copy.inc | 5 | ||||
-rw-r--r-- | program/steps/mail/func.inc | 3 | ||||
-rw-r--r-- | program/steps/mail/mark.inc | 3 | ||||
-rw-r--r-- | program/steps/mail/move_del.inc | 10 | ||||
-rw-r--r-- | program/steps/mail/show.inc | 3 |
11 files changed, 108 insertions, 53 deletions
@@ -60,6 +60,8 @@ CHANGELOG Roundcube Webmail - Improve performance of message cache status checking with skip_disabled=true - Support contact's email addresses up to 255 characters long (#1487095) - Add option to place replies in the folder of the message being replied to (#1485945) +- Add missing confirmation/error messages on contact/group/message actions (#1486845) +- Add 'loading' message on message move/copy/delete/mark actions RELEASE 0.4.2 ------------- diff --git a/program/js/app.js b/program/js/app.js index 870459dc4..bbc455021 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -2362,6 +2362,7 @@ function rcube_webmail() return; var a_uids = [], + lock = this.display_message(this.get_label('copyingmessage'), 'loading'), add_url = '&_target_mbox='+urlencode(mbox)+'&_from='+(this.env.action ? this.env.action : ''); if (this.env.uid) @@ -2374,7 +2375,7 @@ function rcube_webmail() } // send request to server - this.http_post('copy', '_uid='+a_uids.join(',')+'&_mbox='+urlencode(this.env.mailbox)+add_url, false); + this.http_post('copy', '_uid='+a_uids.join(',')+'&_mbox='+urlencode(this.env.mailbox)+add_url, lock); }; // move selected messages to the specified mailbox @@ -2425,7 +2426,7 @@ function rcube_webmail() return false; } // if there isn't a defined trash mailbox or we are in it - else if (!this.env.trash_mailbox || this.env.mailbox == this.env.trash_mailbox) + else if (!this.env.trash_mailbox || this.env.mailbox == this.env.trash_mailbox) this.permanently_remove_messages(); // if there is a trash mailbox defined and we're not currently in it else { @@ -2456,7 +2457,7 @@ function rcube_webmail() // @private this._with_selected_messages = function(action, lock, add_url) { - var a_uids = [], count = 0; + var a_uids = [], count = 0, msg; if (this.env.uid) a_uids[0] = this.env.uid; @@ -2486,7 +2487,7 @@ function rcube_webmail() } } - // also send search request to get the right messages + // also send search request to get the right messages if (this.env.search_request) add_url += '&_search='+this.env.search_request; @@ -2501,6 +2502,11 @@ function rcube_webmail() add_url += '&_uid='+this.uids_to_list(a_uids); + if (!lock) { + msg = action == 'moveto' ? 'movingmessage' : 'deletingmessage'; + lock = this.display_message(this.get_label(msg), 'loading'); + } + // send request to server this.http_post(action, '_mbox='+urlencode(this.env.mailbox)+add_url, lock); }; @@ -2564,13 +2570,14 @@ function rcube_webmail() for (var i=0; i<a_uids.length; i++) this.set_message(a_uids[i], 'unread', (flag=='unread' ? true : false)); - var url = '_uid='+this.uids_to_list(a_uids)+'&_flag='+flag; + var url = '_uid='+this.uids_to_list(a_uids)+'&_flag='+flag, + lock = this.display_message(this.get_label('markingmessage'), 'loading'); // also send search request to get the right messages if (this.env.search_request) url += '&_search='+this.env.search_request; - this.http_post('mark', url); + this.http_post('mark', url, lock); for (var i=0; i<a_uids.length; i++) this.update_thread_root(a_uids[i], flag); @@ -2583,13 +2590,14 @@ function rcube_webmail() for (var i=0; i<a_uids.length; i++) this.set_message(a_uids[i], 'flagged', (flag=='flagged' ? true : false)); - var url = '_uid='+this.uids_to_list(a_uids)+'&_flag='+flag; + var url = '_uid='+this.uids_to_list(a_uids)+'&_flag='+flag, + lock = this.display_message(this.get_label('markingmessage'), 'loading'); // also send search request to get the right messages if (this.env.search_request) url += '&_search='+this.env.search_request; - this.http_post('mark', url); + this.http_post('mark', url, lock); }; // mark all message rows as deleted/undeleted @@ -2628,13 +2636,14 @@ function rcube_webmail() for (var i=0, len=a_uids.length; i<len; i++) this.set_message(a_uids[i], 'deleted', false); - var url = '_uid='+this.uids_to_list(a_uids)+'&_flag=undelete'; + var url = '_uid='+this.uids_to_list(a_uids)+'&_flag=undelete', + lock = this.display_message(this.get_label('markingmessage'), 'loading'); // also send search request to get the right messages if (this.env.search_request) url += '&_search='+this.env.search_request; - this.http_post('mark', url); + this.http_post('mark', url, lock); return true; }; @@ -2671,7 +2680,8 @@ function rcube_webmail() this.delete_excessive_thread_rows(); } - add_url = '&_from='+(this.env.action ? this.env.action : ''); + add_url = '&_from='+(this.env.action ? this.env.action : ''), + lock = this.display_message(this.get_label('markingmessage'), 'loading'); // ?? if (r_uids.length) @@ -2686,8 +2696,8 @@ function rcube_webmail() if (this.env.search_request) add_url += '&_search='+this.env.search_request; - this.http_post('mark', '_uid='+this.uids_to_list(a_uids)+'&_flag=delete'+add_url); - return true; + this.http_post('mark', '_uid='+this.uids_to_list(a_uids)+'&_flag=delete'+add_url, lock); + return true; }; // flag as read without mark request (called from backend) diff --git a/program/localization/en_US/messages.inc b/program/localization/en_US/messages.inc index 6474c9dbc..a5ac4315a 100644 --- a/program/localization/en_US/messages.inc +++ b/program/localization/en_US/messages.inc @@ -87,8 +87,10 @@ $messages['copysuccess'] = 'Successfully copied $nr addresses'; $messages['copyerror'] = 'Could not copy any addresses'; $messages['sourceisreadonly'] = 'This address source is read only'; $messages['errorsavingcontact'] = 'Could not save the contact address'; -$messages['movingmessage'] = 'Moving message...'; -$messages['copyingmessage'] = 'Copying message...'; +$messages['movingmessage'] = 'Moving message(s)...'; +$messages['copyingmessage'] = 'Copying message(s)...'; +$messages['deletingmessage'] = 'Deleting message(s)...'; +$messages['markingmessage'] = 'Marking message(s)...'; $messages['receiptsent'] = 'Successfully sent a read receipt'; $messages['errorsendingreceipt'] = 'Could not send the receipt'; $messages['nodeletelastidentity'] = 'You cannot delete this identity, it\'s your last one.'; @@ -116,5 +118,14 @@ $messages['emailformaterror'] = 'Invalid e-mail address: $email'; $messages['toomanyrecipients'] = 'Too many recipients. Reduce the number of recipients to $max.'; $messages['maxgroupmembersreached'] = 'The number of group members exceeds the maximum of $max'; $messages['internalerror'] = 'An internal error occured. Please try again'; +$messages['contactdelerror'] = 'Could not delete contact(s)'; +$messages['contactdeleted'] = 'Contact(s) deleted successfully'; +$messages['groupdeleted'] = 'Group deleted successfully'; +$messages['grouprenamed'] = 'Group renamed successfully'; +$messages['groupcreated'] = 'Group created successfully'; +$messages['messagedeleted'] = 'Message(s) deleted successfully'; +$messages['messagemoved'] = 'Message(s) moved successfully'; +$messages['messagecopied'] = 'Message(s) copied successfully'; +$messages['messagemarked'] = 'Message(s) marked successfully'; ?> diff --git a/program/localization/pl_PL/messages.inc b/program/localization/pl_PL/messages.inc index 83c566472..db9eaca30 100644 --- a/program/localization/pl_PL/messages.inc +++ b/program/localization/pl_PL/messages.inc @@ -94,6 +94,8 @@ $messages['sourceisreadonly'] = 'Źródło adresu jest tylko do odczytu'; $messages['errorsavingcontact'] = 'Nie można było zapisać adresu kontaktu'; $messages['movingmessage'] = 'Przenoszenie wiadomości...'; $messages['copyingmessage'] = 'Kopiowanie wiadomości...'; +$messages['deletingmessage'] = 'Usuwanie wiadomości...'; +$messages['markingmessage'] = 'Oznaczanie wiadomości...'; $messages['receiptsent'] = 'Pomyślnie wysłano potwierdzenie dostarczenia'; $messages['errorsendingreceipt'] = 'Nie można wysłać potwierdzenia'; $messages['nodeletelastidentity'] = 'Nie można skasować tej tożsamości, ponieważ jest ostatnią.'; @@ -120,6 +122,15 @@ $messages['smtperror'] = 'Błąd SMTP: $msg'; $messages['emailformaterror'] = 'Błędny adres e-mail: $email'; $messages['toomanyrecipients'] = 'Zbyt wielu odbiorców. Zmniejsz ich liczbę do $max.'; $messages['maxgroupmembersreached'] = 'Liczba członków grupy nie może być większa niż $max'; -$messages['internalerror'] = 'Wystąpił wewnętrzny błąd systemu. Spróbuj jeszcze raz' +$messages['internalerror'] = 'Wystąpił wewnętrzny błąd systemu. Spróbuj jeszcze raz'; +$messages['contactdelerror'] = 'Usuwanie kontaktów nie powiodło się'; +$messages['contactdeleted'] = 'Kontakt(y) został(y) usunięte'; +$messages['groupdeleted'] = 'Grupa została usunięta'; +$messages['grouprenamed'] = 'Nazwa grupy została zmieniona'; +$messages['groupcreated'] = 'Grupa została utworzona'; +$messages['messagedeleted'] = 'Wiadomości zostały usunięte'; +$messages['messagemoved'] = 'Wiadomości zostały przeniesione'; +$messages['messagecopied'] = 'Wiadomości zostały skopiowane'; +$messages['messagemarked'] = 'Wiadomości zostały oznaczone'; ?> 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 && |