Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

- Added 'display_next' option

  • Loading branch information...
commit e54bb72d30cfd88fcef5434b472fb3d9b2cca710 1 parent 330ef6c
Aleksander Machniak authored July 31, 2009
1  CHANGELOG
... ...
@@ -1,6 +1,7 @@
1 1
 CHANGELOG RoundCube Webmail
2 2
 ===========================
3 3
 
  4
+- Added 'display_next' option
4 5
 - Fix rcube_mdb2::unixtimestamp for MS SQL (#1486015)
5 6
 - Fix HTML washing to respect character encoding
6 7
 - Fix endless loop in iil_C_Login() with Courier IMAP (#1486010)
3  config/main.inc.php.dist
@@ -437,5 +437,8 @@ $rcmail_config['keep_alive'] = 60;
437 437
 // If true all folders will be checked for recent messages
438 438
 $rcmail_config['check_all_folders'] = FALSE;
439 439
 
  440
+// If true, after message delete/move, the next message will be displayed
  441
+$rcmail_config['display_next'] = FALSE;
  442
+
440 443
 // end of config file
441 444
 ?>
18  program/js/app.js
@@ -1890,19 +1890,21 @@ function rcube_webmail()
1890 1890
       var selection = this.message_list.get_selection();
1891 1891
       var rows = this.message_list.rows;
1892 1892
       var id;
1893  
-      for (var n=0; n<selection.length; n++)
1894  
-        {
  1893
+      for (var n=0; n<selection.length; n++) {
1895 1894
         id = selection[n];
1896 1895
         a_uids[a_uids.length] = id;
1897  
-        this.message_list.remove_row(id, (n == selection.length-1));
  1896
+        this.message_list.remove_row(id, (this.env.display_next && n == selection.length-1));
1898 1897
       }
  1898
+      // make sure there are no selected rows
  1899
+      if (!this.env.display_next)
  1900
+        this.message_list.clear_selection();
1899 1901
     }
1900 1902
 
1901 1903
     // also send search request to get the right messages 
1902 1904
     if (this.env.search_request) 
1903 1905
       add_url += '&_search='+this.env.search_request;
1904 1906
 
1905  
-    if (this.env.next_uid)
  1907
+    if (this.env.display_next && this.env.next_uid)
1906 1908
       add_url += '&_next_uid='+this.env.next_uid;
1907 1909
 
1908 1910
     // send request to server
@@ -2046,12 +2048,16 @@ function rcube_webmail()
2046 2048
           r_uids[r_uids.length] = uid;
2047 2049
 
2048 2050
 	if (this.env.skip_deleted)
2049  
-          this.message_list.remove_row(uid, (i == this.message_list.selection.length-1));
  2051
+          this.message_list.remove_row(uid, (this.env.display_next && i == this.message_list.selection.length-1));
2050 2052
 	else
2051 2053
 	  this.set_message(uid, 'deleted', true);
2052 2054
         }
2053 2055
       }
2054 2056
 
  2057
+    // make sure there are no selected rows
  2058
+    if (this.env.skip_deleted && !this.env.display_next && this.message_list)
  2059
+      this.message_list.clear_selection();
  2060
+
2055 2061
     add_url = '&_from='+(this.env.action ? this.env.action : '');
2056 2062
     
2057 2063
     if (r_uids.length)
@@ -2061,7 +2067,7 @@ function rcube_webmail()
2061 2067
       // also send search request to get the right messages 
2062 2068
       if (this.env.search_request) 
2063 2069
         add_url += '&_search='+this.env.search_request;
2064  
-      if (this.env.next_uid)
  2070
+      if (this.env.display_next && this.env.next_uid)
2065 2071
         add_url += '&_next_uid='+this.env.next_uid;
2066 2072
     }
2067 2073
     
1  program/localization/en_US/labels.inc
@@ -305,6 +305,7 @@ $labels['2047folding'] = 'Full RFC 2047 (other)';
305 305
 $labels['advancedoptions'] = 'Advanced options';
306 306
 $labels['focusonnewmessage'] = 'Focus browser window on new message';
307 307
 $labels['checkallfolders'] = 'Check all folders for new messages';
  308
+$labels['displaynext'] = 'After message delete/move display the next message';
308 309
 
309 310
 $labels['folder']  = 'Folder';
310 311
 $labels['folders']  = 'Folders';
1  program/localization/pl_PL/labels.inc
@@ -245,6 +245,7 @@ $labels['keepalive']  = 'Sprawdzaj czy nadeszły nowe wiadomości';
245 245
 $labels['everynminutes']  = 'co $n minut(y)';
246 246
 $labels['never'] = 'nigdy';
247 247
 $labels['focusonnewmessage'] = 'Informuj przeglądarkę o nowej wiadomości';
  248
+$labels['displaynext'] = 'Po usunięciu/przeniesieniu wiadomości wyświetl następną';
248 249
 $labels['folder'] = 'Folder';
249 250
 $labels['folders'] = 'Foldery';
250 251
 $labels['foldername'] = 'Nazwa folderu';
22  program/steps/mail/func.inc
@@ -93,6 +93,8 @@ if (empty($RCMAIL->action) || $RCMAIL->action == 'list')
93 93
     $OUTPUT->set_env('read_when_deleted', true);
94 94
   if ($CONFIG['skip_deleted'])
95 95
     $OUTPUT->set_env('skip_deleted', true);
  96
+  if ($CONFIG['display_next'])
  97
+    $OUTPUT->set_env('display_next', true);
96 98
 	  
97 99
   if ($CONFIG['trash_mbox'])
98 100
     $OUTPUT->set_env('trash_mailbox', $CONFIG['trash_mbox']);
@@ -686,18 +688,16 @@ function rcmail_wash_html($html, $p = array(), $cid_replaces)
686 688
   $html = preg_replace_callback('/(<[\/!]*)([^ >]+)/', 'rcmail_html_tag_callback', $html);
687 689
 
688 690
   // charset was converted to UTF-8 in rcube_imap::get_message_part(),
689  
-  // -> change charset specification in HTML accordingly
690  
-  $charset_pattern = '(content=[\'"]?\w+\/\w+;\s*charset)=([a-z0-9-_]+)';
691  
-  if (preg_match("/<meta\s+[^>]*$charset_pattern/Ui", $html)) {
692  
-    $html = preg_replace("/\s+$charset_pattern/i", '\\1='.RCMAIL_CHARSET, $html);
  691
+  // change charset specification in HTML accordingly
  692
+  $charset_pattern = '/(\s+content=[\'"]?\w+\/\w+;\s*charset)=([a-z0-9-_]+)/i';
  693
+  if (preg_match($charset_pattern, $html)) {
  694
+    $html = preg_replace($charset_pattern, '\\1='.RCMAIL_CHARSET, $html);
693 695
   }
694  
-  else {
695  
-    // add meta content-type to malformed messages, washtml cannot work without that
696  
-    if (!preg_match('/<head[^>]*>(.*)<\/head>/Uims', $html))
697  
-      $html = '<head></head>'. $html;
698  
-    $html = substr_replace($html, '<meta http-equiv="Content-Type" content="text/html; charset='.RCMAIL_CHARSET.'" />', intval(stripos($html, '<head>')+6), 0);
699  
-  }
700  
-  
  696
+  // add head for malformed messages, washtml cannot work without that
  697
+  if (!preg_match('/<head[^>]*>(.*)<\/head>/Uims', $html))
  698
+    $html = '<head></head>'. $html;
  699
+  $html = substr_replace($html, '<meta http-equiv="Content-Type" content="text/html; charset='.RCMAIL_CHARSET.'" />', intval(stripos($html, '<head>')+6), 0);
  700
+
701 701
   // turn relative into absolute urls
702 702
   $html = rcmail_resolve_base($html);
703 703
 
5  program/steps/mail/show.inc
@@ -78,7 +78,7 @@ if ($_GET['_uid']) {
78 78
     $OUTPUT->set_env('trash_mailbox', $CONFIG['trash_mbox']);
79 79
   if (!$OUTPUT->ajax_call)
80 80
     $OUTPUT->add_label('checkingmail', 'deletemessage', 'movemessagetotrash', 'movingmessage');
81  
-    
  81
+        
82 82
   // check for unset disposition notification
83 83
   if ($MESSAGE->headers->mdn_to &&
84 84
       !$MESSAGE->headers->mdn_sent && !$MESSAGE->headers->seen &&
@@ -143,6 +143,9 @@ if ($_GET['_uid']) {
143 143
       $OUTPUT->set_env('last_uid', $last);
144 144
     }
145 145
 
  146
+  if ($CONFIG['display_next'])
  147
+    $OUTPUT->set_env('display_next', true);
  148
+
146 149
   if (!$MESSAGE->headers->seen)
147 150
     $RCMAIL->plugins->exec_hook('message_read', array('uid' => $MESSAGE->uid,
148 151
       'mailbox' => $IMAP->mailbox, 'message' => $MESSAGE));
10  program/steps/settings/func.inc
@@ -258,13 +258,21 @@ function rcmail_user_prefs_block($part, $no_override, $attrib)
258 258
       $table->add(null, $input_inline_images->show($config['inline_images']?1:0));
259 259
     }
260 260
 
  261
+    // "display after delete" checkbox
  262
+    if (!isset($no_override['display_next'])) {
  263
+      $field_id = 'rcmfd_displaynext';
  264
+      $input_displaynext = new html_checkbox(array('name' => '_display_next', 'id' => $field_id, 'value' => 1));
  265
+
  266
+      $table->add('title', html::label($field_id, Q(rcube_label('displaynext'))));
  267
+      $table->add(null, $input_displaynext->show($config['display_next']?1:0));
  268
+    }
  269
+
261 270
     $RCMAIL->plugins->exec_hook('user_preferences', array('section' => $part, 'table' => $table));
262 271
 
263 272
     if ($table->size())
264 273
       $out = html::tag('fieldset', null, html::tag('legend', null, Q(rcube_label('messagesdisplaying'))) . $table->show($attrib));
265 274
     break;
266 275
 
267  
-
268 276
   // Mail composition
269 277
   case 'compose':
270 278
     $table = new html_table(array('cols' => 2));
1  program/steps/settings/save_prefs.inc
@@ -29,6 +29,7 @@ $a_user_prefs = array(
29 29
   'htmleditor'   => isset($_POST['_htmleditor']) ? TRUE : FALSE,
30 30
   'inline_images'   => isset($_POST['_inline_images']) ? TRUE : FALSE,
31 31
   'preview_pane' => isset($_POST['_preview_pane']) ? TRUE : FALSE,
  32
+  'display_next' => isset($_POST['_display_next']) ? TRUE : FALSE,
32 33
   'focus_on_new_message' => isset($_POST['_focus_on_new_message']) ? TRUE : FALSE,
33 34
   'read_when_deleted' => isset($_POST['_read_when_deleted']) ? TRUE : FALSE,
34 35
   'skip_deleted' => isset($_POST['_skip_deleted']) ? TRUE : FALSE,

0 notes on commit e54bb72

Please sign in to comment.
Something went wrong with that request. Please try again.