- Add option to delete messages instead of moving to Trash when in Junk folder (#1486686)

pull/1/head
alecpl 13 years ago
parent 84b028ce00
commit 1b30a710cf

@ -1,6 +1,7 @@
CHANGELOG Roundcube Webmail CHANGELOG Roundcube Webmail
=========================== ===========================
- Add option to delete messages instead of moving to Trash when in Junk folder (#1486686)
- Fix invisible cursor when replying to a html message (#1487073) - Fix invisible cursor when replying to a html message (#1487073)
- Reset IP stored in session when destroying session data (#1488056) - Reset IP stored in session when destroying session data (#1488056)
- Fix bug where memory_limit = -1 wasn't handled properly - Fix bug where memory_limit = -1 wasn't handled properly

@ -785,6 +785,9 @@ $rcmail_config['addressbook_search_mods'] = null; // Example: array('name'=>1,
// when user is over quota and Trash is included in the quota. // when user is over quota and Trash is included in the quota.
$rcmail_config['delete_always'] = false; $rcmail_config['delete_always'] = false;
// Directly delete messages in Junk instead of moving to Trash
$rcmail_config['delete_junk'] = false;
// Behavior if a received message requests a message delivery notification (read receipt) // Behavior if a received message requests a message delivery notification (read receipt)
// 0 = ask the user, 1 = send automatically, 2 = ignore (never send or ask) // 0 = ask the user, 1 = send automatically, 2 = ignore (never send or ask)
// 3 = send automatically if sender is in addressbook, otherwise ask the user // 3 = send automatically if sender is in addressbook, otherwise ask the user

@ -220,8 +220,7 @@ function rcube_webmail()
$(this.gui_objects.qsearchbox).focusin(function() { rcmail.message_list.blur(); }); $(this.gui_objects.qsearchbox).focusin(function() { rcmail.message_list.blur(); });
} }
if (!this.env.flag_for_deletion && this.env.trash_mailbox && this.env.mailbox != this.env.trash_mailbox) this.set_button_titles();
this.set_alttext('delete', 'movemessagetotrash');
this.env.message_commands = ['show', 'reply', 'reply-all', 'reply-list', 'forward', this.env.message_commands = ['show', 'reply', 'reply-all', 'reply-list', 'forward',
'moveto', 'copy', 'delete', 'open', 'mark', 'edit', 'viewsource', 'download', 'moveto', 'copy', 'delete', 'open', 'mark', 'edit', 'viewsource', 'download',
@ -573,13 +572,10 @@ function rcube_webmail()
this.reset_qsearch(); this.reset_qsearch();
if (this.task == 'mail') { if (this.task == 'mail') {
this.list_mailbox(props); this.list_mailbox(props);
this.set_button_titles();
if (this.env.trash_mailbox && !this.env.flag_for_deletion)
this.set_alttext('delete', this.env.mailbox != this.env.trash_mailbox ? 'movemessagetotrash' : 'deletemessage');
} }
else if (this.task == 'addressbook') { else if (this.task == 'addressbook')
this.list_contacts(props); this.list_contacts(props);
}
break; break;
case 'load-headers': case 'load-headers':
@ -2570,6 +2566,9 @@ function rcube_webmail()
// @TODO: we should check if defined trash mailbox exists // @TODO: we should check if defined trash mailbox exists
else if (!trash || this.env.mailbox == trash) else if (!trash || this.env.mailbox == trash)
this.permanently_remove_messages(); this.permanently_remove_messages();
// we're in Junk folder and delete_junk is enabled
else if (this.env.delete_junk && this.env.junk_mailbox && this.env.mailbox == this.env.junk_mailbox)
this.permanently_remove_messages();
// if there is a trash mailbox defined and we're not currently in it // if there is a trash mailbox defined and we're not currently in it
else { else {
// if shift was pressed delete it immediately // if shift was pressed delete it immediately
@ -2869,6 +2868,19 @@ function rcube_webmail()
return this.select_all_mode ? '*' : uids.join(','); return this.select_all_mode ? '*' : uids.join(',');
}; };
// Sets title of the delete button
this.set_button_titles = function()
{
var label = 'deletemessage';
if (!this.env.flag_for_deletion
&& this.env.trash_mailbox && this.env.mailbox != this.env.trash_mailbox
&& (!this.env.delete_junk || !this.env.junk_mailbox || this.env.mailbox != this.env.junk_mailbox)
)
label = 'movemessagetotrash';
this.set_alttext('delete', label);
};
/*********************************************************/ /*********************************************************/
/********* mailbox folders methods *********/ /********* mailbox folders methods *********/

@ -341,6 +341,7 @@ $labels['readwhendeleted'] = 'Mark the message as read on delete';
$labels['flagfordeletion'] = 'Flag the message for deletion instead of delete'; $labels['flagfordeletion'] = 'Flag the message for deletion instead of delete';
$labels['skipdeleted'] = 'Do not show deleted messages'; $labels['skipdeleted'] = 'Do not show deleted messages';
$labels['deletealways'] = 'If moving messages to "Deleted Items" fails, permanently delete them'; $labels['deletealways'] = 'If moving messages to "Deleted Items" fails, permanently delete them';
$labels['deletejunk'] = 'Directly delete messages in Junk';
$labels['showremoteimages'] = 'Display remote inline images'; $labels['showremoteimages'] = 'Display remote inline images';
$labels['fromknownsenders'] = 'from known senders'; $labels['fromknownsenders'] = 'from known senders';
$labels['always'] = 'always'; $labels['always'] = 'always';

@ -402,6 +402,7 @@ $labels['readwhendeleted'] = 'Mark the message as read on delete';
$labels['flagfordeletion'] = 'Flag the message for deletion instead of delete'; $labels['flagfordeletion'] = 'Flag the message for deletion instead of delete';
$labels['skipdeleted'] = 'Do not show deleted messages'; $labels['skipdeleted'] = 'Do not show deleted messages';
$labels['deletealways'] = 'If moving messages to Trash fails, delete them'; $labels['deletealways'] = 'If moving messages to Trash fails, delete them';
$labels['deletejunk'] = 'Directly delete messages in Junk';
$labels['showremoteimages'] = 'Display remote inline images'; $labels['showremoteimages'] = 'Display remote inline images';
$labels['fromknownsenders'] = 'from known senders'; $labels['fromknownsenders'] = 'from known senders';
$labels['always'] = 'always'; $labels['always'] = 'always';

@ -341,6 +341,7 @@ $labels['readwhendeleted'] = '將刪除的郵件標示為已讀取';
$labels['flagfordeletion'] = '刪除郵件時將原始郵件標示為已刪除'; $labels['flagfordeletion'] = '刪除郵件時將原始郵件標示為已刪除';
$labels['skipdeleted'] = '不要顯示已刪除的郵件'; $labels['skipdeleted'] = '不要顯示已刪除的郵件';
$labels['deletealways'] = '如果移到垃圾桶失敗,就直接刪除'; $labels['deletealways'] = '如果移到垃圾桶失敗,就直接刪除';
$labels['deletejunk'] = '直接從垃圾郵件刪除';
$labels['showremoteimages'] = '顯示遠端郵件內文中的圖片'; $labels['showremoteimages'] = '顯示遠端郵件內文中的圖片';
$labels['fromknownsenders'] = '從已知的寄件者'; $labels['fromknownsenders'] = '從已知的寄件者';
$labels['always'] = '總是接受'; $labels['always'] = '總是接受';

@ -99,6 +99,8 @@ if (empty($RCMAIL->action) || $RCMAIL->action == 'list') {
$OUTPUT->set_env('threads', $threading || $RCMAIL->storage->get_capability('THREAD')); $OUTPUT->set_env('threads', $threading || $RCMAIL->storage->get_capability('THREAD'));
$OUTPUT->set_env('preview_pane_mark_read', $RCMAIL->config->get('preview_pane_mark_read', 0)); $OUTPUT->set_env('preview_pane_mark_read', $RCMAIL->config->get('preview_pane_mark_read', 0));
if ($CONFIG['delete_junk'])
$OUTPUT->set_env('delete_junk', true);
if ($CONFIG['flag_for_deletion']) if ($CONFIG['flag_for_deletion'])
$OUTPUT->set_env('flag_for_deletion', true); $OUTPUT->set_env('flag_for_deletion', true);
if ($CONFIG['read_when_deleted']) if ($CONFIG['read_when_deleted'])

@ -52,16 +52,19 @@ if ($uid = get_input_value('_uid', RCUBE_INPUT_GET)) {
$OUTPUT->set_env('permaurl', rcmail_url('show', array('_uid' => $MESSAGE->uid, '_mbox' => $mbox_name))); $OUTPUT->set_env('permaurl', rcmail_url('show', array('_uid' => $MESSAGE->uid, '_mbox' => $mbox_name)));
$OUTPUT->set_env('delimiter', $RCMAIL->storage->get_hierarchy_delimiter()); $OUTPUT->set_env('delimiter', $RCMAIL->storage->get_hierarchy_delimiter());
$OUTPUT->set_env('mailbox', $mbox_name); $OUTPUT->set_env('mailbox', $mbox_name);
if ($CONFIG['drafts_mbox']) {
$OUTPUT->set_env('drafts_mailbox', $CONFIG['drafts_mbox']);
}
// mimetypes supported by the browser (default settings) // mimetypes supported by the browser (default settings)
$mimetypes = $RCMAIL->config->get('client_mimetypes', 'text/plain,text/html,text/xml,image/jpeg,image/gif,image/png,application/x-javascript,application/pdf,application/x-shockwave-flash'); $mimetypes = $RCMAIL->config->get('client_mimetypes', 'text/plain,text/html,text/xml,image/jpeg,image/gif,image/png,application/x-javascript,application/pdf,application/x-shockwave-flash');
$OUTPUT->set_env('mimetypes', is_string($mimetypes) ? explode(',', $mimetypes) : (array)$mimetypes); $OUTPUT->set_env('mimetypes', is_string($mimetypes) ? explode(',', $mimetypes) : (array)$mimetypes);
if ($CONFIG['drafts_mbox'])
$OUTPUT->set_env('drafts_mailbox', $CONFIG['drafts_mbox']);
if ($CONFIG['trash_mbox']) if ($CONFIG['trash_mbox'])
$OUTPUT->set_env('trash_mailbox', $CONFIG['trash_mbox']); $OUTPUT->set_env('trash_mailbox', $CONFIG['trash_mbox']);
if ($CONFIG['junk_mbox'])
$OUTPUT->set_env('junk_mailbox', $CONFIG['junk_mbox']);
if ($CONFIG['delete_junk'])
$OUTPUT->set_env('delete_junk', true);
if ($CONFIG['flag_for_deletion']) if ($CONFIG['flag_for_deletion'])
$OUTPUT->set_env('flag_for_deletion', true); $OUTPUT->set_env('flag_for_deletion', true);
if ($CONFIG['read_when_deleted']) if ($CONFIG['read_when_deleted'])

@ -816,6 +816,16 @@ function rcmail_user_prefs($current=null)
); );
} }
if (!isset($no_override['delete_junk'])) {
$field_id = 'rcmfd_delete_junk';
$input_delete_junk = new html_checkbox(array('name' => '_delete_junk', 'id' => $field_id, 'value' => 1));
$blocks['main']['options']['delete_junk'] = array(
'title' => html::label($field_id, Q(rcube_label('deletejunk'))),
'content' => $input_delete_junk->show($config['delete_junk']?1:0),
);
}
// Trash purging on logout // Trash purging on logout
if (!isset($no_override['logout_purge'])) { if (!isset($no_override['logout_purge'])) {
$field_id = 'rcmfd_logout_purge'; $field_id = 'rcmfd_logout_purge';

@ -110,6 +110,7 @@ switch ($CURR_SECTION)
'skip_deleted' => isset($_POST['_skip_deleted']) ? TRUE : FALSE, 'skip_deleted' => isset($_POST['_skip_deleted']) ? TRUE : FALSE,
'flag_for_deletion' => isset($_POST['_flag_for_deletion']) ? TRUE : FALSE, 'flag_for_deletion' => isset($_POST['_flag_for_deletion']) ? TRUE : FALSE,
'delete_always' => isset($_POST['_delete_always']) ? TRUE : FALSE, 'delete_always' => isset($_POST['_delete_always']) ? TRUE : FALSE,
'delete_junk' => isset($_POST['_delete_junk']) ? TRUE : FALSE,
'logout_purge' => isset($_POST['_logout_purge']) ? TRUE : FALSE, 'logout_purge' => isset($_POST['_logout_purge']) ? TRUE : FALSE,
'logout_expunge' => isset($_POST['_logout_expunge']) ? TRUE : FALSE, 'logout_expunge' => isset($_POST['_logout_expunge']) ? TRUE : FALSE,
); );

Loading…
Cancel
Save