From 71a7f2a74f77d3afe0c0c3465a22f87d4827dd5a Mon Sep 17 00:00:00 2001 From: Nathan Kinkade Date: Sat, 21 Mar 2009 23:25:00 +0000 Subject: Allow user to configure which folder is used as the HamNotSpam folder in the user preferences. --- roundcubemail/program/js/app.js | 18 +++++++++++------- roundcubemail/program/localization/en_US/labels.inc | 4 ++++ roundcubemail/program/steps/mail/func.inc | 2 ++ roundcubemail/program/steps/settings/func.inc | 11 ++++++++--- roundcubemail/program/steps/settings/save_prefs.inc | 1 + 5 files changed, 26 insertions(+), 10 deletions(-) (limited to 'roundcubemail/program') diff --git a/roundcubemail/program/js/app.js b/roundcubemail/program/js/app.js index 34f3763ec..04f7e3146 100644 --- a/roundcubemail/program/js/app.js +++ b/roundcubemail/program/js/app.js @@ -549,14 +549,18 @@ function rcube_webmail() this.list_mailbox(props); // Only show the "Not Spam" button if we are currently - // in the configured Junk mailbox - notjunkbutton_elm = rcube_find_object('notjunkbutton'); - if (notjunkbutton_elm) + // in the configured Junk mailbox AND if the user has + // configured a hamnotspam mbox in their preferences + if (this.env.hamnotspam_mailbox) { - if (this.env.mailbox == this.env.junk_mailbox) - notjunkbutton_elm.style.display = 'inline'; - else - notjunkbutton_elm.style.display = 'none'; + notjunkbutton_elm = rcube_find_object('notjunkbutton'); + if (notjunkbutton_elm) + { + if (this.env.mailbox == this.env.junk_mailbox) + notjunkbutton_elm.style.display = 'inline'; + else + notjunkbutton_elm.style.display = 'none'; + } } // Only show the "Shred" button if we are currently diff --git a/roundcubemail/program/localization/en_US/labels.inc b/roundcubemail/program/localization/en_US/labels.inc index 399023827..75305d337 100644 --- a/roundcubemail/program/localization/en_US/labels.inc +++ b/roundcubemail/program/localization/en_US/labels.inc @@ -38,6 +38,10 @@ $labels['drafts'] = 'Drafts'; $labels['sent'] = 'Sent'; $labels['trash'] = 'Trash'; $labels['junk'] = 'Spam'; +// mailboxes for training a Bayesian Spam filter +// like DSPAM +$labels['hamnotspam'] = 'Ham-not-spam'; +$labels['spamnotham'] = 'Spam-not-ham'; // message listing $labels['subject'] = 'Subject'; diff --git a/roundcubemail/program/steps/mail/func.inc b/roundcubemail/program/steps/mail/func.inc index f9c1d951d..c203443dd 100644 --- a/roundcubemail/program/steps/mail/func.inc +++ b/roundcubemail/program/steps/mail/func.inc @@ -96,6 +96,8 @@ if (empty($RCMAIL->action) || $RCMAIL->action == 'list') $OUTPUT->set_env('drafts_mailbox', $CONFIG['drafts_mbox']); if ($CONFIG['junk_mbox']) $OUTPUT->set_env('junk_mailbox', $CONFIG['junk_mbox']); + if ($CONFIG['hamnotspam_mbox']) + $OUTPUT->set_env('hamnotspam_mailbox', $CONFIG['hamnotspam_mbox']); if (!$OUTPUT->ajax_call) $OUTPUT->add_label('checkingmail', 'deletemessage', 'movemessagetotrash', 'movingmessage'); diff --git a/roundcubemail/program/steps/settings/func.inc b/roundcubemail/program/steps/settings/func.inc index 6515ae4f6..715890f9d 100644 --- a/roundcubemail/program/steps/settings/func.inc +++ b/roundcubemail/program/steps/settings/func.inc @@ -321,14 +321,19 @@ function rcmail_user_prefs_block($part, $no_override, $attrib) $table->add(null, $select->show($config['sent_mbox'], array('name' => "_sent_mbox"))); } + if (!isset($no_override['trash_mbox'])) { + $table->add('title', Q(rcube_label('trash'))); + $table->add(null, $select->show($config['trash_mbox'], array('name' => "_trash_mbox"))); + } + if (!isset($no_override['junk_mbox'])) { $table->add('title', Q(rcube_label('junk'))); $table->add(null, $select->show($config['junk_mbox'], array('name' => "_junk_mbox"))); } - if (!isset($no_override['trash_mbox'])) { - $table->add('title', Q(rcube_label('trash'))); - $table->add(null, $select->show($config['trash_mbox'], array('name' => "_trash_mbox"))); + if (!isset($no_override['hamnotspam_mbox'])) { + $table->add('title', Q(rcube_label('hamnotspam'))); + $table->add(null, $select->show($config['hamnotspam_mbox'], array('name' => "_hamnotspam_mbox"))); } $out = html::tag('fieldset', null, html::tag('legend', null, Q(rcube_label('specialfolders'))) . $table->show($attrib)); diff --git a/roundcubemail/program/steps/settings/save_prefs.inc b/roundcubemail/program/steps/settings/save_prefs.inc index 09cf63d6f..a0b825f07 100644 --- a/roundcubemail/program/steps/settings/save_prefs.inc +++ b/roundcubemail/program/steps/settings/save_prefs.inc @@ -46,6 +46,7 @@ $a_user_prefs = array( 'sent_mbox' => get_input_value('_sent_mbox', RCUBE_INPUT_POST), 'junk_mbox' => get_input_value('_junk_mbox', RCUBE_INPUT_POST), 'trash_mbox' => get_input_value('_trash_mbox', RCUBE_INPUT_POST), + 'hamnotspam_mbox' => get_input_value('_hamnotspam_mbox', RCUBE_INPUT_POST) ); // don't override these parameters -- cgit v1.2.3