diff options
author | Justin Velluppillai <justin@innocraft.com> | 2021-06-30 08:34:46 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-30 08:34:46 +0300 |
commit | 9d1e5b5423fa031b578e6758bca761e75a4e70ec (patch) | |
tree | 9510495c0ec5a89aeab7d7447b4255be5d691bf4 /plugins/MultiSites | |
parent | 264407f37b47e8517d4129c89bc0e86ecd41217c (diff) |
Multisite links to reports now pass token_auth so user is logged in to matomo (#17725)
Diffstat (limited to 'plugins/MultiSites')
-rw-r--r-- | plugins/MultiSites/angularjs/site/site.controller.js | 16 | ||||
-rw-r--r-- | plugins/MultiSites/angularjs/site/site.directive.html | 4 |
2 files changed, 12 insertions, 8 deletions
diff --git a/plugins/MultiSites/angularjs/site/site.controller.js b/plugins/MultiSites/angularjs/site/site.controller.js index 97f526e91e..cd4b270788 100644 --- a/plugins/MultiSites/angularjs/site/site.controller.js +++ b/plugins/MultiSites/angularjs/site/site.controller.js @@ -13,6 +13,7 @@ $scope.period = piwik.period; $scope.date = piwik.broadcast.getValueFromUrl('date'); + $scope.dashboardUrl = dashboardUrl; $scope.sparklineImage = sparklineImage; $scope.website.label = piwik.helper.htmlDecode($scope.website.label); @@ -20,13 +21,16 @@ return $scope.website; }; - function sparklineImage(website){ - var append = ''; + function tokenParam() { var token_auth = piwik.broadcast.getValueFromUrl('token_auth'); - if (token_auth.length) { - append = '&token_auth=' + token_auth; - } + return token_auth.length ? '&token_auth=' + token_auth : ''; + } + function dashboardUrl(website){ + return piwik.piwik_url + 'index.php?module=CoreHome&action=index&date=' + $scope.date + '&period=' + $scope.period + '&idSite=' + website.idsite + tokenParam(); + } + + function sparklineImage(website){ var metric = $scope.metric; switch ($scope.evolutionMetric) { @@ -41,7 +45,7 @@ break; } - return piwik.piwik_url + 'index.php?module=MultiSites&action=getEvolutionGraph&period=' + $scope.period + '&date=' + $scope.dateSparkline + '&evolutionBy=' + metric + '&columns=' + metric + '&idSite=' + website.idsite + '&idsite=' + website.idsite + '&viewDataTable=sparkline' + append + '&colors=' + encodeURIComponent(JSON.stringify(piwik.getSparklineColors())); + return piwik.piwik_url + 'index.php?module=MultiSites&action=getEvolutionGraph&period=' + $scope.period + '&date=' + $scope.dateSparkline + '&evolutionBy=' + metric + '&columns=' + metric + '&idSite=' + website.idsite + '&idsite=' + website.idsite + '&viewDataTable=sparkline' + tokenParam() + '&colors=' + encodeURIComponent(JSON.stringify(piwik.getSparklineColors())); } } })(); diff --git a/plugins/MultiSites/angularjs/site/site.directive.html b/plugins/MultiSites/angularjs/site/site.directive.html index 27342fefcb..376d70349a 100644 --- a/plugins/MultiSites/angularjs/site/site.directive.html +++ b/plugins/MultiSites/angularjs/site/site.directive.html @@ -1,6 +1,6 @@ <tr ng-class="{'groupedWebsite': website.group, 'website': !website.group, 'group': website.isGroup}"> <td ng-if="!website.isGroup" class="multisites-label label"> - <a title="View reports" ng-href="index.php?module=CoreHome&action=index&date={{ date }}&period={{ period }}&idSite={{ website.idsite }}" class="value truncated-text-line">{{ website.label }}</a> + <a title="View reports" ng-href="{{ dashboardUrl(website) }}" class="value truncated-text-line">{{ website.label }}</a> <span> <a rel="noreferrer noopener" target="_blank" title="{{ 'General_GoTo'|translate:website.main_url }}" ng-href="{{ website.main_url }}"> @@ -30,7 +30,7 @@ <td ng-if="showSparklines" style="width:180px;"> <div ng-if="!website.isGroup" class="sparkline" style="width: 100px; margin: auto;"> - <a rel="noreferrer noopener" target="_blank" ng-href="index.php?module=CoreHome&action=index&date={{ date }}&period={{ period }}&idSite={{ website.idsite }}" + <a rel="noreferrer noopener" target="_blank" ng-href="{{ dashboardUrl(website) }}" title="{{ 'General_GoTo'|translate:('Dashboard_DashboardOf'|translate:website.label) }}"> <img alt="" ng-src="{{ sparklineImage(website) }}" width="100" height="25" /> </a> |