[Svn] r4179 - in trunk/roundcubemail: . program/js program/steps/mail

trac at roundcube.net trac at roundcube.net
Thu Nov 4 14:48:17 CET 2010


Author: alec
Date: 2010-11-04 08:48:17 -0500 (Thu, 04 Nov 2010)
New Revision: 4179

Added:
   trunk/roundcubemail/program/steps/mail/pagenav.inc
Modified:
   trunk/roundcubemail/CHANGELOG
   trunk/roundcubemail/program/js/app.js
   trunk/roundcubemail/program/steps/mail/func.inc
   trunk/roundcubemail/program/steps/mail/show.inc
Log:
- Improve responsiveness of messages displaying (#1486986)


Modified: trunk/roundcubemail/CHANGELOG
===================================================================
--- trunk/roundcubemail/CHANGELOG	2010-11-04 13:05:29 UTC (rev 4178)
+++ trunk/roundcubemail/CHANGELOG	2010-11-04 13:48:17 UTC (rev 4179)
@@ -62,6 +62,7 @@
 - Add option to place replies in the folder of the message being replied to (#1485945)
 - Add missing confirmation/error messages on contact/group/message actions (#1486845)
 - Add 'loading' message on message move/copy/delete/mark actions
+- Improve responsiveness of messages displaying (#1486986)
 
 RELEASE 0.4.2
 -------------

Modified: trunk/roundcubemail/program/js/app.js
===================================================================
--- trunk/roundcubemail/program/js/app.js	2010-11-04 13:05:29 UTC (rev 4178)
+++ trunk/roundcubemail/program/js/app.js	2010-11-04 13:48:17 UTC (rev 4179)
@@ -210,12 +210,10 @@
           this.enable_command(this.env.message_commands, this.env.uid);
           this.enable_command('reply-list', this.env.list_post);
 
-          if (this.env.next_uid) {
-            this.enable_command('nextmessage', 'lastmessage', true);
+          if (this.env.action == 'show') {
+            this.http_request('pagenav', '_uid='+this.env.uid+'&_mbox='+urlencode(this.env.mailbox),
+              this.display_message('', 'loading'));
           }
-          if (this.env.prev_uid) {
-            this.enable_command('previousmessage', 'firstmessage', true);
-          }
 
           if (this.env.blockedobjects) {
             if (this.gui_objects.remoteobjectsmsg)
@@ -4595,10 +4593,15 @@
     var date = new Date(),
       id = type + date.getTime();
 
-    // The same message of type 'loading' is already displayed
-    if (type == 'loading' && this.messages[msg]) {
-       this.messages[msg].elements.push(id);
-       return id;
+    if (type == 'loading') {
+      if (!msg)
+        msg = this.get_label('loading');
+
+      // The same message of type 'loading' is already displayed
+      if (this.messages[msg]) {
+        this.messages[msg].elements.push(id);
+        return id;
+      }
     }
 
     var ref = this,

Modified: trunk/roundcubemail/program/steps/mail/func.inc
===================================================================
--- trunk/roundcubemail/program/steps/mail/func.inc	2010-11-04 13:05:29 UTC (rev 4178)
+++ trunk/roundcubemail/program/steps/mail/func.inc	2010-11-04 13:48:17 UTC (rev 4179)
@@ -423,14 +423,16 @@
 
 function rcmail_messagecount_display($attrib)
   {
-  global $IMAP, $OUTPUT;
+  global $RCMAIL;
 
   if (!$attrib['id'])
     $attrib['id'] = 'rcmcountdisplay';
 
-  $OUTPUT->add_gui_object('countdisplay', $attrib['id']);
+  $RCMAIL->output->add_gui_object('countdisplay', $attrib['id']);
 
-  return html::span($attrib, rcmail_get_messagecount_text());
+  $content =  $RCMAIL->action != 'show' ? rcmail_get_messagecount_text() : rcube_label('loading');
+
+  return html::span($attrib, $content);
   }
 
 
@@ -495,15 +497,8 @@
 
 function rcmail_get_messagecount_text($count=NULL, $page=NULL)
   {
-  global $RCMAIL, $IMAP, $MESSAGE;
+  global $RCMAIL, $IMAP;
 
-  if (isset($MESSAGE->index))
-    {
-    return rcube_label(array('name' => 'messagenrof',
-        'vars' => array('nr'  => $MESSAGE->index+1,
-        'count' => $count!==NULL ? $count : $IMAP->messagecount(NULL, 'ALL')))); // Only messages, no threads here
-    }
-
   if ($page===NULL)
     $page = $IMAP->list_page;
 

Added: trunk/roundcubemail/program/steps/mail/pagenav.inc
===================================================================
--- trunk/roundcubemail/program/steps/mail/pagenav.inc	                        (rev 0)
+++ trunk/roundcubemail/program/steps/mail/pagenav.inc	2010-11-04 13:48:17 UTC (rev 4179)
@@ -0,0 +1,74 @@
+<?php
+
+/*
+ +-----------------------------------------------------------------------+
+ | program/steps/mail/pagenav.inc                                        |
+ |                                                                       |
+ | This file is part of the Roundcube Webmail client                     |
+ | Copyright (C) 2005-2009, Roundcube Dev. - Switzerland                 |
+ | Licensed under the GNU GPL                                            |
+ |                                                                       |
+ | PURPOSE:                                                              |
+ |   Updates message page navigation controls                            |
+ |                                                                       |
+ +-----------------------------------------------------------------------+
+ | Author: Aleksander Machniak <alec at alec.pl>                            |
+ +-----------------------------------------------------------------------+
+
+ $Id: show.inc 4176 2010-11-04 09:59:55Z alec $
+
+*/
+
+$uid = get_input_value('_uid', RCUBE_INPUT_GET);
+$cnt  = $IMAP->messagecount(NULL, 'ALL'); // Only messages, no threads here
+
+if ($_SESSION['sort_col'] == 'date' && $_SESSION['sort_order'] != 'DESC'
+    && empty($_REQUEST['_search']) && !$CONFIG['skip_deleted'] && !$IMAP->threading
+) {
+    // this assumes that we are sorted by date_DESC
+    $seq   = $IMAP->get_id($uid);
+    $index = $cnt - $seq;
+
+    $prev  = $IMAP->get_uid($seq + 1);
+    $first = $IMAP->get_uid($cnt);
+    $next  = $IMAP->get_uid($seq - 1);
+    $last  = $IMAP->get_uid(1);
+}
+else {
+    // Only if we use custom sorting
+    $a_msg_index = $IMAP->message_index(NULL, $_SESSION['sort_col'], $_SESSION['sort_order']);
+
+    $index = array_search($IMAP->get_id($uid), $a_msg_index);
+
+    $count = count($a_msg_index);
+    $prev  = isset($a_msg_index[$index-1]) ? $IMAP->get_uid($a_msg_index[$index-1]) : -1;
+    $first = $count > 1 ? $IMAP->get_uid($a_msg_index[0]) : -1;
+    $next  = isset($a_msg_index[$index+1]) ? $IMAP->get_uid($a_msg_index[$index+1]) : -1;
+    $last  = $count > 1 ? $IMAP->get_uid($a_msg_index[$count-1]) : -1;
+}
+
+// Set UIDs and activate navigation buttons
+if ($prev > 0) {
+    $OUTPUT->set_env('prev_uid', $prev);
+    $OUTPUT->command('enable_command', 'previousmessage', 'firstmessage', true);
+}
+if ($next > 0) {
+    $OUTPUT->set_env('next_uid', $next);
+    $OUTPUT->command('enable_command', 'nextmessage', 'lastmessage', true);
+}
+if ($first > 0)
+    $OUTPUT->set_env('first_uid', $first);
+if ($last > 0)
+    $OUTPUT->set_env('last_uid', $last);
+
+// Don't need a real messages count value
+$OUTPUT->set_env('messagecount', 1);
+
+// Set rowcount text
+$OUTPUT->command('set_rowcount', rcube_label(array(
+    'name' => 'messagenrof',
+    'vars' => array('nr'  => $index+1, 'count' => $cnt)
+)));
+
+$OUTPUT->send();
+

Modified: trunk/roundcubemail/program/steps/mail/show.inc
===================================================================
--- trunk/roundcubemail/program/steps/mail/show.inc	2010-11-04 13:05:29 UTC (rev 4178)
+++ trunk/roundcubemail/program/steps/mail/show.inc	2010-11-04 13:48:17 UTC (rev 4179)
@@ -94,51 +94,6 @@
     }
   }
 
-  // get previous, first, next and last message UID
-  if ($RCMAIL->action != 'preview' && $RCMAIL->action != 'print')
-    {
-    $next = $prev = $first = $last = -1;
-
-    if ($_SESSION['sort_col'] == 'date' && $_SESSION['sort_order'] != 'DESC'
-        && empty($_REQUEST['_search']) && !$CONFIG['skip_deleted'] && !$IMAP->threading)
-      {
-      // this assumes that we are sorted by date_DESC
-      $cnt = $IMAP->messagecount();
-      $seq = $IMAP->get_id($MESSAGE->uid);
-      $MESSAGE->index = $cnt - $seq;
-
-      $prev = $IMAP->get_uid($seq + 1);
-      $first = $IMAP->get_uid($cnt);
-      $next = $IMAP->get_uid($seq - 1);
-      $last = $IMAP->get_uid(1);
-      }
-    else 
-      {
-      // Only if we use custom sorting
-      $a_msg_index = $IMAP->message_index(NULL, $_SESSION['sort_col'], $_SESSION['sort_order']);
-
-      $MESSAGE->index = array_search($IMAP->get_id($MESSAGE->uid), $a_msg_index);
-
-      $count = count($a_msg_index);
-      $prev = isset($a_msg_index[$MESSAGE->index-1]) ? $IMAP->get_uid($a_msg_index[$MESSAGE->index-1]) : -1;
-      $first = $count > 1 ? $IMAP->get_uid($a_msg_index[0]) : -1;
-      $next = isset($a_msg_index[$MESSAGE->index+1]) ? $IMAP->get_uid($a_msg_index[$MESSAGE->index+1]) : -1;
-      $last = $count > 1 ? $IMAP->get_uid($a_msg_index[$count-1]) : -1;
-      }
-
-    if ($prev > 0)
-      $OUTPUT->set_env('prev_uid', $prev);
-    if ($first > 0)
-      $OUTPUT->set_env('first_uid', $first);
-    if ($next > 0)
-      $OUTPUT->set_env('next_uid', $next);
-    if ($last > 0)
-      $OUTPUT->set_env('last_uid', $last);
-
-    // Don't need a real messages count value
-    $OUTPUT->set_env('messagecount', 1);
-    }
-
   if (!$MESSAGE->headers->seen && ($RCMAIL->action == 'show' || ($RCMAIL->action == 'preview' && intval($CONFIG['preview_pane_mark_read']) == 0)))
     $RCMAIL->plugins->exec_hook('message_read', array('uid' => $MESSAGE->uid,
       'mailbox' => $mbox_name, 'message' => $MESSAGE));

_______________________________________________
http://lists.roundcube.net/mailman/listinfo/svn



More information about the Svn mailing list