diff --git a/ChangeLog b/ChangeLog index 74a36771a..0b9d43eda 100644 --- a/ChangeLog +++ b/ChangeLog @@ -13,6 +13,10 @@ (displayAccountSignature): strips the tags and unescape the HTML to improve readability. + * UI/WebServerResources/MailerUI.js (updateWindowTitle): new + function used to update the window title with respect to the + currently selected mailbox. + 2011-03-20 Wolfgang Sourdeau * OpenChange/MAPIStoreCalendarMessage.m diff --git a/UI/WebServerResources/MailerUI.js b/UI/WebServerResources/MailerUI.js index 713a3c69d..16a27c58f 100644 --- a/UI/WebServerResources/MailerUI.js +++ b/UI/WebServerResources/MailerUI.js @@ -5,6 +5,7 @@ var accounts = []; var mailboxTree; var Mailer = { + defaultWindowTitle: null, currentMailbox: null, currentMailboxType: "", currentMessages: {}, @@ -564,6 +565,7 @@ function onMailboxTreeItemClick(event) { $("messageContent").innerHTML = ''; $("messageCountHeader").childNodes[0].innerHTML = ' '; Mailer.dataTable._emptyTable(); + updateWindowTitle(); } else { var datatype = this.parentNode.getAttribute("datatype"); @@ -572,6 +574,7 @@ function onMailboxTreeItemClick(event) { else toggleAddressColumn("to", "from"); + updateWindowTitle(this.childNodesWithTag("span")[0]); openMailbox(mailbox); } @@ -900,6 +903,8 @@ function updateUnseenCount(node, count, isDelta) { counterSpan.addClassName("hidden"); unseenSpan.removeClassName("unseen"); } + if (node.getAttribute("dataname") == Mailer.currentMailbox) + updateWindowTitle(unseenSpan); } } @@ -917,6 +922,21 @@ function updateMessageListCounter(count, isDelta) { cell.update(_("No message")); } +function updateWindowTitle(span) { + if (!Mailer.defaultWindowTitle) + Mailer.defaultWindowTitle = document.title || "SOGo"; + else if (!span) + document.title = Mailer.defaultWindowTitle; + if (span) { + var title = Mailer.defaultWindowTitle + " - "; + if (span.hasClassName("unseen")) + title += span.innerHTML.stripTags(); + else + title += span.childNodes[0].nodeValue; + document.title = title; + } +} + /* Function is called when the event datatable:rendered is fired from SOGoDataTable. */ function onMessageListRender(event) { // Restore previous selection