diff options
author | Aleksander Machniak <alec@alec.pl> | 2013-03-02 20:29:20 +0100 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2013-03-02 20:29:20 +0100 |
commit | e7c1aad83208b343634a1b857b53474c97a74f61 (patch) | |
tree | 4e3c19621e7db3e7df1acec738b3ed3e8ab1ad77 /program | |
parent | 0bf724ef1f6a980479d7d6dfc6af62aa421a2888 (diff) |
Even better message on over quota error in move to trash operation (#1484164)
Diffstat (limited to 'program')
-rw-r--r-- | program/include/bc.php | 4 | ||||
-rw-r--r-- | program/include/rcmail.php | 29 | ||||
-rw-r--r-- | program/localization/en_US/messages.inc | 3 | ||||
-rw-r--r-- | program/steps/mail/move_del.inc | 9 |
4 files changed, 29 insertions, 16 deletions
diff --git a/program/include/bc.php b/program/include/bc.php index 3d9d46289..d8356338d 100644 --- a/program/include/bc.php +++ b/program/include/bc.php @@ -205,9 +205,9 @@ function rcmail_quota_content($attrib = null) return rcmail::get_instance()->quota_content($attrib); } -function rcmail_display_server_error($fallback=null, $fallback_args=null) +function rcmail_display_server_error($fallback=null, $fallback_args=null, $suffix='') { - rcmail::get_instance()->display_server_error($fallback, $fallback_args); + rcmail::get_instance()->display_server_error($fallback, $fallback_args, $suffix); } function rcmail_filetype2classname($mimetype, $filename) diff --git a/program/include/rcmail.php b/program/include/rcmail.php index 667be14bc..30d1fe84c 100644 --- a/program/include/rcmail.php +++ b/program/include/rcmail.php @@ -1798,39 +1798,50 @@ class rcmail extends rcube * * @param string $fallback Fallback message label * @param array $fallback_args Fallback message label arguments + * @param string $suffix Message label suffix */ - public function display_server_error($fallback = null, $fallback_args = null) + public function display_server_error($fallback = null, $fallback_args = null, $suffix = '') { $err_code = $this->storage->get_error_code(); $res_code = $this->storage->get_response_code(); + $args = array(); if ($res_code == rcube_storage::NOPERM) { - $this->output->show_message('errornoperm', 'error'); + $error = 'errornoperm'; } else if ($res_code == rcube_storage::READONLY) { - $this->output->show_message('errorreadonly', 'error'); + $error = 'errorreadonly'; } else if ($res_code == rcube_storage::OVERQUOTA) { - $this->output->show_message('errorroverquota', 'error'); + $error = 'errorroverquota'; } else if ($err_code && ($err_str = $this->storage->get_error_str())) { // try to detect access rights problem and display appropriate message if (stripos($err_str, 'Permission denied') !== false) { - $this->output->show_message('errornoperm', 'error'); + $error = 'errornoperm'; } // try to detect full mailbox problem and display appropriate message else if (stripos($err_str, 'Quota exceeded') !== false) { - $this->output->show_message('erroroverquota', 'error'); + $error = 'erroroverquota'; } else { - $this->output->show_message('servererrormsg', 'error', array('msg' => $err_str)); + $error = 'servererrormsg'; + $args = array('msg' => $err_str); } } else if ($err_code < 0) { - $this->output->show_message('storageerror', 'error'); + $error = 'storageerror'; } else if ($fallback) { - $this->output->show_message($fallback, 'error', $fallback_args); + $error = $fallback; + $args = $fallback_args; + } + + if ($error) { + if ($suffix && $this->text_exists($error . $suffix)) { + $error .= $suffix; + } + $this->output->show_message($error, 'error', $args); } } diff --git a/program/localization/en_US/messages.inc b/program/localization/en_US/messages.inc index 9262db8b2..f9b5e00a6 100644 --- a/program/localization/en_US/messages.inc +++ b/program/localization/en_US/messages.inc @@ -28,7 +28,8 @@ $messages['dberror'] = 'Database Error!'; $messages['requesttimedout'] = 'Request timed out'; $messages['errorreadonly'] = 'Unable to perform operation. Folder is read-only.'; $messages['errornoperm'] = 'Unable to perform operation. Permission denied.'; -$messages['erroroverquota'] = 'Unable to perform operation. No available disk space.'; +$messages['erroroverquota'] = 'Unable to perform operation. No free disk space.'; +$messages['erroroverquotadelete'] = 'No free disk space. Use SHIFT+DEL to delete a message.'; $messages['invalidrequest'] = 'Invalid request! No data was saved.'; $messages['invalidhost'] = 'Invalid server name.'; $messages['nomessagesfound'] = 'No messages found in this mailbox.'; diff --git a/program/steps/mail/move_del.inc b/program/steps/mail/move_del.inc index 3e2252683..3fc6ac5a7 100644 --- a/program/steps/mail/move_del.inc +++ b/program/steps/mail/move_del.inc @@ -29,10 +29,11 @@ $old_count = $RCMAIL->storage->count(NULL, $threading ? 'THREADS' : 'ALL'); $old_pages = ceil($old_count / $RCMAIL->storage->get_pagesize()); // move messages -if ($RCMAIL->action=='moveto' && !empty($_POST['_uid']) && strlen($_POST['_target_mbox'])) { - $count = sizeof(explode(',', ($uids = get_input_value('_uid', RCUBE_INPUT_POST)))); +if ($RCMAIL->action == 'moveto' && !empty($_POST['_uid']) && strlen($_POST['_target_mbox'])) { + $count = sizeof(explode(',', ($uids = get_input_value('_uid', RCUBE_INPUT_POST)))); $target = get_input_value('_target_mbox', RCUBE_INPUT_POST, true); - $mbox = get_input_value('_mbox', RCUBE_INPUT_POST, true); + $mbox = get_input_value('_mbox', RCUBE_INPUT_POST, true); + $trash = $RCMAIL->config->get('trash_mbox'); $moved = $RCMAIL->storage->move_message($uids, $target, $mbox); @@ -40,7 +41,7 @@ if ($RCMAIL->action=='moveto' && !empty($_POST['_uid']) && strlen($_POST['_targe // send error message if ($_POST['_from'] != 'show') $OUTPUT->command('list_mailbox'); - rcmail_display_server_error('errormoving'); + rcmail_display_server_error('errormoving', null, $target == $trash ? 'delete' : ''); $OUTPUT->send(); exit; } |