Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config/global.ini.php3
-rw-r--r--core/ViewDataTable/HtmlTable.php9
-rw-r--r--lang/en.php1
-rw-r--r--plugins/Actions/Controller.php3
-rw-r--r--plugins/CoreHome/templates/broadcast.js9
-rw-r--r--plugins/CoreHome/templates/datatable.js15
-rw-r--r--plugins/Insight/Controller.php4
-rw-r--r--plugins/Insight/client/followingpages.js23
-rw-r--r--plugins/Insight/templates/index.tpl2
-rw-r--r--plugins/Insight/templates/index_noframe.tpl2
10 files changed, 54 insertions, 17 deletions
diff --git a/config/global.ini.php b/config/global.ini.php
index 7e1f7d5457..48e50aaa27 100644
--- a/config/global.ini.php
+++ b/config/global.ini.php
@@ -319,6 +319,9 @@ insight_limit = 300
; will be started in a new tab instead of the iframe.
insight_disable_framed_mode = 0
+; If this option is set, the links in the pages reports will not be opened in a new tab but will launch Insight instead.
+insight_launch_from_pages_report = 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/core/ViewDataTable/HtmlTable.php b/core/ViewDataTable/HtmlTable.php
index 0cc5dc7eff..97210533db 100644
--- a/core/ViewDataTable/HtmlTable.php
+++ b/core/ViewDataTable/HtmlTable.php
@@ -233,4 +233,13 @@ class Piwik_ViewDataTable_HtmlTable extends Piwik_ViewDataTable
{
$this->variablesDefault['disable_row_actions'] = true;
}
+
+ /**
+ * Use this method to open links in Insight instead of a new tab
+ */
+ public function openLinksInInsight()
+ {
+ $this->variablesDefault['open_links_in_insight'] = true;
+ }
+
}
diff --git a/lang/en.php b/lang/en.php
index 57e723a84e..93255429f3 100644
--- a/lang/en.php
+++ b/lang/en.php
@@ -1805,6 +1805,7 @@ And thank you for using Piwik!',
'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' => 'Page Overlay',
+ 'Insight_PluginDescription' => 'See analytics data as an overlay on your actual website.',
'Insight_Page' => 'Page',
'Insight_MainMetrics' => 'Main metrics',
'Insight_NoData' => 'There is no data for this page during the selected period.',
diff --git a/plugins/Actions/Controller.php b/plugins/Actions/Controller.php
index 0493c4ac55..44ee4416f7 100644
--- a/plugins/Actions/Controller.php
+++ b/plugins/Actions/Controller.php
@@ -24,6 +24,9 @@ class Piwik_Actions_Controller extends Piwik_Controller
$view = Piwik_ViewDataTable::factory();
$view->init($this->pluginName, $currentAction, $apiAction, $controllerActionSubtable);
$view->setColumnTranslation('label', Piwik_Translate('Actions_ColumnPageURL'));
+ if (Piwik_Config::getInstance()->General['insight_launch_from_pages_report']) {
+ $view->openLinksInInsight();
+ }
return $view;
}
diff --git a/plugins/CoreHome/templates/broadcast.js b/plugins/CoreHome/templates/broadcast.js
index d4bc3aeab2..2209f5eaa4 100644
--- a/plugins/CoreHome/templates/broadcast.js
+++ b/plugins/CoreHome/templates/broadcast.js
@@ -186,6 +186,11 @@ var broadcast = {
{
currentHashStr = broadcast.updateParamValue('idDashboard=', currentHashStr);
}
+ // unset insightUrl if use doesn't display a page overlay
+ if( module != 'Insight')
+ {
+ currentHashStr = broadcast.updateParamValue('insightUrl=', currentHashStr);
+ }
// Let history know about this new Hash and load it.
broadcast.forceReload = true;
$.history.load(currentHashStr);
@@ -286,6 +291,8 @@ var broadcast = {
}
if( valFromUrl != '') {
// replacing current param=value to newParamValue;
+ valFromUrl = valFromUrl.replace(/\$/g, '\\$');
+ valFromUrl = valFromUrl.replace(/\./g, '\\.');
var regToBeReplace = new RegExp(paramName + '=' + valFromUrl, 'ig');
if(newParamValue == '') {
// if new value is empty remove leading &, aswell
@@ -523,7 +530,7 @@ var broadcast = {
}
var value = url.substring(startStr + param.length +1,endStr);
// sanitize values
- value = value.replace(/[^_%\-\<\>!@=,;0-9a-zA-Z]/gi, '');
+ value = value.replace(/[^_%\-\<\>!@\$\.=,;0-9a-zA-Z]/gi, '');
return value;
} else {
diff --git a/plugins/CoreHome/templates/datatable.js b/plugins/CoreHome/templates/datatable.js
index c4589ea11d..0a4a1ea1e0 100644
--- a/plugins/CoreHome/templates/datatable.js
+++ b/plugins/CoreHome/templates/datatable.js
@@ -1335,6 +1335,21 @@ dataTable.prototype =
actionsDom.hide();
}
});
+
+ if (typeof self.param.open_links_in_insight != 'undefined' && self.param.open_links_in_insight)
+ {
+ var link = td.find('a');
+ link.click(function()
+ {
+ var rowUrl = $(this).attr('href');
+ var newUrl = 'module=Insight&action=index&insightUrl=' + encodeURIComponent(rowUrl).replace(/%/g, '$');
+
+ $('ul.nav').trigger('piwikSwitchPage');
+ broadcast.propagateAjax(newUrl);
+
+ return false;
+ });
+ }
});
},
diff --git a/plugins/Insight/Controller.php b/plugins/Insight/Controller.php
index d35c87eeb7..0ee65e1dc9 100644
--- a/plugins/Insight/Controller.php
+++ b/plugins/Insight/Controller.php
@@ -28,6 +28,10 @@ class Piwik_Insight_Controller extends Piwik_Controller
$view->date = Piwik_Common::getRequestVar('date', 'today');
$view->period = Piwik_Common::getRequestVar('period', 'day');
+ $url = Piwik_Common::getRequestVar('insightUrl', '');
+ $url = urldecode(str_replace('$', '%', $url));
+ $view->targetUrl = $url;
+
echo $view->render();
}
diff --git a/plugins/Insight/client/followingpages.js b/plugins/Insight/client/followingpages.js
index b4186c7320..08d86dccc9 100644
--- a/plugins/Insight/client/followingpages.js
+++ b/plugins/Insight/client/followingpages.js
@@ -168,12 +168,9 @@ var Piwik_Insight_FollowingPages = (function() {
tagElement.addClass('PIS_Highlighted');
}
- if (linkTag.find('img').size() > 0) {
+ if (linkTag.children().size() == 1 && linkTag.find('img').size() == 1) {
// see comment in highlightLink()
- var cssDisplay = linkTag.css('display');
- linkTag.css('display', 'block');
- offset = linkTag.offset();
- linkTag.css('display', cssDisplay);
+ offset = linkTag.find('img').offset();
} else {
offset = linkTag.offset();
}
@@ -226,15 +223,13 @@ var Piwik_Insight_FollowingPages = (function() {
var width = linkTag.outerWidth();
var offset, height;
- if (linkTag.find('img').size() > 0) {
- // if the a tag contains an img, the offset and height methods don't work properly.
- // as a result, the box around the image link would be wrong. we display the link
- // as block for a moment to get correct values.
- var cssDisplay = linkTag.css('display');
- linkTag.css('display', 'block');
- offset = linkTag.offset();
- height = linkTag.outerHeight();
- linkTag.css('display', cssDisplay);
+ if (linkTag.children().size() == 1 && linkTag.find('img').size() == 1) {
+ // if the <a> tag contains only an <img>, the offset and height methods don't work properly.
+ // as a result, the box around the image link would be wrong. we use the image to derive
+ // the offset and height instead of the link to get correct values.
+ var img = linkTag.find('img');
+ offset = img.offset();
+ height = img.outerHeight();
} else {
offset = linkTag.offset();
height = linkTag.outerHeight();
diff --git a/plugins/Insight/templates/index.tpl b/plugins/Insight/templates/index.tpl
index b85547a403..ea9cc6e0f3 100644
--- a/plugins/Insight/templates/index.tpl
+++ b/plugins/Insight/templates/index.tpl
@@ -10,7 +10,7 @@
<div id="Insight_Main">
<iframe
id="Insight_Iframe"
- src="index.php?module=Insight&action=startInsightSession&idsite={$idSite}&period={$period}&date={$date}">
+ src="index.php?module=Insight&action=startInsightSession&idsite={$idSite}&period={$period}&date={$date}{if $targetUrl}#{$targetUrl|urlencode}{/if}">
</iframe>
</div>
diff --git a/plugins/Insight/templates/index_noframe.tpl b/plugins/Insight/templates/index_noframe.tpl
index 3f8c45c311..af7a6d9e94 100644
--- a/plugins/Insight/templates/index_noframe.tpl
+++ b/plugins/Insight/templates/index_noframe.tpl
@@ -1,7 +1,7 @@
<div id="Insight_NoFrame">
- {capture name="link"}index.php?module=Insight&action=startInsightSession&idsite={$idSite}&period={$period}&date={$date}{/capture}
+ {capture name="link"}index.php?module=Insight&action=startInsightSession&idsite={$idSite}&period={$period}&date={$date}{if $targetUrl}#{$targetUrl|urlencode}{/if}{/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>'}