From cf1f0f97b23e1d22ee087436edc283da59bfb6ce Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Tue, 05 Feb 2008 16:39:08 -0500
Subject: [PATCH] Applied patch for updating page title (#1484727, #1484650)

---
 CHANGELOG                           |    4 +++-
 program/steps/mail/list.inc         |    6 +++---
 program/include/rcmail_template.inc |   14 ++++++++------
 program/steps/mail/check_recent.inc |    2 +-
 program/steps/mail/getunread.inc    |    2 +-
 program/steps/mail/mark.inc         |    2 +-
 program/steps/mail/move_del.inc     |    2 +-
 7 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 87fd51e..03abaea 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,10 +1,12 @@
 CHANGELOG RoundCube Webmail
 ---------------------------
 
-2008/02/04 (thomasb)
+2008/02/05 (thomasb)
 ----------
 - Fix regular expression for checking e-mail address (#1484710)
 - Make sending of read receipts configurable
+- Respect config when localize folder names (#1484707)
+- Aplied patch for updating page title (#1484727, #1484650)
 
 2008/02/02 (thomasb)
 ----------
diff --git a/program/include/rcmail_template.inc b/program/include/rcmail_template.inc
index cc5a58a..bfc31d3 100644
--- a/program/include/rcmail_template.inc
+++ b/program/include/rcmail_template.inc
@@ -312,6 +312,13 @@
     if (!$this->framed && !empty($this->js_env))
       $out .= ($this->ajax_call ? 'this' : JS_OBJECT_NAME) . '.set_env('.json_serialize($this->js_env).");\n";
     
+    // add command to set page title
+    if ($this->ajax_call && !empty($this->pagetitle))
+      $out .= sprintf(
+        "this.set_pagetitle('%s');\n",
+        JQ((!empty($this->config['product_name']) ? $this->config['product_name'].' :: ' : '') . $this->pagetitle)
+      );
+
     foreach ($this->js_commands as $i => $args)
     {
       $method = array_shift($args);
@@ -326,12 +333,7 @@
         join(',', $args));
     }
     
-    // add command to set page title
-    if ($this->ajax_call && !empty($this->pagetitle))
-      $out .= sprintf(
-        "this.set_pagetitle('%s');\n",
-        JQ((!empty($this->config['product_name']) ? $this->config['product_name'].' :: ' : '') . $this->pagetitle)
-      );
+
     
     return $out;
   }
diff --git a/program/steps/mail/check_recent.inc b/program/steps/mail/check_recent.inc
index a392cd0..3e03016 100644
--- a/program/steps/mail/check_recent.inc
+++ b/program/steps/mail/check_recent.inc
@@ -35,7 +35,7 @@
       $unread_count = $IMAP->messagecount(NULL, 'UNSEEN', TRUE);
 
       $OUTPUT->set_env('messagecount', $IMAP->messagecount());
-      $OUTPUT->command('set_unread_count', $mbox_name, $unread_count, true);
+      $OUTPUT->command('set_unread_count', $mbox_name, $unread_count, ($mbox_name == 'INBOX'));
       $OUTPUT->command('set_rowcount', rcmail_get_messagecount_text());
       $OUTPUT->command('set_quota', $IMAP->get_quota());
 
diff --git a/program/steps/mail/getunread.inc b/program/steps/mail/getunread.inc
index ae12bc2..b94a66b 100644
--- a/program/steps/mail/getunread.inc
+++ b/program/steps/mail/getunread.inc
@@ -24,7 +24,7 @@
 if (!empty($a_folders))
 {
   foreach ($a_folders as $mbox_row)
-    $OUTPUT->command('set_unread_count', $mbox_row, $IMAP->messagecount($mbox_row, 'UNSEEN'));
+    $OUTPUT->command('set_unread_count', $mbox_row, $IMAP->messagecount($mbox_row, 'UNSEEN'), ($IMAP->get_mailbox_name() == 'INBOX' && $mbox_row == 'INBOX'));
 }
 
 $OUTPUT->send();
diff --git a/program/steps/mail/list.inc b/program/steps/mail/list.inc
index 8caf4c0..e2fafc2 100644
--- a/program/steps/mail/list.inc
+++ b/program/steps/mail/list.inc
@@ -52,9 +52,6 @@
 $OUTPUT->set_env('pagecount', $pages);
 $OUTPUT->command('set_rowcount', rcmail_get_messagecount_text($count));
 
-// update mailboxlist
-$OUTPUT->command('set_unread_count', $mbox_name, $unseen);
-
 
 // add message rows
 if (isset($a_headers) && count($a_headers))
@@ -62,6 +59,9 @@
 else
   $OUTPUT->show_message('nomessagesfound', 'notice');
   
+// update mailboxlist
+$OUTPUT->command('set_unread_count', $mbox_name, $unseen, ($mbox_name == 'INBOX'));
+
 // send response
 $OUTPUT->send();
 
diff --git a/program/steps/mail/mark.inc b/program/steps/mail/mark.inc
index 74510ab..53194b5 100644
--- a/program/steps/mail/mark.inc
+++ b/program/steps/mail/mark.inc
@@ -32,7 +32,7 @@
   if ($marked != -1)
   {
     $mbox_name = $IMAP->get_mailbox_name();
-    $OUTPUT->command('set_unread_count', $mbox_name, $IMAP->messagecount($mbox_name, 'UNSEEN'));
+    $OUTPUT->command('set_unread_count', $mbox_name, $IMAP->messagecount($mbox_name, 'UNSEEN'), ($mbox_name == 'INBOX'));
     $OUTPUT->send();
   }
 }
diff --git a/program/steps/mail/move_del.inc b/program/steps/mail/move_del.inc
index c78d6db..b6ec207 100644
--- a/program/steps/mail/move_del.inc
+++ b/program/steps/mail/move_del.inc
@@ -86,7 +86,7 @@
 
 // update mailboxlist
 $mbox = $IMAP->get_mailbox_name();
-$OUTPUT->command('set_unread_count', $mbox, $IMAP->messagecount($mbox, 'UNSEEN'));
+$OUTPUT->command('set_unread_count', $mbox, $IMAP->messagecount($mbox, 'UNSEEN'), ($mbox == 'INBOX'));
 
 if ($_action=='moveto' && $target)
   $OUTPUT->command('set_unread_count', $target, $IMAP->messagecount($target, 'UNSEEN'));

--
Gitblit v1.9.1