[Svn] r6052 - in trunk/roundcubemail: . config program/js program/localization/en_GB program/localization/en_US program/localization/zh_TW program/steps/mail program/steps/settings

trac at roundcube.net trac at roundcube.net
Sun Apr 8 18:34:36 CEST 2012


Author: alec
Date: 2012-04-08 11:34:36 -0500 (Sun, 08 Apr 2012)
New Revision: 6052

Modified:
   trunk/roundcubemail/CHANGELOG
   trunk/roundcubemail/config/main.inc.php.dist
   trunk/roundcubemail/program/js/app.js
   trunk/roundcubemail/program/localization/en_GB/labels.inc
   trunk/roundcubemail/program/localization/en_US/labels.inc
   trunk/roundcubemail/program/localization/zh_TW/labels.inc
   trunk/roundcubemail/program/steps/mail/func.inc
   trunk/roundcubemail/program/steps/mail/show.inc
   trunk/roundcubemail/program/steps/settings/func.inc
   trunk/roundcubemail/program/steps/settings/save_prefs.inc
Log:
- Add option to delete messages instead of moving to Trash when in Junk folder (#1486686)


Modified: trunk/roundcubemail/CHANGELOG
===================================================================
--- trunk/roundcubemail/CHANGELOG	2012-04-08 08:36:15 UTC (rev 6051)
+++ trunk/roundcubemail/CHANGELOG	2012-04-08 16:34:36 UTC (rev 6052)
@@ -1,6 +1,7 @@
 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)
 - Reset IP stored in session when destroying session data (#1488056)
 - Fix bug where memory_limit = -1 wasn't handled properly

Modified: trunk/roundcubemail/config/main.inc.php.dist
===================================================================
--- trunk/roundcubemail/config/main.inc.php.dist	2012-04-08 08:36:15 UTC (rev 6051)
+++ trunk/roundcubemail/config/main.inc.php.dist	2012-04-08 16:34:36 UTC (rev 6052)
@@ -785,6 +785,9 @@
 // when user is over quota and Trash is included in the quota.
 $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)
 // 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

Modified: trunk/roundcubemail/program/js/app.js
===================================================================
--- trunk/roundcubemail/program/js/app.js	2012-04-08 08:36:15 UTC (rev 6051)
+++ trunk/roundcubemail/program/js/app.js	2012-04-08 16:34:36 UTC (rev 6052)
@@ -220,8 +220,7 @@
           $(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_alttext('delete', 'movemessagetotrash');
+        this.set_button_titles();
 
         this.env.message_commands = ['show', 'reply', 'reply-all', 'reply-list', 'forward',
           'moveto', 'copy', 'delete', 'open', 'mark', 'edit', 'viewsource', 'download',
@@ -573,13 +572,10 @@
         this.reset_qsearch();
         if (this.task == 'mail') {
           this.list_mailbox(props);
-
-          if (this.env.trash_mailbox && !this.env.flag_for_deletion)
-            this.set_alttext('delete', this.env.mailbox != this.env.trash_mailbox ? 'movemessagetotrash' : 'deletemessage');
+          this.set_button_titles();
         }
-        else if (this.task == 'addressbook') {
+        else if (this.task == 'addressbook')
           this.list_contacts(props);
-        }
         break;
 
       case 'load-headers':
@@ -2570,6 +2566,9 @@
     // @TODO: we should check if defined trash mailbox exists
     else if (!trash || this.env.mailbox == trash)
       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
     else {
       // if shift was pressed delete it immediately
@@ -2869,7 +2868,20 @@
     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         *********/
   /*********************************************************/

Modified: trunk/roundcubemail/program/localization/en_GB/labels.inc
===================================================================
--- trunk/roundcubemail/program/localization/en_GB/labels.inc	2012-04-08 08:36:15 UTC (rev 6051)
+++ trunk/roundcubemail/program/localization/en_GB/labels.inc	2012-04-08 16:34:36 UTC (rev 6052)
@@ -341,6 +341,7 @@
 $labels['flagfordeletion'] = 'Flag the message for deletion instead of delete';
 $labels['skipdeleted'] = 'Do not show deleted messages';
 $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['fromknownsenders'] = 'from known senders';
 $labels['always'] = 'always';

Modified: trunk/roundcubemail/program/localization/en_US/labels.inc
===================================================================
--- trunk/roundcubemail/program/localization/en_US/labels.inc	2012-04-08 08:36:15 UTC (rev 6051)
+++ trunk/roundcubemail/program/localization/en_US/labels.inc	2012-04-08 16:34:36 UTC (rev 6052)
@@ -402,6 +402,7 @@
 $labels['flagfordeletion'] = 'Flag the message for deletion instead of delete';
 $labels['skipdeleted'] = 'Do not show deleted messages';
 $labels['deletealways'] = 'If moving messages to Trash fails, delete them';
+$labels['deletejunk'] = 'Directly delete messages in Junk';
 $labels['showremoteimages'] = 'Display remote inline images';
 $labels['fromknownsenders'] = 'from known senders';
 $labels['always'] = 'always';

Modified: trunk/roundcubemail/program/localization/zh_TW/labels.inc
===================================================================
--- trunk/roundcubemail/program/localization/zh_TW/labels.inc	2012-04-08 08:36:15 UTC (rev 6051)
+++ trunk/roundcubemail/program/localization/zh_TW/labels.inc	2012-04-08 16:34:36 UTC (rev 6052)
@@ -341,6 +341,7 @@
 $labels['flagfordeletion'] = '刪除郵件時將原始郵件標示為已刪除';
 $labels['skipdeleted'] = '不要顯示已刪除的郵件';
 $labels['deletealways'] = '如果移到垃圾桶失敗,就直接刪除';
+$labels['deletejunk'] = '直接從垃圾郵件刪除';
 $labels['showremoteimages'] = '顯示遠端郵件內文中的圖片';
 $labels['fromknownsenders'] = '從已知的寄件者';
 $labels['always'] = '總是接受';

Modified: trunk/roundcubemail/program/steps/mail/func.inc
===================================================================
--- trunk/roundcubemail/program/steps/mail/func.inc	2012-04-08 08:36:15 UTC (rev 6051)
+++ trunk/roundcubemail/program/steps/mail/func.inc	2012-04-08 16:34:36 UTC (rev 6052)
@@ -99,6 +99,8 @@
   $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));
 
+  if ($CONFIG['delete_junk'])
+    $OUTPUT->set_env('delete_junk', true);
   if ($CONFIG['flag_for_deletion'])
     $OUTPUT->set_env('flag_for_deletion', true);
   if ($CONFIG['read_when_deleted'])

Modified: trunk/roundcubemail/program/steps/mail/show.inc
===================================================================
--- trunk/roundcubemail/program/steps/mail/show.inc	2012-04-08 08:36:15 UTC (rev 6051)
+++ trunk/roundcubemail/program/steps/mail/show.inc	2012-04-08 16:34:36 UTC (rev 6052)
@@ -52,16 +52,19 @@
   $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('mailbox', $mbox_name);
-  if ($CONFIG['drafts_mbox']) {
-    $OUTPUT->set_env('drafts_mailbox', $CONFIG['drafts_mbox']);
-  }
 
   // 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');
   $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'])
     $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'])
     $OUTPUT->set_env('flag_for_deletion', true);
   if ($CONFIG['read_when_deleted'])

Modified: trunk/roundcubemail/program/steps/settings/func.inc
===================================================================
--- trunk/roundcubemail/program/steps/settings/func.inc	2012-04-08 08:36:15 UTC (rev 6051)
+++ trunk/roundcubemail/program/steps/settings/func.inc	2012-04-08 16:34:36 UTC (rev 6052)
@@ -816,6 +816,16 @@
       );
     }
 
+    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
     if (!isset($no_override['logout_purge'])) {
       $field_id = 'rcmfd_logout_purge';

Modified: trunk/roundcubemail/program/steps/settings/save_prefs.inc
===================================================================
--- trunk/roundcubemail/program/steps/settings/save_prefs.inc	2012-04-08 08:36:15 UTC (rev 6051)
+++ trunk/roundcubemail/program/steps/settings/save_prefs.inc	2012-04-08 16:34:36 UTC (rev 6052)
@@ -110,6 +110,7 @@
       'skip_deleted'      => isset($_POST['_skip_deleted']) ? TRUE : FALSE,
       'flag_for_deletion' => isset($_POST['_flag_for_deletion']) ? 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_expunge'    => isset($_POST['_logout_expunge']) ? TRUE : FALSE,
     );



More information about the svn mailing list