[Svn] r4397 - trunk/roundcubemail/program/js

trac at roundcube.net trac at roundcube.net
Thu Jan 6 14:49:06 CET 2011


Author: thomasb
Date: 2011-01-06 07:49:06 -0600 (Thu, 06 Jan 2011)
New Revision: 4397

Modified:
   trunk/roundcubemail/program/js/app.js
Log:
Only display one loading message at once

Modified: trunk/roundcubemail/program/js/app.js
===================================================================
--- trunk/roundcubemail/program/js/app.js	2011-01-06 12:41:16 UTC (rev 4396)
+++ trunk/roundcubemail/program/js/app.js	2011-01-06 13:49:06 UTC (rev 4397)
@@ -4521,16 +4521,23 @@
     type = type ? type : 'notice';
 
     var ref = this,
+      key = msg,
       date = new Date(),
       id = type + date.getTime(),
-      timeout = type == 'loading' ? this.env.request_timeout * 1000 : (this.message_time * (type == 'error' || type == 'warning' ? 2 : 1));
+      timeout = this.message_time * (type == 'error' || type == 'warning' ? 2 : 1);
+      
+    if (type == 'loading') {
+      key = 'loading';
+      timeout = this.env.request_timeout * 1000;
+      if (!msg)
+        msg = this.get_label('loading');
+    }
 
-    if (type == 'loading' && !msg)
-      msg = this.get_label('loading');
-
     // The same message is already displayed
-    if (this.messages[msg]) {
-      this.messages[msg].elements.push(id);
+    if (this.messages[key]) {
+      if (this.messages[key].obj)
+        this.messages[key].obj.html(msg);
+      this.messages[key].elements.push(id);
       window.setTimeout(function() { ref.hide_message(id, true); }, timeout);
       return id;
     }
@@ -4540,14 +4547,14 @@
 
     if (type == 'loading') {
       obj.appendTo(cont);
-      this.messages[msg] = {'obj': obj, 'elements': [id]};
+      this.messages[key] = {'obj': obj, 'elements': [id]};
       window.setTimeout(function() { rcmail.hide_message(id); }, timeout);
       return id;
     }
     else {
       obj.appendTo(cont).bind('mousedown', function() { return ref.hide_message(obj, true); });
       window.setTimeout(function() { ref.hide_message(id, true); }, timeout);
-      this.messages[msg] = { 'obj': obj, 'elements': [id] };
+      this.messages[key] = { 'obj': obj, 'elements': [id] };
       return id;
     }
   };

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



More information about the Svn mailing list