Removing support for dhtmlHistory in dimp.
authorMichael M Slusarz <slusarz@curecanti.org>
Wed, 18 Nov 2009 05:42:29 +0000 (22:42 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Wed, 18 Nov 2009 05:44:03 +0000 (22:44 -0700)
It is just too much work to try to maintain - (the original code base
hasn't been touched/updated for 2+ years) and it doesn't work
properly with all current browsers, let alone with previous browsers.
Keep the most important part of the code - allowing to link to
messages/folders - but axe the rest.

imp/index-dimp.php
imp/js/DimpBase.js
imp/js/DimpCore.js

index da85be9..9474b15 100644 (file)
@@ -20,7 +20,6 @@ $scripts = array(
     array('DimpBase.js', 'imp'),
     array('DimpSlider.js', 'imp'),
     array('ViewPort.js', 'imp'),
-    array('dhtmlHistory.js', 'horde'),
     array('dialog.js', 'imp'),
     array('dragdrop2.js', 'horde'),
     array('imp.js', 'imp'),
index 52e129f..5c78ea7 100644 (file)
@@ -230,7 +230,7 @@ var DimpBase = {
 
                 // This catches the refresh case - no need to re-add to history
                 if (!Object.isUndefined(this.folder) && !this.search) {
-                    this._addHistory(loc);
+                    location.hash = escape(loc);
                 }
             }
 
@@ -250,7 +250,7 @@ var DimpBase = {
                 return;
             }
             this.highlightSidebar('app' + app);
-            this._addHistory(loc, data);
+            location.hash = escape(loc);
             if (data) {
                 this.iframeContent(loc, data);
             } else if (DIMP.conf.app_urls[app]) {
@@ -273,7 +273,7 @@ var DimpBase = {
 
         case 'portal':
             this.highlightSidebar('appportal');
-            this._addHistory(loc);
+            location.hash = escape(loc);
             DimpCore.setTitle(DIMP.text.portal);
             DimpCore.doAction('ShowPortal', {}, { callback: this._portalCallback.bind(this) });
             break;
@@ -286,13 +286,6 @@ var DimpBase = {
         }
     },
 
-    _addHistory: function(loc, data)
-    {
-        if (Horde.dhtmlHistory.getCurrentLocation() != loc) {
-            Horde.dhtmlHistory.add(loc, data);
-        }
-    },
-
     highlightSidebar: function(id)
     {
         // Folder bar may not be fully loaded yet.
@@ -1199,7 +1192,7 @@ var DimpBase = {
             eval(r.js.join(';'));
         }
 
-        this._addHistory('msg:' + row.view + ':' + row.imapuid);
+        location.hash = escape('msg:' + row.view + ':' + row.imapuid);
     },
 
     // opts = mailbox, uid
@@ -2616,7 +2609,7 @@ var DimpBase = {
     {
         DimpCore.init();
 
-        var DM = DimpCore.DMenu;
+        var DM = DimpCore.DMenu, tmp;
 
         /* Register global handlers now. */
         document.observe('keydown', this.keydownHandler.bindAsEventListener(this));
@@ -2647,21 +2640,18 @@ var DimpBase = {
             DM.addSubMenu('ctx_qsearchopts_filternot', 'ctx_flag');
         }
 
-        /* Start message list loading as soon as possible. */
-        if (Horde.dhtmlHistory.initialize()) {
-            Horde.dhtmlHistory.addListener(this.go.bind(this));
+        /* Initialize the starting page. */
+        tmp = location.hash;
+        if (!tmp.empty() && tmp.startsWith('#')) {
+            tmp = (tmp.length == 1) ? "" : tmp.substring(1);
         }
-
-        /* Initialize the starting page if necessary. addListener() will have
-         * already fired if there is a current location so only do a go()
-         * call if there is no current location. */
-        if (!Horde.dhtmlHistory.getCurrentLocation()) {
-            if (DIMP.conf.login_view == 'inbox') {
-                this.go('folder:INBOX');
-            } else {
-                this.go('portal');
-                this.loadMailbox('INBOX', { background: true });
-            }
+        if (!tmp.empty()) {
+            this.go(unescape(tmp));
+        } else if (DIMP.conf.login_view == 'inbox') {
+            this.go('folder:INBOX');
+        } else {
+            this.go('portal');
+            this.loadMailbox('INBOX', { background: true });
         }
 
         this._setQsearchText(true);
index 005f880..876f85b 100644 (file)
@@ -274,15 +274,11 @@ var DimpCore = {
     {
         var ptr = parent.frames.horde_main ? parent : window;
 
-        if (Horde.dhtmlHistory) {
-            Horde.dhtmlHistory.stop();
-        }
-
         ptr.location.assign(this.addURLParam(url));
 
         // Catch browsers that don't redirect on assign().
         if (force && !Prototype.Browser.WebKit) {
-            (function() { ptr.location.reload(); }).delay(0.4);
+            (function() { ptr.location.reload(); }).delay(0.5);
         }
     },