From: Jan Schneider Date: Tue, 27 Apr 2010 13:12:40 +0000 (+0200) Subject: Reload page after changing options. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=ba43537d1d4e09b1604e3b6317c1742f0420b91f;p=horde.git Reload page after changing options. --- diff --git a/kronolith/js/kronolith.js b/kronolith/js/kronolith.js index d4775ff08..2449a8593 100644 --- a/kronolith/js/kronolith.js +++ b/kronolith/js/kronolith.js @@ -27,6 +27,7 @@ KronolithCore = { loading: 0, fbLoading: 0, redBoxLoading: false, + inOptions: false, date: Date.today(), tasktype: 'incomplete', growls: 0, @@ -238,33 +239,33 @@ KronolithCore = { this.redirect(Kronolith.conf.URI_AJAX + 'logOut'); }, - redirect: function(url) + redirect: function(url, force) { - url = this.addSID(url); - if (parent.frames.horde_main) { - parent.location = url; - } else { - window.location = url; - } - }, + var ptr = parent.frames.horde_main ? parent : window; - addSID: function(url) - { - if (!Kronolith.conf.SESSION_ID) { - return url; + 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.5); } - return this.addURLParam(url, Kronolith.conf.SESSION_ID.toQueryParams()); }, addURLParam: function(url, params) { var q = url.indexOf('?'); + params = $H(params); + + if (Kronolith.conf.SESSION_ID) { + params.update(Kronolith.conf.SESSION_ID.toQueryParams()); + } if (q != -1) { - params = $H(url.toQueryParams()).merge(params).toObject(); + params.update(url.toQueryParams()); url = url.substring(0, q); } - return url + '?' + Object.toQueryString(params); + + return params.size() ? (url + '?' + params.toQueryString()) : url; }, go: function(fullloc, data) @@ -272,6 +273,11 @@ KronolithCore = { var locParts = fullloc.split(':'); var loc = locParts.shift(); + if (this.inOptions && loc != 'options') { + this.redirect(window.location.href.sub(window.location.hash, '#' + fullloc), true); + return; + } + switch (loc) { case 'day': case 'week': @@ -489,6 +495,7 @@ KronolithCore = { if (data) { url += (url.include('?') ? '&' : '?') + $H(data).toQueryString(); } + this.inOptions = true; this.closeView('iframe'); this.iframeContent(url); this.setTitle(Kronolith.text.prefs);