From 8458c7ca0e787db4a04fb1a6264e15153fd173b3 Mon Sep 17 00:00:00 2001 From: thomascube <thomas@roundcube.net> Date: Sun, 23 Jan 2011 13:10:40 -0500 Subject: [PATCH] When creating a new contact, add it to the selected group; consider the selected group when deleting a contact --- program/js/app.js | 20 ++++++++++++-------- 1 files changed, 12 insertions(+), 8 deletions(-) diff --git a/program/js/app.js b/program/js/app.js index e78ac27..1c8c4c3 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -3766,6 +3766,9 @@ this.show_contentframe(false); } + if (this.env.group) + qs += '&_gid='+urlencode(this.env.group); + // also send search request to get the right records from the next page if (this.env.search_request) qs += '&_search='+this.env.search_request; @@ -4914,11 +4917,14 @@ // update the mailbox count display this.set_unread_count_display = function(mbox, set_title) { - var reg, text_obj, item, mycount, childcount, div; + var reg, link, text_obj, item, mycount, childcount, div; if (item = this.get_folder_li(mbox)) { mycount = this.env.unread_counts[mbox] ? this.env.unread_counts[mbox] : 0; - text_obj = item.getElementsByTagName('a')[0]; + link = $(item).children('a').eq(0); + text_obj = link.children('span.unreadcount'); + if (!text_obj.length && mycount) + text_obj = $('<span>').addClass('unreadcount').appendTo(link); reg = /\s+\([0-9]+\)$/i; childcount = 0; @@ -4930,12 +4936,10 @@ childcount += this.env.unread_counts[k]; } - if (mycount && text_obj.innerHTML.match(reg)) - text_obj.innerHTML = text_obj.innerHTML.replace(reg, ' ('+mycount+')'); - else if (mycount) - text_obj.innerHTML += ' ('+mycount+')'; - else - text_obj.innerHTML = text_obj.innerHTML.replace(reg, ''); + if (mycount && text_obj.length) + text_obj.html(' ('+mycount+')'); + else if (text_obj.length) + text_obj.remove(); // set parent's display reg = new RegExp(RegExp.escape(this.env.delimiter) + '[^' + RegExp.escape(this.env.delimiter) + ']+$'); -- Gitblit v1.9.1