Title setting tweaks.
authorMichael M Slusarz <slusarz@curecanti.org>
Wed, 8 Sep 2010 05:59:52 +0000 (23:59 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Wed, 8 Sep 2010 16:52:22 +0000 (10:52 -0600)
Don't use escaped mailbox name for window title - since it is not HTML
code, it doesn't need to be escaped.
Don't continually defer setTitle() if mailbox does not exist on remote
server.

imp/js/dimpbase.js
imp/lib/Ajax/Application.php

index 060749e..75e85b5 100644 (file)
@@ -554,7 +554,7 @@ var DimpBase = {
             if (!this.isSearch()) {
                 this.setFolderLabel(this.folder, this.viewport.getMetaData('unseen') || 0);
             }
-            this.updateTitle();
+            this.updateTitle(this.viewport.getMetaData('noexist'));
 
             if (this.rownum) {
                 this.viewport.select(this.viewport.createSelection('rownum', this.rownum));
@@ -986,10 +986,13 @@ var DimpBase = {
         }
     },
 
-    updateTitle: function()
+    // nodefer - (boolean) If true, don't defer updating if folder element
+    //           does not exist.
+    updateTitle: function(nodefer)
     {
         var elt, unseen,
-            label = this.viewport.getMetaData('label');
+            // Label is HTML encoded - but this is not HTML code so unescape.
+            label = this.viewport.getMetaData('label').unescapeHTML();
 
         if (this.isSearch(null, true)) {
             label += ' (' + this.search.label + ')';
@@ -1000,10 +1003,11 @@ var DimpBase = {
                 if (unseen > 0) {
                     label += ' (' + unseen + ')';
                 }
-            } else {
+            } else if (!nodefer) {
                 this.updateTitle.bind(this).defer();
             }
         }
+
         DimpCore.setTitle(label);
     },
 
index da89dd2..b7a3209 100644 (file)
@@ -575,6 +575,8 @@ class IMP_Ajax_Application extends Horde_Core_Ajax_Application
             if (!is_null($req_id)) {
                 $result->ViewPort->requestid = intval($req_id);
             }
+
+            $result->ViewPort->metadata->noexist = 1;
         } elseif ($changed ||
                   $this->_vars->rangeslice ||
                   !$this->_vars->checkcache) {