From ac5d15de2946cbd8988c11de0f218aeb1acf58dc Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Thu, 14 Aug 2008 07:27:16 -0400
Subject: [PATCH] Added template object for current mailbox name (#1485256)

---
 CHANGELOG                   |    5 +++++
 program/steps/mail/list.inc |    2 ++
 program/steps/mail/func.inc |   22 ++++++++++++++++++++++
 program/steps/mail/show.inc |    1 +
 program/js/app.js           |    7 +++++++
 5 files changed, 37 insertions(+), 0 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index fad40f2..d03e017 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,11 @@
 CHANGELOG RoundCube Webmail
 ---------------------------
 
+2008/08/14 (thomasb)
+----------
+- Use current mailbox name in template (#1485256)
+- Better fix for skipping untagged responses (#1485261)
+
 2008/08/09 (alec)
 ----------
 - Case insensitive contacts searching using PostgreSQL (#1485259)
diff --git a/program/js/app.js b/program/js/app.js
index 58d1175..998efd7 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -3409,6 +3409,13 @@
     };
 
 
+  // replace content of mailboxname display
+  this.set_mailboxname = function(content)
+    {
+    if (this.gui_objects.mailboxname && content)
+      this.gui_objects.mailboxname.innerHTML = content;
+    };
+
   // replace content of quota display
   this.set_quota = function(content)
     {
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index 7a986c1..a408111 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -529,6 +529,27 @@
   return Q($out);
   }
 
+/**
+ *
+ */
+function rcmail_mailbox_name_display($attrib)
+{
+    global $RCMAIL;
+
+    if (!$attrib['id'])
+        $attrib['id'] = 'rcmmailboxname';
+
+    $RCMAIL->output->add_gui_object('mailboxname', $attrib['id']);
+
+    return html::span($attrib, rcmail_get_mailbox_name_text());
+}
+
+function rcmail_get_mailbox_name_text()
+{
+    global $RCMAIL;
+    return rcmail_localize_foldername($RCMAIL->imap->get_mailbox_name());
+}
+
 
 /**
  * Convert the given message part to proper HTML
@@ -1179,6 +1200,7 @@
   'messages' => 'rcmail_message_list',
   'messagecountdisplay' => 'rcmail_messagecount_display',
   'quotadisplay' => 'rcmail_quota_display',
+  'mailboxname' => 'rcmail_mailbox_name_display',
   'messageheaders' => 'rcmail_message_headers',
   'messagebody' => 'rcmail_message_body',
   'messagecontentframe' => 'rcmail_messagecontent_frame',
diff --git a/program/steps/mail/list.inc b/program/steps/mail/list.inc
index e2fafc2..e09919c 100644
--- a/program/steps/mail/list.inc
+++ b/program/steps/mail/list.inc
@@ -51,6 +51,8 @@
 $OUTPUT->set_env('messagecount', $count);
 $OUTPUT->set_env('pagecount', $pages);
 $OUTPUT->command('set_rowcount', rcmail_get_messagecount_text($count));
+$OUTPUT->command('set_mailboxname', rcmail_get_mailbox_name_text());
+
 
 
 // add message rows
diff --git a/program/steps/mail/show.inc b/program/steps/mail/show.inc
index ef88c7b..4256458 100644
--- a/program/steps/mail/show.inc
+++ b/program/steps/mail/show.inc
@@ -194,6 +194,7 @@
 
 $OUTPUT->add_handlers(array(
   'messageattachments' => 'rcmail_message_attachments',
+  'mailboxname' => 'rcmail_mailbox_name_display',
   'blockedobjects' => 'rcmail_remote_objects_msg'));
 
 

--
Gitblit v1.9.1