diff options
-rw-r--r-- | lang/en.php | 6 | ||||
-rw-r--r-- | plugins/CoreHome/templates/broadcast.js | 8 | ||||
-rw-r--r-- | plugins/Overlay/Controller.php | 24 | ||||
-rw-r--r-- | plugins/Overlay/templates/index.css | 13 | ||||
-rw-r--r-- | plugins/Overlay/templates/index.js | 16 | ||||
-rw-r--r-- | plugins/Overlay/templates/index.tpl | 16 |
6 files changed, 73 insertions, 10 deletions
diff --git a/lang/en.php b/lang/en.php index e362577ab3..20fb553bec 100644 --- a/lang/en.php +++ b/lang/en.php @@ -1820,5 +1820,9 @@ And thank you for using Piwik!', 'Overlay_OpenNewTab' => 'Open Overlay in new tab', 'Overlay_RedirectUrlError' => 'You are attempting to open Page Overlay for the URL "%s". %s None of the URLs from the Piwik settings matches the link. Please add the domain there.', 'Overlay_Domain' => 'Domain', - 'Overlay_NoFrameModeText' => 'The page overlay session will be launched in a new tab. %s If opening the tab doesn\'t work automatically, please %sclick here%s.' + 'Overlay_NoFrameModeText' => 'The page overlay session will be launched in a new tab. %s If opening the tab doesn\'t work automatically, please %sclick here%s.', + 'Overlay_ErrorNotLoading' => 'The Page Overlay session couldn\'t be launched yet.', + 'Overlay_ErrorNotLoadingDetails' => 'Maybe the page loaded on the right doesn\'t have the Piwik tracker code. In this case, try launching Overlay for a different page from the pages report.', + 'Overlay_ErrorNotLoadingDetailsSSL' => 'Since you\'re using Piwik over https, the most likely cause is that your website doesn\'t support SSL. Try using Piwik over http.', + 'Overlay_ErrorNotLoadingLink' => 'Click here to get more tips for troubleshooting', ); diff --git a/plugins/CoreHome/templates/broadcast.js b/plugins/CoreHome/templates/broadcast.js index 4d7c695d42..e38a399ac0 100644 --- a/plugins/CoreHome/templates/broadcast.js +++ b/plugins/CoreHome/templates/broadcast.js @@ -183,6 +183,9 @@ var broadcast = { // available in global scope var currentHashStr = broadcast.getHash(); + // remove overlayUrl: the parameter should never be there unless it is set in the ajaxUrl parameter + currentHashStr = broadcast.updateParamValue('overlayUrl=', currentHashStr); + ajaxUrl = ajaxUrl.replace(/^\?|&#/,''); var params_vals = ajaxUrl.split("&"); @@ -204,11 +207,6 @@ var broadcast = { { currentHashStr = broadcast.updateParamValue('idDashboard=', currentHashStr); } - // unset overlayUrl if use doesn't display a page overlay - if( module != 'Overlay') - { - currentHashStr = broadcast.updateParamValue('overlayUrl=', currentHashStr); - } if (disableHistory) { diff --git a/plugins/Overlay/Controller.php b/plugins/Overlay/Controller.php index 74bd9c87dd..45839e0da0 100644 --- a/plugins/Overlay/Controller.php +++ b/plugins/Overlay/Controller.php @@ -4,7 +4,7 @@ * * @link http://piwik.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - * @version $Id$ + * @version $Id: Controller.php 7446 2012-11-12 09:16:00Z EZdesign $ * * @category Piwik_Plugins * @package Piwik_Overlay @@ -35,6 +35,8 @@ class Piwik_Overlay_Controller extends Piwik_Controller $url = urldecode(str_replace('$', '%', $url)); $view->targetUrl = $url; + $view->ssl = $this->usingSsl(); + echo $view->render(); } @@ -132,6 +134,14 @@ class Piwik_Overlay_Controller extends Piwik_Controller echo ' <script type="text/javascript"> + function handleProtocol(url) { + if (' . ($this->usingSsl() ? 'true' : 'false') . ') { + return url.replace(/http:\/\//i, "https://"); + } else { + return url.replace(/https:\/\//i, "http://"); + } + } + function removeUrlPrefix(url) { return url.replace(/http(s)?:\/\/(www\.)?/i, ""); } @@ -151,7 +161,7 @@ class Piwik_Overlay_Controller extends Piwik_Controller var testUrl = removeUrlPrefix(knownUrls[i]); if (urlToRedirectWithoutPrefix.substr(0, testUrl.length) == testUrl) { match = true; - window.location.href = urlToRedirect; + window.location.href = handleProtocol(urlToRedirect); break; } } @@ -164,7 +174,7 @@ class Piwik_Overlay_Controller extends Piwik_Controller } } else { - window.location.href = "'.$site['main_url'].'"; + window.location.href = handleProtocol("'.$site['main_url'].'"); }; </script> '; @@ -184,4 +194,12 @@ class Piwik_Overlay_Controller extends Piwik_Controller echo $view->render(); } + /** + * Detect whether Piwik is used over SSL + */ + private function usingSsl() + { + return isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] && $_SERVER['HTTPS'] !== 'off'; + } + } diff --git a/plugins/Overlay/templates/index.css b/plugins/Overlay/templates/index.css index 1e477e6b99..2135e39015 100644 --- a/plugins/Overlay/templates/index.css +++ b/plugins/Overlay/templates/index.css @@ -141,4 +141,17 @@ body .piwik-tooltip.Overlay_Tooltip { #Overlay_NoFrame { padding: 20px 0 40px 2px +} + +#Overlay_Error_NotLoading { + float: left; + width: 190px; + position: relative; + clear: left; + display: none; +} + +#Overlay_Error_NotLoading span { + color: #E87500; + font-weight: bold; }
\ No newline at end of file diff --git a/plugins/Overlay/templates/index.js b/plugins/Overlay/templates/index.js index a9a6f0ba8d..60e3bd8441 100644 --- a/plugins/Overlay/templates/index.js +++ b/plugins/Overlay/templates/index.js @@ -1,11 +1,13 @@ var Piwik_Overlay = (function() { - var $container, $iframe, $sidebar, $main, $location, $loading; + var $container, $iframe, $sidebar, $main, $location, $loading, $errorNotLoading; var isFullScreen = false; var iframeDomain = ''; + var errorTimeout; + /** Load the sidebar for a url */ function loadSidebar(currentUrl) { $sidebar.hide(); @@ -85,9 +87,12 @@ var Piwik_Overlay = (function() { $location = $('#Overlay_Location'); $main = $('#Overlay_Main'); $loading = $('#Overlay_Loading'); + $errorNotLoading = $('#Overlay_Error_NotLoading'); adjustHeight(); + $loading.show(); + window.setTimeout(function() { // sometimes the frame is too high at first adjustHeight(); @@ -97,10 +102,19 @@ var Piwik_Overlay = (function() { $(window).resize(function() { adjustHeight(); }); + + errorTimeout = window.setTimeout(function() { + $loading.hide(); + $errorNotLoading.show(); + }, 8000); }, /** This callback is used from within the iframe */ setCurrentUrl: function(currentUrl) { + window.clearTimeout(errorTimeout); + $loading.show(); + $errorNotLoading.hide(); + // put the current iframe url in the main url to enable refresh and deep linking. // to prevent browsers from braking the encoding, we replace the % with a $. var urlValue = encodeURIComponent(currentUrl).replace(/%/g, '$'); diff --git a/plugins/Overlay/templates/index.tpl b/plugins/Overlay/templates/index.tpl index b9b6222554..d011875161 100644 --- a/plugins/Overlay/templates/index.tpl +++ b/plugins/Overlay/templates/index.tpl @@ -5,6 +5,22 @@ <div id="Overlay_Sidebar"></div> + <div id="Overlay_Error_NotLoading"> + <p> + <span>{'Overlay_ErrorNotLoading'|translate|escape:'html'}</span> + </p> + <p> + {if $ssl} + {'Overlay_ErrorNotLoadingDetailsSSL'|translate|escape:'html'} + {else} + {'Overlay_ErrorNotLoadingDetails'|translate|escape:'html'} + {/if} + </p> + <p> + <a href="#">{'Overlay_ErrorNotLoadingLink'|translate|escape:'html'}</a> + </p> + </div> + <div id="Overlay_Loading">{'General_Loading_js'|translate|escape:'html'}</div> <div id="Overlay_Main"> |