diff --git a/config/global.ini.php b/config/global.ini.php index 697b918407397645a4184dc75df6ee2cf0473f9c..7e1f7d54570825d0762af8f5c6b5ed5756a44f92 100644 --- a/config/global.ini.php +++ b/config/global.ini.php @@ -315,6 +315,10 @@ graphs_default_period_to_plot_when_period_range = day ; a view of the current page. The value X can be set here. insight_limit = 300 +; With this option, you can disable the framed mode of the Insight plugin. If set to 1, the Insight session +; will be started in a new tab instead of the iframe. +insight_disable_framed_mode = 0 + [Tracker] ; Piwik uses first party cookies by default. If set to 1, ; the visit ID cookie will be set on the Piwik server domain as well diff --git a/lang/en.php b/lang/en.php index e03b5b9bcb4adc4a7f20d6dfb47f05c33fe56c3c..57e723a84e9b37b4431b24ab4c33eb86ec3637c9 100644 --- a/lang/en.php +++ b/lang/en.php @@ -1804,7 +1804,7 @@ And thank you for using Piwik!', 'Transitions_NoDataForAction' => 'There\'s no data for %s', 'Transitions_NoDataForActionDetails' => 'Either the action had no pageviews during the period %s or it is invalid.', 'Transitions_ErrorBack' => 'Go back to the previous action', - 'Insight_Insight' => 'Insight', + 'Insight_Insight' => 'Page Overlay', 'Insight_Page' => 'Page', 'Insight_MainMetrics' => 'Main metrics', 'Insight_NoData' => 'There is no data for this page during the selected period.', @@ -1815,5 +1815,7 @@ And thank you for using Piwik!', 'Insight_ClicksFromXLinks' => '%1$s clicks from one of %2$s links', 'Insight_Link' => 'Link', 'Insight_OpenNewTab' => 'Open in new tab', - 'Insight_RedirectUrlError' => 'You are attempting to open Insight for the URL "%s". %s None of the URLs from the Piwik settings matches the link. Please add the domain there.' + 'Insight_RedirectUrlError' => 'You are attempting to open Insight for the URL "%s". %s None of the URLs from the Piwik settings matches the link. Please add the domain there.', + 'Insight_Domain' => 'Domain', + 'Insight_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.' ); diff --git a/plugins/Insight/API.php b/plugins/Insight/API.php index 9517b75367b000a5aa217894a44de0da10375fee..d48a7e69be6b7c2e692461ea490daf2f30b57638 100644 --- a/plugins/Insight/API.php +++ b/plugins/Insight/API.php @@ -56,7 +56,13 @@ class Piwik_Insight_API $sitesManager = Piwik_SitesManager_API::getInstance(); $site = $sitesManager->getSiteFromId($idSite); - return Piwik_SitesManager::getTrackerExcludedQueryParameters($site); + try { + return Piwik_SitesManager::getTrackerExcludedQueryParameters($site); + } catch(Exception $e) { + // an exception is thrown when the user has no admin access. + // in this case, we don't handle excluded parameters. + return array(); + } } /** diff --git a/plugins/Insight/Controller.php b/plugins/Insight/Controller.php index 325f01deb3bea74fb95232333f75dc87770c26e7..d35c87eeb70c641f98b85408db31c68bed704323 100644 --- a/plugins/Insight/Controller.php +++ b/plugins/Insight/Controller.php @@ -18,7 +18,12 @@ class Piwik_Insight_Controller extends Piwik_Controller { Piwik::checkUserHasViewAccess($this->idSite); - $view = Piwik_View::factory('index'); + $template = 'index'; + if (Piwik_Config::getInstance()->General['insight_disable_framed_mode']) { + $template = 'index_noframe'; + } + + $view = Piwik_View::factory($template); $view->idSite = $this->idSite; $view->date = Piwik_Common::getRequestVar('date', 'today'); $view->period = Piwik_Common::getRequestVar('period', 'day'); diff --git a/plugins/Insight/Insight.php b/plugins/Insight/Insight.php index 2b0f1e2abd77b87d00f3b675e295483566160217..1e36fd3e873a1c44d49bc7ab5647b71d45590add 100644 --- a/plugins/Insight/Insight.php +++ b/plugins/Insight/Insight.php @@ -45,7 +45,7 @@ class Piwik_Insight extends Piwik_Plugin public function addMenu() { - Piwik_AddMenu('General_Visitors', 'Insight_Insight', + Piwik_AddMenu('Actions_Actions', 'Insight_Insight', array('module' => 'Insight', 'action' => 'index'), $display = true, $order = 60); } diff --git a/plugins/Insight/templates/index.css b/plugins/Insight/templates/index.css index 92eefd7defb82450704154c64785e6b5bc98c23e..eaa114f84a8517042c6796e6fbabdd64e68f188b 100644 --- a/plugins/Insight/templates/index.css +++ b/plugins/Insight/templates/index.css @@ -34,6 +34,17 @@ padding: 0; } +#Insight_Loading { + background: url(../../../themes/default/images/loading-blue.gif) no-repeat center 10px; + float: left; + width: 190px; + position: relative; + clear: left; + padding-top: 35px; + text-align: center; + display: none; +} + #Insight_Sidebar { float: left; width: 200px; @@ -126,4 +137,8 @@ h2.Insight_MainMetrics { body .piwik-tooltip.Insight_Tooltip { font-size: 11px; padding: 3px 5px 3px 6px; +} + +#Insight_NoFrame { + padding: 20px 0 40px 2px } \ No newline at end of file diff --git a/plugins/Insight/templates/index.tpl b/plugins/Insight/templates/index.tpl index 217aa2fbdfdc371c9bbfe5539d318bf565feef43..b85547a40319c04c63e747c6cd6a9b8fb0b366cc 100644 --- a/plugins/Insight/templates/index.tpl +++ b/plugins/Insight/templates/index.tpl @@ -5,6 +5,8 @@ <div id="Insight_Sidebar"></div> + <div id="Insight_Loading">{'General_Loading_js'|translate|escape:'html'}</div> + <div id="Insight_Main"> <iframe id="Insight_Iframe" @@ -17,4 +19,8 @@ <script type="text/javascript"> Piwik_Insight.init(); + + Piwik_Insight_Translations = {literal}{{/literal} + domain: "{'Insight_Domain'|translate|escape:'html'}" + {literal}}{/literal}; </script> \ No newline at end of file diff --git a/plugins/Insight/templates/index_noframe.tpl b/plugins/Insight/templates/index_noframe.tpl new file mode 100644 index 0000000000000000000000000000000000000000..3f8c45c31120d09d0f80bc0d6ead026816c96f14 --- /dev/null +++ b/plugins/Insight/templates/index_noframe.tpl @@ -0,0 +1,13 @@ + +<div id="Insight_NoFrame"> + + {capture name="link"}index.php?module=Insight&action=startInsightSession&idsite={$idSite}&period={$period}&date={$date}{/capture} + {capture name="linkTag"}<a id="Insight_Link" href="{$smarty.capture.link}" target="_blank">{/capture} + + {'Insight_NoFrameModeText'|translate|escape:'html'|sprintf:'<br />':$smarty.capture.linkTag:'</a>'} + + <script type="text/javascript"> + window.open('{$smarty.capture.link}', '_newtab'); + </script> + +</div> \ No newline at end of file diff --git a/plugins/Insight/templates/insight.js b/plugins/Insight/templates/insight.js index 5437d1863e8071ac9c47c30e8ad3582a6673a52f..408030cfc351fd834f26f5c3bfc41bf0b401948a 100644 --- a/plugins/Insight/templates/insight.js +++ b/plugins/Insight/templates/insight.js @@ -1,6 +1,6 @@ var Piwik_Insight = (function() { - var $container, $iframe, $sidebar, $main, $location; + var $container, $iframe, $sidebar, $main, $location, $loading; var isFullScreen = false; @@ -10,8 +10,7 @@ var Piwik_Insight = (function() { function loadSidebar(currentUrl) { $sidebar.hide(); $location.html(' '); - - // TODO show loading message + $loading.show(); iframeDomain = currentUrl.match(/http(s)?:\/\/(www\.)?([^\/]*)/i)[3]; @@ -27,16 +26,17 @@ var Piwik_Insight = (function() { $responseLocation.remove(); $location.find('span').hover(function() { - // TODO translate if (iframeDomain) { // use addBreakpointsToUrl because it also encoded html entities - Piwik_Tooltip.show('<b>Domain:</b> ' + piwikHelper.addBreakpointsToUrl(iframeDomain), 'Insight_Tooltip'); + Piwik_Tooltip.show('<b>' + Piwik_Insight_Translations.domain + ':</b> ' + + piwikHelper.addBreakpointsToUrl(iframeDomain), 'Insight_Tooltip'); } }, function() { Piwik_Tooltip.hide(); }); $sidebar.empty().append($response).show(); + $loading.hide(); var $fullScreen = $sidebar.find('a.Insight_FullScreen'); $fullScreen.click(function() { @@ -84,6 +84,7 @@ var Piwik_Insight = (function() { $sidebar = $('#Insight_Sidebar'); $location = $('#Insight_Location'); $main = $('#Insight_Main'); + $loading = $('#Insight_Loading'); adjustHeight();