From 85360dc8df13c9641301f0b40b1ecf00d3c1e966 Mon Sep 17 00:00:00 2001 From: thomascube Date: Fri, 29 Aug 2008 14:10:18 +0000 Subject: Fix unread count display: save counts in list, use the right vars --- program/js/app.js | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/program/js/app.js b/program/js/app.js index 4ed67cbc0..6b475ce35 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -230,6 +230,7 @@ function rcube_webmail() // get unread count for each mailbox if (this.gui_objects.mailboxlist) { + this.env.unread_counts = {}; this.gui_objects.folderlist = this.gui_objects.mailboxlist; this.http_request('getunread', ''); } @@ -3484,22 +3485,18 @@ function rcube_webmail() if (!this.gui_objects.mailboxlist) return false; - var reg, text_obj, item; - if (item = this.get_folder_li(mbox)) - { - item.setAttribute('count', count); - this.set_unread_count_display(mbox, set_title); - } + this.env.unread_counts[mbox] = count; + this.set_unread_count_display(mbox, set_title); } // update the mailbox count display this.set_unread_count_display = function(mbox, set_title) { - var reg, text_obj, item, mycount, childcount, div, children; + var reg, text_obj, item, mycount, childcount, div; if (item = this.get_folder_li(mbox)) { - mycount = parseInt(item.getAttribute('count') ? item.getAttribute('count') : 0); + mycount = this.env.unread_counts[mbox]; text_obj = item.getElementsByTagName('a')[0]; reg = /\s+\([0-9]+\)$/i; @@ -3508,9 +3505,10 @@ function rcube_webmail() div.className.match(/collapsed/)) { // add children's counters - children = item.getElementsByTagName('li'); - for (var i=0; i